forked from daren.hsu/line_push
update
This commit is contained in:
+1
-1
@@ -684,7 +684,7 @@ Example: `[ /*before*/ href /* after-attr */ = /* after-operator */ te/*inside-v
|
||||
```js
|
||||
{
|
||||
attribute: "href",
|
||||
operatator: "=",
|
||||
operator: "=",
|
||||
value: "test",
|
||||
spaces: {
|
||||
before: '',
|
||||
|
||||
+34
@@ -1,3 +1,37 @@
|
||||
# 6.0.10
|
||||
|
||||
- Fixed: `isPseudoElement()` supports `:first-letter` and `:first-line`
|
||||
|
||||
# 6.0.9
|
||||
|
||||
- Fixed: `Combinator.raws` property type
|
||||
|
||||
# 6.0.8
|
||||
|
||||
- Fixed: reduced size
|
||||
|
||||
# 6.0.7
|
||||
|
||||
- Fixed: parse animation percents
|
||||
|
||||
# 6.0.6
|
||||
|
||||
- Fixed: parse quoted attributes containing a newline correctly
|
||||
|
||||
# 6.0.5
|
||||
|
||||
- Perf: rework unesc for a 63+% performance boost
|
||||
|
||||
# 6.0.4
|
||||
|
||||
- Fixed: ts errors
|
||||
|
||||
# 6.0.3
|
||||
|
||||
- Fixed: replace node built-in "util" module with "util-deprecate"
|
||||
- Fixed: handle uppercase pseudo elements
|
||||
- Fixed: do not create invalid combinator before comment
|
||||
|
||||
# 6.0.2
|
||||
|
||||
- Fixed an issue with parsing and stringifying an empty attribute value
|
||||
|
||||
+7
-5
@@ -1,22 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _processor = _interopRequireDefault(require("./processor"));
|
||||
|
||||
var selectors = _interopRequireWildcard(require("./selectors"));
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
var parser = function parser(processor) {
|
||||
return new _processor.default(processor);
|
||||
return new _processor["default"](processor);
|
||||
};
|
||||
|
||||
Object.assign(parser, selectors);
|
||||
delete parser.__esModule;
|
||||
var _default = parser;
|
||||
exports.default = _default;
|
||||
exports["default"] = _default;
|
||||
module.exports = exports.default;
|
||||
+57
-37
@@ -1,11 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
|
||||
var _indexesOf = _interopRequireDefault(require("indexes-of"));
|
||||
|
||||
var _uniq = _interopRequireDefault(require("uniq"));
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _root = _interopRequireDefault(require("./selectors/root"));
|
||||
|
||||
@@ -43,9 +39,11 @@ var _util = require("./util");
|
||||
|
||||
var _WHITESPACE_TOKENS, _Object$assign;
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
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 _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); } }
|
||||
|
||||
@@ -112,9 +110,25 @@ function unescapeProp(node, prop) {
|
||||
return node;
|
||||
}
|
||||
|
||||
var Parser =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function indexesOf(array, item) {
|
||||
var i = -1;
|
||||
var indexes = [];
|
||||
|
||||
while ((i = array.indexOf(item, i + 1)) !== -1) {
|
||||
indexes.push(i);
|
||||
}
|
||||
|
||||
return indexes;
|
||||
}
|
||||
|
||||
function uniqs() {
|
||||
var list = Array.prototype.concat.apply([], arguments);
|
||||
return list.filter(function (item, i) {
|
||||
return i === list.indexOf(item);
|
||||
});
|
||||
}
|
||||
|
||||
var Parser = /*#__PURE__*/function () {
|
||||
function Parser(rule, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
@@ -127,17 +141,17 @@ function () {
|
||||
}, options);
|
||||
this.position = 0;
|
||||
this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
|
||||
this.tokens = (0, _tokenize.default)({
|
||||
this.tokens = (0, _tokenize["default"])({
|
||||
css: this.css,
|
||||
error: this._errorGenerator(),
|
||||
safe: this.options.safe
|
||||
});
|
||||
var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);
|
||||
this.root = new _root.default({
|
||||
this.root = new _root["default"]({
|
||||
source: rootSource
|
||||
});
|
||||
this.root.errorGenerator = this._errorGenerator();
|
||||
var selector = new _selector.default({
|
||||
var selector = new _selector["default"]({
|
||||
source: {
|
||||
start: {
|
||||
line: 1,
|
||||
@@ -447,7 +461,7 @@ function () {
|
||||
|
||||
unescapeProp(node, "attribute");
|
||||
unescapeProp(node, "namespace");
|
||||
this.newNode(new _attribute.default(node));
|
||||
this.newNode(new _attribute["default"](node));
|
||||
this.position++;
|
||||
}
|
||||
/**
|
||||
@@ -487,7 +501,7 @@ function () {
|
||||
space = "";
|
||||
}
|
||||
|
||||
lastComment = new _comment.default({
|
||||
lastComment = new _comment["default"]({
|
||||
value: this.content(),
|
||||
source: getTokenSource(this.currToken),
|
||||
sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
|
||||
@@ -503,7 +517,7 @@ function () {
|
||||
} else if (!this.options.lossy) {
|
||||
var firstToken = this.tokens[startPosition];
|
||||
var lastToken = this.tokens[this.position - 1];
|
||||
nodes.push(new _string.default({
|
||||
nodes.push(new _string["default"]({
|
||||
value: '',
|
||||
source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),
|
||||
sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
|
||||
@@ -570,7 +584,7 @@ function () {
|
||||
raws.value = "/" + nameRaw + "/";
|
||||
}
|
||||
|
||||
var node = new _combinator.default({
|
||||
var node = new _combinator["default"]({
|
||||
value: "/" + name + "/",
|
||||
source: getSource(this.currToken[_tokenize.FIELDS.START_LINE], this.currToken[_tokenize.FIELDS.START_COL], this.tokens[this.position + 2][_tokenize.FIELDS.END_LINE], this.tokens[this.position + 2][_tokenize.FIELDS.END_COL]),
|
||||
sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
|
||||
@@ -631,7 +645,7 @@ function () {
|
||||
if (this.isNamedCombinator()) {
|
||||
node = this.namedCombinator();
|
||||
} else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
|
||||
node = new _combinator.default({
|
||||
node = new _combinator["default"]({
|
||||
value: this.content(),
|
||||
source: getTokenSource(this.currToken),
|
||||
sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]
|
||||
@@ -676,7 +690,7 @@ function () {
|
||||
raws.value = _rawSpace2;
|
||||
}
|
||||
|
||||
node = new _combinator.default({
|
||||
node = new _combinator["default"]({
|
||||
value: ' ',
|
||||
source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
|
||||
sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
|
||||
@@ -702,7 +716,7 @@ function () {
|
||||
|
||||
this.current._inferEndPosition();
|
||||
|
||||
var selector = new _selector.default({
|
||||
var selector = new _selector["default"]({
|
||||
source: {
|
||||
start: tokenStart(this.tokens[this.position + 1])
|
||||
}
|
||||
@@ -714,7 +728,7 @@ function () {
|
||||
|
||||
_proto.comment = function comment() {
|
||||
var current = this.currToken;
|
||||
this.newNode(new _comment.default({
|
||||
this.newNode(new _comment["default"]({
|
||||
value: this.content(),
|
||||
source: getTokenSource(current),
|
||||
sourceIndex: current[_tokenize.FIELDS.START_POS]
|
||||
@@ -767,7 +781,7 @@ function () {
|
||||
}
|
||||
|
||||
var current = this.currToken;
|
||||
this.newNode(new _nesting.default({
|
||||
this.newNode(new _nesting["default"]({
|
||||
value: this.content(),
|
||||
source: getTokenSource(current),
|
||||
sourceIndex: current[_tokenize.FIELDS.START_POS]
|
||||
@@ -781,7 +795,7 @@ function () {
|
||||
this.position++;
|
||||
|
||||
if (last && last.type === types.PSEUDO) {
|
||||
var selector = new _selector.default({
|
||||
var selector = new _selector["default"]({
|
||||
source: {
|
||||
start: tokenStart(this.tokens[this.position - 1])
|
||||
}
|
||||
@@ -833,7 +847,7 @@ function () {
|
||||
if (last) {
|
||||
last.appendToPropertyAndEscape("value", parenValue, parenValue);
|
||||
} else {
|
||||
this.newNode(new _string.default({
|
||||
this.newNode(new _string["default"]({
|
||||
value: parenValue,
|
||||
source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),
|
||||
sourceIndex: parenStart[_tokenize.FIELDS.START_POS]
|
||||
@@ -865,7 +879,7 @@ function () {
|
||||
this.splitWord(false, function (first, length) {
|
||||
pseudoStr += first;
|
||||
|
||||
_this4.newNode(new _pseudo.default({
|
||||
_this4.newNode(new _pseudo["default"]({
|
||||
value: pseudoStr,
|
||||
source: getTokenSourceSpan(startingToken, _this4.currToken),
|
||||
sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
|
||||
@@ -885,7 +899,9 @@ function () {
|
||||
_proto.space = function space() {
|
||||
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) {
|
||||
if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
|
||||
return node.type === 'comment';
|
||||
})) {
|
||||
this.spaces = this.optionalSpace(content);
|
||||
this.position++;
|
||||
} else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
|
||||
@@ -898,7 +914,7 @@ function () {
|
||||
|
||||
_proto.string = function string() {
|
||||
var current = this.currToken;
|
||||
this.newNode(new _string.default({
|
||||
this.newNode(new _string["default"]({
|
||||
value: this.content(),
|
||||
source: getTokenSource(current),
|
||||
sourceIndex: current[_tokenize.FIELDS.START_POS]
|
||||
@@ -915,7 +931,7 @@ function () {
|
||||
}
|
||||
|
||||
var current = this.currToken;
|
||||
this.newNode(new _universal.default({
|
||||
this.newNode(new _universal["default"]({
|
||||
value: this.content(),
|
||||
source: getTokenSource(current),
|
||||
sourceIndex: current[_tokenize.FIELDS.START_POS]
|
||||
@@ -946,14 +962,18 @@ function () {
|
||||
nextToken = this.nextToken;
|
||||
}
|
||||
|
||||
var hasClass = (0, _indexesOf.default)(word, '.').filter(function (i) {
|
||||
return word[i - 1] !== '\\';
|
||||
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 isKeyframesPercent = /^\d+\.\d+%$/.test(word);
|
||||
return !escapedDot && !isKeyframesPercent;
|
||||
});
|
||||
var hasId = (0, _indexesOf.default)(word, '#').filter(function (i) {
|
||||
var hasId = indexesOf(word, '#').filter(function (i) {
|
||||
return word[i - 1] !== '\\';
|
||||
}); // Eliminate Sass interpolations from the list of id indexes
|
||||
|
||||
var interpolations = (0, _indexesOf.default)(word, '#{');
|
||||
var interpolations = indexesOf(word, '#{');
|
||||
|
||||
if (interpolations.length) {
|
||||
hasId = hasId.filter(function (hashIndex) {
|
||||
@@ -961,7 +981,7 @@ function () {
|
||||
});
|
||||
}
|
||||
|
||||
var indices = (0, _sortAscending.default)((0, _uniq.default)([0].concat(hasClass, hasId)));
|
||||
var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
|
||||
indices.forEach(function (ind, i) {
|
||||
var index = indices[i + 1] || word.length;
|
||||
var value = word.slice(ind, index);
|
||||
@@ -981,14 +1001,14 @@ function () {
|
||||
source: source,
|
||||
sourceIndex: sourceIndex
|
||||
};
|
||||
node = new _className.default(unescapeProp(classNameOpts, "value"));
|
||||
node = new _className["default"](unescapeProp(classNameOpts, "value"));
|
||||
} else if (~hasId.indexOf(ind)) {
|
||||
var idOpts = {
|
||||
value: value.slice(1),
|
||||
source: source,
|
||||
sourceIndex: sourceIndex
|
||||
};
|
||||
node = new _id.default(unescapeProp(idOpts, "value"));
|
||||
node = new _id["default"](unescapeProp(idOpts, "value"));
|
||||
} else {
|
||||
var tagOpts = {
|
||||
value: value,
|
||||
@@ -996,7 +1016,7 @@ function () {
|
||||
sourceIndex: sourceIndex
|
||||
};
|
||||
unescapeProp(tagOpts, "value");
|
||||
node = new _tag.default(tagOpts);
|
||||
node = new _tag["default"](tagOpts);
|
||||
}
|
||||
|
||||
_this5.newNode(node, namespace); // Ensure that the namespace is used only once
|
||||
@@ -1219,5 +1239,5 @@ function () {
|
||||
return Parser;
|
||||
}();
|
||||
|
||||
exports.default = Parser;
|
||||
exports["default"] = Parser;
|
||||
module.exports = exports.default;
|
||||
+5
-7
@@ -1,15 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _parser = _interopRequireDefault(require("./parser"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
var Processor =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
var Processor = /*#__PURE__*/function () {
|
||||
function Processor(func, options) {
|
||||
this.func = func || function noop() {};
|
||||
|
||||
@@ -52,7 +50,7 @@ function () {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var parser = new _parser.default(rule, this._parseOptions(options));
|
||||
var parser = new _parser["default"](rule, this._parseOptions(options));
|
||||
return parser.root;
|
||||
};
|
||||
|
||||
@@ -204,5 +202,5 @@ function () {
|
||||
return Processor;
|
||||
}();
|
||||
|
||||
exports.default = Processor;
|
||||
exports["default"] = Processor;
|
||||
module.exports = exports.default;
|
||||
+16
-17
@@ -2,7 +2,7 @@
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.unescapeValue = unescapeValue;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _cssesc = _interopRequireDefault(require("cssesc"));
|
||||
|
||||
@@ -14,18 +14,19 @@ var _types = require("./types");
|
||||
|
||||
var _CSSESC_QUOTE_OPTIONS;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var _require = require("util"),
|
||||
deprecate = _require.deprecate;
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var WRAPPED_IN_QUOTES = /^('|")(.*)\1$/;
|
||||
var deprecate = require("util-deprecate");
|
||||
|
||||
var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
|
||||
var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
|
||||
var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
|
||||
var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
|
||||
@@ -41,7 +42,7 @@ function unescapeValue(value) {
|
||||
unescaped = m[2];
|
||||
}
|
||||
|
||||
unescaped = (0, _unesc.default)(unescaped);
|
||||
unescaped = (0, _unesc["default"])(unescaped);
|
||||
|
||||
if (unescaped !== value) {
|
||||
deprecatedUsage = true;
|
||||
@@ -82,9 +83,7 @@ function handleDeprecatedContructorOpts(opts) {
|
||||
return opts;
|
||||
}
|
||||
|
||||
var Attribute =
|
||||
/*#__PURE__*/
|
||||
function (_Namespace) {
|
||||
var Attribute = /*#__PURE__*/function (_Namespace) {
|
||||
_inheritsLoose(Attribute, _Namespace);
|
||||
|
||||
function Attribute(opts) {
|
||||
@@ -141,7 +140,7 @@ function (_Namespace) {
|
||||
var quoteMark = this._determineQuoteMark(options);
|
||||
|
||||
var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
|
||||
var escaped = (0, _cssesc.default)(this._value, cssescopts);
|
||||
var escaped = (0, _cssesc["default"])(this._value, cssescopts);
|
||||
return escaped;
|
||||
};
|
||||
|
||||
@@ -185,7 +184,7 @@ function (_Namespace) {
|
||||
var numDoubleQuotes = v.replace(/[^"]/g, '').length;
|
||||
|
||||
if (numSingleQuotes + numDoubleQuotes === 0) {
|
||||
var escaped = (0, _cssesc.default)(v, {
|
||||
var escaped = (0, _cssesc["default"])(v, {
|
||||
isIdentifier: true
|
||||
});
|
||||
|
||||
@@ -198,7 +197,7 @@ function (_Namespace) {
|
||||
// pick a quote mark that isn't none and see if it's smaller
|
||||
var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
|
||||
var opts = CSSESC_QUOTE_OPTIONS[quote];
|
||||
var quoteValue = (0, _cssesc.default)(v, opts);
|
||||
var quoteValue = (0, _cssesc["default"])(v, opts);
|
||||
|
||||
if (quoteValue.length < escaped.length) {
|
||||
return quote;
|
||||
@@ -237,7 +236,7 @@ function (_Namespace) {
|
||||
};
|
||||
|
||||
_proto._syncRawValue = function _syncRawValue() {
|
||||
var rawValue = (0, _cssesc.default)(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
|
||||
var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
|
||||
|
||||
if (rawValue === this._value) {
|
||||
if (this.raws) {
|
||||
@@ -250,7 +249,7 @@ function (_Namespace) {
|
||||
|
||||
_proto._handleEscapes = function _handleEscapes(prop, value) {
|
||||
if (this._constructed) {
|
||||
var escaped = (0, _cssesc.default)(value, {
|
||||
var escaped = (0, _cssesc["default"])(value, {
|
||||
isIdentifier: true
|
||||
});
|
||||
|
||||
@@ -492,9 +491,9 @@ function (_Namespace) {
|
||||
}]);
|
||||
|
||||
return Attribute;
|
||||
}(_namespace.default);
|
||||
}(_namespace["default"]);
|
||||
|
||||
exports.default = Attribute;
|
||||
exports["default"] = Attribute;
|
||||
Attribute.NO_QUOTE = null;
|
||||
Attribute.SINGLE_QUOTE = "'";
|
||||
Attribute.DOUBLE_QUOTE = '"';
|
||||
|
||||
+14
-14
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _cssesc = _interopRequireDefault(require("cssesc"));
|
||||
|
||||
@@ -11,17 +11,17 @@ var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var ClassName =
|
||||
/*#__PURE__*/
|
||||
function (_Node) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var ClassName = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(ClassName, _Node);
|
||||
|
||||
function ClassName(opts) {
|
||||
@@ -35,15 +35,18 @@ function (_Node) {
|
||||
|
||||
var _proto = ClassName.prototype;
|
||||
|
||||
_proto.toString = function toString() {
|
||||
return [this.rawSpaceBefore, String('.' + this.stringifyProperty("value")), this.rawSpaceAfter].join('');
|
||||
_proto.valueToString = function valueToString() {
|
||||
return '.' + _Node.prototype.valueToString.call(this);
|
||||
};
|
||||
|
||||
_createClass(ClassName, [{
|
||||
key: "value",
|
||||
get: function get() {
|
||||
return this._value;
|
||||
},
|
||||
set: function set(v) {
|
||||
if (this._constructed) {
|
||||
var escaped = (0, _cssesc.default)(v, {
|
||||
var escaped = (0, _cssesc["default"])(v, {
|
||||
isIdentifier: true
|
||||
});
|
||||
|
||||
@@ -56,14 +59,11 @@ function (_Node) {
|
||||
}
|
||||
|
||||
this._value = v;
|
||||
},
|
||||
get: function get() {
|
||||
return this._value;
|
||||
}
|
||||
}]);
|
||||
|
||||
return ClassName;
|
||||
}(_node.default);
|
||||
}(_node["default"]);
|
||||
|
||||
exports.default = ClassName;
|
||||
exports["default"] = ClassName;
|
||||
module.exports = exports.default;
|
||||
+8
-8
@@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var Combinator =
|
||||
/*#__PURE__*/
|
||||
function (_Node) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Combinator = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Combinator, _Node);
|
||||
|
||||
function Combinator(opts) {
|
||||
@@ -25,7 +25,7 @@ function (_Node) {
|
||||
}
|
||||
|
||||
return Combinator;
|
||||
}(_node.default);
|
||||
}(_node["default"]);
|
||||
|
||||
exports.default = Combinator;
|
||||
exports["default"] = Combinator;
|
||||
module.exports = exports.default;
|
||||
+8
-8
@@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var Comment =
|
||||
/*#__PURE__*/
|
||||
function (_Node) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Comment = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Comment, _Node);
|
||||
|
||||
function Comment(opts) {
|
||||
@@ -25,7 +25,7 @@ function (_Node) {
|
||||
}
|
||||
|
||||
return Comment;
|
||||
}(_node.default);
|
||||
}(_node["default"]);
|
||||
|
||||
exports.default = Comment;
|
||||
exports["default"] = Comment;
|
||||
module.exports = exports.default;
|
||||
+13
-13
@@ -27,76 +27,76 @@ var _tag = _interopRequireDefault(require("./tag"));
|
||||
|
||||
var _universal = _interopRequireDefault(require("./universal"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
var attribute = function attribute(opts) {
|
||||
return new _attribute.default(opts);
|
||||
return new _attribute["default"](opts);
|
||||
};
|
||||
|
||||
exports.attribute = attribute;
|
||||
|
||||
var className = function className(opts) {
|
||||
return new _className.default(opts);
|
||||
return new _className["default"](opts);
|
||||
};
|
||||
|
||||
exports.className = className;
|
||||
|
||||
var combinator = function combinator(opts) {
|
||||
return new _combinator.default(opts);
|
||||
return new _combinator["default"](opts);
|
||||
};
|
||||
|
||||
exports.combinator = combinator;
|
||||
|
||||
var comment = function comment(opts) {
|
||||
return new _comment.default(opts);
|
||||
return new _comment["default"](opts);
|
||||
};
|
||||
|
||||
exports.comment = comment;
|
||||
|
||||
var id = function id(opts) {
|
||||
return new _id.default(opts);
|
||||
return new _id["default"](opts);
|
||||
};
|
||||
|
||||
exports.id = id;
|
||||
|
||||
var nesting = function nesting(opts) {
|
||||
return new _nesting.default(opts);
|
||||
return new _nesting["default"](opts);
|
||||
};
|
||||
|
||||
exports.nesting = nesting;
|
||||
|
||||
var pseudo = function pseudo(opts) {
|
||||
return new _pseudo.default(opts);
|
||||
return new _pseudo["default"](opts);
|
||||
};
|
||||
|
||||
exports.pseudo = pseudo;
|
||||
|
||||
var root = function root(opts) {
|
||||
return new _root.default(opts);
|
||||
return new _root["default"](opts);
|
||||
};
|
||||
|
||||
exports.root = root;
|
||||
|
||||
var selector = function selector(opts) {
|
||||
return new _selector.default(opts);
|
||||
return new _selector["default"](opts);
|
||||
};
|
||||
|
||||
exports.selector = selector;
|
||||
|
||||
var string = function string(opts) {
|
||||
return new _string.default(opts);
|
||||
return new _string["default"](opts);
|
||||
};
|
||||
|
||||
exports.string = string;
|
||||
|
||||
var tag = function tag(opts) {
|
||||
return new _tag.default(opts);
|
||||
return new _tag["default"](opts);
|
||||
};
|
||||
|
||||
exports.tag = tag;
|
||||
|
||||
var universal = function universal(opts) {
|
||||
return new _universal.default(opts);
|
||||
return new _universal["default"](opts);
|
||||
};
|
||||
|
||||
exports.universal = universal;
|
||||
+19
-22
@@ -1,25 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var types = _interopRequireWildcard(require("./types"));
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
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 _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 _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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var Container =
|
||||
/*#__PURE__*/
|
||||
function (_Node) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Container = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Container, _Node);
|
||||
|
||||
function Container(opts) {
|
||||
@@ -78,19 +86,8 @@ function (_Node) {
|
||||
};
|
||||
|
||||
_proto.removeAll = function removeAll() {
|
||||
for (var _iterator = this.nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var node = _ref;
|
||||
for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
|
||||
var node = _step.value;
|
||||
node.parent = undefined;
|
||||
}
|
||||
|
||||
@@ -392,7 +389,7 @@ function (_Node) {
|
||||
}]);
|
||||
|
||||
return Container;
|
||||
}(_node.default);
|
||||
}(_node["default"]);
|
||||
|
||||
exports.default = Container;
|
||||
exports["default"] = Container;
|
||||
module.exports = exports.default;
|
||||
+1
-1
@@ -48,7 +48,7 @@ var isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
|
||||
exports.isUniversal = isUniversal;
|
||||
|
||||
function isPseudoElement(node) {
|
||||
return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value === ":before" || node.value === ":after");
|
||||
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) {
|
||||
|
||||
+10
-10
@@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var ID =
|
||||
/*#__PURE__*/
|
||||
function (_Node) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var ID = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(ID, _Node);
|
||||
|
||||
function ID(opts) {
|
||||
@@ -26,12 +26,12 @@ function (_Node) {
|
||||
|
||||
var _proto = ID.prototype;
|
||||
|
||||
_proto.toString = function toString() {
|
||||
return [this.rawSpaceBefore, String('#' + this.stringifyProperty("value")), this.rawSpaceAfter].join('');
|
||||
_proto.valueToString = function valueToString() {
|
||||
return '#' + _Node.prototype.valueToString.call(this);
|
||||
};
|
||||
|
||||
return ID;
|
||||
}(_node.default);
|
||||
}(_node["default"]);
|
||||
|
||||
exports.default = ID;
|
||||
exports["default"] = ID;
|
||||
module.exports = exports.default;
|
||||
+3
@@ -6,6 +6,7 @@ var _types = require("./types");
|
||||
|
||||
Object.keys(_types).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _types[key]) return;
|
||||
exports[key] = _types[key];
|
||||
});
|
||||
|
||||
@@ -13,6 +14,7 @@ var _constructors = require("./constructors");
|
||||
|
||||
Object.keys(_constructors).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _constructors[key]) return;
|
||||
exports[key] = _constructors[key];
|
||||
});
|
||||
|
||||
@@ -20,5 +22,6 @@ var _guards = require("./guards");
|
||||
|
||||
Object.keys(_guards).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _guards[key]) return;
|
||||
exports[key] = _guards[key];
|
||||
});
|
||||
+11
-11
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _cssesc = _interopRequireDefault(require("cssesc"));
|
||||
|
||||
@@ -9,17 +9,17 @@ var _util = require("../util");
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var Namespace =
|
||||
/*#__PURE__*/
|
||||
function (_Node) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Namespace = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Namespace, _Node);
|
||||
|
||||
function Namespace() {
|
||||
@@ -36,8 +36,8 @@ function (_Node) {
|
||||
}
|
||||
};
|
||||
|
||||
_proto.toString = function toString() {
|
||||
return [this.rawSpaceBefore, this.qualifiedName(this.stringifyProperty("value")), this.rawSpaceAfter].join('');
|
||||
_proto.valueToString = function valueToString() {
|
||||
return this.qualifiedName(_Node.prototype.valueToString.call(this));
|
||||
};
|
||||
|
||||
_createClass(Namespace, [{
|
||||
@@ -56,7 +56,7 @@ function (_Node) {
|
||||
return;
|
||||
}
|
||||
|
||||
var escaped = (0, _cssesc.default)(namespace, {
|
||||
var escaped = (0, _cssesc["default"])(namespace, {
|
||||
isIdentifier: true
|
||||
});
|
||||
this._namespace = namespace;
|
||||
@@ -94,8 +94,8 @@ function (_Node) {
|
||||
}]);
|
||||
|
||||
return Namespace;
|
||||
}(_node.default);
|
||||
}(_node["default"]);
|
||||
|
||||
exports.default = Namespace;
|
||||
exports["default"] = Namespace;
|
||||
;
|
||||
module.exports = exports.default;
|
||||
+8
-8
@@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var Nesting =
|
||||
/*#__PURE__*/
|
||||
function (_Node) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Nesting = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Nesting, _Node);
|
||||
|
||||
function Nesting(opts) {
|
||||
@@ -26,7 +26,7 @@ function (_Node) {
|
||||
}
|
||||
|
||||
return Nesting;
|
||||
}(_node.default);
|
||||
}(_node["default"]);
|
||||
|
||||
exports.default = Nesting;
|
||||
exports["default"] = Nesting;
|
||||
module.exports = exports.default;
|
||||
+9
-7
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _util = require("../util");
|
||||
|
||||
@@ -40,9 +40,7 @@ var cloneNode = function cloneNode(obj, parent) {
|
||||
return cloned;
|
||||
};
|
||||
|
||||
var Node =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
var Node = /*#__PURE__*/function () {
|
||||
function Node(opts) {
|
||||
if (opts === void 0) {
|
||||
opts = {};
|
||||
@@ -160,7 +158,7 @@ function () {
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {number} line The number (starting with 1)
|
||||
* @param {number} column The column number (starting with 1)
|
||||
*/
|
||||
@@ -194,8 +192,12 @@ function () {
|
||||
return this.raws && this.raws[name] || this[name];
|
||||
};
|
||||
|
||||
_proto.valueToString = function valueToString() {
|
||||
return String(this.stringifyProperty("value"));
|
||||
};
|
||||
|
||||
_proto.toString = function toString() {
|
||||
return [this.rawSpaceBefore, String(this.stringifyProperty("value")), this.rawSpaceAfter].join('');
|
||||
return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
|
||||
};
|
||||
|
||||
_createClass(Node, [{
|
||||
@@ -233,5 +235,5 @@ function () {
|
||||
return Node;
|
||||
}();
|
||||
|
||||
exports.default = Node;
|
||||
exports["default"] = Node;
|
||||
module.exports = exports.default;
|
||||
+8
-8
@@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _container = _interopRequireDefault(require("./container"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var Pseudo =
|
||||
/*#__PURE__*/
|
||||
function (_Container) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Pseudo = /*#__PURE__*/function (_Container) {
|
||||
_inheritsLoose(Pseudo, _Container);
|
||||
|
||||
function Pseudo(opts) {
|
||||
@@ -32,7 +32,7 @@ function (_Container) {
|
||||
};
|
||||
|
||||
return Pseudo;
|
||||
}(_container.default);
|
||||
}(_container["default"]);
|
||||
|
||||
exports.default = Pseudo;
|
||||
exports["default"] = Pseudo;
|
||||
module.exports = exports.default;
|
||||
+8
-8
@@ -1,23 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _container = _interopRequireDefault(require("./container"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var Root =
|
||||
/*#__PURE__*/
|
||||
function (_Container) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Root = /*#__PURE__*/function (_Container) {
|
||||
_inheritsLoose(Root, _Container);
|
||||
|
||||
function Root(opts) {
|
||||
@@ -54,7 +54,7 @@ function (_Container) {
|
||||
}]);
|
||||
|
||||
return Root;
|
||||
}(_container.default);
|
||||
}(_container["default"]);
|
||||
|
||||
exports.default = Root;
|
||||
exports["default"] = Root;
|
||||
module.exports = exports.default;
|
||||
+8
-8
@@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _container = _interopRequireDefault(require("./container"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var Selector =
|
||||
/*#__PURE__*/
|
||||
function (_Container) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Selector = /*#__PURE__*/function (_Container) {
|
||||
_inheritsLoose(Selector, _Container);
|
||||
|
||||
function Selector(opts) {
|
||||
@@ -25,7 +25,7 @@ function (_Container) {
|
||||
}
|
||||
|
||||
return Selector;
|
||||
}(_container.default);
|
||||
}(_container["default"]);
|
||||
|
||||
exports.default = Selector;
|
||||
exports["default"] = Selector;
|
||||
module.exports = exports.default;
|
||||
+8
-8
@@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var String =
|
||||
/*#__PURE__*/
|
||||
function (_Node) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var String = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(String, _Node);
|
||||
|
||||
function String(opts) {
|
||||
@@ -25,7 +25,7 @@ function (_Node) {
|
||||
}
|
||||
|
||||
return String;
|
||||
}(_node.default);
|
||||
}(_node["default"]);
|
||||
|
||||
exports.default = String;
|
||||
exports["default"] = String;
|
||||
module.exports = exports.default;
|
||||
+8
-8
@@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _namespace = _interopRequireDefault(require("./namespace"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var Tag =
|
||||
/*#__PURE__*/
|
||||
function (_Namespace) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Tag = /*#__PURE__*/function (_Namespace) {
|
||||
_inheritsLoose(Tag, _Namespace);
|
||||
|
||||
function Tag(opts) {
|
||||
@@ -25,7 +25,7 @@ function (_Namespace) {
|
||||
}
|
||||
|
||||
return Tag;
|
||||
}(_namespace.default);
|
||||
}(_namespace["default"]);
|
||||
|
||||
exports.default = Tag;
|
||||
exports["default"] = Tag;
|
||||
module.exports = exports.default;
|
||||
+8
-8
@@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _namespace = _interopRequireDefault(require("./namespace"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
var Universal =
|
||||
/*#__PURE__*/
|
||||
function (_Namespace) {
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var Universal = /*#__PURE__*/function (_Namespace) {
|
||||
_inheritsLoose(Universal, _Namespace);
|
||||
|
||||
function Universal(opts) {
|
||||
@@ -26,7 +26,7 @@ function (_Namespace) {
|
||||
}
|
||||
|
||||
return Universal;
|
||||
}(_namespace.default);
|
||||
}(_namespace["default"]);
|
||||
|
||||
exports.default = Universal;
|
||||
exports["default"] = Universal;
|
||||
module.exports = exports.default;
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = sortAscending;
|
||||
exports["default"] = sortAscending;
|
||||
|
||||
function sortAscending(list) {
|
||||
return list.sort(function (a, b) {
|
||||
|
||||
+6
-3
@@ -1,14 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = tokenize;
|
||||
exports["default"] = tokenize;
|
||||
exports.FIELDS = void 0;
|
||||
|
||||
var t = _interopRequireWildcard(require("./tokenTypes"));
|
||||
|
||||
var _unescapable, _wordDelimiters;
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
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; }
|
||||
|
||||
var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
|
||||
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);
|
||||
@@ -254,7 +256,8 @@ function tokenize(input) {
|
||||
endLine, // [3] Ending line
|
||||
endColumn, // [4] Ending column
|
||||
start, // [5] Start position / Source index
|
||||
end]); // Reset offset for the next token
|
||||
end // [6] End position
|
||||
]); // Reset offset for the next token
|
||||
|
||||
if (nextOffset) {
|
||||
offset = nextOffset;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = ensureObject;
|
||||
exports["default"] = ensureObject;
|
||||
|
||||
function ensureObject(obj) {
|
||||
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = getProp;
|
||||
exports["default"] = getProp;
|
||||
|
||||
function getProp(obj) {
|
||||
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
|
||||
+5
-5
@@ -5,18 +5,18 @@ exports.stripComments = exports.ensureObject = exports.getProp = exports.unesc =
|
||||
|
||||
var _unesc = _interopRequireDefault(require("./unesc"));
|
||||
|
||||
exports.unesc = _unesc.default;
|
||||
exports.unesc = _unesc["default"];
|
||||
|
||||
var _getProp = _interopRequireDefault(require("./getProp"));
|
||||
|
||||
exports.getProp = _getProp.default;
|
||||
exports.getProp = _getProp["default"];
|
||||
|
||||
var _ensureObject = _interopRequireDefault(require("./ensureObject"));
|
||||
|
||||
exports.ensureObject = _ensureObject.default;
|
||||
exports.ensureObject = _ensureObject["default"];
|
||||
|
||||
var _stripComments = _interopRequireDefault(require("./stripComments"));
|
||||
|
||||
exports.stripComments = _stripComments.default;
|
||||
exports.stripComments = _stripComments["default"];
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = stripComments;
|
||||
exports["default"] = stripComments;
|
||||
|
||||
function stripComments(str) {
|
||||
var s = "";
|
||||
|
||||
+84
-11
@@ -1,20 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = unesc;
|
||||
var whitespace = '[\\x20\\t\\r\\n\\f]';
|
||||
var unescapeRegExp = new RegExp('\\\\([\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig');
|
||||
exports["default"] = unesc;
|
||||
|
||||
// Many thanks for this post which made this migration much easier.
|
||||
// https://mathiasbynens.be/notes/css-escapes
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} str
|
||||
* @returns {[string, number]|undefined}
|
||||
*/
|
||||
function gobbleHex(str) {
|
||||
var lower = str.toLowerCase();
|
||||
var hex = '';
|
||||
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
|
||||
|
||||
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
|
||||
// "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) {
|
||||
return str.replace(unescapeRegExp, function (_, escaped, escapedWhitespace) {
|
||||
var high = '0x' + escaped - 0x10000; // NaN means non-codepoint
|
||||
// Workaround erroneous numeric interpretation of +"0x"
|
||||
// eslint-disable-next-line no-self-compare
|
||||
var needToProcess = CONTAINS_ESCAPE.test(str);
|
||||
|
||||
return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint
|
||||
String.fromCharCode(high + 0x10000) : // Supplemental Plane codepoint (surrogate pair)
|
||||
String.fromCharCode(high >> 10 | 0xd800, high & 0x3ff | 0xdc00);
|
||||
});
|
||||
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) {
|
||||
ret += gobbled[0];
|
||||
i += gobbled[1];
|
||||
continue;
|
||||
} // Retain a pair of \\ if double escaped `\\\\`
|
||||
// https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
|
||||
|
||||
|
||||
if (str[i + 1] === "\\") {
|
||||
ret += "\\";
|
||||
i++;
|
||||
continue;
|
||||
} // 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;
|
||||
+38
-36
@@ -1,25 +1,25 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"postcss-selector-parser@6.0.2",
|
||||
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
|
||||
"postcss-selector-parser@6.0.10",
|
||||
"/home/node/nuxt"
|
||||
]
|
||||
],
|
||||
"_from": "postcss-selector-parser@6.0.2",
|
||||
"_id": "postcss-selector-parser@6.0.2",
|
||||
"_from": "postcss-selector-parser@6.0.10",
|
||||
"_id": "postcss-selector-parser@6.0.10",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg==",
|
||||
"_integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==",
|
||||
"_location": "/postcss-selector-parser",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "postcss-selector-parser@6.0.2",
|
||||
"raw": "postcss-selector-parser@6.0.10",
|
||||
"name": "postcss-selector-parser",
|
||||
"escapedName": "postcss-selector-parser",
|
||||
"rawSpec": "6.0.2",
|
||||
"rawSpec": "6.0.10",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "6.0.2"
|
||||
"fetchSpec": "6.0.10"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/component-compiler-utils",
|
||||
@@ -28,14 +28,15 @@
|
||||
"/postcss-modules-local-by-default",
|
||||
"/postcss-modules-scope"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz",
|
||||
"_spec": "6.0.2",
|
||||
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
|
||||
"_resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz",
|
||||
"_spec": "6.0.10",
|
||||
"_where": "/home/node/nuxt",
|
||||
"ava": {
|
||||
"require": [
|
||||
"@babel/register"
|
||||
],
|
||||
"concurrency": 5
|
||||
"concurrency": 5,
|
||||
"timeout": "25s"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/postcss/postcss-selector-parser/issues"
|
||||
@@ -54,29 +55,29 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"cssesc": "^3.0.0",
|
||||
"indexes-of": "^1.0.1",
|
||||
"uniq": "^1.0.1"
|
||||
"util-deprecate": "^1.0.2"
|
||||
},
|
||||
"description": "> Selector parser with built in methods for working with selector strings.",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/plugin-proposal-class-properties": "^7.3.4",
|
||||
"@babel/preset-env": "^7.3.4",
|
||||
"@babel/register": "^7.0.0",
|
||||
"ava": "^1.3.1",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-plugin-add-module-exports": "^1.0.0",
|
||||
"coveralls": "^3.0.3",
|
||||
"del-cli": "^1.1.0",
|
||||
"eslint": "^5.15.1",
|
||||
"eslint-plugin-babel": "^5.3.0",
|
||||
"eslint-plugin-import": "^2.16.0",
|
||||
"glob": "^7.1.3",
|
||||
"minimist": "^1.2.0",
|
||||
"nyc": "^13.3.0",
|
||||
"postcss": "^7.0.14",
|
||||
"semver": "^5.6.0"
|
||||
"@babel/cli": "^7.11.6",
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/eslint-parser": "^7.11.5",
|
||||
"@babel/eslint-plugin": "^7.11.5",
|
||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||
"@babel/preset-env": "^7.11.5",
|
||||
"@babel/register": "^7.11.5",
|
||||
"ava": "^3.12.1",
|
||||
"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",
|
||||
"minimist": "^1.2.5",
|
||||
"nyc": "^15.1.0",
|
||||
"postcss": "^8.0.0",
|
||||
"semver": "^7.3.2",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
@@ -86,7 +87,8 @@
|
||||
"CHANGELOG.md",
|
||||
"LICENSE-MIT",
|
||||
"dist",
|
||||
"postcss-selector-parser.d.ts"
|
||||
"postcss-selector-parser.d.ts",
|
||||
"!**/__tests__"
|
||||
],
|
||||
"homepage": "https://github.com/postcss/postcss-selector-parser",
|
||||
"license": "MIT",
|
||||
@@ -105,11 +107,11 @@
|
||||
"scripts": {
|
||||
"lintfix": "eslint --fix src",
|
||||
"prepare": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
|
||||
"pretest": "eslint src",
|
||||
"pretest": "eslint src && tsc --noEmit postcss-selector-parser.d.ts",
|
||||
"report": "nyc report --reporter=html",
|
||||
"test": "nyc ava src/__tests__/*.js",
|
||||
"test": "nyc ava src/__tests__/*.js ",
|
||||
"testone": "ava"
|
||||
},
|
||||
"types": "postcss-selector-parser.d.ts",
|
||||
"version": "6.0.2"
|
||||
"version": "6.0.10"
|
||||
}
|
||||
|
||||
+89
-33
@@ -14,6 +14,9 @@
|
||||
*/
|
||||
export = parser;
|
||||
|
||||
// A type that's T but not U.
|
||||
type Diff<T, U> = T extends U ? never : T;
|
||||
|
||||
// TODO: Conditional types in TS 1.8 will really clean this up.
|
||||
declare function parser(): parser.Processor<never>;
|
||||
declare function parser<Transform>(processor: parser.AsyncProcessor<Transform>): parser.Processor<Transform, never>;
|
||||
@@ -203,11 +206,14 @@ declare namespace parser {
|
||||
interface ContainerOptions extends NodeOptions {
|
||||
nodes?: Array<Node>;
|
||||
}
|
||||
interface Container<Value extends string | undefined = string> extends Base<Value> {
|
||||
nodes: Array<Node>;
|
||||
append(selector: Selector): Container;
|
||||
prepend(selector: Selector): Container;
|
||||
at(index: number): Node;
|
||||
interface Container<
|
||||
Value extends string | undefined = string,
|
||||
Child extends Node = Node
|
||||
> extends Base<Value> {
|
||||
nodes: Array<Child>;
|
||||
append(selector: Selector): this;
|
||||
prepend(selector: Selector): this;
|
||||
at(index: number): Child;
|
||||
/**
|
||||
* Return the most specific node at the line and column number given.
|
||||
* The source location is based on the original parsed location, locations aren't
|
||||
@@ -221,33 +227,74 @@ declare namespace parser {
|
||||
* @param line The line number of the node to find. (1-based index)
|
||||
* @param col The column number of the node to find. (1-based index)
|
||||
*/
|
||||
atPosition(line: number, column: number): Node;
|
||||
index(child: Node): number;
|
||||
readonly first: Node;
|
||||
readonly last: Node;
|
||||
atPosition(line: number, column: number): Child;
|
||||
index(child: Child): number;
|
||||
readonly first: Child;
|
||||
readonly last: Child;
|
||||
readonly length: number;
|
||||
removeChild(child: Node): Container;
|
||||
removeChild(child: Child): this;
|
||||
removeAll(): Container;
|
||||
empty(): Container;
|
||||
insertAfter(oldNode: Node, newNode: Node): Container;
|
||||
insertBefore(oldNode: Node, newNode: Node): Container;
|
||||
each(callback: (node: Node) => boolean | void): boolean | undefined;
|
||||
walk(callback: (node: Node) => boolean | void): boolean | undefined;
|
||||
walkAttributes(callback: (node: Node) => boolean | void): boolean | undefined;
|
||||
walkClasses(callback: (node: Node) => boolean | void): boolean | undefined;
|
||||
walkCombinators(callback: (node: Node) => boolean | void): boolean | undefined;
|
||||
walkComments(callback: (node: Node) => boolean | void): boolean | undefined;
|
||||
walkIds(callback: (node: Node) => boolean | void): boolean | undefined;
|
||||
walkNesting(callback: (node: Node) => boolean | void): boolean | undefined;
|
||||
walkPseudos(callback: (node: Node) => boolean | void): boolean | undefined;
|
||||
walkTags(callback: (node: Node) => boolean | void): boolean | undefined;
|
||||
split(callback: (node: Node) => boolean): [Node[], Node[]];
|
||||
map(callback: (node: Node) => Node): Node[];
|
||||
reduce<T>(callback: (node: Node) => Node, memo: T): T;
|
||||
every(callback: (node: Node) => boolean): boolean;
|
||||
some(callback: (node: Node) => boolean): boolean;
|
||||
filter(callback: (node: Node) => boolean): Node[];
|
||||
sort(callback: (nodeA: Node, nodeB: Node) => number): Node[];
|
||||
insertAfter(oldNode: Child, newNode: Child): this;
|
||||
insertBefore(oldNode: Child, newNode: Child): this;
|
||||
each(callback: (node: Child) => boolean | void): boolean | undefined;
|
||||
walk(
|
||||
callback: (node: Node) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkAttributes(
|
||||
callback: (node: Attribute) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkClasses(
|
||||
callback: (node: ClassName) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkCombinators(
|
||||
callback: (node: Combinator) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkComments(
|
||||
callback: (node: Comment) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkIds(
|
||||
callback: (node: Identifier) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkNesting(
|
||||
callback: (node: Nesting) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkPseudos(
|
||||
callback: (node: Pseudo) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkTags(callback: (node: Tag) => boolean | void): boolean | undefined;
|
||||
split(callback: (node: Child) => boolean): [Child[], Child[]];
|
||||
map<T>(callback: (node: Child) => T): T[];
|
||||
reduce(
|
||||
callback: (
|
||||
previousValue: Child,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => Child
|
||||
): Child;
|
||||
reduce(
|
||||
callback: (
|
||||
previousValue: Child,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => Child,
|
||||
initialValue: Child
|
||||
): Child;
|
||||
reduce<T>(
|
||||
callback: (
|
||||
previousValue: T,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => T,
|
||||
initialValue: T
|
||||
): T;
|
||||
every(callback: (node: Child) => boolean): boolean;
|
||||
some(callback: (node: Child) => boolean): boolean;
|
||||
filter(callback: (node: Child) => boolean): Child[];
|
||||
sort(callback: (nodeA: Child, nodeB: Child) => number): Child[];
|
||||
toString(): string;
|
||||
}
|
||||
function isContainer(node: any): node is Root | Selector | Pseudo;
|
||||
@@ -273,7 +320,7 @@ declare namespace parser {
|
||||
}
|
||||
function isNamespace(node: any): node is Attribute | Tag;
|
||||
|
||||
interface Root extends Container<undefined> {
|
||||
interface Root extends Container<undefined, Selector> {
|
||||
type: "root";
|
||||
/**
|
||||
* Raises an error, if the processor is invoked on
|
||||
@@ -285,14 +332,23 @@ declare namespace parser {
|
||||
function root(opts: ContainerOptions): Root;
|
||||
function isRoot(node: any): node is Root;
|
||||
|
||||
interface Selector extends Container {
|
||||
interface _Selector<S> extends Container<string, Diff<Node, S>> {
|
||||
type: "selector";
|
||||
}
|
||||
type Selector = _Selector<Selector>;
|
||||
function selector(opts: ContainerOptions): Selector;
|
||||
function isSelector(node: any): node is Selector;
|
||||
|
||||
interface CombinatorRaws {
|
||||
value?: string;
|
||||
spaces?: {
|
||||
before?: string;
|
||||
after?: string;
|
||||
};
|
||||
}
|
||||
interface Combinator extends Base {
|
||||
type: "combinator"
|
||||
type: "combinator";
|
||||
raws?: CombinatorRaws;
|
||||
}
|
||||
function combinator(opts: NodeOptions): Combinator;
|
||||
function isCombinator(node: any): node is Combinator;
|
||||
@@ -439,7 +495,7 @@ declare namespace parser {
|
||||
function attribute(opts: AttributeOptions): Attribute;
|
||||
function isAttribute(node: any): node is Attribute;
|
||||
|
||||
interface Pseudo extends Container {
|
||||
interface Pseudo extends Container<string, Selector> {
|
||||
type: "pseudo";
|
||||
}
|
||||
function pseudo(opts: ContainerOptions): Pseudo;
|
||||
|
||||
Reference in New Issue
Block a user