mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
22
web/node_modules/postcss-minify-selectors/LICENSE-MIT
generated
vendored
Normal file
22
web/node_modules/postcss-minify-selectors/LICENSE-MIT
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
42
web/node_modules/postcss-minify-selectors/README.md
generated
vendored
Normal file
42
web/node_modules/postcss-minify-selectors/README.md
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
# [postcss][postcss]-minify-selectors
|
||||
|
||||
> Minify selectors with PostCSS.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://www.npmjs.com/package/postcss-minify-selectors) do:
|
||||
|
||||
```
|
||||
npm install postcss-minify-selectors --save
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
### Input
|
||||
|
||||
```css
|
||||
h1 + p, h2, h3, h2{color:blue}
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
```css
|
||||
h1+p,h2,h3{color:blue}
|
||||
```
|
||||
|
||||
For more examples see the [tests](test.js).
|
||||
|
||||
## Usage
|
||||
|
||||
See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
|
||||
examples for your environment.
|
||||
|
||||
## Contributors
|
||||
|
||||
See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Ben Briggs](http://beneb.info)
|
||||
|
||||
[postcss]: https://github.com/postcss/postcss
|
230
web/node_modules/postcss-minify-selectors/dist/index.js
generated
vendored
Normal file
230
web/node_modules/postcss-minify-selectors/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,230 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _postcss = require("postcss");
|
||||
|
||||
var _alphanumSort = require("alphanum-sort");
|
||||
|
||||
var _alphanumSort2 = _interopRequireDefault(_alphanumSort);
|
||||
|
||||
var _has = require("has");
|
||||
|
||||
var _has2 = _interopRequireDefault(_has);
|
||||
|
||||
var _postcssSelectorParser = require("postcss-selector-parser");
|
||||
|
||||
var _postcssSelectorParser2 = _interopRequireDefault(_postcssSelectorParser);
|
||||
|
||||
var _unquote = require("./lib/unquote");
|
||||
|
||||
var _unquote2 = _interopRequireDefault(_unquote);
|
||||
|
||||
var _canUnquote = require("./lib/canUnquote");
|
||||
|
||||
var _canUnquote2 = _interopRequireDefault(_canUnquote);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const pseudoElements = ["::before", "::after", "::first-letter", "::first-line"];
|
||||
|
||||
function getParsed(selectors, callback) {
|
||||
return (0, _postcssSelectorParser2.default)(callback).processSync(selectors);
|
||||
}
|
||||
|
||||
function attribute(selector) {
|
||||
if (selector.value) {
|
||||
// Join selectors that are split over new lines
|
||||
selector.value = selector.value.replace(/\\\n/g, "").trim();
|
||||
|
||||
if ((0, _canUnquote2.default)(selector.value)) {
|
||||
selector.value = (0, _unquote2.default)(selector.value);
|
||||
}
|
||||
|
||||
selector.operator = selector.operator.trim();
|
||||
}
|
||||
|
||||
if (!selector.raws) {
|
||||
selector.raws = {};
|
||||
}
|
||||
|
||||
if (!selector.raws.spaces) {
|
||||
selector.raws.spaces = {};
|
||||
}
|
||||
|
||||
selector.raws.spaces.attribute = {
|
||||
before: "",
|
||||
after: ""
|
||||
};
|
||||
|
||||
selector.raws.spaces.operator = {
|
||||
before: "",
|
||||
after: ""
|
||||
};
|
||||
|
||||
selector.raws.spaces.value = {
|
||||
before: "",
|
||||
after: selector.insensitive ? " " : ""
|
||||
};
|
||||
|
||||
if (selector.insensitive) {
|
||||
selector.raws.spaces.insensitive = {
|
||||
before: "",
|
||||
after: ""
|
||||
};
|
||||
}
|
||||
|
||||
selector.attribute = selector.attribute.trim();
|
||||
}
|
||||
|
||||
function combinator(selector) {
|
||||
const value = selector.value.trim();
|
||||
|
||||
selector.value = value.length ? value : " ";
|
||||
}
|
||||
|
||||
const pseudoReplacements = {
|
||||
":nth-child": ":first-child",
|
||||
":nth-of-type": ":first-of-type",
|
||||
":nth-last-child": ":last-child",
|
||||
":nth-last-of-type": ":last-of-type"
|
||||
};
|
||||
|
||||
function pseudo(selector) {
|
||||
const value = selector.value.toLowerCase();
|
||||
|
||||
if (selector.nodes.length === 1 && pseudoReplacements[value]) {
|
||||
const first = selector.at(0);
|
||||
const one = first.at(0);
|
||||
|
||||
if (first.length === 1) {
|
||||
if (one.value === "1") {
|
||||
selector.replaceWith(_postcssSelectorParser2.default.pseudo({
|
||||
value: pseudoReplacements[value]
|
||||
}));
|
||||
}
|
||||
|
||||
if (one.value.toLowerCase() === "even") {
|
||||
one.value = "2n";
|
||||
}
|
||||
}
|
||||
|
||||
if (first.length === 3) {
|
||||
const two = first.at(1);
|
||||
const three = first.at(2);
|
||||
|
||||
if (one.value.toLowerCase() === "2n" && two.value === "+" && three.value === "1") {
|
||||
one.value = "odd";
|
||||
|
||||
two.remove();
|
||||
three.remove();
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const uniques = [];
|
||||
|
||||
selector.walk(child => {
|
||||
if (child.type === "selector") {
|
||||
const childStr = String(child);
|
||||
|
||||
if (!~uniques.indexOf(childStr)) {
|
||||
uniques.push(childStr);
|
||||
} else {
|
||||
child.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (~pseudoElements.indexOf(value)) {
|
||||
selector.value = selector.value.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
const tagReplacements = {
|
||||
from: "0%",
|
||||
"100%": "to"
|
||||
};
|
||||
|
||||
function tag(selector) {
|
||||
const value = selector.value.toLowerCase();
|
||||
|
||||
if ((0, _has2.default)(tagReplacements, value)) {
|
||||
selector.value = tagReplacements[value];
|
||||
}
|
||||
}
|
||||
|
||||
function universal(selector) {
|
||||
const next = selector.next();
|
||||
|
||||
if (next && next.type !== "combinator") {
|
||||
selector.remove();
|
||||
}
|
||||
}
|
||||
|
||||
const reducers = {
|
||||
attribute,
|
||||
combinator,
|
||||
pseudo,
|
||||
tag,
|
||||
universal
|
||||
};
|
||||
|
||||
exports.default = (0, _postcss.plugin)("postcss-minify-selectors", () => {
|
||||
return css => {
|
||||
const cache = {};
|
||||
|
||||
css.walkRules(rule => {
|
||||
const selector = rule.raws.selector && rule.raws.selector.value === rule.selector ? rule.raws.selector.raw : rule.selector;
|
||||
|
||||
// If the selector ends with a ':' it is likely a part of a custom mixin,
|
||||
// so just pass through.
|
||||
if (selector[selector.length - 1] === ":") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cache[selector]) {
|
||||
rule.selector = cache[selector];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const optimizedSelector = getParsed(selector, selectors => {
|
||||
selectors.nodes = (0, _alphanumSort2.default)(selectors.nodes, { insensitive: true });
|
||||
|
||||
const uniqueSelectors = [];
|
||||
|
||||
selectors.walk(sel => {
|
||||
const { type } = sel;
|
||||
|
||||
// Trim whitespace around the value
|
||||
sel.spaces.before = sel.spaces.after = "";
|
||||
|
||||
if ((0, _has2.default)(reducers, type)) {
|
||||
reducers[type](sel);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const toString = String(sel);
|
||||
|
||||
if (type === "selector" && sel.parent.type !== "pseudo") {
|
||||
if (!~uniqueSelectors.indexOf(toString)) {
|
||||
uniqueSelectors.push(toString);
|
||||
} else {
|
||||
sel.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
rule.selector = optimizedSelector;
|
||||
cache[selector] = optimizedSelector;
|
||||
});
|
||||
};
|
||||
});
|
||||
module.exports = exports["default"];
|
30
web/node_modules/postcss-minify-selectors/dist/lib/canUnquote.js
generated
vendored
Normal file
30
web/node_modules/postcss-minify-selectors/dist/lib/canUnquote.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = canUnquote;
|
||||
|
||||
var _unquote = require('./unquote');
|
||||
|
||||
var _unquote2 = _interopRequireDefault(_unquote);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Can unquote attribute detection from mothereff.in
|
||||
* Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
* https://github.com/mathiasbynens/mothereff.in
|
||||
*/
|
||||
const escapes = /\\([0-9A-Fa-f]{1,6})[ \t\n\f\r]?/g;
|
||||
const range = /[\u0000-\u002c\u002e\u002f\u003A-\u0040\u005B-\u005E\u0060\u007B-\u009f]/;
|
||||
|
||||
function canUnquote(value) {
|
||||
value = (0, _unquote2.default)(value);
|
||||
if (value === '-' || value === '') {
|
||||
return false;
|
||||
}
|
||||
value = value.replace(escapes, 'a').replace(/\\./g, 'a');
|
||||
return !(range.test(value) || /^(?:-?\d|--)/.test(value));
|
||||
}
|
||||
module.exports = exports['default'];
|
9
web/node_modules/postcss-minify-selectors/dist/lib/unquote.js
generated
vendored
Normal file
9
web/node_modules/postcss-minify-selectors/dist/lib/unquote.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = string => string.replace(/["']/g, '');
|
||||
|
||||
module.exports = exports['default'];
|
836
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/API.md
generated
vendored
Normal file
836
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/API.md
generated
vendored
Normal file
|
@ -0,0 +1,836 @@
|
|||
# API Documentation
|
||||
|
||||
*Please use only this documented API when working with the parser. Methods
|
||||
not documented here are subject to change at any point.*
|
||||
|
||||
## `parser` function
|
||||
|
||||
This is the module's main entry point.
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
```
|
||||
|
||||
### `parser([transform], [options])`
|
||||
|
||||
Creates a new `processor` instance
|
||||
|
||||
```js
|
||||
const processor = parser();
|
||||
|
||||
// or, with optional transform function
|
||||
const transform = selectors => {
|
||||
selectors.walkUniversals(selector => {
|
||||
selector.remove();
|
||||
});
|
||||
};
|
||||
|
||||
const processor = parser(transform)
|
||||
|
||||
// Example
|
||||
const result = processor.processSync('*.class');
|
||||
// => .class
|
||||
```
|
||||
|
||||
[See processor documentation](#processor)
|
||||
|
||||
Arguments:
|
||||
|
||||
* `transform (function)`: Provide a function to work with the parsed AST.
|
||||
* `options (object)`: Provide default options for all calls on the returned `Processor`.
|
||||
|
||||
### `parser.attribute([props])`
|
||||
|
||||
Creates a new attribute selector.
|
||||
|
||||
```js
|
||||
parser.attribute({attribute: 'href'});
|
||||
// => [href]
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.className([props])`
|
||||
|
||||
Creates a new class selector.
|
||||
|
||||
```js
|
||||
parser.className({value: 'button'});
|
||||
// => .button
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.combinator([props])`
|
||||
|
||||
Creates a new selector combinator.
|
||||
|
||||
```js
|
||||
parser.combinator({value: '+'});
|
||||
// => +
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.comment([props])`
|
||||
|
||||
Creates a new comment.
|
||||
|
||||
```js
|
||||
parser.comment({value: '/* Affirmative, Dave. I read you. */'});
|
||||
// => /* Affirmative, Dave. I read you. */
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.id([props])`
|
||||
|
||||
Creates a new id selector.
|
||||
|
||||
```js
|
||||
parser.id({value: 'search'});
|
||||
// => #search
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.nesting([props])`
|
||||
|
||||
Creates a new nesting selector.
|
||||
|
||||
```js
|
||||
parser.nesting();
|
||||
// => &
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.pseudo([props])`
|
||||
|
||||
Creates a new pseudo selector.
|
||||
|
||||
```js
|
||||
parser.pseudo({value: '::before'});
|
||||
// => ::before
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.root([props])`
|
||||
|
||||
Creates a new root node.
|
||||
|
||||
```js
|
||||
parser.root();
|
||||
// => (empty)
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.selector([props])`
|
||||
|
||||
Creates a new selector node.
|
||||
|
||||
```js
|
||||
parser.selector();
|
||||
// => (empty)
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.string([props])`
|
||||
|
||||
Creates a new string node.
|
||||
|
||||
```js
|
||||
parser.string();
|
||||
// => (empty)
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.tag([props])`
|
||||
|
||||
Creates a new tag selector.
|
||||
|
||||
```js
|
||||
parser.tag({value: 'button'});
|
||||
// => button
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.universal([props])`
|
||||
|
||||
Creates a new universal selector.
|
||||
|
||||
```js
|
||||
parser.universal();
|
||||
// => *
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
## Node types
|
||||
|
||||
### `node.type`
|
||||
|
||||
A string representation of the selector type. It can be one of the following;
|
||||
`attribute`, `class`, `combinator`, `comment`, `id`, `nesting`, `pseudo`,
|
||||
`root`, `selector`, `string`, `tag`, or `universal`. Note that for convenience,
|
||||
these constants are exposed on the main `parser` as uppercased keys. So for
|
||||
example you can get `id` by querying `parser.ID`.
|
||||
|
||||
```js
|
||||
parser.attribute({attribute: 'href'}).type;
|
||||
// => 'attribute'
|
||||
```
|
||||
|
||||
### `node.parent`
|
||||
|
||||
Returns the parent node.
|
||||
|
||||
```js
|
||||
root.nodes[0].parent === root;
|
||||
```
|
||||
|
||||
### `node.toString()`, `String(node)`, or `'' + node`
|
||||
|
||||
Returns a string representation of the node.
|
||||
|
||||
```js
|
||||
const id = parser.id({value: 'search'});
|
||||
console.log(String(id));
|
||||
// => #search
|
||||
```
|
||||
|
||||
### `node.next()` & `node.prev()`
|
||||
|
||||
Returns the next/previous child of the parent node.
|
||||
|
||||
```js
|
||||
const next = id.next();
|
||||
if (next && next.type !== 'combinator') {
|
||||
throw new Error('Qualified IDs are not allowed!');
|
||||
}
|
||||
```
|
||||
|
||||
### `node.replaceWith(node)`
|
||||
|
||||
Replace a node with another.
|
||||
|
||||
```js
|
||||
const attr = selectors.first.first;
|
||||
const className = parser.className({value: 'test'});
|
||||
attr.replaceWith(className);
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: The node to substitute the original with.
|
||||
|
||||
### `node.remove()`
|
||||
|
||||
Removes the node from its parent node.
|
||||
|
||||
```js
|
||||
if (node.type === 'id') {
|
||||
node.remove();
|
||||
}
|
||||
```
|
||||
|
||||
### `node.clone()`
|
||||
|
||||
Returns a copy of a node, detached from any parent containers that the
|
||||
original might have had.
|
||||
|
||||
```js
|
||||
const cloned = parser.id({value: 'search'});
|
||||
String(cloned);
|
||||
|
||||
// => #search
|
||||
```
|
||||
|
||||
### `node.spaces`
|
||||
|
||||
Extra whitespaces around the node will be moved into `node.spaces.before` and
|
||||
`node.spaces.after`. So for example, these spaces will be moved as they have
|
||||
no semantic meaning:
|
||||
|
||||
```css
|
||||
h1 , h2 {}
|
||||
```
|
||||
|
||||
However, *combinating* spaces will form a `combinator` node:
|
||||
|
||||
```css
|
||||
h1 h2 {}
|
||||
```
|
||||
|
||||
A `combinator` node may only have the `spaces` property set if the combinator
|
||||
value is a non-whitespace character, such as `+`, `~` or `>`. Otherwise, the
|
||||
combinator value will contain all of the spaces between selectors.
|
||||
|
||||
### `node.source`
|
||||
|
||||
An object describing the node's start/end, line/column source position.
|
||||
|
||||
Within the following CSS, the `.bar` class node ...
|
||||
|
||||
```css
|
||||
.foo,
|
||||
.bar {}
|
||||
```
|
||||
|
||||
... will contain the following `source` object.
|
||||
|
||||
```js
|
||||
source: {
|
||||
start: {
|
||||
line: 2,
|
||||
column: 3
|
||||
},
|
||||
end: {
|
||||
line: 2,
|
||||
column: 6
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `node.sourceIndex`
|
||||
|
||||
The zero-based index of the node within the original source string.
|
||||
|
||||
Within the following CSS, the `.baz` class node will have a `sourceIndex` of `12`.
|
||||
|
||||
```css
|
||||
.foo, .bar, .baz {}
|
||||
```
|
||||
|
||||
## Container types
|
||||
|
||||
The `root`, `selector`, and `pseudo` nodes have some helper methods for working
|
||||
with their children.
|
||||
|
||||
### `container.nodes`
|
||||
|
||||
An array of the container's children.
|
||||
|
||||
```js
|
||||
// Input: h1 h2
|
||||
selectors.at(0).nodes.length // => 3
|
||||
selectors.at(0).nodes[0].value // => 'h1'
|
||||
selectors.at(0).nodes[1].value // => ' '
|
||||
```
|
||||
|
||||
### `container.first` & `container.last`
|
||||
|
||||
The first/last child of the container.
|
||||
|
||||
```js
|
||||
selector.first === selector.nodes[0];
|
||||
selector.last === selector.nodes[selector.nodes.length - 1];
|
||||
```
|
||||
|
||||
### `container.at(index)`
|
||||
|
||||
Returns the node at position `index`.
|
||||
|
||||
```js
|
||||
selector.at(0) === selector.first;
|
||||
selector.at(0) === selector.nodes[0];
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `index`: The index of the node to return.
|
||||
|
||||
### `container.index(node)`
|
||||
|
||||
Return the index of the node within its container.
|
||||
|
||||
```js
|
||||
selector.index(selector.nodes[2]) // => 2
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: A node within the current container.
|
||||
|
||||
### `container.length`
|
||||
|
||||
Proxy to the length of the container's nodes.
|
||||
|
||||
```js
|
||||
container.length === container.nodes.length
|
||||
```
|
||||
|
||||
### `container` Array iterators
|
||||
|
||||
The container class provides proxies to certain Array methods; these are:
|
||||
|
||||
* `container.map === container.nodes.map`
|
||||
* `container.reduce === container.nodes.reduce`
|
||||
* `container.every === container.nodes.every`
|
||||
* `container.some === container.nodes.some`
|
||||
* `container.filter === container.nodes.filter`
|
||||
* `container.sort === container.nodes.sort`
|
||||
|
||||
Note that these methods only work on a container's immediate children; recursive
|
||||
iteration is provided by `container.walk`.
|
||||
|
||||
### `container.each(callback)`
|
||||
|
||||
Iterate the container's immediate children, calling `callback` for each child.
|
||||
You may return `false` within the callback to break the iteration.
|
||||
|
||||
```js
|
||||
let className;
|
||||
selectors.each((selector, index) => {
|
||||
if (selector.type === 'class') {
|
||||
className = selector.value;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Note that unlike `Array#forEach()`, this iterator is safe to use whilst adding
|
||||
or removing nodes from the container.
|
||||
|
||||
Arguments:
|
||||
|
||||
* `callback (function)`: A function to call for each node, which receives `node`
|
||||
and `index` arguments.
|
||||
|
||||
### `container.walk(callback)`
|
||||
|
||||
Like `container#each`, but will also iterate child nodes as long as they are
|
||||
`container` types.
|
||||
|
||||
```js
|
||||
selectors.walk((selector, index) => {
|
||||
// all nodes
|
||||
});
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `callback (function)`: A function to call for each node, which receives `node`
|
||||
and `index` arguments.
|
||||
|
||||
This iterator is safe to use whilst mutating `container.nodes`,
|
||||
like `container#each`.
|
||||
|
||||
### `container.walk` proxies
|
||||
|
||||
The container class provides proxy methods for iterating over types of nodes,
|
||||
so that it is easier to write modules that target specific selectors. Those
|
||||
methods are:
|
||||
|
||||
* `container.walkAttributes`
|
||||
* `container.walkClasses`
|
||||
* `container.walkCombinators`
|
||||
* `container.walkComments`
|
||||
* `container.walkIds`
|
||||
* `container.walkNesting`
|
||||
* `container.walkPseudos`
|
||||
* `container.walkTags`
|
||||
* `container.walkUniversals`
|
||||
|
||||
### `container.split(callback)`
|
||||
|
||||
This method allows you to split a group of nodes by returning `true` from
|
||||
a callback. It returns an array of arrays, where each inner array corresponds
|
||||
to the groups that you created via the callback.
|
||||
|
||||
```js
|
||||
// (input) => h1 h2>>h3
|
||||
const list = selectors.first.split(selector => {
|
||||
return selector.type === 'combinator';
|
||||
});
|
||||
|
||||
// (node values) => [['h1', ' '], ['h2', '>>'], ['h3']]
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `callback (function)`: A function to call for each node, which receives `node`
|
||||
as an argument.
|
||||
|
||||
### `container.prepend(node)` & `container.append(node)`
|
||||
|
||||
Add a node to the start/end of the container. Note that doing so will set
|
||||
the parent property of the node to this container.
|
||||
|
||||
```js
|
||||
const id = parser.id({value: 'search'});
|
||||
selector.append(id);
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: The node to add.
|
||||
|
||||
### `container.insertBefore(old, new)` & `container.insertAfter(old, new)`
|
||||
|
||||
Add a node before or after an existing node in a container:
|
||||
|
||||
```js
|
||||
selectors.walk(selector => {
|
||||
if (selector.type !== 'class') {
|
||||
const className = parser.className({value: 'theme-name'});
|
||||
selector.parent.insertAfter(selector, className);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `old`: The existing node in the container.
|
||||
* `new`: The new node to add before/after the existing node.
|
||||
|
||||
### `container.removeChild(node)`
|
||||
|
||||
Remove the node from the container. Note that you can also use
|
||||
`node.remove()` if you would like to remove just a single node.
|
||||
|
||||
```js
|
||||
selector.length // => 2
|
||||
selector.remove(id)
|
||||
selector.length // => 1;
|
||||
id.parent // undefined
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: The node to remove.
|
||||
|
||||
### `container.removeAll()` or `container.empty()`
|
||||
|
||||
Remove all children from the container.
|
||||
|
||||
```js
|
||||
selector.removeAll();
|
||||
selector.length // => 0
|
||||
```
|
||||
|
||||
## Root nodes
|
||||
|
||||
A root node represents a comma separated list of selectors. Indeed, all
|
||||
a root's `toString()` method does is join its selector children with a ','.
|
||||
Other than this, it has no special functionality and acts like a container.
|
||||
|
||||
### `root.trailingComma`
|
||||
|
||||
This will be set to `true` if the input has a trailing comma, in order to
|
||||
support parsing of legacy CSS hacks.
|
||||
|
||||
## Selector nodes
|
||||
|
||||
A selector node represents a single compound selector. For example, this
|
||||
selector string `h1 h2 h3, [href] > p`, is represented as two selector nodes.
|
||||
It has no special functionality of its own.
|
||||
|
||||
## Pseudo nodes
|
||||
|
||||
A pseudo selector extends a container node; if it has any parameters of its
|
||||
own (such as `h1:not(h2, h3)`), they will be its children. Note that the pseudo
|
||||
`value` will always contain the colons preceding the pseudo identifier. This
|
||||
is so that both `:before` and `::before` are properly represented in the AST.
|
||||
|
||||
## Attribute nodes
|
||||
|
||||
### `attribute.quoted`
|
||||
|
||||
Returns `true` if the attribute's value is wrapped in quotation marks, false if it is not.
|
||||
Remains `undefined` if there is no attribute value.
|
||||
|
||||
```css
|
||||
[href=foo] /* false */
|
||||
[href='foo'] /* true */
|
||||
[href="foo"] /* true */
|
||||
[href] /* undefined */
|
||||
```
|
||||
|
||||
### `attribute.qualifiedAttribute`
|
||||
|
||||
Returns the attribute name qualified with the namespace if one is given.
|
||||
|
||||
### `attribute.offsetOf(part)`
|
||||
|
||||
Returns the offset of the attribute part specified relative to the
|
||||
start of the node of the output string. This is useful in raising
|
||||
error messages about a specific part of the attribute, especially
|
||||
in combination with `attribute.sourceIndex`.
|
||||
|
||||
Returns `-1` if the name is invalid or the value doesn't exist in this
|
||||
attribute.
|
||||
|
||||
The legal values for `part` are:
|
||||
|
||||
* `"ns"` - alias for "namespace"
|
||||
* `"namespace"` - the namespace if it exists.
|
||||
* `"attribute"` - the attribute name
|
||||
* `"attributeNS"` - the start of the attribute or its namespace
|
||||
* `"operator"` - the match operator of the attribute
|
||||
* `"value"` - The value (string or identifier)
|
||||
* `"insensitive"` - the case insensitivity flag
|
||||
|
||||
### `attribute.raws.unquoted`
|
||||
|
||||
Returns the unquoted content of the attribute's value.
|
||||
Remains `undefined` if there is no attribute value.
|
||||
|
||||
```css
|
||||
[href=foo] /* foo */
|
||||
[href='foo'] /* foo */
|
||||
[href="foo"] /* foo */
|
||||
[href] /* undefined */
|
||||
```
|
||||
|
||||
### `attribute.spaces`
|
||||
|
||||
Like `node.spaces` with the `before` and `after` values containing the spaces
|
||||
around the element, the parts of the attribute can also have spaces before
|
||||
and after them. The for each of `attribute`, `operator`, `value` and
|
||||
`insensitive` there is corresponding property of the same nam in
|
||||
`node.spaces` that has an optional `before` or `after` string containing only
|
||||
whitespace.
|
||||
|
||||
Note that corresponding values in `attributes.raws.spaces` contain values
|
||||
including any comments. If set, these values will override the
|
||||
`attribute.spaces` value. Take care to remove them if changing
|
||||
`attribute.spaces`.
|
||||
|
||||
### `attribute.raws`
|
||||
|
||||
The raws object stores comments and other information necessary to re-render
|
||||
the node exactly as it was in the source.
|
||||
|
||||
If a comment is embedded within the identifiers for the `namespace`, `attribute`
|
||||
or `value` then a property is placed in the raws for that value containing the full source of the propery including comments.
|
||||
|
||||
If a comment is embedded within the space between parts of the attribute
|
||||
then the raw for that space is set accordingly.
|
||||
|
||||
Setting an attribute's property `raws` value to be deleted.
|
||||
|
||||
For now, changing the spaces required also updating or removing any of the
|
||||
raws values that override them.
|
||||
|
||||
Example: `[ /*before*/ href /* after-attr */ = /* after-operator */ te/*inside-value*/st/* wow */ /*omg*/i/*bbq*/ /*whodoesthis*/]` would parse as:
|
||||
|
||||
```js
|
||||
{
|
||||
attribute: "href",
|
||||
operatator: "=",
|
||||
value: "test",
|
||||
spaces: {
|
||||
before: '',
|
||||
after: '',
|
||||
attribute: { before: ' ', after: ' ' },
|
||||
operator: { after: ' ' },
|
||||
value: { after: ' ' },
|
||||
insensitive: { after: ' ' }
|
||||
},
|
||||
raws: {
|
||||
spaces: {
|
||||
attribute: { before: ' /*before*/ ', after: ' /* after-attr */ ' },
|
||||
operator: { after: ' /* after-operator */ ' },
|
||||
value: { after: '/* wow */ /*omg*/' },
|
||||
insensitive: { after: '/*bbq*/ /*whodoesthis*/' }
|
||||
},
|
||||
unquoted: 'test',
|
||||
value: 'te/*inside-value*/st'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## `Processor`
|
||||
|
||||
### `ProcessorOptions`
|
||||
|
||||
* `lossless` - When `true`, whitespace is preserved. Defaults to `true`.
|
||||
* `updateSelector` - When `true`, if any processor methods are passed a postcss
|
||||
`Rule` node instead of a string, then that Rule's selector is updated
|
||||
with the results of the processing. Defaults to `true`.
|
||||
|
||||
### `process|processSync(selectors, [options])`
|
||||
|
||||
Processes the `selectors`, returning a string from the result of processing.
|
||||
|
||||
Note: when the `updateSelector` option is set, the rule's selector
|
||||
will be updated with the resulting string.
|
||||
|
||||
**Example:**
|
||||
|
||||
```js
|
||||
const parser = require("postcss-selector-parser");
|
||||
const processor = parser();
|
||||
|
||||
let result = processor.processSync(' .class');
|
||||
console.log(result);
|
||||
// => .class
|
||||
|
||||
// Asynchronous operation
|
||||
let promise = processor.process(' .class').then(result => {
|
||||
console.log(result)
|
||||
// => .class
|
||||
});
|
||||
|
||||
// To have the parser normalize whitespace values, utilize the options
|
||||
result = processor.processSync(' .class ', {lossless: false});
|
||||
console.log(result);
|
||||
// => .class
|
||||
|
||||
// For better syntax errors, pass a PostCSS Rule node.
|
||||
const postcss = require('postcss');
|
||||
rule = postcss.rule({selector: ' #foo > a, .class '});
|
||||
processor.process(rule, {lossless: false, updateSelector: true}).then(result => {
|
||||
console.log(result);
|
||||
// => #foo>a,.class
|
||||
console.log("rule:", rule.selector);
|
||||
// => rule: #foo>a,.class
|
||||
})
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `selectors (string|postcss.Rule)`: Either a selector string or a PostCSS Rule
|
||||
node.
|
||||
* `[options] (object)`: Process options
|
||||
|
||||
|
||||
### `ast|astSync(selectors, [options])`
|
||||
|
||||
Like `process()` and `processSync()` but after
|
||||
processing the `selectors` these methods return the `Root` node of the result
|
||||
instead of a string.
|
||||
|
||||
Note: when the `updateSelector` option is set, the rule's selector
|
||||
will be updated with the resulting string.
|
||||
|
||||
### `transform|transformSync(selectors, [options])`
|
||||
|
||||
Like `process()` and `processSync()` but after
|
||||
processing the `selectors` these methods return the value returned by the
|
||||
processor callback.
|
||||
|
||||
Note: when the `updateSelector` option is set, the rule's selector
|
||||
will be updated with the resulting string.
|
||||
|
||||
### Error Handling Within Selector Processors
|
||||
|
||||
The root node passed to the selector processor callback
|
||||
has a method `error(message, options)` that returns an
|
||||
error object. This method should always be used to raise
|
||||
errors relating to the syntax of selectors. The options
|
||||
to this method are passed to postcss's error constructor
|
||||
([documentation](http://api.postcss.org/Container.html#error)).
|
||||
|
||||
#### Async Error Example
|
||||
|
||||
```js
|
||||
let processor = (root) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
root.walkClasses((classNode) => {
|
||||
if (/^(.*)[-_]/.test(classNode.value)) {
|
||||
let msg = "classes may not have underscores or dashes in them";
|
||||
reject(root.error(msg, {
|
||||
index: classNode.sourceIndex + RegExp.$1.length + 1,
|
||||
word: classNode.value
|
||||
}));
|
||||
}
|
||||
});
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
||||
const postcss = require("postcss");
|
||||
const parser = require("postcss-selector-parser");
|
||||
const selectorProcessor = parser(processor);
|
||||
const plugin = postcss.plugin('classValidator', (options) => {
|
||||
return (root) => {
|
||||
let promises = [];
|
||||
root.walkRules(rule => {
|
||||
promises.push(selectorProcessor.process(rule));
|
||||
});
|
||||
return Promise.all(promises);
|
||||
};
|
||||
});
|
||||
postcss(plugin()).process(`
|
||||
.foo-bar {
|
||||
color: red;
|
||||
}
|
||||
`.trim(), {from: 'test.css'}).catch((e) => console.error(e.toString()));
|
||||
|
||||
// CssSyntaxError: classValidator: ./test.css:1:5: classes may not have underscores or dashes in them
|
||||
//
|
||||
// > 1 | .foo-bar {
|
||||
// | ^
|
||||
// 2 | color: red;
|
||||
// 3 | }
|
||||
```
|
||||
|
||||
#### Synchronous Error Example
|
||||
|
||||
```js
|
||||
let processor = (root) => {
|
||||
root.walkClasses((classNode) => {
|
||||
if (/.*[-_]/.test(classNode.value)) {
|
||||
let msg = "classes may not have underscores or dashes in them";
|
||||
throw root.error(msg, {
|
||||
index: classNode.sourceIndex,
|
||||
word: classNode.value
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const postcss = require("postcss");
|
||||
const parser = require("postcss-selector-parser");
|
||||
const selectorProcessor = parser(processor);
|
||||
const plugin = postcss.plugin('classValidator', (options) => {
|
||||
return (root) => {
|
||||
root.walkRules(rule => {
|
||||
selectorProcessor.processSync(rule);
|
||||
});
|
||||
};
|
||||
});
|
||||
postcss(plugin()).process(`
|
||||
.foo-bar {
|
||||
color: red;
|
||||
}
|
||||
`.trim(), {from: 'test.css'}).catch((e) => console.error(e.toString()));
|
||||
|
||||
// CssSyntaxError: classValidator: ./test.css:1:5: classes may not have underscores or dashes in them
|
||||
//
|
||||
// > 1 | .foo-bar {
|
||||
// | ^
|
||||
// 2 | color: red;
|
||||
// 3 | }
|
||||
```
|
217
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/CHANGELOG.md
generated
vendored
Normal file
217
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,217 @@
|
|||
# 3.1.2
|
||||
|
||||
* SECURITY FIX: update `dot-prop` to `5.2.0`
|
||||
|
||||
## Breaking changes
|
||||
|
||||
* Unfortunately, due to fixing the vulnerability, the minimum supported version of the Node.js is `8`.
|
||||
|
||||
# 3.1.1
|
||||
|
||||
* Fix: typescript definitions weren't in the published package.
|
||||
|
||||
# 3.1.0
|
||||
|
||||
* Fixed numerous bugs in attribute nodes relating to the handling of comments
|
||||
and whitespace. There's significant changes to `attrNode.spaces` and `attrNode.raws` since the `3.0.0` release.
|
||||
* Added `Attribute#offsetOf(part)` to get the offset location of
|
||||
attribute parts like `"operator"` and `"value"`. This is most
|
||||
often added to `Attribute#sourceIndex` for error reporting.
|
||||
|
||||
# 3.0.0
|
||||
|
||||
## Breaking changes
|
||||
|
||||
* Some tweaks to the tokenizer/attribute selector parsing mean that whitespace
|
||||
locations might be slightly different to the 2.x code.
|
||||
* Better attribute selector parsing with more validation; postcss-selector-parser
|
||||
no longer uses regular expressions to parse attribute selectors.
|
||||
* Added an async API (thanks to @jacobp100); the default `process` API is now
|
||||
async, and the sync API is now accessed through `processSync` instead.
|
||||
* `process()` and `processSync()` now return a string instead of the Processor
|
||||
instance.
|
||||
* Tweaks handling of Less interpolation (thanks to @jwilsson).
|
||||
* Removes support for Node 0.12.
|
||||
|
||||
## Other changes
|
||||
|
||||
* `ast()` and `astSync()` methods have been added to the `Processor`. These
|
||||
return the `Root` node of the selectors after processing them.
|
||||
* `transform()` and `transformSync()` methods have been added to the
|
||||
`Processor`. These return the value returned by the processor callback
|
||||
after processing the selectors.
|
||||
* Set the parent when inserting a node (thanks to @chriseppstein).
|
||||
* Correctly adjust indices when using insertBefore/insertAfter (thanks to @tivac).
|
||||
* Fixes handling of namespaces with qualified tag selectors.
|
||||
* `process`, `ast` and `transform` (and their sync variants) now accept a
|
||||
`postcss` rule node. When provided, better errors are generated and selector
|
||||
processing is automatically set back to the rule selector (unless the `updateSelector` option is set to `false`.)
|
||||
* Now more memory efficient when tokenizing selectors.
|
||||
|
||||
### Upgrade hints
|
||||
|
||||
The pattern of:
|
||||
|
||||
`rule.selector = processor.process(rule.selector).result.toString();`
|
||||
|
||||
is now:
|
||||
|
||||
`processor.processSync(rule)`
|
||||
|
||||
# 2.2.3
|
||||
|
||||
* Resolves an issue where the parser would not reduce multiple spaces between an
|
||||
ampersand and another simple selector in lossy mode (thanks to @adam-26).
|
||||
|
||||
# 2.2.2
|
||||
|
||||
* No longer hangs on an unescaped semicolon; instead the parser will throw
|
||||
an exception for these cases.
|
||||
|
||||
# 2.2.1
|
||||
|
||||
* Allows a consumer to specify whitespace tokens when creating a new Node
|
||||
(thanks to @Semigradsky).
|
||||
|
||||
# 2.2.0
|
||||
|
||||
* Added a new option to normalize whitespace when parsing the selector string
|
||||
(thanks to @adam-26).
|
||||
|
||||
# 2.1.1
|
||||
|
||||
* Better unquoted value handling within attribute selectors
|
||||
(thanks to @evilebottnawi).
|
||||
|
||||
# 2.1.0
|
||||
|
||||
* Added: Use string constants for all node types & expose them on the main
|
||||
parser instance (thanks to @Aweary).
|
||||
|
||||
# 2.0.0
|
||||
|
||||
This release contains the following breaking changes:
|
||||
|
||||
* Renamed all `eachInside` iterators to `walk`. For example, `eachTag` is now
|
||||
`walkTags`, and `eachInside` is now `walk`.
|
||||
* Renamed `Node#removeSelf()` to `Node#remove()`.
|
||||
* Renamed `Container#remove()` to `Container#removeChild()`.
|
||||
* Renamed `Node#raw` to `Node#raws` (thanks to @davidtheclark).
|
||||
* Now parses `&` as the *nesting* selector, rather than a *tag* selector.
|
||||
* Fixes misinterpretation of Sass interpolation (e.g. `#{foo}`) as an
|
||||
id selector (thanks to @davidtheclark).
|
||||
|
||||
and;
|
||||
|
||||
* Fixes parsing of attribute selectors with equals signs in them
|
||||
(e.g. `[data-attr="foo=bar"]`) (thanks to @montmanu).
|
||||
* Adds `quoted` and `raw.unquoted` properties to attribute nodes
|
||||
(thanks to @davidtheclark).
|
||||
|
||||
# 1.3.3
|
||||
|
||||
* Fixes an infinite loop on `)` and `]` tokens when they had no opening pairs.
|
||||
Now postcss-selector-parser will throw when it encounters these lone tokens.
|
||||
|
||||
# 1.3.2
|
||||
|
||||
* Now uses plain integers rather than `str.charCodeAt(0)` for compiled builds.
|
||||
|
||||
# 1.3.1
|
||||
|
||||
* Update flatten to v1.x (thanks to @shinnn).
|
||||
|
||||
# 1.3.0
|
||||
|
||||
* Adds a new node type, `String`, to fix a crash on selectors such as
|
||||
`foo:bar("test")`.
|
||||
|
||||
# 1.2.1
|
||||
|
||||
* Fixes a crash when the parser encountered a trailing combinator.
|
||||
|
||||
# 1.2.0
|
||||
|
||||
* A more descriptive error is thrown when the parser expects to find a
|
||||
pseudo-class/pseudo-element (thanks to @ashelley).
|
||||
* Adds support for line/column locations for selector nodes, as well as a
|
||||
`Node#sourceIndex` method (thanks to @davidtheclark).
|
||||
|
||||
# 1.1.4
|
||||
|
||||
* Fixes a crash when a selector started with a `>` combinator. The module will
|
||||
now no longer throw if a selector has a leading/trailing combinator node.
|
||||
|
||||
# 1.1.3
|
||||
|
||||
* Fixes a crash on `@` tokens.
|
||||
|
||||
# 1.1.2
|
||||
|
||||
* Fixes an infinite loop caused by using parentheses in a non-pseudo element
|
||||
context.
|
||||
|
||||
# 1.1.1
|
||||
|
||||
* Fixes a crash when a backslash ended a selector string.
|
||||
|
||||
# 1.1.0
|
||||
|
||||
* Adds support for replacing multiple nodes at once with `replaceWith`
|
||||
(thanks to @jonathantneal).
|
||||
* Parser no longer throws on sequential IDs and trailing commas, to support
|
||||
parsing of selector hacks.
|
||||
|
||||
# 1.0.1
|
||||
|
||||
* Fixes using `insertAfter` and `insertBefore` during iteration.
|
||||
|
||||
# 1.0.0
|
||||
|
||||
* Adds `clone` and `replaceWith` methods to nodes.
|
||||
* Adds `insertBefore` and `insertAfter` to containers.
|
||||
* Stabilises API.
|
||||
|
||||
# 0.0.5
|
||||
|
||||
* Fixes crash on extra whitespace inside a pseudo selector's parentheses.
|
||||
* Adds sort function to the container class.
|
||||
* Enables the parser to pass its input through without transforming.
|
||||
* Iteration-safe `each` and `eachInside`.
|
||||
|
||||
# 0.0.4
|
||||
|
||||
* Tidy up redundant duplication.
|
||||
* Fixes a bug where the parser would loop infinitely on universal selectors
|
||||
inside pseudo selectors.
|
||||
* Adds `length` getter and `eachInside`, `map`, `reduce` to the container class.
|
||||
* When a selector has been removed from the tree, the root node will no longer
|
||||
cast it to a string.
|
||||
* Adds node type iterators to the container class (e.g. `eachComment`).
|
||||
* Adds filter function to the container class.
|
||||
* Adds split function to the container class.
|
||||
* Create new node types by doing `parser.id(opts)` etc.
|
||||
* Adds support for pseudo classes anywhere in the selector.
|
||||
|
||||
# 0.0.3
|
||||
|
||||
* Adds `next` and `prev` to the node class.
|
||||
* Adds `first` and `last` getters to the container class.
|
||||
* Adds `every` and `some` iterators to the container class.
|
||||
* Add `empty` alias for `removeAll`.
|
||||
* Combinators are now types of node.
|
||||
* Fixes the at method so that it is not an alias for `index`.
|
||||
* Tidy up creation of new nodes in the parser.
|
||||
* Refactors how namespaces are handled for consistency & less redundant code.
|
||||
* Refactors AST to use `nodes` exclusively, and eliminates excessive nesting.
|
||||
* Fixes nested pseudo parsing.
|
||||
* Fixes whitespace parsing.
|
||||
|
||||
# 0.0.2
|
||||
|
||||
* Adds support for namespace selectors.
|
||||
* Adds support for selectors joined by escaped spaces - such as `.\31\ 0`.
|
||||
|
||||
# 0.0.1
|
||||
|
||||
* Initial release.
|
22
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/LICENSE-MIT
generated
vendored
Normal file
22
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/LICENSE-MIT
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
49
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/README.md
generated
vendored
Normal file
49
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/README.md
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
# postcss-selector-parser [](https://travis-ci.org/postcss/postcss-selector-parser)
|
||||
|
||||
> Selector parser with built in methods for working with selector strings.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.com/package/postcss-selector-parser) do:
|
||||
|
||||
```
|
||||
npm install postcss-selector-parser
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
const transform = selectors => {
|
||||
selectors.walk(selector => {
|
||||
// do something with the selector
|
||||
console.log(String(selector))
|
||||
});
|
||||
};
|
||||
|
||||
const transformed = parser(transform).processSync('h1, h2, h3');
|
||||
```
|
||||
|
||||
To normalize selector whitespace:
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
const normalized = parser().processSync('h1, h2, h3', {lossless: false});
|
||||
// -> h1,h2,h3
|
||||
```
|
||||
|
||||
Async support is provided through `parser.process` and will resolve a Promise
|
||||
with the resulting selector string.
|
||||
|
||||
## API
|
||||
|
||||
Please see [API.md](API.md).
|
||||
|
||||
## Credits
|
||||
|
||||
* Huge thanks to Andrey Sitnik (@ai) for work on PostCSS which helped
|
||||
accelerate this module's development.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
26
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/index.js
generated
vendored
Normal file
26
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _processor = require('./processor');
|
||||
|
||||
var _processor2 = _interopRequireDefault(_processor);
|
||||
|
||||
var _selectors = require('./selectors');
|
||||
|
||||
var selectors = _interopRequireWildcard(_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)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var parser = function parser(processor) {
|
||||
return new _processor2.default(processor);
|
||||
};
|
||||
|
||||
Object.assign(parser, selectors);
|
||||
|
||||
delete parser.__esModule;
|
||||
|
||||
exports.default = parser;
|
||||
module.exports = exports['default'];
|
767
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/parser.js
generated
vendored
Normal file
767
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/parser.js
generated
vendored
Normal file
|
@ -0,0 +1,767 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _dotProp = require('dot-prop');
|
||||
|
||||
var _dotProp2 = _interopRequireDefault(_dotProp);
|
||||
|
||||
var _indexesOf = require('indexes-of');
|
||||
|
||||
var _indexesOf2 = _interopRequireDefault(_indexesOf);
|
||||
|
||||
var _uniq = require('uniq');
|
||||
|
||||
var _uniq2 = _interopRequireDefault(_uniq);
|
||||
|
||||
var _root = require('./selectors/root');
|
||||
|
||||
var _root2 = _interopRequireDefault(_root);
|
||||
|
||||
var _selector = require('./selectors/selector');
|
||||
|
||||
var _selector2 = _interopRequireDefault(_selector);
|
||||
|
||||
var _className = require('./selectors/className');
|
||||
|
||||
var _className2 = _interopRequireDefault(_className);
|
||||
|
||||
var _comment = require('./selectors/comment');
|
||||
|
||||
var _comment2 = _interopRequireDefault(_comment);
|
||||
|
||||
var _id = require('./selectors/id');
|
||||
|
||||
var _id2 = _interopRequireDefault(_id);
|
||||
|
||||
var _tag = require('./selectors/tag');
|
||||
|
||||
var _tag2 = _interopRequireDefault(_tag);
|
||||
|
||||
var _string = require('./selectors/string');
|
||||
|
||||
var _string2 = _interopRequireDefault(_string);
|
||||
|
||||
var _pseudo = require('./selectors/pseudo');
|
||||
|
||||
var _pseudo2 = _interopRequireDefault(_pseudo);
|
||||
|
||||
var _attribute = require('./selectors/attribute');
|
||||
|
||||
var _attribute2 = _interopRequireDefault(_attribute);
|
||||
|
||||
var _universal = require('./selectors/universal');
|
||||
|
||||
var _universal2 = _interopRequireDefault(_universal);
|
||||
|
||||
var _combinator = require('./selectors/combinator');
|
||||
|
||||
var _combinator2 = _interopRequireDefault(_combinator);
|
||||
|
||||
var _nesting = require('./selectors/nesting');
|
||||
|
||||
var _nesting2 = _interopRequireDefault(_nesting);
|
||||
|
||||
var _sortAscending = require('./sortAscending');
|
||||
|
||||
var _sortAscending2 = _interopRequireDefault(_sortAscending);
|
||||
|
||||
var _tokenize = require('./tokenize');
|
||||
|
||||
var _tokenize2 = _interopRequireDefault(_tokenize);
|
||||
|
||||
var _tokenTypes = require('./tokenTypes');
|
||||
|
||||
var tokens = _interopRequireWildcard(_tokenTypes);
|
||||
|
||||
var _types = require('./selectors/types');
|
||||
|
||||
var types = _interopRequireWildcard(_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)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function getSource(startLine, startColumn, endLine, endColumn) {
|
||||
return {
|
||||
start: {
|
||||
line: startLine,
|
||||
column: startColumn
|
||||
},
|
||||
end: {
|
||||
line: endLine,
|
||||
column: endColumn
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var Parser = function () {
|
||||
function Parser(rule) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
_classCallCheck(this, Parser);
|
||||
|
||||
this.rule = rule;
|
||||
this.options = Object.assign({ lossy: false, safe: false }, options);
|
||||
this.position = 0;
|
||||
this.root = new _root2.default();
|
||||
this.root.errorGenerator = this._errorGenerator();
|
||||
|
||||
var selector = new _selector2.default();
|
||||
this.root.append(selector);
|
||||
this.current = selector;
|
||||
|
||||
this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
|
||||
|
||||
if (this.options.lossy) {
|
||||
this.css = this.css.trim();
|
||||
}
|
||||
this.tokens = (0, _tokenize2.default)({
|
||||
css: this.css,
|
||||
error: this._errorGenerator(),
|
||||
safe: this.options.safe
|
||||
});
|
||||
|
||||
this.loop();
|
||||
}
|
||||
|
||||
Parser.prototype._errorGenerator = function _errorGenerator() {
|
||||
var _this = this;
|
||||
|
||||
return function (message, errorOptions) {
|
||||
if (typeof _this.rule === 'string') {
|
||||
return new Error(message);
|
||||
}
|
||||
return _this.rule.error(message, errorOptions);
|
||||
};
|
||||
};
|
||||
|
||||
Parser.prototype.attribute = function attribute() {
|
||||
var attr = [];
|
||||
var startingToken = this.currToken;
|
||||
this.position++;
|
||||
while (this.position < this.tokens.length && this.currToken[0] !== tokens.closeSquare) {
|
||||
attr.push(this.currToken);
|
||||
this.position++;
|
||||
}
|
||||
if (this.currToken[0] !== tokens.closeSquare) {
|
||||
return this.expected('closing square bracket', this.currToken[5]);
|
||||
}
|
||||
|
||||
var len = attr.length;
|
||||
var node = {
|
||||
source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
|
||||
sourceIndex: startingToken[5]
|
||||
};
|
||||
|
||||
if (len === 1 && !~[tokens.word].indexOf(attr[0][0])) {
|
||||
return this.expected('attribute', attr[0][5]);
|
||||
}
|
||||
|
||||
var pos = 0;
|
||||
var spaceBefore = '';
|
||||
var commentBefore = '';
|
||||
var lastAdded = null;
|
||||
var spaceAfterMeaningfulToken = false;
|
||||
|
||||
while (pos < len) {
|
||||
var token = attr[pos];
|
||||
var content = this.content(token);
|
||||
var next = attr[pos + 1];
|
||||
|
||||
switch (token[0]) {
|
||||
case tokens.space:
|
||||
if (len === 1 || pos === 0 && this.content(next) === '|') {
|
||||
return this.expected('attribute', token[5], content);
|
||||
}
|
||||
spaceAfterMeaningfulToken = true;
|
||||
if (this.options.lossy) {
|
||||
break;
|
||||
}
|
||||
if (lastAdded) {
|
||||
var spaceProp = 'spaces.' + lastAdded + '.after';
|
||||
_dotProp2.default.set(node, spaceProp, _dotProp2.default.get(node, spaceProp, '') + content);
|
||||
var commentProp = 'raws.spaces.' + lastAdded + '.after';
|
||||
var existingComment = _dotProp2.default.get(node, commentProp);
|
||||
if (existingComment) {
|
||||
_dotProp2.default.set(node, commentProp, existingComment + content);
|
||||
}
|
||||
} else {
|
||||
spaceBefore = spaceBefore + content;
|
||||
commentBefore = commentBefore + content;
|
||||
}
|
||||
break;
|
||||
case tokens.asterisk:
|
||||
if (next[0] === tokens.equals) {
|
||||
node.operator = content;
|
||||
lastAdded = 'operator';
|
||||
} else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) {
|
||||
if (spaceBefore) {
|
||||
_dotProp2.default.set(node, 'spaces.attribute.before', spaceBefore);
|
||||
spaceBefore = '';
|
||||
}
|
||||
if (commentBefore) {
|
||||
_dotProp2.default.set(node, 'raws.spaces.attribute.before', spaceBefore);
|
||||
commentBefore = '';
|
||||
}
|
||||
node.namespace = (node.namespace || "") + content;
|
||||
var rawValue = _dotProp2.default.get(node, "raws.namespace");
|
||||
if (rawValue) {
|
||||
node.raws.namespace += content;
|
||||
}
|
||||
lastAdded = 'namespace';
|
||||
}
|
||||
spaceAfterMeaningfulToken = false;
|
||||
break;
|
||||
case tokens.dollar:
|
||||
case tokens.caret:
|
||||
if (next[0] === tokens.equals) {
|
||||
node.operator = content;
|
||||
lastAdded = 'operator';
|
||||
}
|
||||
spaceAfterMeaningfulToken = false;
|
||||
break;
|
||||
case tokens.combinator:
|
||||
if (content === '~' && next[0] === tokens.equals) {
|
||||
node.operator = content;
|
||||
lastAdded = 'operator';
|
||||
}
|
||||
if (content !== '|') {
|
||||
spaceAfterMeaningfulToken = false;
|
||||
break;
|
||||
}
|
||||
if (next[0] === tokens.equals) {
|
||||
node.operator = content;
|
||||
lastAdded = 'operator';
|
||||
} else if (!node.namespace && !node.attribute) {
|
||||
node.namespace = true;
|
||||
}
|
||||
spaceAfterMeaningfulToken = false;
|
||||
break;
|
||||
case tokens.word:
|
||||
if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][0] !== tokens.equals && // this look-ahead probably fails with comment nodes involved.
|
||||
!node.operator && !node.namespace) {
|
||||
node.namespace = content;
|
||||
lastAdded = 'namespace';
|
||||
} else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) {
|
||||
if (spaceBefore) {
|
||||
_dotProp2.default.set(node, 'spaces.attribute.before', spaceBefore);
|
||||
spaceBefore = '';
|
||||
}
|
||||
if (commentBefore) {
|
||||
_dotProp2.default.set(node, 'raws.spaces.attribute.before', commentBefore);
|
||||
commentBefore = '';
|
||||
}
|
||||
node.attribute = (node.attribute || "") + content;
|
||||
var _rawValue = _dotProp2.default.get(node, "raws.attribute");
|
||||
if (_rawValue) {
|
||||
node.raws.attribute += content;
|
||||
}
|
||||
lastAdded = 'attribute';
|
||||
} else if (!node.value || lastAdded === "value" && !spaceAfterMeaningfulToken) {
|
||||
node.value = (node.value || "") + content;
|
||||
var _rawValue2 = _dotProp2.default.get(node, "raws.value");
|
||||
if (_rawValue2) {
|
||||
node.raws.value += content;
|
||||
}
|
||||
lastAdded = 'value';
|
||||
_dotProp2.default.set(node, 'raws.unquoted', _dotProp2.default.get(node, 'raws.unquoted', '') + content);
|
||||
} else if (content === 'i') {
|
||||
if (node.value && (node.quoted || spaceAfterMeaningfulToken)) {
|
||||
node.insensitive = true;
|
||||
lastAdded = 'insensitive';
|
||||
if (spaceBefore) {
|
||||
_dotProp2.default.set(node, 'spaces.insensitive.before', spaceBefore);
|
||||
spaceBefore = '';
|
||||
}
|
||||
if (commentBefore) {
|
||||
_dotProp2.default.set(node, 'raws.spaces.insensitive.before', commentBefore);
|
||||
commentBefore = '';
|
||||
}
|
||||
} else if (node.value) {
|
||||
lastAdded = 'value';
|
||||
node.value += 'i';
|
||||
if (node.raws.value) {
|
||||
node.raws.value += 'i';
|
||||
}
|
||||
}
|
||||
}
|
||||
spaceAfterMeaningfulToken = false;
|
||||
break;
|
||||
case tokens.str:
|
||||
if (!node.attribute || !node.operator) {
|
||||
return this.error('Expected an attribute followed by an operator preceding the string.', {
|
||||
index: token[5]
|
||||
});
|
||||
}
|
||||
node.value = content;
|
||||
node.quoted = true;
|
||||
lastAdded = 'value';
|
||||
_dotProp2.default.set(node, 'raws.unquoted', content.slice(1, -1));
|
||||
spaceAfterMeaningfulToken = false;
|
||||
break;
|
||||
case tokens.equals:
|
||||
if (!node.attribute) {
|
||||
return this.expected('attribute', token[5], content);
|
||||
}
|
||||
if (node.value) {
|
||||
return this.error('Unexpected "=" found; an operator was already defined.', { index: token[5] });
|
||||
}
|
||||
node.operator = node.operator ? node.operator + content : content;
|
||||
lastAdded = 'operator';
|
||||
spaceAfterMeaningfulToken = false;
|
||||
break;
|
||||
case tokens.comment:
|
||||
if (lastAdded) {
|
||||
if (spaceAfterMeaningfulToken || next && next[0] === tokens.space) {
|
||||
var lastComment = _dotProp2.default.get(node, 'raws.spaces.' + lastAdded + '.after', _dotProp2.default.get(node, 'spaces.' + lastAdded + '.after', ''));
|
||||
_dotProp2.default.set(node, 'raws.spaces.' + lastAdded + '.after', lastComment + content);
|
||||
} else {
|
||||
var lastValue = _dotProp2.default.get(node, 'raws.' + lastAdded, _dotProp2.default.get(node, lastAdded, ''));
|
||||
_dotProp2.default.set(node, 'raws.' + lastAdded, lastValue + content);
|
||||
}
|
||||
} else {
|
||||
commentBefore = commentBefore + content;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return this.error('Unexpected "' + content + '" found.', { index: token[5] });
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
|
||||
this.newNode(new _attribute2.default(node));
|
||||
this.position++;
|
||||
};
|
||||
|
||||
Parser.prototype.combinator = function combinator() {
|
||||
var current = this.currToken;
|
||||
if (this.content() === '|') {
|
||||
return this.namespace();
|
||||
}
|
||||
var node = new _combinator2.default({
|
||||
value: '',
|
||||
source: getSource(current[1], current[2], current[3], current[4]),
|
||||
sourceIndex: current[5]
|
||||
});
|
||||
while (this.position < this.tokens.length && this.currToken && (this.currToken[0] === tokens.space || this.currToken[0] === tokens.combinator)) {
|
||||
var content = this.content();
|
||||
if (this.nextToken && this.nextToken[0] === tokens.combinator) {
|
||||
node.spaces.before = this.parseSpace(content);
|
||||
node.source = getSource(this.nextToken[1], this.nextToken[2], this.nextToken[3], this.nextToken[4]);
|
||||
node.sourceIndex = this.nextToken[5];
|
||||
} else if (this.prevToken && this.prevToken[0] === tokens.combinator) {
|
||||
node.spaces.after = this.parseSpace(content);
|
||||
} else if (this.currToken[0] === tokens.combinator) {
|
||||
node.value = content;
|
||||
} else if (this.currToken[0] === tokens.space) {
|
||||
node.value = this.parseSpace(content, ' ');
|
||||
}
|
||||
this.position++;
|
||||
}
|
||||
return this.newNode(node);
|
||||
};
|
||||
|
||||
Parser.prototype.comma = function comma() {
|
||||
if (this.position === this.tokens.length - 1) {
|
||||
this.root.trailingComma = true;
|
||||
this.position++;
|
||||
return;
|
||||
}
|
||||
var selector = new _selector2.default();
|
||||
this.current.parent.append(selector);
|
||||
this.current = selector;
|
||||
this.position++;
|
||||
};
|
||||
|
||||
Parser.prototype.comment = function comment() {
|
||||
var current = this.currToken;
|
||||
this.newNode(new _comment2.default({
|
||||
value: this.content(),
|
||||
source: getSource(current[1], current[2], current[3], current[4]),
|
||||
sourceIndex: current[5]
|
||||
}));
|
||||
this.position++;
|
||||
};
|
||||
|
||||
Parser.prototype.error = function error(message, opts) {
|
||||
throw this.root.error(message, opts);
|
||||
};
|
||||
|
||||
Parser.prototype.missingBackslash = function missingBackslash() {
|
||||
return this.error('Expected a backslash preceding the semicolon.', {
|
||||
index: this.currToken[5]
|
||||
});
|
||||
};
|
||||
|
||||
Parser.prototype.missingParenthesis = function missingParenthesis() {
|
||||
return this.expected('opening parenthesis', this.currToken[5]);
|
||||
};
|
||||
|
||||
Parser.prototype.missingSquareBracket = function missingSquareBracket() {
|
||||
return this.expected('opening square bracket', this.currToken[5]);
|
||||
};
|
||||
|
||||
Parser.prototype.namespace = function namespace() {
|
||||
var before = this.prevToken && this.content(this.prevToken) || true;
|
||||
if (this.nextToken[0] === tokens.word) {
|
||||
this.position++;
|
||||
return this.word(before);
|
||||
} else if (this.nextToken[0] === tokens.asterisk) {
|
||||
this.position++;
|
||||
return this.universal(before);
|
||||
}
|
||||
};
|
||||
|
||||
Parser.prototype.nesting = function nesting() {
|
||||
var current = this.currToken;
|
||||
this.newNode(new _nesting2.default({
|
||||
value: this.content(),
|
||||
source: getSource(current[1], current[2], current[3], current[4]),
|
||||
sourceIndex: current[5]
|
||||
}));
|
||||
this.position++;
|
||||
};
|
||||
|
||||
Parser.prototype.parentheses = function parentheses() {
|
||||
var last = this.current.last;
|
||||
var balanced = 1;
|
||||
this.position++;
|
||||
if (last && last.type === types.PSEUDO) {
|
||||
var selector = new _selector2.default();
|
||||
var cache = this.current;
|
||||
last.append(selector);
|
||||
this.current = selector;
|
||||
while (this.position < this.tokens.length && balanced) {
|
||||
if (this.currToken[0] === tokens.openParenthesis) {
|
||||
balanced++;
|
||||
}
|
||||
if (this.currToken[0] === tokens.closeParenthesis) {
|
||||
balanced--;
|
||||
}
|
||||
if (balanced) {
|
||||
this.parse();
|
||||
} else {
|
||||
selector.parent.source.end.line = this.currToken[3];
|
||||
selector.parent.source.end.column = this.currToken[4];
|
||||
this.position++;
|
||||
}
|
||||
}
|
||||
this.current = cache;
|
||||
} else {
|
||||
last.value += '(';
|
||||
while (this.position < this.tokens.length && balanced) {
|
||||
if (this.currToken[0] === tokens.openParenthesis) {
|
||||
balanced++;
|
||||
}
|
||||
if (this.currToken[0] === tokens.closeParenthesis) {
|
||||
balanced--;
|
||||
}
|
||||
last.value += this.parseParenthesisToken(this.currToken);
|
||||
this.position++;
|
||||
}
|
||||
}
|
||||
if (balanced) {
|
||||
return this.expected('closing parenthesis', this.currToken[5]);
|
||||
}
|
||||
};
|
||||
|
||||
Parser.prototype.pseudo = function pseudo() {
|
||||
var _this2 = this;
|
||||
|
||||
var pseudoStr = '';
|
||||
var startingToken = this.currToken;
|
||||
while (this.currToken && this.currToken[0] === tokens.colon) {
|
||||
pseudoStr += this.content();
|
||||
this.position++;
|
||||
}
|
||||
if (!this.currToken) {
|
||||
return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
|
||||
}
|
||||
if (this.currToken[0] === tokens.word) {
|
||||
this.splitWord(false, function (first, length) {
|
||||
pseudoStr += first;
|
||||
_this2.newNode(new _pseudo2.default({
|
||||
value: pseudoStr,
|
||||
source: getSource(startingToken[1], startingToken[2], _this2.currToken[3], _this2.currToken[4]),
|
||||
sourceIndex: startingToken[5]
|
||||
}));
|
||||
if (length > 1 && _this2.nextToken && _this2.nextToken[0] === tokens.openParenthesis) {
|
||||
_this2.error('Misplaced parenthesis.', {
|
||||
index: _this2.nextToken[5]
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[5]);
|
||||
}
|
||||
};
|
||||
|
||||
Parser.prototype.space = function space() {
|
||||
var content = this.content();
|
||||
// Handle space before and after the selector
|
||||
if (this.position === 0 || this.prevToken[0] === tokens.comma || this.prevToken[0] === tokens.openParenthesis) {
|
||||
this.spaces = this.parseSpace(content);
|
||||
this.position++;
|
||||
} else if (this.position === this.tokens.length - 1 || this.nextToken[0] === tokens.comma || this.nextToken[0] === tokens.closeParenthesis) {
|
||||
this.current.last.spaces.after = this.parseSpace(content);
|
||||
this.position++;
|
||||
} else {
|
||||
this.combinator();
|
||||
}
|
||||
};
|
||||
|
||||
Parser.prototype.string = function string() {
|
||||
var current = this.currToken;
|
||||
this.newNode(new _string2.default({
|
||||
value: this.content(),
|
||||
source: getSource(current[1], current[2], current[3], current[4]),
|
||||
sourceIndex: current[5]
|
||||
}));
|
||||
this.position++;
|
||||
};
|
||||
|
||||
Parser.prototype.universal = function universal(namespace) {
|
||||
var nextToken = this.nextToken;
|
||||
if (nextToken && this.content(nextToken) === '|') {
|
||||
this.position++;
|
||||
return this.namespace();
|
||||
}
|
||||
var current = this.currToken;
|
||||
this.newNode(new _universal2.default({
|
||||
value: this.content(),
|
||||
source: getSource(current[1], current[2], current[3], current[4]),
|
||||
sourceIndex: current[5]
|
||||
}), namespace);
|
||||
this.position++;
|
||||
};
|
||||
|
||||
Parser.prototype.splitWord = function splitWord(namespace, firstCallback) {
|
||||
var _this3 = this;
|
||||
|
||||
var nextToken = this.nextToken;
|
||||
var word = this.content();
|
||||
while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[0])) {
|
||||
this.position++;
|
||||
var current = this.content();
|
||||
word += current;
|
||||
if (current.lastIndexOf('\\') === current.length - 1) {
|
||||
var next = this.nextToken;
|
||||
if (next && next[0] === tokens.space) {
|
||||
word += this.parseSpace(this.content(next), ' ');
|
||||
this.position++;
|
||||
}
|
||||
}
|
||||
nextToken = this.nextToken;
|
||||
}
|
||||
var hasClass = (0, _indexesOf2.default)(word, '.');
|
||||
var hasId = (0, _indexesOf2.default)(word, '#');
|
||||
// Eliminate Sass interpolations from the list of id indexes
|
||||
var interpolations = (0, _indexesOf2.default)(word, '#{');
|
||||
if (interpolations.length) {
|
||||
hasId = hasId.filter(function (hashIndex) {
|
||||
return !~interpolations.indexOf(hashIndex);
|
||||
});
|
||||
}
|
||||
var indices = (0, _sortAscending2.default)((0, _uniq2.default)([0].concat(hasClass, hasId)));
|
||||
indices.forEach(function (ind, i) {
|
||||
var index = indices[i + 1] || word.length;
|
||||
var value = word.slice(ind, index);
|
||||
if (i === 0 && firstCallback) {
|
||||
return firstCallback.call(_this3, value, indices.length);
|
||||
}
|
||||
var node = void 0;
|
||||
var current = _this3.currToken;
|
||||
var sourceIndex = current[5] + indices[i];
|
||||
var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
|
||||
if (~hasClass.indexOf(ind)) {
|
||||
node = new _className2.default({
|
||||
value: value.slice(1),
|
||||
source: source,
|
||||
sourceIndex: sourceIndex
|
||||
});
|
||||
} else if (~hasId.indexOf(ind)) {
|
||||
node = new _id2.default({
|
||||
value: value.slice(1),
|
||||
source: source,
|
||||
sourceIndex: sourceIndex
|
||||
});
|
||||
} else {
|
||||
node = new _tag2.default({
|
||||
value: value,
|
||||
source: source,
|
||||
sourceIndex: sourceIndex
|
||||
});
|
||||
}
|
||||
_this3.newNode(node, namespace);
|
||||
// Ensure that the namespace is used only once
|
||||
namespace = null;
|
||||
});
|
||||
this.position++;
|
||||
};
|
||||
|
||||
Parser.prototype.word = function word(namespace) {
|
||||
var nextToken = this.nextToken;
|
||||
if (nextToken && this.content(nextToken) === '|') {
|
||||
this.position++;
|
||||
return this.namespace();
|
||||
}
|
||||
return this.splitWord(namespace);
|
||||
};
|
||||
|
||||
Parser.prototype.loop = function loop() {
|
||||
while (this.position < this.tokens.length) {
|
||||
this.parse(true);
|
||||
}
|
||||
return this.root;
|
||||
};
|
||||
|
||||
Parser.prototype.parse = function parse(throwOnParenthesis) {
|
||||
switch (this.currToken[0]) {
|
||||
case tokens.space:
|
||||
this.space();
|
||||
break;
|
||||
case tokens.comment:
|
||||
this.comment();
|
||||
break;
|
||||
case tokens.openParenthesis:
|
||||
this.parentheses();
|
||||
break;
|
||||
case tokens.closeParenthesis:
|
||||
if (throwOnParenthesis) {
|
||||
this.missingParenthesis();
|
||||
}
|
||||
break;
|
||||
case tokens.openSquare:
|
||||
this.attribute();
|
||||
break;
|
||||
case tokens.dollar:
|
||||
case tokens.caret:
|
||||
case tokens.equals:
|
||||
case tokens.word:
|
||||
this.word();
|
||||
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.combinator:
|
||||
this.combinator();
|
||||
break;
|
||||
case tokens.str:
|
||||
this.string();
|
||||
break;
|
||||
// These cases throw; no break needed.
|
||||
case tokens.closeSquare:
|
||||
this.missingSquareBracket();
|
||||
case tokens.semicolon:
|
||||
this.missingBackslash();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
Parser.prototype.expected = function expected(description, index, found) {
|
||||
if (Array.isArray(description)) {
|
||||
var last = description.pop();
|
||||
description = description.join(', ') + ' or ' + last;
|
||||
}
|
||||
var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
|
||||
if (!found) {
|
||||
return this.error('Expected ' + an + ' ' + description + '.', { index: index });
|
||||
}
|
||||
return this.error('Expected ' + an + ' ' + description + ', found "' + found + '" instead.', { index: index });
|
||||
};
|
||||
|
||||
Parser.prototype.parseNamespace = function parseNamespace(namespace) {
|
||||
if (this.options.lossy && typeof namespace === 'string') {
|
||||
var trimmed = namespace.trim();
|
||||
if (!trimmed.length) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
return namespace;
|
||||
};
|
||||
|
||||
Parser.prototype.parseSpace = function parseSpace(space) {
|
||||
var replacement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
|
||||
return this.options.lossy ? replacement : space;
|
||||
};
|
||||
|
||||
Parser.prototype.parseValue = function parseValue(value) {
|
||||
if (!this.options.lossy || !value || typeof value !== 'string') {
|
||||
return value;
|
||||
}
|
||||
return value.trim();
|
||||
};
|
||||
|
||||
Parser.prototype.parseParenthesisToken = function parseParenthesisToken(token) {
|
||||
var content = this.content(token);
|
||||
if (!this.options.lossy) {
|
||||
return content;
|
||||
}
|
||||
|
||||
if (token[0] === tokens.space) {
|
||||
return this.parseSpace(content, ' ');
|
||||
}
|
||||
|
||||
return this.parseValue(content);
|
||||
};
|
||||
|
||||
Parser.prototype.newNode = function newNode(node, namespace) {
|
||||
if (namespace) {
|
||||
node.namespace = this.parseNamespace(namespace);
|
||||
}
|
||||
if (this.spaces) {
|
||||
node.spaces.before = this.spaces;
|
||||
this.spaces = '';
|
||||
}
|
||||
return this.current.append(node);
|
||||
};
|
||||
|
||||
Parser.prototype.content = function content() {
|
||||
var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currToken;
|
||||
|
||||
return this.css.slice(token[5], token[6]);
|
||||
};
|
||||
|
||||
_createClass(Parser, [{
|
||||
key: 'currToken',
|
||||
get: function get() {
|
||||
return this.tokens[this.position];
|
||||
}
|
||||
}, {
|
||||
key: 'nextToken',
|
||||
get: function get() {
|
||||
return this.tokens[this.position + 1];
|
||||
}
|
||||
}, {
|
||||
key: 'prevToken',
|
||||
get: function get() {
|
||||
return this.tokens[this.position - 1];
|
||||
}
|
||||
}]);
|
||||
|
||||
return Parser;
|
||||
}();
|
||||
|
||||
exports.default = Parser;
|
||||
module.exports = exports['default'];
|
185
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/processor.js
generated
vendored
Normal file
185
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/processor.js
generated
vendored
Normal file
|
@ -0,0 +1,185 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _parser = require("./parser");
|
||||
|
||||
var _parser2 = _interopRequireDefault(_parser);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Processor = function () {
|
||||
function Processor(func, options) {
|
||||
_classCallCheck(this, Processor);
|
||||
|
||||
this.func = func || function noop() {};
|
||||
this.funcRes = null;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
Processor.prototype._shouldUpdateSelector = function _shouldUpdateSelector(rule) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
var merged = Object.assign({}, this.options, options);
|
||||
if (merged.updateSelector === false) {
|
||||
return false;
|
||||
} else {
|
||||
return typeof rule !== "string";
|
||||
}
|
||||
};
|
||||
|
||||
Processor.prototype._isLossy = function _isLossy() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
var merged = Object.assign({}, this.options, options);
|
||||
if (merged.lossless === false) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Processor.prototype._root = function _root(rule) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
var parser = new _parser2.default(rule, this._parseOptions(options));
|
||||
return parser.root;
|
||||
};
|
||||
|
||||
Processor.prototype._parseOptions = function _parseOptions(options) {
|
||||
return {
|
||||
lossy: this._isLossy(options)
|
||||
};
|
||||
};
|
||||
|
||||
Processor.prototype._run = function _run(rule) {
|
||||
var _this = this;
|
||||
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
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)) {
|
||||
string = root.toString();
|
||||
rule.selector = string;
|
||||
}
|
||||
return { transform: transform, root: root, string: string };
|
||||
}).then(resolve, reject);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Processor.prototype._runSync = function _runSync(rule) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
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") {
|
||||
string = root.toString();
|
||||
rule.selector = string;
|
||||
}
|
||||
return { transform: transform, root: root, string: string };
|
||||
};
|
||||
|
||||
/**
|
||||
* Process rule into a selector AST.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {Promise<parser.Root>} The AST of the selector after processing it.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.ast = function ast(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.root;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Process rule into a selector AST synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {parser.Root} The AST of the selector after processing it.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.astSync = function astSync(rule, options) {
|
||||
return this._runSync(rule, options).root;
|
||||
};
|
||||
|
||||
/**
|
||||
* Process a selector into a transformed value asynchronously
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {Promise<any>} The value returned by the processor.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.transform = function transform(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.transform;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Process a selector into a transformed value synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {any} The value returned by the processor.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.transformSync = function transformSync(rule, options) {
|
||||
return this._runSync(rule, options).transform;
|
||||
};
|
||||
|
||||
/**
|
||||
* Process a selector into a new selector string asynchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {string} the selector after processing.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.process = function process(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.string || result.root.toString();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Process a selector into a new selector string synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {string} the selector after processing.
|
||||
*/
|
||||
|
||||
|
||||
Processor.prototype.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"];
|
196
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/attribute.js
generated
vendored
Normal file
196
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/attribute.js
generated
vendored
Normal file
|
@ -0,0 +1,196 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _namespace = require('./namespace');
|
||||
|
||||
var _namespace2 = _interopRequireDefault(_namespace);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Attribute = function (_Namespace) {
|
||||
_inherits(Attribute, _Namespace);
|
||||
|
||||
function Attribute() {
|
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
_classCallCheck(this, Attribute);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
|
||||
|
||||
_this.type = _types.ATTRIBUTE;
|
||||
_this.raws = _this.raws || {};
|
||||
_this._constructed = true;
|
||||
return _this;
|
||||
}
|
||||
|
||||
Attribute.prototype._spacesFor = function _spacesFor(name) {
|
||||
var attrSpaces = { before: '', after: '' };
|
||||
var spaces = this.spaces[name] || {};
|
||||
var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
|
||||
return Object.assign(attrSpaces, spaces, rawSpaces);
|
||||
};
|
||||
|
||||
Attribute.prototype._valueFor = function _valueFor(name) {
|
||||
return this.raws[name] || this[name];
|
||||
};
|
||||
|
||||
Attribute.prototype._stringFor = function _stringFor(name) {
|
||||
var spaceName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : name;
|
||||
var concat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultAttrConcat;
|
||||
|
||||
var attrSpaces = this._spacesFor(spaceName);
|
||||
return concat(this._valueFor(name), attrSpaces);
|
||||
};
|
||||
|
||||
/**
|
||||
* returns the offset of the attribute part specified relative to the
|
||||
* start of the node of the output string.
|
||||
*
|
||||
* * "ns" - alias for "namespace"
|
||||
* * "namespace" - the namespace if it exists.
|
||||
* * "attribute" - the attribute name
|
||||
* * "attributeNS" - the start of the attribute or its namespace
|
||||
* * "operator" - the match operator of the attribute
|
||||
* * "value" - The value (string or identifier)
|
||||
* * "insensitive" - the case insensitivity flag;
|
||||
* @param part One of the possible values inside an attribute.
|
||||
* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
|
||||
*/
|
||||
|
||||
|
||||
Attribute.prototype.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._valueFor("attribute").length;
|
||||
count += attributeSpaces.after.length;
|
||||
var operatorSpaces = this._spacesFor("operator");
|
||||
count += operatorSpaces.before.length;
|
||||
var operator = this._valueFor("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._valueFor("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;
|
||||
};
|
||||
|
||||
Attribute.prototype.toString = function toString() {
|
||||
var _this2 = this;
|
||||
|
||||
var selector = [this.spaces.before, '['];
|
||||
|
||||
selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
|
||||
|
||||
if (this.operator && this.value) {
|
||||
selector.push(this._stringFor('operator'));
|
||||
selector.push(this._stringFor('value'));
|
||||
selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
|
||||
if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
|
||||
attrSpaces.before = " ";
|
||||
}
|
||||
return defaultAttrConcat(attrValue, attrSpaces);
|
||||
}));
|
||||
}
|
||||
|
||||
selector.push(']');
|
||||
selector.push(this.spaces.after);
|
||||
return selector.join('');
|
||||
};
|
||||
|
||||
_createClass(Attribute, [{
|
||||
key: 'qualifiedAttribute',
|
||||
get: function get() {
|
||||
return this.qualifiedName(this.raws.attribute || this.attribute);
|
||||
}
|
||||
}, {
|
||||
key: 'insensitiveFlag',
|
||||
get: function get() {
|
||||
return this.insensitive ? 'i' : '';
|
||||
}
|
||||
}, {
|
||||
key: 'value',
|
||||
get: function get() {
|
||||
return this._value;
|
||||
},
|
||||
set: function set(v) {
|
||||
this._value = v;
|
||||
if (this._constructed) {
|
||||
delete this.raws.value;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'namespace',
|
||||
get: function get() {
|
||||
return this._namespace;
|
||||
},
|
||||
set: function set(v) {
|
||||
this._namespace = v;
|
||||
if (this._constructed) {
|
||||
delete this.raws.namespace;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'attribute',
|
||||
get: function get() {
|
||||
return this._attribute;
|
||||
},
|
||||
set: function set(v) {
|
||||
this._attribute = v;
|
||||
if (this._constructed) {
|
||||
delete this.raws.attibute;
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return Attribute;
|
||||
}(_namespace2.default);
|
||||
|
||||
exports.default = Attribute;
|
||||
|
||||
|
||||
function defaultAttrConcat(attrValue, attrSpaces) {
|
||||
return '' + attrSpaces.before + attrValue + attrSpaces.after;
|
||||
}
|
||||
module.exports = exports['default'];
|
39
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/className.js
generated
vendored
Normal file
39
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/className.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _namespace = require('./namespace');
|
||||
|
||||
var _namespace2 = _interopRequireDefault(_namespace);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var ClassName = function (_Namespace) {
|
||||
_inherits(ClassName, _Namespace);
|
||||
|
||||
function ClassName(opts) {
|
||||
_classCallCheck(this, ClassName);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
|
||||
|
||||
_this.type = _types.CLASS;
|
||||
return _this;
|
||||
}
|
||||
|
||||
ClassName.prototype.toString = function toString() {
|
||||
return [this.spaces.before, this.ns, String('.' + this.value), this.spaces.after].join('');
|
||||
};
|
||||
|
||||
return ClassName;
|
||||
}(_namespace2.default);
|
||||
|
||||
exports.default = ClassName;
|
||||
module.exports = exports['default'];
|
35
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/combinator.js
generated
vendored
Normal file
35
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/combinator.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Combinator = function (_Node) {
|
||||
_inherits(Combinator, _Node);
|
||||
|
||||
function Combinator(opts) {
|
||||
_classCallCheck(this, Combinator);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
_this.type = _types.COMBINATOR;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Combinator;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Combinator;
|
||||
module.exports = exports['default'];
|
35
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/comment.js
generated
vendored
Normal file
35
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/comment.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Comment = function (_Node) {
|
||||
_inherits(Comment, _Node);
|
||||
|
||||
function Comment(opts) {
|
||||
_classCallCheck(this, Comment);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
_this.type = _types.COMMENT;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Comment;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Comment;
|
||||
module.exports = exports['default'];
|
91
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/constructors.js
generated
vendored
Normal file
91
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/constructors.js
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.universal = exports.tag = exports.string = exports.selector = exports.root = exports.pseudo = exports.nesting = exports.id = exports.comment = exports.combinator = exports.className = exports.attribute = undefined;
|
||||
|
||||
var _attribute = require('./attribute');
|
||||
|
||||
var _attribute2 = _interopRequireDefault(_attribute);
|
||||
|
||||
var _className = require('./className');
|
||||
|
||||
var _className2 = _interopRequireDefault(_className);
|
||||
|
||||
var _combinator = require('./combinator');
|
||||
|
||||
var _combinator2 = _interopRequireDefault(_combinator);
|
||||
|
||||
var _comment = require('./comment');
|
||||
|
||||
var _comment2 = _interopRequireDefault(_comment);
|
||||
|
||||
var _id = require('./id');
|
||||
|
||||
var _id2 = _interopRequireDefault(_id);
|
||||
|
||||
var _nesting = require('./nesting');
|
||||
|
||||
var _nesting2 = _interopRequireDefault(_nesting);
|
||||
|
||||
var _pseudo = require('./pseudo');
|
||||
|
||||
var _pseudo2 = _interopRequireDefault(_pseudo);
|
||||
|
||||
var _root = require('./root');
|
||||
|
||||
var _root2 = _interopRequireDefault(_root);
|
||||
|
||||
var _selector = require('./selector');
|
||||
|
||||
var _selector2 = _interopRequireDefault(_selector);
|
||||
|
||||
var _string = require('./string');
|
||||
|
||||
var _string2 = _interopRequireDefault(_string);
|
||||
|
||||
var _tag = require('./tag');
|
||||
|
||||
var _tag2 = _interopRequireDefault(_tag);
|
||||
|
||||
var _universal = require('./universal');
|
||||
|
||||
var _universal2 = _interopRequireDefault(_universal);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var attribute = exports.attribute = function attribute(opts) {
|
||||
return new _attribute2.default(opts);
|
||||
};
|
||||
var className = exports.className = function className(opts) {
|
||||
return new _className2.default(opts);
|
||||
};
|
||||
var combinator = exports.combinator = function combinator(opts) {
|
||||
return new _combinator2.default(opts);
|
||||
};
|
||||
var comment = exports.comment = function comment(opts) {
|
||||
return new _comment2.default(opts);
|
||||
};
|
||||
var id = exports.id = function id(opts) {
|
||||
return new _id2.default(opts);
|
||||
};
|
||||
var nesting = exports.nesting = function nesting(opts) {
|
||||
return new _nesting2.default(opts);
|
||||
};
|
||||
var pseudo = exports.pseudo = function pseudo(opts) {
|
||||
return new _pseudo2.default(opts);
|
||||
};
|
||||
var root = exports.root = function root(opts) {
|
||||
return new _root2.default(opts);
|
||||
};
|
||||
var selector = exports.selector = function selector(opts) {
|
||||
return new _selector2.default(opts);
|
||||
};
|
||||
var string = exports.string = function string(opts) {
|
||||
return new _string2.default(opts);
|
||||
};
|
||||
var tag = exports.tag = function tag(opts) {
|
||||
return new _tag2.default(opts);
|
||||
};
|
||||
var universal = exports.universal = function universal(opts) {
|
||||
return new _universal2.default(opts);
|
||||
};
|
344
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/container.js
generated
vendored
Normal file
344
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/container.js
generated
vendored
Normal file
|
@ -0,0 +1,344 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
var types = _interopRequireWildcard(_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)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Container = function (_Node) {
|
||||
_inherits(Container, _Node);
|
||||
|
||||
function Container(opts) {
|
||||
_classCallCheck(this, Container);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
if (!_this.nodes) {
|
||||
_this.nodes = [];
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
|
||||
Container.prototype.append = function append(selector) {
|
||||
selector.parent = this;
|
||||
this.nodes.push(selector);
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.prepend = function prepend(selector) {
|
||||
selector.parent = this;
|
||||
this.nodes.unshift(selector);
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.at = function at(index) {
|
||||
return this.nodes[index];
|
||||
};
|
||||
|
||||
Container.prototype.index = function index(child) {
|
||||
if (typeof child === 'number') {
|
||||
return child;
|
||||
}
|
||||
return this.nodes.indexOf(child);
|
||||
};
|
||||
|
||||
Container.prototype.removeChild = function removeChild(child) {
|
||||
child = this.index(child);
|
||||
this.at(child).parent = undefined;
|
||||
this.nodes.splice(child, 1);
|
||||
|
||||
var index = void 0;
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
if (index >= child) {
|
||||
this.indexes[id] = index - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.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;
|
||||
|
||||
node.parent = undefined;
|
||||
}
|
||||
this.nodes = [];
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.empty = function empty() {
|
||||
return this.removeAll();
|
||||
};
|
||||
|
||||
Container.prototype.insertAfter = function insertAfter(oldNode, newNode) {
|
||||
newNode.parent = this;
|
||||
var oldIndex = this.index(oldNode);
|
||||
this.nodes.splice(oldIndex + 1, 0, newNode);
|
||||
|
||||
newNode.parent = this;
|
||||
|
||||
var index = void 0;
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
if (oldIndex <= index) {
|
||||
this.indexes[id] = index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.insertBefore = function insertBefore(oldNode, newNode) {
|
||||
newNode.parent = this;
|
||||
var oldIndex = this.index(oldNode);
|
||||
this.nodes.splice(oldIndex, 0, newNode);
|
||||
|
||||
newNode.parent = this;
|
||||
|
||||
var index = void 0;
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
if (index <= oldIndex) {
|
||||
this.indexes[id] = index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Container.prototype.each = function each(callback) {
|
||||
if (!this.lastEach) {
|
||||
this.lastEach = 0;
|
||||
}
|
||||
if (!this.indexes) {
|
||||
this.indexes = {};
|
||||
}
|
||||
|
||||
this.lastEach++;
|
||||
var id = this.lastEach;
|
||||
this.indexes[id] = 0;
|
||||
|
||||
if (!this.length) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var index = void 0,
|
||||
result = void 0;
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Container.prototype.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) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkAttributes = function walkAttributes(callback) {
|
||||
var _this2 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.ATTRIBUTE) {
|
||||
return callback.call(_this2, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkClasses = function walkClasses(callback) {
|
||||
var _this3 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.CLASS) {
|
||||
return callback.call(_this3, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkCombinators = function walkCombinators(callback) {
|
||||
var _this4 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.COMBINATOR) {
|
||||
return callback.call(_this4, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkComments = function walkComments(callback) {
|
||||
var _this5 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.COMMENT) {
|
||||
return callback.call(_this5, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkIds = function walkIds(callback) {
|
||||
var _this6 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.ID) {
|
||||
return callback.call(_this6, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkNesting = function walkNesting(callback) {
|
||||
var _this7 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.NESTING) {
|
||||
return callback.call(_this7, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkPseudos = function walkPseudos(callback) {
|
||||
var _this8 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.PSEUDO) {
|
||||
return callback.call(_this8, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkTags = function walkTags(callback) {
|
||||
var _this9 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.TAG) {
|
||||
return callback.call(_this9, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.walkUniversals = function walkUniversals(callback) {
|
||||
var _this10 = this;
|
||||
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.UNIVERSAL) {
|
||||
return callback.call(_this10, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Container.prototype.split = function split(callback) {
|
||||
var _this11 = this;
|
||||
|
||||
var current = [];
|
||||
return this.reduce(function (memo, node, index) {
|
||||
var split = callback.call(_this11, node);
|
||||
current.push(node);
|
||||
if (split) {
|
||||
memo.push(current);
|
||||
current = [];
|
||||
} else if (index === _this11.length - 1) {
|
||||
memo.push(current);
|
||||
}
|
||||
return memo;
|
||||
}, []);
|
||||
};
|
||||
|
||||
Container.prototype.map = function map(callback) {
|
||||
return this.nodes.map(callback);
|
||||
};
|
||||
|
||||
Container.prototype.reduce = function reduce(callback, memo) {
|
||||
return this.nodes.reduce(callback, memo);
|
||||
};
|
||||
|
||||
Container.prototype.every = function every(callback) {
|
||||
return this.nodes.every(callback);
|
||||
};
|
||||
|
||||
Container.prototype.some = function some(callback) {
|
||||
return this.nodes.some(callback);
|
||||
};
|
||||
|
||||
Container.prototype.filter = function filter(callback) {
|
||||
return this.nodes.filter(callback);
|
||||
};
|
||||
|
||||
Container.prototype.sort = function sort(callback) {
|
||||
return this.nodes.sort(callback);
|
||||
};
|
||||
|
||||
Container.prototype.toString = function toString() {
|
||||
return this.map(String).join('');
|
||||
};
|
||||
|
||||
_createClass(Container, [{
|
||||
key: 'first',
|
||||
get: function get() {
|
||||
return this.at(0);
|
||||
}
|
||||
}, {
|
||||
key: 'last',
|
||||
get: function get() {
|
||||
return this.at(this.length - 1);
|
||||
}
|
||||
}, {
|
||||
key: 'length',
|
||||
get: function get() {
|
||||
return this.nodes.length;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Container;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Container;
|
||||
module.exports = exports['default'];
|
54
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/guards.js
generated
vendored
Normal file
54
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/guards.js
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = exports.isPseudo = exports.isNesting = exports.isIdentifier = exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = undefined;
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
var _IS_TYPE;
|
||||
|
||||
exports.isNode = isNode;
|
||||
exports.isPseudoElement = isPseudoElement;
|
||||
exports.isPseudoClass = isPseudoClass;
|
||||
exports.isContainer = isContainer;
|
||||
exports.isNamespace = isNamespace;
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
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 === "undefined" ? "undefined" : _typeof(node)) === "object" && IS_TYPE[node.type];
|
||||
}
|
||||
|
||||
function isNodeType(type, node) {
|
||||
return isNode(node) && node.type === type;
|
||||
}
|
||||
|
||||
var isAttribute = exports.isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
|
||||
var isClassName = exports.isClassName = isNodeType.bind(null, _types.CLASS);
|
||||
var isCombinator = exports.isCombinator = isNodeType.bind(null, _types.COMBINATOR);
|
||||
var isComment = exports.isComment = isNodeType.bind(null, _types.COMMENT);
|
||||
var isIdentifier = exports.isIdentifier = isNodeType.bind(null, _types.ID);
|
||||
var isNesting = exports.isNesting = isNodeType.bind(null, _types.NESTING);
|
||||
var isPseudo = exports.isPseudo = isNodeType.bind(null, _types.PSEUDO);
|
||||
var isRoot = exports.isRoot = isNodeType.bind(null, _types.ROOT);
|
||||
var isSelector = exports.isSelector = isNodeType.bind(null, _types.SELECTOR);
|
||||
var isString = exports.isString = isNodeType.bind(null, _types.STRING);
|
||||
var isTag = exports.isTag = isNodeType.bind(null, _types.TAG);
|
||||
var isUniversal = exports.isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
|
||||
|
||||
function isPseudoElement(node) {
|
||||
return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value === ":before" || node.value === ":after");
|
||||
}
|
||||
function isPseudoClass(node) {
|
||||
return isPseudo(node) && !isPseudoElement(node);
|
||||
}
|
||||
|
||||
function isContainer(node) {
|
||||
return !!(isNode(node) && node.walk);
|
||||
}
|
||||
|
||||
function isNamespace(node) {
|
||||
return isClassName(node) || isAttribute(node) || isTag(node);
|
||||
}
|
39
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/id.js
generated
vendored
Normal file
39
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/id.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _namespace = require('./namespace');
|
||||
|
||||
var _namespace2 = _interopRequireDefault(_namespace);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var ID = function (_Namespace) {
|
||||
_inherits(ID, _Namespace);
|
||||
|
||||
function ID(opts) {
|
||||
_classCallCheck(this, ID);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
|
||||
|
||||
_this.type = _types.ID;
|
||||
return _this;
|
||||
}
|
||||
|
||||
ID.prototype.toString = function toString() {
|
||||
return [this.spaces.before, this.ns, String('#' + this.value), this.spaces.after].join('');
|
||||
};
|
||||
|
||||
return ID;
|
||||
}(_namespace2.default);
|
||||
|
||||
exports.default = ID;
|
||||
module.exports = exports['default'];
|
39
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/index.js
generated
vendored
Normal file
39
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/index.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
Object.keys(_types).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _types[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _constructors = require("./constructors");
|
||||
|
||||
Object.keys(_constructors).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _constructors[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _guards = require("./guards");
|
||||
|
||||
Object.keys(_guards).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _guards[key];
|
||||
}
|
||||
});
|
||||
});
|
83
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/namespace.js
generated
vendored
Normal file
83
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/namespace.js
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Namespace = function (_Node) {
|
||||
_inherits(Namespace, _Node);
|
||||
|
||||
function Namespace() {
|
||||
_classCallCheck(this, Namespace);
|
||||
|
||||
return _possibleConstructorReturn(this, _Node.apply(this, arguments));
|
||||
}
|
||||
|
||||
Namespace.prototype.qualifiedName = function qualifiedName(value) {
|
||||
if (this.namespace) {
|
||||
return this.namespaceString + '|' + value;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
Namespace.prototype.toString = function toString() {
|
||||
return [this.spaces.before, this.qualifiedName(this.value), this.spaces.after].join('');
|
||||
};
|
||||
|
||||
_createClass(Namespace, [{
|
||||
key: 'namespace',
|
||||
get: function get() {
|
||||
return this._namespace;
|
||||
},
|
||||
set: function set(namespace) {
|
||||
this._namespace = namespace;
|
||||
if (this.raws) {
|
||||
delete this.raws.namespace;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'ns',
|
||||
get: function get() {
|
||||
return this._namespace;
|
||||
},
|
||||
set: function set(namespace) {
|
||||
this._namespace = namespace;
|
||||
if (this.raws) {
|
||||
delete this.raws.namespace;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'namespaceString',
|
||||
get: function get() {
|
||||
if (this.namespace) {
|
||||
var ns = this.raws && this.raws.namespace || this.namespace;
|
||||
if (ns === true) {
|
||||
return '';
|
||||
} else {
|
||||
return ns;
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return Namespace;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Namespace;
|
||||
;
|
||||
module.exports = exports['default'];
|
36
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/nesting.js
generated
vendored
Normal file
36
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/nesting.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Nesting = function (_Node) {
|
||||
_inherits(Nesting, _Node);
|
||||
|
||||
function Nesting(opts) {
|
||||
_classCallCheck(this, Nesting);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
_this.type = _types.NESTING;
|
||||
_this.value = '&';
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Nesting;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Nesting;
|
||||
module.exports = exports['default'];
|
95
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/node.js
generated
vendored
Normal file
95
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/node.js
generated
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var cloneNode = function cloneNode(obj, parent) {
|
||||
if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var cloned = new obj.constructor();
|
||||
|
||||
for (var i in obj) {
|
||||
if (!obj.hasOwnProperty(i)) {
|
||||
continue;
|
||||
}
|
||||
var value = obj[i];
|
||||
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
||||
|
||||
if (i === 'parent' && type === 'object') {
|
||||
if (parent) {
|
||||
cloned[i] = parent;
|
||||
}
|
||||
} else if (value instanceof Array) {
|
||||
cloned[i] = value.map(function (j) {
|
||||
return cloneNode(j, cloned);
|
||||
});
|
||||
} else {
|
||||
cloned[i] = cloneNode(value, cloned);
|
||||
}
|
||||
}
|
||||
|
||||
return cloned;
|
||||
};
|
||||
|
||||
var _class = function () {
|
||||
function _class() {
|
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
_classCallCheck(this, _class);
|
||||
|
||||
Object.assign(this, opts);
|
||||
this.spaces = this.spaces || {};
|
||||
this.spaces.before = this.spaces.before || '';
|
||||
this.spaces.after = this.spaces.after || '';
|
||||
}
|
||||
|
||||
_class.prototype.remove = function remove() {
|
||||
if (this.parent) {
|
||||
this.parent.removeChild(this);
|
||||
}
|
||||
this.parent = undefined;
|
||||
return this;
|
||||
};
|
||||
|
||||
_class.prototype.replaceWith = function replaceWith() {
|
||||
if (this.parent) {
|
||||
for (var index in arguments) {
|
||||
this.parent.insertBefore(this, arguments[index]);
|
||||
}
|
||||
this.remove();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
_class.prototype.next = function next() {
|
||||
return this.parent.at(this.parent.index(this) + 1);
|
||||
};
|
||||
|
||||
_class.prototype.prev = function prev() {
|
||||
return this.parent.at(this.parent.index(this) - 1);
|
||||
};
|
||||
|
||||
_class.prototype.clone = function clone() {
|
||||
var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
var cloned = cloneNode(this);
|
||||
for (var name in overrides) {
|
||||
cloned[name] = overrides[name];
|
||||
}
|
||||
return cloned;
|
||||
};
|
||||
|
||||
_class.prototype.toString = function toString() {
|
||||
return [this.spaces.before, String(this.value), this.spaces.after].join('');
|
||||
};
|
||||
|
||||
return _class;
|
||||
}();
|
||||
|
||||
exports.default = _class;
|
||||
module.exports = exports['default'];
|
40
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/pseudo.js
generated
vendored
Normal file
40
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/pseudo.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _container = require('./container');
|
||||
|
||||
var _container2 = _interopRequireDefault(_container);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Pseudo = function (_Container) {
|
||||
_inherits(Pseudo, _Container);
|
||||
|
||||
function Pseudo(opts) {
|
||||
_classCallCheck(this, Pseudo);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Container.call(this, opts));
|
||||
|
||||
_this.type = _types.PSEUDO;
|
||||
return _this;
|
||||
}
|
||||
|
||||
Pseudo.prototype.toString = function toString() {
|
||||
var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
|
||||
return [this.spaces.before, String(this.value), params, this.spaces.after].join('');
|
||||
};
|
||||
|
||||
return Pseudo;
|
||||
}(_container2.default);
|
||||
|
||||
exports.default = Pseudo;
|
||||
module.exports = exports['default'];
|
60
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/root.js
generated
vendored
Normal file
60
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/root.js
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _container = require('./container');
|
||||
|
||||
var _container2 = _interopRequireDefault(_container);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Root = function (_Container) {
|
||||
_inherits(Root, _Container);
|
||||
|
||||
function Root(opts) {
|
||||
_classCallCheck(this, Root);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Container.call(this, opts));
|
||||
|
||||
_this.type = _types.ROOT;
|
||||
return _this;
|
||||
}
|
||||
|
||||
Root.prototype.toString = function toString() {
|
||||
var str = this.reduce(function (memo, selector) {
|
||||
var sel = String(selector);
|
||||
return sel ? memo + sel + ',' : '';
|
||||
}, '').slice(0, -1);
|
||||
return this.trailingComma ? str + ',' : str;
|
||||
};
|
||||
|
||||
Root.prototype.error = function error(message, options) {
|
||||
if (this._error) {
|
||||
return this._error(message, options);
|
||||
} else {
|
||||
return new Error(message);
|
||||
}
|
||||
};
|
||||
|
||||
_createClass(Root, [{
|
||||
key: 'errorGenerator',
|
||||
set: function set(handler) {
|
||||
this._error = handler;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Root;
|
||||
}(_container2.default);
|
||||
|
||||
exports.default = Root;
|
||||
module.exports = exports['default'];
|
35
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/selector.js
generated
vendored
Normal file
35
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/selector.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _container = require('./container');
|
||||
|
||||
var _container2 = _interopRequireDefault(_container);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Selector = function (_Container) {
|
||||
_inherits(Selector, _Container);
|
||||
|
||||
function Selector(opts) {
|
||||
_classCallCheck(this, Selector);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Container.call(this, opts));
|
||||
|
||||
_this.type = _types.SELECTOR;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Selector;
|
||||
}(_container2.default);
|
||||
|
||||
exports.default = Selector;
|
||||
module.exports = exports['default'];
|
35
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/string.js
generated
vendored
Normal file
35
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/string.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _node = require('./node');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var String = function (_Node) {
|
||||
_inherits(String, _Node);
|
||||
|
||||
function String(opts) {
|
||||
_classCallCheck(this, String);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, opts));
|
||||
|
||||
_this.type = _types.STRING;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return String;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = String;
|
||||
module.exports = exports['default'];
|
35
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/tag.js
generated
vendored
Normal file
35
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/tag.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _namespace = require('./namespace');
|
||||
|
||||
var _namespace2 = _interopRequireDefault(_namespace);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Tag = function (_Namespace) {
|
||||
_inherits(Tag, _Namespace);
|
||||
|
||||
function Tag(opts) {
|
||||
_classCallCheck(this, Tag);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
|
||||
|
||||
_this.type = _types.TAG;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Tag;
|
||||
}(_namespace2.default);
|
||||
|
||||
exports.default = Tag;
|
||||
module.exports = exports['default'];
|
15
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/types.js
generated
vendored
Normal file
15
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/types.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
var TAG = exports.TAG = 'tag';
|
||||
var STRING = exports.STRING = 'string';
|
||||
var SELECTOR = exports.SELECTOR = 'selector';
|
||||
var ROOT = exports.ROOT = 'root';
|
||||
var PSEUDO = exports.PSEUDO = 'pseudo';
|
||||
var NESTING = exports.NESTING = 'nesting';
|
||||
var ID = exports.ID = 'id';
|
||||
var COMMENT = exports.COMMENT = 'comment';
|
||||
var COMBINATOR = exports.COMBINATOR = 'combinator';
|
||||
var CLASS = exports.CLASS = 'class';
|
||||
var ATTRIBUTE = exports.ATTRIBUTE = 'attribute';
|
||||
var UNIVERSAL = exports.UNIVERSAL = 'universal';
|
36
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/universal.js
generated
vendored
Normal file
36
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/selectors/universal.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _namespace = require('./namespace');
|
||||
|
||||
var _namespace2 = _interopRequireDefault(_namespace);
|
||||
|
||||
var _types = require('./types');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var Universal = function (_Namespace) {
|
||||
_inherits(Universal, _Namespace);
|
||||
|
||||
function Universal(opts) {
|
||||
_classCallCheck(this, Universal);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Namespace.call(this, opts));
|
||||
|
||||
_this.type = _types.UNIVERSAL;
|
||||
_this.value = '*';
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Universal;
|
||||
}(_namespace2.default);
|
||||
|
||||
exports.default = Universal;
|
||||
module.exports = exports['default'];
|
10
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/sortAscending.js
generated
vendored
Normal file
10
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/sortAscending.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = sortAscending;
|
||||
function sortAscending(list) {
|
||||
return list.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
};
|
||||
module.exports = exports["default"];
|
38
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/tokenTypes.js
generated
vendored
Normal file
38
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/tokenTypes.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
var ampersand = exports.ampersand = 38;
|
||||
var asterisk = exports.asterisk = 42;
|
||||
var at = exports.at = 64;
|
||||
var comma = exports.comma = 44;
|
||||
var colon = exports.colon = 58;
|
||||
var semicolon = exports.semicolon = 59;
|
||||
var openParenthesis = exports.openParenthesis = 40;
|
||||
var closeParenthesis = exports.closeParenthesis = 41;
|
||||
var openSquare = exports.openSquare = 91;
|
||||
var closeSquare = exports.closeSquare = 93;
|
||||
var dollar = exports.dollar = 36;
|
||||
var tilde = exports.tilde = 126;
|
||||
var caret = exports.caret = 94;
|
||||
var plus = exports.plus = 43;
|
||||
var equals = exports.equals = 61;
|
||||
var pipe = exports.pipe = 124;
|
||||
var greaterThan = exports.greaterThan = 62;
|
||||
var space = exports.space = 32;
|
||||
var singleQuote = exports.singleQuote = 39;
|
||||
var doubleQuote = exports.doubleQuote = 34;
|
||||
var slash = exports.slash = 47;
|
||||
|
||||
var backslash = exports.backslash = 92;
|
||||
var cr = exports.cr = 13;
|
||||
var feed = exports.feed = 12;
|
||||
var newline = exports.newline = 10;
|
||||
var tab = exports.tab = 9;
|
||||
|
||||
// Expose aliases primarily for readability.
|
||||
var str = exports.str = singleQuote;
|
||||
|
||||
// No good single character representation!
|
||||
var comment = exports.comment = -1;
|
||||
var word = exports.word = -2;
|
||||
var combinator = exports.combinator = -3;
|
218
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/tokenize.js
generated
vendored
Normal file
218
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/dist/tokenize.js
generated
vendored
Normal file
|
@ -0,0 +1,218 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = tokenize;
|
||||
|
||||
var _tokenTypes = require('./tokenTypes');
|
||||
|
||||
var t = _interopRequireWildcard(_tokenTypes);
|
||||
|
||||
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)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
var wordEnd = /[ \n\t\r\(\)\*:;!&'"\+\|~>,=$^\[\]\\]|\/(?=\*)/g;
|
||||
|
||||
function tokenize(input) {
|
||||
var tokens = [];
|
||||
var css = input.css.valueOf();
|
||||
var _css = css,
|
||||
length = _css.length;
|
||||
|
||||
var offset = -1;
|
||||
var line = 1;
|
||||
var start = 0;
|
||||
var end = 0;
|
||||
|
||||
var code = void 0,
|
||||
content = void 0,
|
||||
endColumn = void 0,
|
||||
endLine = void 0,
|
||||
escaped = void 0,
|
||||
escapePos = void 0,
|
||||
last = void 0,
|
||||
lines = void 0,
|
||||
next = void 0,
|
||||
nextLine = void 0,
|
||||
nextOffset = void 0,
|
||||
quote = void 0,
|
||||
tokenType = void 0;
|
||||
|
||||
function unclosed(what, fix) {
|
||||
if (input.safe) {
|
||||
// fyi: this is never set to true.
|
||||
css += fix;
|
||||
next = css.length - 1;
|
||||
} else {
|
||||
throw input.error('Unclosed ' + what, line, start - offset, start);
|
||||
}
|
||||
}
|
||||
|
||||
while (start < length) {
|
||||
code = css.charCodeAt(start);
|
||||
|
||||
if (code === t.newline) {
|
||||
offset = start;
|
||||
line += 1;
|
||||
}
|
||||
|
||||
switch (code) {
|
||||
case t.newline:
|
||||
case t.space:
|
||||
case t.tab:
|
||||
case t.cr:
|
||||
case t.feed:
|
||||
next = start;
|
||||
do {
|
||||
next += 1;
|
||||
code = css.charCodeAt(next);
|
||||
if (code === t.newline) {
|
||||
offset = next;
|
||||
line += 1;
|
||||
}
|
||||
} while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
|
||||
|
||||
tokenType = t.space;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next;
|
||||
break;
|
||||
|
||||
case t.plus:
|
||||
case t.greaterThan:
|
||||
case t.tilde:
|
||||
case t.pipe:
|
||||
next = start;
|
||||
do {
|
||||
next += 1;
|
||||
code = css.charCodeAt(next);
|
||||
} while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
|
||||
|
||||
tokenType = t.combinator;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next;
|
||||
break;
|
||||
|
||||
// Consume these characters as single tokens.
|
||||
case t.asterisk:
|
||||
case t.ampersand:
|
||||
case t.comma:
|
||||
case t.equals:
|
||||
case t.dollar:
|
||||
case t.caret:
|
||||
case t.openSquare:
|
||||
case t.closeSquare:
|
||||
case t.colon:
|
||||
case t.semicolon:
|
||||
case t.openParenthesis:
|
||||
case t.closeParenthesis:
|
||||
next = start;
|
||||
tokenType = code;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
break;
|
||||
|
||||
case t.singleQuote:
|
||||
case t.doubleQuote:
|
||||
quote = code === t.singleQuote ? "'" : '"';
|
||||
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) {
|
||||
escapePos -= 1;
|
||||
escaped = !escaped;
|
||||
}
|
||||
} while (escaped);
|
||||
|
||||
tokenType = t.str;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
break;
|
||||
|
||||
case t.backslash:
|
||||
next = start;
|
||||
escaped = true;
|
||||
while (css.charCodeAt(next + 1) === t.backslash) {
|
||||
next += 1;
|
||||
escaped = !escaped;
|
||||
}
|
||||
code = css.charCodeAt(next + 1);
|
||||
if (escaped && code !== t.slash && code !== t.space && code !== t.newline && code !== t.tab && code !== t.cr && code !== t.feed) {
|
||||
next += 1;
|
||||
}
|
||||
|
||||
tokenType = t.word;
|
||||
endLine = line;
|
||||
endColumn = next - offset;
|
||||
end = next + 1;
|
||||
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) {
|
||||
nextLine = line + last;
|
||||
nextOffset = next - lines[last].length;
|
||||
} else {
|
||||
nextLine = line;
|
||||
nextOffset = offset;
|
||||
}
|
||||
|
||||
tokenType = t.comment;
|
||||
line = nextLine;
|
||||
endLine = nextLine;
|
||||
endColumn = next - nextOffset;
|
||||
} else {
|
||||
wordEnd.lastIndex = start + 1;
|
||||
wordEnd.test(css);
|
||||
if (wordEnd.lastIndex === 0) {
|
||||
next = css.length - 1;
|
||||
} else {
|
||||
next = wordEnd.lastIndex - 2;
|
||||
}
|
||||
|
||||
tokenType = t.word;
|
||||
endLine = line;
|
||||
endColumn = next - offset;
|
||||
}
|
||||
|
||||
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
|
||||
end] // [6] End position
|
||||
);
|
||||
|
||||
// Reset offset for the next token
|
||||
if (nextOffset) {
|
||||
offset = nextOffset;
|
||||
nextOffset = null;
|
||||
}
|
||||
|
||||
start = end;
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
module.exports = exports['default'];
|
76
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/package.json
generated
vendored
Normal file
76
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/package.json
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"name": "postcss-selector-parser",
|
||||
"version": "3.1.2",
|
||||
"devDependencies": {
|
||||
"ava": "^0.20.0",
|
||||
"babel-cli": "^6.4.0",
|
||||
"babel-core": "^6.4.0",
|
||||
"babel-plugin-add-module-exports": "^0.2.0",
|
||||
"babel-plugin-precompile-charcodes": "^1.0.0",
|
||||
"babel-preset-es2015": "^6.3.13",
|
||||
"babel-preset-es2015-loose": "^7.0.0",
|
||||
"babel-preset-stage-0": "^6.3.13",
|
||||
"babel-register": "^6.9.0",
|
||||
"coveralls": "^2.11.6",
|
||||
"del-cli": "^0.2.0",
|
||||
"eslint": "^3.0.0",
|
||||
"eslint-config-cssnano": "^3.0.0",
|
||||
"eslint-plugin-babel": "^3.3.0",
|
||||
"eslint-plugin-import": "^1.10.2",
|
||||
"glob": "^7.0.3",
|
||||
"minimist": "^1.2.0",
|
||||
"nyc": "^10.0.0",
|
||||
"postcss": "^6.0.6"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "postcss-selector-parser.d.ts",
|
||||
"files": [
|
||||
"API.md",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE-MIT",
|
||||
"dist",
|
||||
"postcss-selector-parser.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"pretest": "eslint src",
|
||||
"prepublish": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
|
||||
"report": "nyc report --reporter=html",
|
||||
"test": "nyc ava src/__tests__/*.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"dot-prop": "^5.2.0",
|
||||
"indexes-of": "^1.0.1",
|
||||
"uniq": "^1.0.1"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"homepage": "https://github.com/postcss/postcss-selector-parser",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Ben Briggs",
|
||||
"email": "beneb.info@gmail.com",
|
||||
"url": "http://beneb.info"
|
||||
},
|
||||
{
|
||||
"name": "Chris Eppstein",
|
||||
"email": "chris@eppsteins.net",
|
||||
"url": "http://twitter.com/chriseppstein"
|
||||
}
|
||||
],
|
||||
"repository": "postcss/postcss-selector-parser",
|
||||
"ava": {
|
||||
"require": "babel-register",
|
||||
"concurrency": 5
|
||||
},
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/__tests__"
|
||||
]
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "cssnano"
|
||||
}
|
||||
}
|
388
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/postcss-selector-parser.d.ts
generated
vendored
Normal file
388
web/node_modules/postcss-minify-selectors/node_modules/postcss-selector-parser/postcss-selector-parser.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,388 @@
|
|||
// Type definitions for postcss-selector-parser 2.2.3
|
||||
// Definitions by: Chris Eppstein <chris@eppsteins.net>
|
||||
|
||||
/*~ Note that ES6 modules cannot directly export callable functions.
|
||||
*~ This file should be imported using the CommonJS-style:
|
||||
*~ import x = require('someLibrary');
|
||||
*~
|
||||
*~ Refer to the documentation to understand common
|
||||
*~ workarounds for this limitation of ES6 modules.
|
||||
*/
|
||||
|
||||
/*~ This declaration specifies that the function
|
||||
*~ is the exported object from the file
|
||||
*/
|
||||
export = parser;
|
||||
|
||||
declare function parser(): parser.Processor<never>;
|
||||
declare function parser<Transform extends any>(processor: parser.AsyncProcessor<Transform>): parser.Processor<Transform, never>;
|
||||
declare function parser(processor: parser.AsyncProcessor): parser.Processor<never>;
|
||||
declare function parser<Transform extends any>(processor: parser.SyncProcessor<Transform>): parser.Processor<Transform, never>;
|
||||
declare function parser(processor: parser.SyncProcessor): parser.Processor<never>;
|
||||
declare function parser<Transform>(processor?: parser.SyncProcessor<Transform> | parser.AsyncProcessor<Transform>): parser.Processor<Transform>;
|
||||
|
||||
/*~ If you want to expose types from your module as well, you can
|
||||
*~ place them in this block. Often you will want to describe the
|
||||
*~ shape of the return type of the function; that type should
|
||||
*~ be declared in here, as this example shows.
|
||||
*/
|
||||
declare namespace parser {
|
||||
/* copied from postcss -- so we don't need to add a dependency */
|
||||
type ErrorOptions = {
|
||||
plugin?: string;
|
||||
word?: string;
|
||||
index?: number
|
||||
};
|
||||
/* the bits we use of postcss.Rule, copied from postcss -- so we don't need to add a dependency */
|
||||
type PostCSSRuleNode = {
|
||||
selector: string
|
||||
/**
|
||||
* @returns postcss.CssSyntaxError but it's a complex object, caller
|
||||
* should cast to it if they have a dependency on postcss.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): Error;
|
||||
};
|
||||
/** Accepts a string */
|
||||
type Selectors = string | PostCSSRuleNode
|
||||
type SyncProcessor<Transform = void> = (root: parser.Root) => Transform
|
||||
type AsyncProcessor<Transform = void> = (root: parser.Root) => Transform | PromiseLike<Transform>
|
||||
|
||||
const TAG: "tag";
|
||||
const STRING: "string";
|
||||
const SELECTOR: "selector";
|
||||
const ROOT: "root";
|
||||
const PSEUDO: "pseudo";
|
||||
const NESTING: "nesting";
|
||||
const ID: "id";
|
||||
const COMMENT: "comment";
|
||||
const COMBINATOR: "combinator";
|
||||
const CLASS: "class";
|
||||
const ATTRIBUTE: "attribute";
|
||||
const UNIVERSAL: "universal";
|
||||
|
||||
interface NodeTypes {
|
||||
tag: Tag,
|
||||
string: String,
|
||||
selector: Selector,
|
||||
root: Root,
|
||||
pseudo: Pseudo,
|
||||
nesting: Nesting,
|
||||
id: Identifier,
|
||||
comment: Comment,
|
||||
combinator: Combinator,
|
||||
class: ClassName,
|
||||
attribute: Attribute,
|
||||
universal: Universal
|
||||
}
|
||||
|
||||
type Node = NodeTypes[keyof NodeTypes];
|
||||
|
||||
function isNode(node: any): node is Node;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Preserve whitespace when true. Default: false;
|
||||
*/
|
||||
lossless: boolean;
|
||||
/**
|
||||
* When true and a postcss.Rule is passed, set the result of
|
||||
* processing back onto the rule when done. Default: false.
|
||||
*/
|
||||
updateSelector: boolean;
|
||||
}
|
||||
class Processor<
|
||||
TransformType = never,
|
||||
SyncSelectorsType extends Selectors | never = Selectors
|
||||
> {
|
||||
res: Root;
|
||||
readonly result: String;
|
||||
ast(selectors: Selectors, options?: Partial<Options>): Promise<Root>;
|
||||
astSync(selectors: SyncSelectorsType, options?: Partial<Options>): Root;
|
||||
transform(selectors: Selectors, options?: Partial<Options>): Promise<TransformType>;
|
||||
transformSync(selectors: SyncSelectorsType, options?: Partial<Options>): TransformType;
|
||||
process(selectors: Selectors, options?: Partial<Options>): Promise<string>;
|
||||
processSync(selectors: SyncSelectorsType, options?: Partial<Options>): string;
|
||||
}
|
||||
interface ParserOptions {
|
||||
css: string;
|
||||
error: (message: string, options: ErrorOptions) => Error;
|
||||
options: Options;
|
||||
}
|
||||
class Parser {
|
||||
input: ParserOptions;
|
||||
lossy: boolean;
|
||||
position: number;
|
||||
root: Root;
|
||||
selectors: string;
|
||||
current: Selector;
|
||||
constructor(input: ParserOptions);
|
||||
/**
|
||||
* Raises an error, if the processor is invoked on
|
||||
* a postcss Rule node, a better error message is raised.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): void;
|
||||
}
|
||||
interface NodeSource {
|
||||
start?: {
|
||||
line: number,
|
||||
column: number
|
||||
},
|
||||
end?: {
|
||||
line: number,
|
||||
column: number
|
||||
}
|
||||
}
|
||||
interface SpaceAround {
|
||||
before: string;
|
||||
after: string;
|
||||
}
|
||||
interface Spaces extends SpaceAround {
|
||||
[spaceType: string]: string | Partial<SpaceAround> | undefined;
|
||||
}
|
||||
interface NodeOptions<Value = string> {
|
||||
value: Value;
|
||||
spaces?: Partial<Spaces>;
|
||||
source?: NodeSource;
|
||||
sourceIndex?: number;
|
||||
}
|
||||
interface Base<
|
||||
Value extends string | undefined = string,
|
||||
ParentType extends Container | undefined = Container | undefined
|
||||
> {
|
||||
type: keyof NodeTypes;
|
||||
parent: ParentType;
|
||||
value: Value;
|
||||
spaces: Spaces;
|
||||
source?: NodeSource;
|
||||
sourceIndex: number;
|
||||
remove(): Node;
|
||||
replaceWith(...nodes: Node[]): Node;
|
||||
next(): Node;
|
||||
prev(): Node;
|
||||
clone(opts: {[override: string]:any}): Node;
|
||||
toString(): string;
|
||||
}
|
||||
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;
|
||||
index(child: Node): number;
|
||||
readonly first: Node;
|
||||
readonly last: Node;
|
||||
readonly length: number;
|
||||
removeChild(child: Node): Container;
|
||||
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[];
|
||||
toString(): string;
|
||||
}
|
||||
function isContainer(node: any): node is Root | Selector | Pseudo;
|
||||
|
||||
interface NamespaceOptions<Value extends string | undefined = string> extends NodeOptions<Value> {
|
||||
namespace?: string | true;
|
||||
}
|
||||
interface Namespace<Value extends string | undefined = string> extends Base<Value> {
|
||||
/** alias for namespace */
|
||||
ns: string | true;
|
||||
/**
|
||||
* namespace prefix.
|
||||
*/
|
||||
namespace: string | true;
|
||||
/**
|
||||
* If a namespace exists, prefix the value provided with it, separated by |.
|
||||
*/
|
||||
qualifiedName(value: string): string;
|
||||
/**
|
||||
* A string representing the namespace suitable for output.
|
||||
*/
|
||||
readonly namespaceString: string;
|
||||
}
|
||||
function isNamespace(node: any): node is ClassName | Attribute | Tag;
|
||||
|
||||
interface Root extends Container<undefined> {
|
||||
type: "root";
|
||||
/**
|
||||
* Raises an error, if the processor is invoked on
|
||||
* a postcss Rule node, a better error message is raised.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): Error;
|
||||
}
|
||||
function root(opts: ContainerOptions): Root;
|
||||
function isRoot(node: any): node is Root;
|
||||
|
||||
interface Selector extends Container {
|
||||
type: "selector";
|
||||
}
|
||||
function selector(opts: ContainerOptions): Selector;
|
||||
function isSelector(node: any): node is Selector;
|
||||
|
||||
interface Combinator extends Base {
|
||||
type: "combinator"
|
||||
}
|
||||
function combinator(opts: NodeOptions): Combinator;
|
||||
function isCombinator(node: any): node is Combinator;
|
||||
|
||||
interface ClassName extends Namespace {
|
||||
type: "class";
|
||||
}
|
||||
function className(opts: NamespaceOptions): ClassName;
|
||||
function isClassName(node: any): node is ClassName;
|
||||
|
||||
type AttributeOperator = "=" | "~=" | "|=" | "^=" | "$=" | "*=";
|
||||
interface AttributeOptions extends NamespaceOptions<string | undefined> {
|
||||
attribute: string;
|
||||
operator?: AttributeOperator;
|
||||
insensitive?: boolean;
|
||||
quoted?: boolean;
|
||||
spaces?: {
|
||||
before?: string;
|
||||
after?: string;
|
||||
attribute?: Partial<SpaceAround>;
|
||||
operator?: Partial<SpaceAround>;
|
||||
value?: Partial<SpaceAround>;
|
||||
insensitive?: Partial<SpaceAround>;
|
||||
}
|
||||
raws: {
|
||||
unquoted?: string;
|
||||
attribute?: string;
|
||||
operator?: string;
|
||||
value?: string;
|
||||
insensitive?: string;
|
||||
spaces?: {
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
};
|
||||
}
|
||||
interface Attribute extends Namespace<string | undefined> {
|
||||
type: "attribute";
|
||||
attribute: string;
|
||||
operator?: AttributeOperator;
|
||||
insensitive?: boolean;
|
||||
quoted?: boolean;
|
||||
spaces: {
|
||||
before: string;
|
||||
after: string;
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
raws: {
|
||||
unquoted?: string;
|
||||
attribute?: string;
|
||||
operator?: string;
|
||||
value?: string;
|
||||
insensitive?: string;
|
||||
spaces?: {
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* The attribute name after having been qualified with a namespace.
|
||||
*/
|
||||
readonly qualifiedAttribute: string;
|
||||
/**
|
||||
* returns the offset of the attribute part specified relative to the
|
||||
* start of the node of the output string.
|
||||
*
|
||||
* * "ns" - alias for "namespace"
|
||||
* * "namespace" - the namespace if it exists.
|
||||
* * "attribute" - the attribute name
|
||||
* * "attributeNS" - the start of the attribute or its namespace
|
||||
* * "operator" - the match operator of the attribute
|
||||
* * "value" - The value (string or identifier)
|
||||
* * "insensitive" - the case insensitivity flag;
|
||||
* @param part One of the possible values inside an attribute.
|
||||
* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
|
||||
*/
|
||||
offsetOf(part: "ns" | "namespace" | "attribute" | "attributeNS" | "operator" | "value" | "insensitive"): number;
|
||||
}
|
||||
function attribute(opts: AttributeOptions): Attribute;
|
||||
function isAttribute(node: any): node is Attribute;
|
||||
|
||||
interface Pseudo extends Container {
|
||||
type: "pseudo";
|
||||
}
|
||||
function pseudo(opts: ContainerOptions): Pseudo;
|
||||
/**
|
||||
* Checks wether the node is the Psuedo subtype of node.
|
||||
*/
|
||||
function isPseudo(node: any): node is Pseudo;
|
||||
|
||||
/**
|
||||
* Checks wether the node is, specifically, a pseudo element instead of
|
||||
* pseudo class.
|
||||
*/
|
||||
function isPseudoElement(node: any): node is Pseudo;
|
||||
|
||||
/**
|
||||
* Checks wether the node is, specifically, a pseudo class instead of
|
||||
* pseudo element.
|
||||
*/
|
||||
function isPseudoClass(node: any): node is Pseudo;
|
||||
|
||||
|
||||
interface Tag extends Namespace {
|
||||
type: "tag";
|
||||
}
|
||||
function tag(opts: NamespaceOptions): Tag;
|
||||
function isTag(node: any): node is Tag;
|
||||
|
||||
interface Comment extends Base {
|
||||
type: "comment";
|
||||
}
|
||||
function comment(opts: NodeOptions): Comment;
|
||||
function isComment(node: any): node is Comment;
|
||||
|
||||
interface Identifier extends Base {
|
||||
type: "id";
|
||||
}
|
||||
function id(opts: any): any;
|
||||
function isIdentifier(node: any): node is Identifier;
|
||||
|
||||
interface Nesting extends Base {
|
||||
type: "nesting";
|
||||
}
|
||||
function nesting(opts: any): any;
|
||||
function isNesting(node: any): node is Nesting;
|
||||
|
||||
interface String extends Base {
|
||||
type: "string";
|
||||
}
|
||||
function string(opts: NodeOptions): String;
|
||||
function isString(node: any): node is String;
|
||||
|
||||
interface Universal extends Base {
|
||||
type: "universal";
|
||||
}
|
||||
function universal(opts?: NamespaceOptions): any;
|
||||
function isUniversal(node: any): node is Universal;
|
||||
}
|
46
web/node_modules/postcss-minify-selectors/package.json
generated
vendored
Normal file
46
web/node_modules/postcss-minify-selectors/package.json
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "postcss-minify-selectors",
|
||||
"version": "4.0.2",
|
||||
"description": "Minify selectors with PostCSS.",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
"dist",
|
||||
"LICENSE-MIT"
|
||||
],
|
||||
"scripts": {
|
||||
"prepublish": "cross-env BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/"
|
||||
},
|
||||
"keywords": [
|
||||
"css",
|
||||
"minify",
|
||||
"optimise",
|
||||
"postcss",
|
||||
"postcss-plugin",
|
||||
"selectors"
|
||||
],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.0.0",
|
||||
"cross-env": "^5.0.0",
|
||||
"postcss-font-magician": "^2.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/cssnano/cssnano",
|
||||
"author": {
|
||||
"name": "Ben Briggs",
|
||||
"email": "beneb.info@gmail.com",
|
||||
"url": "http://beneb.info"
|
||||
},
|
||||
"repository": "cssnano/cssnano",
|
||||
"dependencies": {
|
||||
"alphanum-sort": "^1.0.0",
|
||||
"has": "^1.0.0",
|
||||
"postcss": "^7.0.0",
|
||||
"postcss-selector-parser": "^3.0.0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cssnano/cssnano/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue