Socket
Socket
Sign inDemoInstall

postcss-selector-parser

Package Overview
Dependencies
2
Maintainers
4
Versions
56
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.11 to 6.0.12

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 6.0.12
- Fixed: `clone` arguments should be optional
# 6.0.11

@@ -2,0 +6,0 @@

11

dist/index.js

@@ -5,17 +5,10 @@ "use strict";

exports["default"] = void 0;
var _processor = _interopRequireDefault(require("./processor"));
var selectors = _interopRequireWildcard(require("./selectors"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
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; }
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); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && 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; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var parser = function parser(processor) {
return new _processor["default"](processor);
};
Object.assign(parser, selectors);

@@ -22,0 +15,0 @@ delete parser.__esModule;

@@ -5,52 +5,27 @@ "use strict";

exports["default"] = void 0;
var _root = _interopRequireDefault(require("./selectors/root"));
var _selector = _interopRequireDefault(require("./selectors/selector"));
var _className = _interopRequireDefault(require("./selectors/className"));
var _comment = _interopRequireDefault(require("./selectors/comment"));
var _id = _interopRequireDefault(require("./selectors/id"));
var _tag = _interopRequireDefault(require("./selectors/tag"));
var _string = _interopRequireDefault(require("./selectors/string"));
var _pseudo = _interopRequireDefault(require("./selectors/pseudo"));
var _attribute = _interopRequireWildcard(require("./selectors/attribute"));
var _universal = _interopRequireDefault(require("./selectors/universal"));
var _combinator = _interopRequireDefault(require("./selectors/combinator"));
var _nesting = _interopRequireDefault(require("./selectors/nesting"));
var _sortAscending = _interopRequireDefault(require("./sortAscending"));
var _tokenize = _interopRequireWildcard(require("./tokenize"));
var tokens = _interopRequireWildcard(require("./tokenTypes"));
var types = _interopRequireWildcard(require("./selectors/types"));
var _util = require("./util");
var _WHITESPACE_TOKENS, _Object$assign;
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
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; }
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); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && 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; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
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);
var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
function tokenStart(token) {

@@ -62,3 +37,2 @@ return {

}
function tokenEnd(token) {

@@ -70,3 +44,2 @@ return {

}
function getSource(startLine, startColumn, endLine, endColumn) {

@@ -84,7 +57,5 @@ return {

}
function getTokenSource(token) {
return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
}
function getTokenSourceSpan(startToken, endToken) {

@@ -94,17 +65,12 @@ if (!startToken) {

}
return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
}
function unescapeProp(node, prop) {
var value = node[prop];
if (typeof value !== "string") {
return;
}
if (value.indexOf("\\") !== -1) {
(0, _util.ensureObject)(node, 'raws');
node[prop] = (0, _util.unesc)(value);
if (node.raws[prop] === undefined) {

@@ -114,17 +80,12 @@ node.raws[prop] = value;

}
return node;
}
function indexesOf(array, item) {
var i = -1;
var indexes = [];
while ((i = array.indexOf(item, i + 1)) !== -1) {
indexes.push(i);
}
return indexes;
}
function uniqs() {

@@ -136,3 +97,2 @@ var list = Array.prototype.concat.apply([], arguments);

}
var Parser = /*#__PURE__*/function () {

@@ -143,3 +103,2 @@ function Parser(rule, options) {

}
this.rule = rule;

@@ -174,8 +133,5 @@ this.options = Object.assign({

}
var _proto = Parser.prototype;
_proto._errorGenerator = function _errorGenerator() {
var _this = this;
return function (message, errorOptions) {

@@ -185,7 +141,5 @@ if (typeof _this.rule === 'string') {

}
return _this.rule.error(message, errorOptions);
};
};
_proto.attribute = function attribute() {

@@ -195,3 +149,2 @@ var attr = [];

this.position++;
while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {

@@ -201,7 +154,5 @@ attr.push(this.currToken);

}
if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
}
var len = attr.length;

@@ -212,7 +163,5 @@ var node = {

};
if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
}
var pos = 0;

@@ -223,3 +172,2 @@ var spaceBefore = '';

var spaceAfterMeaningfulToken = false;
while (pos < len) {

@@ -229,3 +177,2 @@ var token = attr[pos];

var next = attr[pos + 1];
switch (token[_tokenize.FIELDS.TYPE]) {

@@ -240,7 +187,5 @@ case tokens.space:

spaceAfterMeaningfulToken = true;
if (this.options.lossy) {
break;
}
if (lastAdded) {

@@ -251,3 +196,2 @@ (0, _util.ensureObject)(node, 'spaces', lastAdded);

var existingComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
if (existingComment) {

@@ -260,5 +204,3 @@ node.raws.spaces[lastAdded].after = existingComment + content;

}
break;
case tokens.asterisk:

@@ -274,3 +216,2 @@ if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {

}
if (commentBefore) {

@@ -281,16 +222,11 @@ (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');

}
node.namespace = (node.namespace || "") + content;
var rawValue = (0, _util.getProp)(node, 'raws', 'namespace') || null;
if (rawValue) {
node.raws.namespace += content;
}
lastAdded = 'namespace';
}
spaceAfterMeaningfulToken = false;
break;
case tokens.dollar:

@@ -300,12 +236,8 @@ if (lastAdded === "value") {

node.value += "$";
if (oldRawValue) {
node.raws.value = oldRawValue + "$";
}
break;
}
// Falls through
case tokens.caret:

@@ -316,6 +248,4 @@ if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {

}
spaceAfterMeaningfulToken = false;
break;
case tokens.combinator:

@@ -326,3 +256,2 @@ if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {

}
if (content !== '|') {

@@ -332,3 +261,2 @@ spaceAfterMeaningfulToken = false;

}
if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {

@@ -340,8 +268,7 @@ node.operator = content;

}
spaceAfterMeaningfulToken = false;
break;
case tokens.word:
if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals && // this look-ahead probably fails with comment nodes involved.
if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals &&
// this look-ahead probably fails with comment nodes involved.
!node.operator && !node.namespace) {

@@ -356,3 +283,2 @@ node.namespace = content;

}
if (commentBefore) {

@@ -363,21 +289,14 @@ (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');

}
node.attribute = (node.attribute || "") + content;
var _rawValue = (0, _util.getProp)(node, 'raws', 'attribute') || null;
if (_rawValue) {
node.raws.attribute += content;
}
lastAdded = 'attribute';
} else if (!node.value && node.value !== "" || lastAdded === "value" && !(spaceAfterMeaningfulToken || node.quoteMark)) {
var _unescaped = (0, _util.unesc)(content);
var _oldRawValue = (0, _util.getProp)(node, 'raws', 'value') || '';
var oldValue = node.value || '';
node.value = oldValue + _unescaped;
node.quoteMark = null;
if (_unescaped !== content || _oldRawValue) {

@@ -387,10 +306,7 @@ (0, _util.ensureObject)(node, 'raws');

}
lastAdded = 'value';
} else {
var insensitive = content === 'i' || content === "I";
if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
node.insensitive = insensitive;
if (!insensitive || content === "I") {

@@ -400,5 +316,3 @@ (0, _util.ensureObject)(node, 'raws');

}
lastAdded = 'insensitive';
if (spaceBefore) {

@@ -409,3 +323,2 @@ (0, _util.ensureObject)(node, 'spaces', 'insensitive');

}
if (commentBefore) {

@@ -419,3 +332,2 @@ (0, _util.ensureObject)(node, 'raws', 'spaces', 'insensitive');

node.value += content;
if (node.raws.value) {

@@ -426,6 +338,4 @@ node.raws.value += content;

}
spaceAfterMeaningfulToken = false;
break;
case tokens.str:

@@ -437,7 +347,5 @@ if (!node.attribute || !node.operator) {

}
var _unescapeValue = (0, _attribute.unescapeValue)(content),
unescaped = _unescapeValue.unescaped,
quoteMark = _unescapeValue.quoteMark;
unescaped = _unescapeValue.unescaped,
quoteMark = _unescapeValue.quoteMark;
node.value = unescaped;

@@ -450,3 +358,2 @@ node.quoteMark = quoteMark;

break;
case tokens.equals:

@@ -456,3 +363,2 @@ if (!node.attribute) {

}
if (node.value) {

@@ -463,3 +369,2 @@ return this.error('Unexpected "=" found; an operator was already defined.', {

}
node.operator = node.operator ? node.operator + content : content;

@@ -469,3 +374,2 @@ lastAdded = 'operator';

break;
case tokens.comment:

@@ -487,5 +391,3 @@ if (lastAdded) {

}
break;
default:

@@ -496,6 +398,4 @@ return this.error("Unexpected \"" + content + "\" found.", {

}
pos++;
}
unescapeProp(node, "attribute");

@@ -506,2 +406,3 @@ unescapeProp(node, "namespace");

}
/**

@@ -518,5 +419,3 @@ * return a node containing meaningless garbage up to (but not including) the specified token position.

* In lossy mode, this returns only comments.
*/
;
*/;
_proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {

@@ -526,3 +425,2 @@ if (stopPosition < 0) {

}
var startPosition = this.position;

@@ -532,3 +430,2 @@ var nodes = [];

var lastComment = undefined;
do {

@@ -541,3 +438,2 @@ if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {

var spaces = {};
if (space) {

@@ -547,3 +443,2 @@ spaces.before = space;

}
lastComment = new _comment["default"]({

@@ -558,3 +453,2 @@ value: this.content(),

} while (++this.position < stopPosition);
if (space) {

@@ -577,18 +471,14 @@ if (lastComment) {

}
return nodes;
}
/**
*
* @param {*} nodes
*/
;
*/;
_proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
var _this2 = this;
if (requiredSpace === void 0) {
requiredSpace = false;
}
var space = "";

@@ -598,13 +488,9 @@ var rawSpace = "";

var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
});
if (rawSpace === space) {
rawSpace = undefined;
}
var result = {

@@ -616,3 +502,2 @@ space: space,

};
_proto.isNamedCombinator = function isNamedCombinator(position) {

@@ -622,6 +507,4 @@ if (position === void 0) {

}
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;
};
_proto.namedCombinator = function namedCombinator() {

@@ -632,7 +515,5 @@ if (this.isNamedCombinator()) {

var raws = {};
if (name !== nameRaw) {
raws.value = "/" + nameRaw + "/";
}
var node = new _combinator["default"]({

@@ -650,28 +531,20 @@ value: "/" + name + "/",

};
_proto.combinator = function combinator() {
var _this3 = this;
if (this.content() === '|') {
return this.namespace();
} // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
}
// We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) {
var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
if (nodes.length > 0) {
var last = this.current.last;
if (last) {
var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
space = _this$convertWhitespa.space,
rawSpace = _this$convertWhitespa.rawSpace;
space = _this$convertWhitespa.space,
rawSpace = _this$convertWhitespa.rawSpace;
if (rawSpace !== undefined) {
last.rawSpaceAfter += rawSpace;
}
last.spaces.after += space;

@@ -684,15 +557,10 @@ } else {

}
return;
}
var firstToken = this.currToken;
var spaceOrDescendantSelectorNodes = undefined;
if (nextSigTokenPos > this.position) {
spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
}
var node;
if (this.isNamedCombinator()) {

@@ -707,13 +575,12 @@ node = this.namedCombinator();

this.position++;
} else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {// pass
} else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
// pass
} else if (!spaceOrDescendantSelectorNodes) {
this.unexpected();
}
if (node) {
if (spaceOrDescendantSelectorNodes) {
var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
_space = _this$convertWhitespa2.space,
_rawSpace = _this$convertWhitespa2.rawSpace;
_space = _this$convertWhitespa2.space,
_rawSpace = _this$convertWhitespa2.rawSpace;
node.spaces.before = _space;

@@ -725,9 +592,7 @@ node.rawSpaceBefore = _rawSpace;

var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
_space2 = _this$convertWhitespa3.space,
_rawSpace2 = _this$convertWhitespa3.rawSpace;
_space2 = _this$convertWhitespa3.space,
_rawSpace2 = _this$convertWhitespa3.rawSpace;
if (!_rawSpace2) {
_rawSpace2 = _space2;
}
var spaces = {};

@@ -737,3 +602,2 @@ var raws = {

};
if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {

@@ -748,3 +612,2 @@ spaces.before = _space2.slice(0, _space2.length - 1);

}
node = new _combinator["default"]({

@@ -758,3 +621,2 @@ value: ' ',

}
if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {

@@ -764,6 +626,4 @@ node.spaces.after = this.optionalSpace(this.content());

}
return this.newNode(node);
};
_proto.comma = function comma() {

@@ -775,5 +635,3 @@ if (this.position === this.tokens.length - 1) {

}
this.current._inferEndPosition();
var selector = new _selector["default"]({

@@ -788,3 +646,2 @@ source: {

};
_proto.comment = function comment() {

@@ -799,7 +656,5 @@ var current = this.currToken;

};
_proto.error = function error(message, opts) {
throw this.root.error(message, opts);
};
_proto.missingBackslash = function missingBackslash() {

@@ -810,18 +665,13 @@ return this.error('Expected a backslash preceding the semicolon.', {

};
_proto.missingParenthesis = function missingParenthesis() {
return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
};
_proto.missingSquareBracket = function missingSquareBracket() {
return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
};
_proto.unexpected = function unexpected() {
return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
};
_proto.namespace = function namespace() {
var before = this.prevToken && this.content(this.prevToken) || true;
if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {

@@ -835,7 +685,5 @@ this.position++;

};
_proto.nesting = function nesting() {
if (this.nextToken) {
var nextContent = this.content(this.nextToken);
if (nextContent === "|") {

@@ -846,3 +694,2 @@ this.position++;

}
var current = this.currToken;

@@ -856,3 +703,2 @@ this.newNode(new _nesting["default"]({

};
_proto.parentheses = function parentheses() {

@@ -862,3 +708,2 @@ var last = this.current.last;

this.position++;
if (last && last.type === types.PSEUDO) {

@@ -873,3 +718,2 @@ var selector = new _selector["default"]({

this.current = selector;
while (this.position < this.tokens.length && unbalanced) {

@@ -879,7 +723,5 @@ if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {

}
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
unbalanced--;
}
if (unbalanced) {

@@ -893,3 +735,2 @@ this.parse();

}
this.current = cache;

@@ -902,3 +743,2 @@ } else {

var parenEnd;
while (this.position < this.tokens.length && unbalanced) {

@@ -908,7 +748,5 @@ if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {

}
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
unbalanced--;
}
parenEnd = this.currToken;

@@ -918,3 +756,2 @@ parenValue += this.parseParenthesisToken(this.currToken);

}
if (last) {

@@ -930,3 +767,2 @@ last.appendToPropertyAndEscape("value", parenValue, parenValue);

}
if (unbalanced) {

@@ -936,9 +772,6 @@ return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);

};
_proto.pseudo = function pseudo() {
var _this4 = this;
var pseudoStr = '';
var startingToken = this.currToken;
while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {

@@ -948,11 +781,8 @@ pseudoStr += this.content();

}
if (!this.currToken) {
return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
}
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
this.splitWord(false, function (first, length) {
pseudoStr += first;
_this4.newNode(new _pseudo["default"]({

@@ -963,3 +793,2 @@ value: pseudoStr,

}));
if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {

@@ -975,6 +804,5 @@ _this4.error('Misplaced parenthesis.', {

};
_proto.space = function space() {
var content = this.content(); // Handle space before and after the selector
var content = this.content();
// Handle space before and after the selector
if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {

@@ -992,3 +820,2 @@ return node.type === 'comment';

};
_proto.string = function string() {

@@ -1003,6 +830,4 @@ var current = this.currToken;

};
_proto.universal = function universal(namespace) {
var nextToken = this.nextToken;
if (nextToken && this.content(nextToken) === '|') {

@@ -1012,3 +837,2 @@ this.position++;

}
var current = this.currToken;

@@ -1022,9 +846,6 @@ this.newNode(new _universal["default"]({

};
_proto.splitWord = function splitWord(namespace, firstCallback) {
var _this5 = this;
var nextToken = this.nextToken;
var word = this.content();
while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {

@@ -1034,6 +855,4 @@ this.position++;

word += current;
if (current.lastIndexOf('\\') === current.length - 1) {
var next = this.nextToken;
if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {

@@ -1044,10 +863,8 @@ word += this.requiredSpace(this.content(next));

}
nextToken = this.nextToken;
}
var hasClass = indexesOf(word, '.').filter(function (i) {
// Allow escaped dot within class name
var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes
var escapedDot = word[i - 1] === '\\';
// Allow decimal numbers percent in @keyframes
var isKeyframesPercent = /^\d+\.\d+%$/.test(word);

@@ -1058,6 +875,5 @@ return !escapedDot && !isKeyframesPercent;

return word[i - 1] !== '\\';
}); // Eliminate Sass interpolations from the list of id indexes
});
// Eliminate Sass interpolations from the list of id indexes
var interpolations = indexesOf(word, '#{');
if (interpolations.length) {

@@ -1068,3 +884,2 @@ hasId = hasId.filter(function (hashIndex) {

}
var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));

@@ -1074,7 +889,5 @@ indices.forEach(function (ind, i) {

var value = word.slice(ind, index);
if (i === 0 && firstCallback) {
return firstCallback.call(_this5, value, indices.length);
}
var node;

@@ -1084,3 +897,2 @@ var current = _this5.currToken;

var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
if (~hasClass.indexOf(ind)) {

@@ -1109,6 +921,4 @@ var classNameOpts = {

}
_this5.newNode(node, namespace); // Ensure that the namespace is used only once
_this5.newNode(node, namespace);
// Ensure that the namespace is used only once
namespace = null;

@@ -1118,6 +928,4 @@ });

};
_proto.word = function word(namespace) {
var nextToken = this.nextToken;
if (nextToken && this.content(nextToken) === '|') {

@@ -1127,6 +935,4 @@ this.position++;

}
return this.splitWord(namespace);
};
_proto.loop = function loop() {

@@ -1136,8 +942,5 @@ while (this.position < this.tokens.length) {

}
this.current._inferEndPosition();
return this.root;
};
_proto.parse = function parse(throwOnParenthesis) {

@@ -1148,11 +951,8 @@ switch (this.currToken[_tokenize.FIELDS.TYPE]) {

break;
case tokens.comment:
this.comment();
break;
case tokens.openParenthesis:
this.parentheses();
break;
case tokens.closeParenthesis:

@@ -1162,9 +962,6 @@ if (throwOnParenthesis) {

}
break;
case tokens.openSquare:
this.attribute();
break;
case tokens.dollar:

@@ -1176,19 +973,14 @@ case tokens.caret:

break;
case tokens.colon:
this.pseudo();
break;
case tokens.comma:
this.comma();
break;
case tokens.asterisk:
this.universal();
break;
case tokens.ampersand:
this.nesting();
break;
case tokens.slash:

@@ -1198,3 +990,2 @@ case tokens.combinator:

break;
case tokens.str:

@@ -1204,9 +995,6 @@ this.string();

// These cases throw; no break needed.
case tokens.closeSquare:
this.missingSquareBracket();
case tokens.semicolon:
this.missingBackslash();
default:

@@ -1216,7 +1004,6 @@ this.unexpected();

}
/**
* Helpers
*/
;
*/;
_proto.expected = function expected(description, index, found) {

@@ -1227,5 +1014,3 @@ if (Array.isArray(description)) {

}
var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
if (!found) {

@@ -1236,3 +1021,2 @@ return this.error("Expected " + an + " " + description + ".", {

}
return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {

@@ -1242,11 +1026,8 @@ index: index

};
_proto.requiredSpace = function requiredSpace(space) {
return this.options.lossy ? ' ' : space;
};
_proto.optionalSpace = function optionalSpace(space) {
return this.options.lossy ? '' : space;
};
_proto.lossySpace = function lossySpace(space, required) {

@@ -1259,6 +1040,4 @@ if (this.options.lossy) {

};
_proto.parseParenthesisToken = function parseParenthesisToken(token) {
var content = this.content(token);
if (token[_tokenize.FIELDS.TYPE] === tokens.space) {

@@ -1270,3 +1049,2 @@ return this.requiredSpace(content);

};
_proto.newNode = function newNode(node, namespace) {

@@ -1278,10 +1056,7 @@ if (namespace) {

}
namespace = true;
}
node.namespace = namespace;
unescapeProp(node, "namespace");
}
if (this.spaces) {

@@ -1291,6 +1066,4 @@ node.spaces.before = this.spaces;

}
return this.current.append(node);
};
_proto.content = function content(token) {

@@ -1300,6 +1073,4 @@ if (token === void 0) {

}
return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
};
/**

@@ -1313,5 +1084,3 @@ * returns the index of the next non-whitespace, non-comment token.

}
var searchPosition = startPosition;
while (searchPosition < this.tokens.length) {

@@ -1325,6 +1094,4 @@ if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {

}
return -1;
};
_createClass(Parser, [{

@@ -1346,7 +1113,5 @@ key: "currToken",

}]);
return Parser;
}();
exports["default"] = Parser;
module.exports = exports.default;

@@ -5,17 +5,11 @@ "use strict";

exports["default"] = void 0;
var _parser = _interopRequireDefault(require("./parser"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Processor = /*#__PURE__*/function () {
function Processor(func, options) {
this.func = func || function noop() {};
this.funcRes = null;
this.options = options;
}
var _proto = Processor.prototype;
_proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {

@@ -25,5 +19,3 @@ if (options === void 0) {

}
var merged = Object.assign({}, this.options, options);
if (merged.updateSelector === false) {

@@ -35,3 +27,2 @@ return false;

};
_proto._isLossy = function _isLossy(options) {

@@ -41,5 +32,3 @@ if (options === void 0) {

}
var merged = Object.assign({}, this.options, options);
if (merged.lossless === false) {

@@ -51,3 +40,2 @@ return true;

};
_proto._root = function _root(rule, options) {

@@ -57,7 +45,5 @@ if (options === void 0) {

}
var parser = new _parser["default"](rule, this._parseOptions(options));
return parser.root;
};
_proto._parseOptions = function _parseOptions(options) {

@@ -68,17 +54,12 @@ return {

};
_proto._run = function _run(rule, options) {
var _this = this;
if (options === void 0) {
options = {};
}
return new Promise(function (resolve, reject) {
try {
var root = _this._root(rule, options);
Promise.resolve(_this.func(root)).then(function (transform) {
var string = undefined;
if (_this._shouldUpdateSelector(rule, options)) {

@@ -88,3 +69,2 @@ string = root.toString();

}
return {

@@ -102,3 +82,2 @@ transform: transform,

};
_proto._runSync = function _runSync(rule, options) {

@@ -108,13 +87,8 @@ if (options === void 0) {

}
var root = this._root(rule, options);
var transform = this.func(root);
if (transform && typeof transform.then === "function") {
throw new Error("Selector processor returned a promise to a synchronous call.");
}
var string = undefined;
if (options.updateSelector && typeof rule !== "string") {

@@ -124,3 +98,2 @@ string = root.toString();

}
return {

@@ -132,2 +105,3 @@ transform: transform,

}
/**

@@ -139,5 +113,3 @@ * Process rule into a selector AST.

* @returns {Promise<parser.Root>} The AST of the selector after processing it.
*/
;
*/;
_proto.ast = function ast(rule, options) {

@@ -148,2 +120,3 @@ return this._run(rule, options).then(function (result) {

}
/**

@@ -155,8 +128,7 @@ * Process rule into a selector AST synchronously.

* @returns {parser.Root} The AST of the selector after processing it.
*/
;
*/;
_proto.astSync = function astSync(rule, options) {
return this._runSync(rule, options).root;
}
/**

@@ -168,5 +140,3 @@ * Process a selector into a transformed value asynchronously

* @returns {Promise<any>} The value returned by the processor.
*/
;
*/;
_proto.transform = function transform(rule, options) {

@@ -177,2 +147,3 @@ return this._run(rule, options).then(function (result) {

}
/**

@@ -184,8 +155,7 @@ * Process a selector into a transformed value synchronously.

* @returns {any} The value returned by the processor.
*/
;
*/;
_proto.transformSync = function transformSync(rule, options) {
return this._runSync(rule, options).transform;
}
/**

@@ -197,5 +167,3 @@ * Process a selector into a new selector string asynchronously.

* @returns {string} the selector after processing.
*/
;
*/;
_proto.process = function process(rule, options) {

@@ -206,2 +174,3 @@ return this._run(rule, options).then(function (result) {

}
/**

@@ -213,15 +182,10 @@ * Process a selector into a new selector string synchronously.

* @returns {string} the selector after processing.
*/
;
*/;
_proto.processSync = function processSync(rule, options) {
var result = this._runSync(rule, options);
return result.string || result.root.toString();
};
return Processor;
}();
exports["default"] = Processor;
module.exports = exports.default;
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
exports.unescapeValue = unescapeValue;
exports["default"] = void 0;
var _cssesc = _interopRequireDefault(require("cssesc"));
var _unesc = _interopRequireDefault(require("../util/unesc"));
var _namespace = _interopRequireDefault(require("./namespace"));
var _types = require("./types");
var _CSSESC_QUOTE_OPTIONS;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var deprecate = require("util-deprecate");
var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;

@@ -33,3 +21,2 @@ var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");

var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
function unescapeValue(value) {

@@ -40,3 +27,2 @@ var deprecatedUsage = false;

var m = unescaped.match(WRAPPED_IN_QUOTES);
if (m) {

@@ -46,9 +32,6 @@ quoteMark = m[1];

}
unescaped = (0, _unesc["default"])(unescaped);
if (unescaped !== value) {
deprecatedUsage = true;
}
return {

@@ -60,3 +43,2 @@ deprecatedUsage: deprecatedUsage,

}
function handleDeprecatedContructorOpts(opts) {

@@ -66,21 +48,15 @@ if (opts.quoteMark !== undefined) {

}
if (opts.value === undefined) {
return opts;
}
warnOfDeprecatedConstructor();
var _unescapeValue = unescapeValue(opts.value),
quoteMark = _unescapeValue.quoteMark,
unescaped = _unescapeValue.unescaped;
quoteMark = _unescapeValue.quoteMark,
unescaped = _unescapeValue.unescaped;
if (!opts.raws) {
opts.raws = {};
}
if (opts.raws.value === undefined) {
opts.raws.value = opts.value;
}
opts.value = unescaped;

@@ -90,13 +66,9 @@ opts.quoteMark = quoteMark;

}
var Attribute = /*#__PURE__*/function (_Namespace) {
_inheritsLoose(Attribute, _Namespace);
function Attribute(opts) {
var _this;
if (opts === void 0) {
opts = {};
}
_this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;

@@ -116,2 +88,3 @@ _this.type = _types.ATTRIBUTE;

}
/**

@@ -138,6 +111,3 @@ * Returns the Attribute's value quoted such that it would be legal to use

**/
var _proto = Attribute.prototype;
_proto.getQuotedValue = function getQuotedValue(options) {

@@ -147,5 +117,3 @@ if (options === void 0) {

}
var quoteMark = this._determineQuoteMark(options);
var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];

@@ -155,6 +123,6 @@ var escaped = (0, _cssesc["default"])(this._value, cssescopts);

};
_proto._determineQuoteMark = function _determineQuoteMark(options) {
return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
}
/**

@@ -164,5 +132,3 @@ * Set the unescaped value with the specified quotation options. The value

* be interpreted as part of the value and escaped accordingly.
*/
;
*/;
_proto.setValue = function setValue(value, options) {

@@ -172,8 +138,7 @@ if (options === void 0) {

}
this._value = value;
this._quoteMark = this._determineQuoteMark(options);
this._syncRawValue();
}
/**

@@ -190,5 +155,3 @@ * Intelligently select a quoteMark value based on the value's contents. If

* from the quoteValue method.
*/
;
*/;
_proto.smartQuoteMark = function smartQuoteMark(options) {

@@ -198,3 +161,2 @@ var v = this.value;

var numDoubleQuotes = v.replace(/[^"]/g, '').length;
if (numSingleQuotes + numDoubleQuotes === 0) {

@@ -204,3 +166,2 @@ var escaped = (0, _cssesc["default"])(v, {

});
if (escaped === v) {

@@ -210,3 +171,2 @@ return Attribute.NO_QUOTE;

var pref = this.preferredQuoteMark(options);
if (pref === Attribute.NO_QUOTE) {

@@ -217,3 +177,2 @@ // pick a quote mark that isn't none and see if it's smaller

var quoteValue = (0, _cssesc["default"])(v, opts);
if (quoteValue.length < escaped.length) {

@@ -223,3 +182,2 @@ return quote;

}
return pref;

@@ -235,2 +193,3 @@ }

}
/**

@@ -240,22 +199,15 @@ * Selects the preferred quote mark based on the options and the current quote mark value.

* instead.
*/
;
*/;
_proto.preferredQuoteMark = function preferredQuoteMark(options) {
var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
if (quoteMark === undefined) {
quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
}
if (quoteMark === undefined) {
quoteMark = Attribute.DOUBLE_QUOTE;
}
return quoteMark;
};
_proto._syncRawValue = function _syncRawValue() {
var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
if (rawValue === this._value) {

@@ -269,3 +221,2 @@ if (this.raws) {

};
_proto._handleEscapes = function _handleEscapes(prop, value) {

@@ -276,3 +227,2 @@ if (this._constructed) {

});
if (escaped !== value) {

@@ -285,3 +235,2 @@ this.raws[prop] = escaped;

};
_proto._spacesFor = function _spacesFor(name) {

@@ -296,3 +245,2 @@ var attrSpaces = {

};
_proto._stringFor = function _stringFor(name, spaceName, concat) {

@@ -302,11 +250,9 @@ if (spaceName === void 0) {

}
if (concat === void 0) {
concat = defaultAttrConcat;
}
var attrSpaces = this._spacesFor(spaceName);
return concat(this.stringifyProperty(name), attrSpaces);
}
/**

@@ -325,74 +271,49 @@ * returns the offset of the attribute part specified relative to the

* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
*/
;
*/;
_proto.offsetOf = function offsetOf(name) {
var count = 1;
var attributeSpaces = this._spacesFor("attribute");
count += attributeSpaces.before.length;
if (name === "namespace" || name === "ns") {
return this.namespace ? count : -1;
}
if (name === "attributeNS") {
return count;
}
count += this.namespaceString.length;
if (this.namespace) {
count += 1;
}
if (name === "attribute") {
return count;
}
count += this.stringifyProperty("attribute").length;
count += attributeSpaces.after.length;
var operatorSpaces = this._spacesFor("operator");
count += operatorSpaces.before.length;
var operator = this.stringifyProperty("operator");
if (name === "operator") {
return operator ? count : -1;
}
count += operator.length;
count += operatorSpaces.after.length;
var valueSpaces = this._spacesFor("value");
count += valueSpaces.before.length;
var value = this.stringifyProperty("value");
if (name === "value") {
return value ? count : -1;
}
count += value.length;
count += valueSpaces.after.length;
var insensitiveSpaces = this._spacesFor("insensitive");
count += insensitiveSpaces.before.length;
if (name === "insensitive") {
return this.insensitive ? count : -1;
}
return -1;
};
_proto.toString = function toString() {
var _this2 = this;
var selector = [this.rawSpaceBefore, '['];
selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
if (this.operator && (this.value || this.value === '')) {

@@ -405,7 +326,5 @@ selector.push(this._stringFor('operator'));

}
return defaultAttrConcat(attrValue, attrSpaces);
}));
}
selector.push(']');

@@ -415,3 +334,2 @@ selector.push(this.rawSpaceAfter);

};
_createClass(Attribute, [{

@@ -426,2 +344,3 @@ key: "quoted",

}
/**

@@ -433,3 +352,2 @@ * returns a single (`'`) or double (`"`) quote character if the value is quoted.

*/
}, {

@@ -440,2 +358,3 @@ key: "quoteMark",

}
/**

@@ -447,4 +366,3 @@ * Set the quote mark to be used by this attribute's value.

* @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
*/
,
*/,
set: function set(quoteMark) {

@@ -455,6 +373,4 @@ if (!this._constructed) {

}
if (this._quoteMark !== quoteMark) {
this._quoteMark = quoteMark;
this._syncRawValue();

@@ -494,17 +410,13 @@ }

var _unescapeValue2 = unescapeValue(v),
deprecatedUsage = _unescapeValue2.deprecatedUsage,
unescaped = _unescapeValue2.unescaped,
quoteMark = _unescapeValue2.quoteMark;
deprecatedUsage = _unescapeValue2.deprecatedUsage,
unescaped = _unescapeValue2.unescaped,
quoteMark = _unescapeValue2.quoteMark;
if (deprecatedUsage) {
warnOfDeprecatedValueAssignment();
}
if (unescaped === this._value && quoteMark === this._quoteMark) {
return;
}
this._value = unescaped;
this._quoteMark = quoteMark;
this._syncRawValue();

@@ -520,2 +432,3 @@ } else {

}
/**

@@ -527,9 +440,9 @@ * Set the case insensitive flag.

* @param {true | false} insensitive true if the attribute should match case-insensitively.
*/
,
*/,
set: function set(insensitive) {
if (!insensitive) {
this._insensitive = false; // "i" and "I" can be used in "this.raws.insensitiveFlag" to store the original notation.
this._insensitive = false;
// "i" and "I" can be used in "this.raws.insensitiveFlag" to store the original notation.
// When setting `attr.insensitive = false` both should be erased to ensure correct serialization.
if (this.raws && (this.raws.insensitiveFlag === 'I' || this.raws.insensitiveFlag === 'i')) {

@@ -539,3 +452,2 @@ this.raws.insensitiveFlag = undefined;

}
this._insensitive = insensitive;

@@ -550,10 +462,7 @@ }

this._handleEscapes("attribute", name);
this._attribute = name;
}
}]);
return Attribute;
}(_namespace["default"]);
exports["default"] = Attribute;

@@ -575,5 +484,4 @@ Attribute.NO_QUOTE = null;

}, _CSSESC_QUOTE_OPTIONS);
function defaultAttrConcat(attrValue, attrSpaces) {
return "" + attrSpaces.before + attrValue + attrSpaces.after;
}

@@ -5,27 +5,15 @@ "use strict";

exports["default"] = void 0;
var _cssesc = _interopRequireDefault(require("cssesc"));
var _util = require("../util");
var _node = _interopRequireDefault(require("./node"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var ClassName = /*#__PURE__*/function (_Node) {
_inheritsLoose(ClassName, _Node);
function ClassName(opts) {
var _this;
_this = _Node.call(this, opts) || this;

@@ -36,9 +24,6 @@ _this.type = _types.CLASS;

}
var _proto = ClassName.prototype;
_proto.valueToString = function valueToString() {
return '.' + _Node.prototype.valueToString.call(this);
};
_createClass(ClassName, [{

@@ -54,3 +39,2 @@ key: "value",

});
if (escaped !== v) {

@@ -63,11 +47,8 @@ (0, _util.ensureObject)(this, "raws");

}
this._value = v;
}
}]);
return ClassName;
}(_node["default"]);
exports["default"] = ClassName;
module.exports = exports.default;

@@ -5,19 +5,11 @@ "use strict";

exports["default"] = void 0;
var _node = _interopRequireDefault(require("./node"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Combinator = /*#__PURE__*/function (_Node) {
_inheritsLoose(Combinator, _Node);
function Combinator(opts) {
var _this;
_this = _Node.call(this, opts) || this;

@@ -27,7 +19,5 @@ _this.type = _types.COMBINATOR;

}
return Combinator;
}(_node["default"]);
exports["default"] = Combinator;
module.exports = exports.default;

@@ -5,19 +5,11 @@ "use strict";

exports["default"] = void 0;
var _node = _interopRequireDefault(require("./node"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Comment = /*#__PURE__*/function (_Node) {
_inheritsLoose(Comment, _Node);
function Comment(opts) {
var _this;
_this = _Node.call(this, opts) || this;

@@ -27,7 +19,5 @@ _this.type = _types.COMMENT;

}
return Comment;
}(_node["default"]);
exports["default"] = Comment;
module.exports = exports.default;

@@ -5,99 +5,62 @@ "use strict";

exports.universal = exports.tag = exports.string = exports.selector = exports.root = exports.pseudo = exports.nesting = exports.id = exports.comment = exports.combinator = exports.className = exports.attribute = void 0;
var _attribute = _interopRequireDefault(require("./attribute"));
var _className = _interopRequireDefault(require("./className"));
var _combinator = _interopRequireDefault(require("./combinator"));
var _comment = _interopRequireDefault(require("./comment"));
var _id = _interopRequireDefault(require("./id"));
var _nesting = _interopRequireDefault(require("./nesting"));
var _pseudo = _interopRequireDefault(require("./pseudo"));
var _root = _interopRequireDefault(require("./root"));
var _selector = _interopRequireDefault(require("./selector"));
var _string = _interopRequireDefault(require("./string"));
var _tag = _interopRequireDefault(require("./tag"));
var _universal = _interopRequireDefault(require("./universal"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var attribute = function attribute(opts) {
return new _attribute["default"](opts);
};
exports.attribute = attribute;
var className = function className(opts) {
return new _className["default"](opts);
};
exports.className = className;
var combinator = function combinator(opts) {
return new _combinator["default"](opts);
};
exports.combinator = combinator;
var comment = function comment(opts) {
return new _comment["default"](opts);
};
exports.comment = comment;
var id = function id(opts) {
return new _id["default"](opts);
};
exports.id = id;
var nesting = function nesting(opts) {
return new _nesting["default"](opts);
};
exports.nesting = nesting;
var pseudo = function pseudo(opts) {
return new _pseudo["default"](opts);
};
exports.pseudo = pseudo;
var root = function root(opts) {
return new _root["default"](opts);
};
exports.root = root;
var selector = function selector(opts) {
return new _selector["default"](opts);
};
exports.selector = selector;
var string = function string(opts) {
return new _string["default"](opts);
};
exports.string = string;
var tag = function tag(opts) {
return new _tag["default"](opts);
};
exports.tag = tag;
var universal = function universal(opts) {
return new _universal["default"](opts);
};
exports.universal = universal;

@@ -5,44 +5,25 @@ "use strict";

exports["default"] = void 0;
var _node = _interopRequireDefault(require("./node"));
var types = _interopRequireWildcard(require("./types"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
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; }
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); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && 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; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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); }
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 && 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."); }
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); }
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; }
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Container = /*#__PURE__*/function (_Node) {
_inheritsLoose(Container, _Node);
function Container(opts) {
var _this;
_this = _Node.call(this, opts) || this;
if (!_this.nodes) {
_this.nodes = [];
}
return _this;
}
var _proto = Container.prototype;
_proto.append = function append(selector) {

@@ -53,3 +34,2 @@ selector.parent = this;

};
_proto.prepend = function prepend(selector) {

@@ -60,7 +40,5 @@ selector.parent = this;

};
_proto.at = function at(index) {
return this.nodes[index];
};
_proto.index = function index(child) {

@@ -70,6 +48,4 @@ if (typeof child === 'number') {

}
return this.nodes.indexOf(child);
};
_proto.removeChild = function removeChild(child) {

@@ -80,6 +56,4 @@ child = this.index(child);

var index;
for (var id in this.indexes) {
index = this.indexes[id];
if (index >= child) {

@@ -89,6 +63,4 @@ this.indexes[id] = index - 1;

}
return this;
};
_proto.removeAll = function removeAll() {

@@ -99,11 +71,8 @@ for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {

}
this.nodes = [];
return this;
};
_proto.empty = function empty() {
return this.removeAll();
};
_proto.insertAfter = function insertAfter(oldNode, newNode) {

@@ -115,6 +84,4 @@ newNode.parent = this;

var index;
for (var id in this.indexes) {
index = this.indexes[id];
if (oldIndex <= index) {

@@ -124,6 +91,4 @@ this.indexes[id] = index + 1;

}
return this;
};
_proto.insertBefore = function insertBefore(oldNode, newNode) {

@@ -135,6 +100,4 @@ newNode.parent = this;

var index;
for (var id in this.indexes) {
index = this.indexes[id];
if (index <= oldIndex) {

@@ -144,6 +107,4 @@ this.indexes[id] = index + 1;

}
return this;
};
_proto._findChildAtPosition = function _findChildAtPosition(line, col) {

@@ -154,3 +115,2 @@ var found = undefined;

var foundChild = node.atPosition(line, col);
if (foundChild) {

@@ -167,2 +127,3 @@ found = foundChild;

}
/**

@@ -180,5 +141,3 @@ * Return the most specific node at the line and column number given.

* @param {number} col The column number of the node to find. (1-based index)
*/
;
*/;
_proto.atPosition = function atPosition(line, col) {

@@ -191,3 +150,2 @@ if (this.isAtPosition(line, col)) {

};
_proto._inferEndPosition = function _inferEndPosition() {

@@ -200,3 +158,2 @@ if (this.last && this.last.source && this.last.source.end) {

};
_proto.each = function each(callback) {

@@ -206,30 +163,21 @@ if (!this.lastEach) {

}
if (!this.indexes) {
this.indexes = {};
}
this.lastEach++;
var id = this.lastEach;
this.indexes[id] = 0;
if (!this.length) {
return undefined;
}
var index, result;
while (this.indexes[id] < this.length) {
index = this.indexes[id];
result = callback(this.at(index), index);
if (result === false) {
break;
}
this.indexes[id] += 1;
}
delete this.indexes[id];
if (result === false) {

@@ -239,11 +187,8 @@ return false;

};
_proto.walk = function walk(callback) {
return this.each(function (node, i) {
var result = callback(node, i);
if (result !== false && node.length) {
result = node.walk(callback);
}
if (result === false) {

@@ -254,6 +199,4 @@ return false;

};
_proto.walkAttributes = function walkAttributes(callback) {
var _this2 = this;
return this.walk(function (selector) {

@@ -265,6 +208,4 @@ if (selector.type === types.ATTRIBUTE) {

};
_proto.walkClasses = function walkClasses(callback) {
var _this3 = this;
return this.walk(function (selector) {

@@ -276,6 +217,4 @@ if (selector.type === types.CLASS) {

};
_proto.walkCombinators = function walkCombinators(callback) {
var _this4 = this;
return this.walk(function (selector) {

@@ -287,6 +226,4 @@ if (selector.type === types.COMBINATOR) {

};
_proto.walkComments = function walkComments(callback) {
var _this5 = this;
return this.walk(function (selector) {

@@ -298,6 +235,4 @@ if (selector.type === types.COMMENT) {

};
_proto.walkIds = function walkIds(callback) {
var _this6 = this;
return this.walk(function (selector) {

@@ -309,6 +244,4 @@ if (selector.type === types.ID) {

};
_proto.walkNesting = function walkNesting(callback) {
var _this7 = this;
return this.walk(function (selector) {

@@ -320,6 +253,4 @@ if (selector.type === types.NESTING) {

};
_proto.walkPseudos = function walkPseudos(callback) {
var _this8 = this;
return this.walk(function (selector) {

@@ -331,6 +262,4 @@ if (selector.type === types.PSEUDO) {

};
_proto.walkTags = function walkTags(callback) {
var _this9 = this;
return this.walk(function (selector) {

@@ -342,6 +271,4 @@ if (selector.type === types.TAG) {

};
_proto.walkUniversals = function walkUniversals(callback) {
var _this10 = this;
return this.walk(function (selector) {

@@ -353,6 +280,4 @@ if (selector.type === types.UNIVERSAL) {

};
_proto.split = function split(callback) {
var _this11 = this;
var current = [];

@@ -362,3 +287,2 @@ return this.reduce(function (memo, node, index) {

current.push(node);
if (split) {

@@ -370,35 +294,26 @@ memo.push(current);

}
return memo;
}, []);
};
_proto.map = function map(callback) {
return this.nodes.map(callback);
};
_proto.reduce = function reduce(callback, memo) {
return this.nodes.reduce(callback, memo);
};
_proto.every = function every(callback) {
return this.nodes.every(callback);
};
_proto.some = function some(callback) {
return this.nodes.some(callback);
};
_proto.filter = function filter(callback) {
return this.nodes.filter(callback);
};
_proto.sort = function sort(callback) {
return this.nodes.sort(callback);
};
_proto.toString = function toString() {
return this.map(String).join('');
};
_createClass(Container, [{

@@ -420,7 +335,5 @@ key: "first",

}]);
return Container;
}(_node["default"]);
exports["default"] = Container;
module.exports = exports.default;
"use strict";
exports.__esModule = true;
exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = void 0;
exports.isContainer = isContainer;
exports.isIdentifier = void 0;
exports.isNamespace = isNamespace;
exports.isNesting = void 0;
exports.isNode = isNode;
exports.isPseudo = void 0;
exports.isPseudoClass = isPseudoClass;
exports.isPseudoElement = isPseudoElement;
exports.isPseudoClass = isPseudoClass;
exports.isContainer = isContainer;
exports.isNamespace = isNamespace;
exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = exports.isPseudo = exports.isNesting = exports.isIdentifier = exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = void 0;
exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = void 0;
var _types = require("./types");
var _IS_TYPE;
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);
function isNode(node) {
return typeof node === "object" && IS_TYPE[node.type];
}
function isNodeType(type, node) {
return isNode(node) && node.type === type;
}
var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);

@@ -49,17 +47,13 @@ exports.isAttribute = isAttribute;

exports.isUniversal = isUniversal;
function isPseudoElement(node) {
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");
}
function isPseudoClass(node) {
return isPseudo(node) && !isPseudoElement(node);
}
function isContainer(node) {
return !!(isNode(node) && node.walk);
}
function isNamespace(node) {
return isAttribute(node) || isTag(node);
}

@@ -5,19 +5,11 @@ "use strict";

exports["default"] = void 0;
var _node = _interopRequireDefault(require("./node"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var ID = /*#__PURE__*/function (_Node) {
_inheritsLoose(ID, _Node);
function ID(opts) {
var _this;
_this = _Node.call(this, opts) || this;

@@ -27,13 +19,9 @@ _this.type = _types.ID;

}
var _proto = ID.prototype;
_proto.valueToString = function valueToString() {
return '#' + _Node.prototype.valueToString.call(this);
};
return ID;
}(_node["default"]);
exports["default"] = ID;
module.exports = exports.default;
"use strict";
exports.__esModule = true;
var _types = require("./types");
Object.keys(_types).forEach(function (key) {

@@ -12,5 +10,3 @@ if (key === "default" || key === "__esModule") return;

});
var _constructors = require("./constructors");
Object.keys(_constructors).forEach(function (key) {

@@ -21,5 +17,3 @@ if (key === "default" || key === "__esModule") return;

});
var _guards = require("./guards");
Object.keys(_guards).forEach(function (key) {

@@ -26,0 +20,0 @@ if (key === "default" || key === "__esModule") return;

@@ -5,28 +5,16 @@ "use strict";

exports["default"] = void 0;
var _cssesc = _interopRequireDefault(require("cssesc"));
var _util = require("../util");
var _node = _interopRequireDefault(require("./node"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Namespace = /*#__PURE__*/function (_Node) {
_inheritsLoose(Namespace, _Node);
function Namespace() {
return _Node.apply(this, arguments) || this;
}
var _proto = Namespace.prototype;
_proto.qualifiedName = function qualifiedName(value) {

@@ -39,7 +27,5 @@ if (this.namespace) {

};
_proto.valueToString = function valueToString() {
return this.qualifiedName(_Node.prototype.valueToString.call(this));
};
_createClass(Namespace, [{

@@ -53,10 +39,7 @@ key: "namespace",

this._namespace = namespace;
if (this.raws) {
delete this.raws.namespace;
}
return;
}
var escaped = (0, _cssesc["default"])(namespace, {

@@ -66,3 +49,2 @@ isIdentifier: true

this._namespace = namespace;
if (escaped !== namespace) {

@@ -88,3 +70,2 @@ (0, _util.ensureObject)(this, "raws");

var ns = this.stringifyProperty("namespace");
if (ns === true) {

@@ -100,8 +81,6 @@ return '';

}]);
return Namespace;
}(_node["default"]);
exports["default"] = Namespace;
;
module.exports = exports.default;

@@ -5,19 +5,11 @@ "use strict";

exports["default"] = void 0;
var _node = _interopRequireDefault(require("./node"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Nesting = /*#__PURE__*/function (_Node) {
_inheritsLoose(Nesting, _Node);
function Nesting(opts) {
var _this;
_this = _Node.call(this, opts) || this;

@@ -28,7 +20,5 @@ _this.type = _types.NESTING;

}
return Nesting;
}(_node["default"]);
exports["default"] = Nesting;
module.exports = exports.default;

@@ -5,9 +5,5 @@ "use strict";

exports["default"] = void 0;
var _util = require("../util");
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
var cloneNode = function cloneNode(obj, parent) {

@@ -17,5 +13,3 @@ if (typeof obj !== 'object' || obj === null) {

}
var cloned = new obj.constructor();
for (var i in obj) {

@@ -25,6 +19,4 @@ if (!obj.hasOwnProperty(i)) {

}
var value = obj[i];
var type = typeof value;
if (i === 'parent' && type === 'object') {

@@ -42,6 +34,4 @@ if (parent) {

}
return cloned;
};
var Node = /*#__PURE__*/function () {

@@ -52,3 +42,2 @@ function Node(opts) {

}
Object.assign(this, opts);

@@ -59,5 +48,3 @@ this.spaces = this.spaces || {};

}
var _proto = Node.prototype;
_proto.remove = function remove() {

@@ -67,7 +54,5 @@ if (this.parent) {

}
this.parent = undefined;
return this;
};
_proto.replaceWith = function replaceWith() {

@@ -78,17 +63,12 @@ if (this.parent) {

}
this.remove();
}
return this;
};
_proto.next = function next() {
return this.parent.at(this.parent.index(this) + 1);
};
_proto.prev = function prev() {
return this.parent.at(this.parent.index(this) - 1);
};
_proto.clone = function clone(overrides) {

@@ -98,11 +78,9 @@ if (overrides === void 0) {

}
var cloned = cloneNode(this);
for (var name in overrides) {
cloned[name] = overrides[name];
}
return cloned;
}
/**

@@ -116,5 +94,3 @@ * Some non-standard syntax doesn't follow normal escaping rules for css.

* @param {string} valueEscaped optional. the escaped value of the property.
*/
;
*/;
_proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {

@@ -124,7 +100,5 @@ if (!this.raws) {

}
var originalValue = this[name];
var originalEscaped = this.raws[name];
this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
if (originalEscaped || valueEscaped !== value) {

@@ -136,2 +110,3 @@ this.raws[name] = (originalEscaped || originalValue) + valueEscaped;

}
/**

@@ -144,5 +119,3 @@ * Some non-standard syntax doesn't follow normal escaping rules for css.

* @param {string} valueEscaped the escaped value of the property.
*/
;
*/;
_proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {

@@ -152,7 +125,6 @@ if (!this.raws) {

}
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
this.raws[name] = valueEscaped;
}
/**

@@ -164,8 +136,5 @@ * When you want a value to passed through to CSS directly. This method

* @param {any} value The value that is both escaped and unescaped.
*/
;
*/;
_proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
if (this.raws) {

@@ -175,2 +144,3 @@ delete this.raws[name];

}
/**

@@ -180,5 +150,3 @@ *

* @param {number} column The column number (starting with 1)
*/
;
*/;
_proto.isAtPosition = function isAtPosition(line, column) {

@@ -189,33 +157,24 @@ if (this.source && this.source.start && this.source.end) {

}
if (this.source.end.line < line) {
return false;
}
if (this.source.start.line === line && this.source.start.column > column) {
return false;
}
if (this.source.end.line === line && this.source.end.column < column) {
return false;
}
return true;
}
return undefined;
};
_proto.stringifyProperty = function stringifyProperty(name) {
return this.raws && this.raws[name] || this[name];
};
_proto.valueToString = function valueToString() {
return String(this.stringifyProperty("value"));
};
_proto.toString = function toString() {
return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
};
_createClass(Node, [{

@@ -225,7 +184,5 @@ key: "rawSpaceBefore",

var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
if (rawSpace === undefined) {
rawSpace = this.spaces && this.spaces.before;
}
return rawSpace || "";

@@ -241,7 +198,5 @@ },

var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
if (rawSpace === undefined) {
rawSpace = this.spaces.after;
}
return rawSpace || "";

@@ -254,7 +209,5 @@ },

}]);
return Node;
}();
exports["default"] = Node;
module.exports = exports.default;

@@ -5,19 +5,11 @@ "use strict";

exports["default"] = void 0;
var _container = _interopRequireDefault(require("./container"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Pseudo = /*#__PURE__*/function (_Container) {
_inheritsLoose(Pseudo, _Container);
function Pseudo(opts) {
var _this;
_this = _Container.call(this, opts) || this;

@@ -27,5 +19,3 @@ _this.type = _types.PSEUDO;

}
var _proto = Pseudo.prototype;
_proto.toString = function toString() {

@@ -35,7 +25,5 @@ var params = this.length ? '(' + this.map(String).join(',') + ')' : '';

};
return Pseudo;
}(_container["default"]);
exports["default"] = Pseudo;
module.exports = exports.default;

@@ -5,23 +5,13 @@ "use strict";

exports["default"] = void 0;
var _container = _interopRequireDefault(require("./container"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Root = /*#__PURE__*/function (_Container) {
_inheritsLoose(Root, _Container);
function Root(opts) {
var _this;
_this = _Container.call(this, opts) || this;

@@ -31,5 +21,3 @@ _this.type = _types.ROOT;

}
var _proto = Root.prototype;
_proto.toString = function toString() {

@@ -42,3 +30,2 @@ var str = this.reduce(function (memo, selector) {

};
_proto.error = function error(message, options) {

@@ -51,3 +38,2 @@ if (this._error) {

};
_createClass(Root, [{

@@ -59,7 +45,5 @@ key: "errorGenerator",

}]);
return Root;
}(_container["default"]);
exports["default"] = Root;
module.exports = exports.default;

@@ -5,19 +5,11 @@ "use strict";

exports["default"] = void 0;
var _container = _interopRequireDefault(require("./container"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Selector = /*#__PURE__*/function (_Container) {
_inheritsLoose(Selector, _Container);
function Selector(opts) {
var _this;
_this = _Container.call(this, opts) || this;

@@ -27,7 +19,5 @@ _this.type = _types.SELECTOR;

}
return Selector;
}(_container["default"]);
exports["default"] = Selector;
module.exports = exports.default;

@@ -5,19 +5,11 @@ "use strict";

exports["default"] = void 0;
var _node = _interopRequireDefault(require("./node"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var String = /*#__PURE__*/function (_Node) {
_inheritsLoose(String, _Node);
function String(opts) {
var _this;
_this = _Node.call(this, opts) || this;

@@ -27,7 +19,5 @@ _this.type = _types.STRING;

}
return String;
}(_node["default"]);
exports["default"] = String;
module.exports = exports.default;

@@ -5,19 +5,11 @@ "use strict";

exports["default"] = void 0;
var _namespace = _interopRequireDefault(require("./namespace"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Tag = /*#__PURE__*/function (_Namespace) {
_inheritsLoose(Tag, _Namespace);
function Tag(opts) {
var _this;
_this = _Namespace.call(this, opts) || this;

@@ -27,7 +19,5 @@ _this.type = _types.TAG;

}
return Tag;
}(_namespace["default"]);
exports["default"] = Tag;
module.exports = exports.default;
"use strict";
exports.__esModule = true;
exports.UNIVERSAL = exports.ATTRIBUTE = exports.CLASS = exports.COMBINATOR = exports.COMMENT = exports.ID = exports.NESTING = exports.PSEUDO = exports.ROOT = exports.SELECTOR = exports.STRING = exports.TAG = void 0;
exports.UNIVERSAL = exports.TAG = exports.STRING = exports.SELECTOR = exports.ROOT = exports.PSEUDO = exports.NESTING = exports.ID = exports.COMMENT = exports.COMBINATOR = exports.CLASS = exports.ATTRIBUTE = void 0;
var TAG = 'tag';

@@ -6,0 +6,0 @@ exports.TAG = TAG;

@@ -5,19 +5,11 @@ "use strict";

exports["default"] = void 0;
var _namespace = _interopRequireDefault(require("./namespace"));
var _types = require("./types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Universal = /*#__PURE__*/function (_Namespace) {
_inheritsLoose(Universal, _Namespace);
function Universal(opts) {
var _this;
_this = _Namespace.call(this, opts) || this;

@@ -28,7 +20,5 @@ _this.type = _types.UNIVERSAL;

}
return Universal;
}(_namespace["default"]);
exports["default"] = Universal;
module.exports = exports.default;

@@ -5,3 +5,2 @@ "use strict";

exports["default"] = sortAscending;
function sortAscending(list) {

@@ -12,4 +11,3 @@ return list.sort(function (a, b) {

}
;
module.exports = exports.default;
"use strict";
exports.__esModule = true;
exports.FIELDS = void 0;
exports["default"] = tokenize;
exports.FIELDS = void 0;
var t = _interopRequireWildcard(require("./tokenTypes"));
var _unescapable, _wordDelimiters;
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
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; }
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); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && 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; }
var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);

@@ -19,6 +14,6 @@ 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);

var hexChars = "0123456789abcdefABCDEF";
for (var i = 0; i < hexChars.length; i++) {
hex[hexChars.charCodeAt(i)] = true;
}
/**

@@ -29,11 +24,7 @@ * Returns the last index of the bar css word

*/
function consumeWord(css, start) {
var next = start;
var code;
do {
code = css.charCodeAt(next);
if (wordDelimiters[code]) {

@@ -48,5 +39,5 @@ return next - 1;

} while (next < css.length);
return next - 1;
}
/**

@@ -57,12 +48,10 @@ * Returns the last index of the escape sequence

*/
function consumeEscape(css, start) {
var next = start;
var code = css.charCodeAt(next + 1);
if (unescapable[code]) {// just consume the escape char
if (unescapable[code]) {
// just consume the escape char
} else if (hex[code]) {
var hexDigits = 0; // consume up to 6 hex chars
var hexDigits = 0;
// consume up to 6 hex chars
do {

@@ -72,5 +61,4 @@ next++;

code = css.charCodeAt(next + 1);
} while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape
} while (hex[code] && hexDigits < 6);
// if fewer than 6 hex chars, a trailing space ends the escape
if (hexDigits < 6 && code === t.space) {

@@ -83,6 +71,4 @@ next++;

}
return next;
}
var FIELDS = {

@@ -98,3 +84,2 @@ TYPE: 0,

exports.FIELDS = FIELDS;
function tokenize(input) {

@@ -104,3 +89,3 @@ var tokens = [];

var _css = css,
length = _css.length;
length = _css.length;
var offset = -1;

@@ -111,3 +96,2 @@ var line = 1;

var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
function unclosed(what, fix) {

@@ -122,6 +106,4 @@ if (input.safe) {

}
while (start < length) {
code = css.charCodeAt(start);
if (code === t.newline) {

@@ -131,3 +113,2 @@ offset = start;

}
switch (code) {

@@ -140,7 +121,5 @@ case t.space:

next = start;
do {
next += 1;
code = css.charCodeAt(next);
if (code === t.newline) {

@@ -151,3 +130,2 @@ offset = next;

} while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
tokenType = t.space;

@@ -158,3 +136,2 @@ endLine = line;

break;
case t.plus:

@@ -165,3 +142,2 @@ case t.greaterThan:

next = start;
do {

@@ -171,3 +147,2 @@ next += 1;

} while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
tokenType = t.combinator;

@@ -178,4 +153,4 @@ endLine = line;

break;
// Consume these characters as single tokens.
case t.asterisk:

@@ -200,3 +175,2 @@ case t.ampersand:

break;
case t.singleQuote:

@@ -206,13 +180,9 @@ case t.doubleQuote:

next = start;
do {
escaped = false;
next = css.indexOf(quote, next + 1);
if (next === -1) {
unclosed('quote', quote);
}
escapePos = next;
while (css.charCodeAt(escapePos - 1) === t.backslash) {

@@ -223,3 +193,2 @@ escapePos -= 1;

} while (escaped);
tokenType = t.str;

@@ -230,15 +199,11 @@ endLine = line;

break;
default:
if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
next = css.indexOf('*/', start + 2) + 1;
if (next === 0) {
unclosed('comment', '*/');
}
content = css.slice(start, next + 1);
lines = content.split('\n');
last = lines.length - 1;
if (last > 0) {

@@ -251,3 +216,2 @@ nextLine = line + last;

}
tokenType = t.comment;

@@ -269,17 +233,23 @@ line = nextLine;

}
end = next + 1;
break;
} // Ensure that the token structure remains consistent
}
tokens.push([tokenType, // [0] Token type
line, // [1] Starting line
start - offset, // [2] Starting column
endLine, // [3] Ending line
endColumn, // [4] Ending column
start, // [5] Start position / Source index
// Ensure that the token structure remains consistent
tokens.push([tokenType,
// [0] Token type
line,
// [1] Starting line
start - offset,
// [2] Starting column
endLine,
// [3] Ending line
endColumn,
// [4] Ending column
start,
// [5] Start position / Source index
end // [6] End position
]); // Reset offset for the next token
]);
// Reset offset for the next token
if (nextOffset) {

@@ -289,7 +259,5 @@ offset = nextOffset;

}
start = end;
}
return tokens;
}
"use strict";
exports.__esModule = true;
exports.combinator = exports.word = exports.comment = exports.str = exports.tab = exports.newline = exports.feed = exports.cr = exports.backslash = exports.bang = exports.slash = exports.doubleQuote = exports.singleQuote = exports.space = exports.greaterThan = exports.pipe = exports.equals = exports.plus = exports.caret = exports.tilde = exports.dollar = exports.closeSquare = exports.openSquare = exports.closeParenthesis = exports.openParenthesis = exports.semicolon = exports.colon = exports.comma = exports.at = exports.asterisk = exports.ampersand = void 0;
exports.word = exports.tilde = exports.tab = exports.str = exports.space = exports.slash = exports.singleQuote = exports.semicolon = exports.plus = exports.pipe = exports.openSquare = exports.openParenthesis = exports.newline = exports.greaterThan = exports.feed = exports.equals = exports.doubleQuote = exports.dollar = exports.cr = exports.comment = exports.comma = exports.combinator = exports.colon = exports.closeSquare = exports.closeParenthesis = exports.caret = exports.bang = exports.backslash = exports.at = exports.asterisk = exports.ampersand = void 0;
var ampersand = 38; // `&`.charCodeAt(0);
exports.ampersand = ampersand;
var asterisk = 42; // `*`.charCodeAt(0);
exports.asterisk = asterisk;
var at = 64; // `@`.charCodeAt(0);
exports.at = at;
var comma = 44; // `,`.charCodeAt(0);
exports.comma = comma;
var colon = 58; // `:`.charCodeAt(0);
exports.colon = colon;
var semicolon = 59; // `;`.charCodeAt(0);
exports.semicolon = semicolon;
var openParenthesis = 40; // `(`.charCodeAt(0);
exports.openParenthesis = openParenthesis;
var closeParenthesis = 41; // `)`.charCodeAt(0);
exports.closeParenthesis = closeParenthesis;
var openSquare = 91; // `[`.charCodeAt(0);
exports.openSquare = openSquare;
var closeSquare = 93; // `]`.charCodeAt(0);
exports.closeSquare = closeSquare;
var dollar = 36; // `$`.charCodeAt(0);
exports.dollar = dollar;
var tilde = 126; // `~`.charCodeAt(0);
exports.tilde = tilde;
var caret = 94; // `^`.charCodeAt(0);
exports.caret = caret;
var plus = 43; // `+`.charCodeAt(0);
exports.plus = plus;
var equals = 61; // `=`.charCodeAt(0);
exports.equals = equals;
var pipe = 124; // `|`.charCodeAt(0);
exports.pipe = pipe;
var greaterThan = 62; // `>`.charCodeAt(0);
exports.greaterThan = greaterThan;
var space = 32; // ` `.charCodeAt(0);
exports.space = space;
var singleQuote = 39; // `'`.charCodeAt(0);
exports.singleQuote = singleQuote;
var doubleQuote = 34; // `"`.charCodeAt(0);
exports.doubleQuote = doubleQuote;
var slash = 47; // `/`.charCodeAt(0);
exports.slash = slash;
var bang = 33; // `!`.charCodeAt(0);
exports.bang = bang;
var backslash = 92; // '\\'.charCodeAt(0);
exports.backslash = backslash;
var cr = 13; // '\r'.charCodeAt(0);
exports.cr = cr;
var feed = 12; // '\f'.charCodeAt(0);
exports.feed = feed;
var newline = 10; // '\n'.charCodeAt(0);
exports.newline = newline;
var tab = 9; // '\t'.charCodeAt(0);
// Expose aliases primarily for readability.
exports.tab = tab;
var str = singleQuote; // No good single character representation!
var str = singleQuote;
// No good single character representation!
exports.str = str;

@@ -90,0 +65,0 @@ var comment = -1;

@@ -5,3 +5,2 @@ "use strict";

exports["default"] = ensureObject;
function ensureObject(obj) {

@@ -11,14 +10,10 @@ for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

}
while (props.length > 0) {
var prop = props.shift();
if (!obj[prop]) {
obj[prop] = {};
}
obj = obj[prop];
}
}
module.exports = exports.default;

@@ -5,3 +5,2 @@ "use strict";

exports["default"] = getProp;
function getProp(obj) {

@@ -11,16 +10,11 @@ for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

}
while (props.length > 0) {
var prop = props.shift();
if (!obj[prop]) {
return undefined;
}
obj = obj[prop];
}
return obj;
}
module.exports = exports.default;
"use strict";
exports.__esModule = true;
exports.stripComments = exports.ensureObject = exports.getProp = exports.unesc = void 0;
exports.unesc = exports.stripComments = exports.getProp = exports.ensureObject = void 0;
var _unesc = _interopRequireDefault(require("./unesc"));
exports.unesc = _unesc["default"];
var _getProp = _interopRequireDefault(require("./getProp"));
exports.getProp = _getProp["default"];
var _ensureObject = _interopRequireDefault(require("./ensureObject"));
exports.ensureObject = _ensureObject["default"];
var _stripComments = _interopRequireDefault(require("./stripComments"));
exports.stripComments = _stripComments["default"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -5,3 +5,2 @@ "use strict";

exports["default"] = stripComments;
function stripComments(str) {

@@ -11,19 +10,14 @@ var s = "";

var lastEnd = 0;
while (commentStart >= 0) {
s = s + str.slice(lastEnd, commentStart);
var commentEnd = str.indexOf("*/", commentStart + 2);
if (commentEnd < 0) {
return s;
}
lastEnd = commentEnd + 2;
commentStart = str.indexOf("/*", lastEnd);
}
s = s + str.slice(lastEnd);
return s;
}
module.exports = exports.default;

@@ -5,3 +5,2 @@ "use strict";

exports["default"] = unesc;
// Many thanks for this post which made this migration much easier.

@@ -19,48 +18,36 @@ // https://mathiasbynens.be/notes/css-escapes

var spaceTerminated = false;
for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
var code = lower.charCodeAt(i);
// check to see if we are dealing with a valid hex char [a-f|0-9]
var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57;
// https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
spaceTerminated = code === 32;
if (!valid) {
break;
}
hex += lower[i];
}
if (hex.length === 0) {
return undefined;
}
var codePoint = parseInt(hex, 16);
var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for
var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF;
// Add special case for
// "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
// https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
}
return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
}
var CONTAINS_ESCAPE = /\\/;
function unesc(str) {
var needToProcess = CONTAINS_ESCAPE.test(str);
if (!needToProcess) {
return str;
}
var ret = "";
for (var i = 0; i < str.length; i++) {
if (str[i] === "\\") {
var gobbled = gobbleHex(str.slice(i + 1, i + 7));
if (gobbled !== undefined) {

@@ -70,6 +57,6 @@ ret += gobbled[0];

continue;
} // Retain a pair of \\ if double escaped `\\\\`
}
// Retain a pair of \\ if double escaped `\\\\`
// https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
if (str[i + 1] === "\\") {

@@ -79,19 +66,15 @@ ret += "\\";

continue;
} // if \\ is at the end of the string retain it
}
// if \\ is at the end of the string retain it
// https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
if (str.length === i + 1) {
ret += str[i];
}
continue;
}
ret += str[i];
}
return ret;
}
module.exports = exports.default;
{
"name": "postcss-selector-parser",
"version": "6.0.11",
"version": "6.0.12",
"devDependencies": {

@@ -12,9 +12,9 @@ "@babel/cli": "^7.11.6",

"@babel/register": "^7.11.5",
"ava": "^3.12.1",
"ava": "^5.1.0",
"babel-plugin-add-module-exports": "^1.0.4",
"coveralls": "^3.1.0",
"del-cli": "^3.0.1",
"eslint": "^7.9.0",
"eslint-plugin-import": "^2.22.0",
"glob": "^7.1.6",
"del-cli": "^5.0.0",
"eslint": "^8.28.0",
"eslint-plugin-import": "^2.26.0",
"glob": "^8.0.3",
"minimist": "^1.2.5",

@@ -41,3 +41,3 @@ "nyc": "^15.1.0",

"report": "nyc report --reporter=html",
"test": "nyc ava src/__tests__/*.js ",
"test": "nyc ava src/__tests__/*.mjs",
"testone": "ava"

@@ -72,3 +72,4 @@ },

"concurrency": 5,
"timeout": "25s"
"timeout": "25s",
"nodeArguments": []
},

@@ -75,0 +76,0 @@ "nyc": {

@@ -169,3 +169,3 @@ // Type definitions for postcss-selector-parser 2.2.3

prev(): Node;
clone(opts: {[override: string]:any}): Node;
clone(opts?: {[override: string]:any}): Node;
/**

@@ -172,0 +172,0 @@ * Return whether this node includes the character at the position of the given line and column.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc