first commit
This commit is contained in:
28
build/node_modules/postcss-csso/HISTORY.md
generated
vendored
Normal file
28
build/node_modules/postcss-csso/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
## 3.0.0 (October 12, 2017)
|
||||
|
||||
- Migrated to [PostCSS](https://github.com/postcss/postcss) `6.0.0`
|
||||
- Migrated to [CSSO](https://github.com/css/csso) `3.3.0`
|
||||
|
||||
## 2.0.0 (March 14, 2017)
|
||||
|
||||
- Migrate to [CSSO 3.0](https://github.com/css/csso/releases/tag/v3.0.0)
|
||||
|
||||
## 1.1.2 (May 8, 2016)
|
||||
|
||||
- Fix CSS parse error handling (#5)
|
||||
|
||||
## 1.1.1 (April 12, 2016)
|
||||
|
||||
- Fix exception when PostCSS at-rule node has no params (#4)
|
||||
|
||||
## 1.1.0 (April 7, 2016)
|
||||
|
||||
- Migrate to [CSSO 2.0](https://github.com/css/csso/releases/tag/v2.0.0)
|
||||
|
||||
## 1.0.1 (March 19, 2016)
|
||||
|
||||
- Refactoring and minor fixes
|
||||
|
||||
## 1.0.0 (March 16, 2016)
|
||||
|
||||
- Initial release
|
||||
19
build/node_modules/postcss-csso/LICENSE
generated
vendored
Normal file
19
build/node_modules/postcss-csso/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (C) 2016 by Roman Dvornov
|
||||
|
||||
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.
|
||||
51
build/node_modules/postcss-csso/README.md
generated
vendored
Normal file
51
build/node_modules/postcss-csso/README.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
[](https://www.npmjs.com/package/postcss-csso)
|
||||
[](https://travis-ci.org/lahmatiy/postcss-csso)
|
||||
|
||||
# postcss-csso
|
||||
|
||||
[PostCSS](https://github.com/postcss/postcss) plugin to minify CSS using [CSSO](https://github.com/css/csso).
|
||||
|
||||
Under the hood the plugin converts `PostCSS` AST into `CSSO` format, optimises it and converts back. The plugin uses either input `PostCSS` tree nodes or their clones on reverse convertation. So shape of original `PostCSS` tree nodes persists the same after compression in most cases (e.g. properties added by other plugins isn't lost). Also this allows to generate source map correctly.
|
||||
|
||||
Performance of the plugin is approximately the same as `CSSO` has (see `CSSO` numbers in [comparison table](https://goalsmashers.github.io/css-minification-benchmark/)).
|
||||
|
||||
> If you have any difficulties with the output of this plugin, please use the [CSSO tracker](https://github.com/css/csso/issues).
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install postcss-csso
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var postcss = require('postcss');
|
||||
var csso = require('postcss-csso');
|
||||
|
||||
postcss([
|
||||
csso
|
||||
])
|
||||
.process('.a { color: #FF0000; } .b { color: rgba(255, 0, 0, 1) }')
|
||||
.then(function(result) {
|
||||
console.log(result.css);
|
||||
// .a,.b{color:red}
|
||||
});
|
||||
```
|
||||
|
||||
Plugin accepts the same [options](https://github.com/css/csso#compressast-options) as `compress()` method of CSSO with no any changes.
|
||||
|
||||
```js
|
||||
postcss([
|
||||
csso({ restructure: false })
|
||||
])
|
||||
.process('.a { color: #FF0000; } .b { color: rgba(255, 0, 0, 1) }')
|
||||
.then(function(result) {
|
||||
console.log(result.css);
|
||||
// .a{color:red}.b{color:red}
|
||||
});
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
16
build/node_modules/postcss-csso/index.js
generated
vendored
Normal file
16
build/node_modules/postcss-csso/index.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
var postcss = require('postcss');
|
||||
var compress = require('csso').compress;
|
||||
var postcssToCsso = require('./lib/postcssToCsso.js');
|
||||
var cssoToPostcss = require('./lib/cssoToPostcss.js');
|
||||
|
||||
var postcssCsso = postcss.plugin('postcss-csso', function postcssCsso(options) {
|
||||
return function(root, result) {
|
||||
result.root = cssoToPostcss(compress(postcssToCsso(root), options).ast);
|
||||
};
|
||||
});
|
||||
|
||||
postcssCsso.process = function(css, options) {
|
||||
return postcss([postcssCsso(options)]).process(css);
|
||||
};
|
||||
|
||||
module.exports = postcssCsso;
|
||||
152
build/node_modules/postcss-csso/lib/cssoToPostcss.js
generated
vendored
Normal file
152
build/node_modules/postcss-csso/lib/cssoToPostcss.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
var postcss = require('postcss');
|
||||
var translate = require('csso').syntax.translate;
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
var DEFAULT_RAWS = {
|
||||
before: '',
|
||||
after: '',
|
||||
between: '',
|
||||
semicolon: false,
|
||||
left: '',
|
||||
right: ''
|
||||
};
|
||||
var ROOT_RAWS = {
|
||||
semicolon: true
|
||||
};
|
||||
var DECL_RAWS = {
|
||||
before: '',
|
||||
after: '',
|
||||
between: ':',
|
||||
important: '!important'
|
||||
};
|
||||
|
||||
function clone(source) {
|
||||
var result = Object.create(Object.getPrototypeOf(source));
|
||||
|
||||
for (var key in source) {
|
||||
if (hasOwnProperty.call(source, key)) {
|
||||
result[key] = source[key];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function listToPostcss(list, used) {
|
||||
var result = [];
|
||||
var before = '';
|
||||
|
||||
list.each(function(node) {
|
||||
if (node.type === 'Raw' || node.type === 'Space') {
|
||||
// attach raw and spaces to next node
|
||||
before += node.value;
|
||||
} else {
|
||||
var postcssNode = cssoToPostcss(node, used);
|
||||
|
||||
if (before !== '') {
|
||||
postcssNode.raws = clone(postcssNode.raws);
|
||||
postcssNode.raws.before = before;
|
||||
before = '';
|
||||
}
|
||||
|
||||
result.push(postcssNode);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function cssoToPostcss(node, used) {
|
||||
var postcssNode = node.loc ? node.loc.postcssNode : null;
|
||||
|
||||
if (postcssNode) {
|
||||
// used is null when WeakSet is not supported
|
||||
if (used === null || used.has(postcssNode)) {
|
||||
// make node clone if it's already used in resulting tree
|
||||
postcssNode = clone(postcssNode);
|
||||
} else {
|
||||
used.add(postcssNode);
|
||||
}
|
||||
}
|
||||
|
||||
switch (node.type) {
|
||||
case 'StyleSheet':
|
||||
if (!postcssNode) {
|
||||
postcssNode = postcss.root();
|
||||
}
|
||||
|
||||
postcssNode.raws = ROOT_RAWS;
|
||||
postcssNode.nodes = listToPostcss(node.children, used);
|
||||
|
||||
break;
|
||||
|
||||
case 'Atrule':
|
||||
if (!postcssNode) {
|
||||
postcssNode = postcss.atRule();
|
||||
}
|
||||
|
||||
postcssNode.raws = DEFAULT_RAWS;
|
||||
postcssNode.name = node.name;
|
||||
postcssNode.params = node.prelude ? translate(node.prelude) : '';
|
||||
postcssNode.nodes = node.block ? listToPostcss(node.block.children, used) : undefined;
|
||||
|
||||
break;
|
||||
|
||||
case 'Rule':
|
||||
if (!postcssNode) {
|
||||
postcssNode = postcss.rule();
|
||||
}
|
||||
|
||||
postcssNode.raws = DEFAULT_RAWS;
|
||||
postcssNode.selector = translate(node.prelude);
|
||||
postcssNode.nodes = listToPostcss(node.block.children, used);
|
||||
|
||||
break;
|
||||
|
||||
case 'Declaration':
|
||||
if (!postcssNode) {
|
||||
postcssNode = postcss.decl();
|
||||
}
|
||||
|
||||
if (typeof node.important === 'string') {
|
||||
postcssNode.raws = clone(DECL_RAWS);
|
||||
postcssNode.raws.important = '!' + node.important;
|
||||
} else {
|
||||
postcssNode.raws = DECL_RAWS;
|
||||
}
|
||||
|
||||
postcssNode.prop = node.property;
|
||||
postcssNode.value = translate(node.value);
|
||||
postcssNode.important = Boolean(node.important);
|
||||
|
||||
break;
|
||||
|
||||
case 'Comment':
|
||||
if (!postcssNode) {
|
||||
postcssNode = postcss.comment();
|
||||
}
|
||||
|
||||
postcssNode.raws = DEFAULT_RAWS;
|
||||
postcssNode.text = node.value;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return postcssNode;
|
||||
};
|
||||
|
||||
module.exports = function(node) {
|
||||
var result;
|
||||
var used = null;
|
||||
|
||||
// node.js 0.10 doesn't support for WeakSet -> always clone nodes
|
||||
if (typeof WeakSet === 'function') {
|
||||
// use weak set to avoid using the same original postcss node twice
|
||||
// in resulting tree, since nodes are changing on tree building
|
||||
used = new WeakSet();
|
||||
}
|
||||
|
||||
result = cssoToPostcss(node, used);
|
||||
|
||||
return result;
|
||||
};
|
||||
87
build/node_modules/postcss-csso/lib/postcssToCsso.js
generated
vendored
Normal file
87
build/node_modules/postcss-csso/lib/postcssToCsso.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
var parse = require('csso').syntax.parse;
|
||||
|
||||
function getInfo(postcssNode) {
|
||||
return {
|
||||
postcssNode: postcssNode
|
||||
};
|
||||
}
|
||||
|
||||
function appendChildren(cssoNode, nodes) {
|
||||
cssoNode.children.fromArray(nodes.map(postcssToCsso));
|
||||
return cssoNode;
|
||||
}
|
||||
|
||||
function parseToCsso(css, config, postcssNode) {
|
||||
var cssoNode;
|
||||
|
||||
try {
|
||||
cssoNode = parse(css || '', config);
|
||||
} catch (e) {
|
||||
if (e.name === 'CssSyntaxError') {
|
||||
throw postcssNode.error(e.message, { index: e.offset });
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
cssoNode.loc = getInfo(postcssNode);
|
||||
|
||||
return cssoNode;
|
||||
}
|
||||
|
||||
function postcssToCsso(node) {
|
||||
switch (node.type) {
|
||||
case 'root':
|
||||
return appendChildren(
|
||||
parseToCsso('', { context: 'stylesheet' }, node),
|
||||
node.nodes
|
||||
);
|
||||
|
||||
case 'rule':
|
||||
return {
|
||||
type: 'Rule',
|
||||
loc: getInfo(node),
|
||||
prelude: parseToCsso(node.selector, { context: 'selectorList' }, node),
|
||||
block: appendChildren(
|
||||
parseToCsso('{}', { context: 'block' }, node),
|
||||
node.nodes
|
||||
)
|
||||
};
|
||||
|
||||
case 'atrule':
|
||||
var cssoNode = {
|
||||
type: 'Atrule',
|
||||
loc: getInfo(node),
|
||||
name: node.name,
|
||||
prelude: node.params
|
||||
? parseToCsso(node.params, { context: 'atrulePrelude', atrule: node.name }, node)
|
||||
: null,
|
||||
block: null
|
||||
};
|
||||
|
||||
if (node.nodes) {
|
||||
cssoNode.block = appendChildren(
|
||||
parseToCsso('{}', { context: 'block' }, node),
|
||||
node.nodes
|
||||
);
|
||||
}
|
||||
|
||||
return cssoNode;
|
||||
|
||||
case 'decl':
|
||||
return parseToCsso(
|
||||
(node.raws.before || '').trimLeft() + node.toString(),
|
||||
{ context: 'declaration' },
|
||||
node
|
||||
);
|
||||
|
||||
case 'comment':
|
||||
return {
|
||||
type: 'Comment',
|
||||
loc: getInfo(node),
|
||||
value: node.raws.left + node.text + node.raws.right
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = postcssToCsso;
|
||||
363
build/node_modules/postcss-csso/node_modules/csso/HISTORY.md
generated
vendored
Normal file
363
build/node_modules/postcss-csso/node_modules/csso/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,363 @@
|
||||
## 3.3.1 (October 17, 2017)
|
||||
|
||||
- Fixed merge of `position` declarations when `sticky` fallback is using (@gruzzilkin, #356)
|
||||
|
||||
## 3.3.0 (October 12, 2017)
|
||||
|
||||
- Migrated to [CSSTree](https://github.com/csstree/csstree) `1.0.0-alpha25`
|
||||
- Changed AST format (see [CSSTree change log](https://github.com/csstree/csstree/blob/master/HISTORY.md) for details)
|
||||
- Fixed performance issue when generate CSS with source map (quadratic increase in time depending on the size of the CSS)
|
||||
|
||||
## 3.2.0 (September 10, 2017)
|
||||
|
||||
- Fixed named color compression to apply only when an identifier is guaranteed to be a color
|
||||
- Added lifting of `@keyframes` to the beginning of style sheet (chunk), but after `@charset` and `@import` rules
|
||||
- Added removal of `@keyframes`, `@media` and `@supports` with no prelude
|
||||
- Added removal of duplicate `@keyframes` (#202)
|
||||
- Added new option `forceMediaMerge` to force media rules merging. It's unsafe in general, but works fine in many cases. Use it on your own risk (#350)
|
||||
- Bumped `CSSTree` to `1.0.0-alpha23`
|
||||
|
||||
## 3.1.1 (April 25, 2017)
|
||||
|
||||
- Fixed crash on a number processing when it used not in a list (#335)
|
||||
|
||||
## 3.1.0 (April 24, 2017)
|
||||
|
||||
- Implemented optimisation for `none` keyword in `border` and `outline` properties (@zoobestik, #41)
|
||||
- Implemented replacing `rgba(x, x, x, 0)` to `transparent`
|
||||
- Fixed plus sign omitting for numbers following identifier, hex color, number or unicode range, since it can change the meaning of CSS (e.g. `calc(1px+2px)` has been optimized to `calc(1px2px)` before, now it stays the same)
|
||||
- Improved usage filtering for nested selectors (i.e. for `:nth-*()`, `:has()`, `:matches` and other pseudos)
|
||||
- Implemented `blacklist` filtering in usage (#334, see [Black list filtering](https://github.com/css/csso#black-list-filtering))
|
||||
- Improved white space removing, now white spaces are removing in the beginning and at the ending of sequences, and between stylesheet and block nodes
|
||||
- Bumped `CSSTree` to `1.0.0-alpha19`
|
||||
|
||||
## 3.0.1 (March 14, 2017)
|
||||
|
||||
- Fixed declaration merging when declaration contains an `!important`
|
||||
|
||||
## 3.0.0 (March 13, 2017)
|
||||
|
||||
- Migrated to [CSSTree](https://github.com/csstree/csstree) as AST backend and exposed its API behind `syntax` property
|
||||
- Extracted CLI into standalone package [css/csso-cli](https://github.com/css/csso-cli)
|
||||
|
||||
## 2.3.1 (January 6, 2017)
|
||||
|
||||
- Added `\0` IE hack support (#320)
|
||||
|
||||
## 2.3.0 (October 25, 2016)
|
||||
|
||||
- Added `beforeCompress` and `afterCompress` options support (#316)
|
||||
- Fixed crash on empty argument in function (#317)
|
||||
|
||||
## 2.2.1 (July 25, 2016)
|
||||
|
||||
- Fixed shorthand optimisation issue when value has a color value or something unknown (#311)
|
||||
- Fixed `cursor` broken fallback (#306)
|
||||
|
||||
## 2.2.0 (June 23, 2016)
|
||||
|
||||
- Implement AST cloning by adding `clone()` [function](https://github.com/css/csso#cloneast) and `clone` [option](https://github.com/css/csso#compressast-options) for `compress()` function (#296)
|
||||
- Fix parse and translate attribute selector with flags but w/o operator (i.e. `[attrName i]`)
|
||||
- Don't merge rules with flagged attribute selectors with others (#291)
|
||||
- Take in account functions when merge TRBL-properties (#297, thanks to @ArturAralin)
|
||||
- Improve partial merge (#304)
|
||||
- Tweak scanner, reduce code deoptimizations and other small improvements
|
||||
|
||||
## 2.1.1 (May 11, 2016)
|
||||
|
||||
- Fix wrong declaration with `\9` hack merge (#295)
|
||||
|
||||
## 2.1.0 (May 8, 2016)
|
||||
|
||||
- New option `comments` to specify what comments to left: `exclamation`, `first-exclamation` and `none`
|
||||
- Add `offset` to CSS parse error details
|
||||
- Fix token `offset` computation
|
||||
|
||||
## 2.0.0 (April 5, 2016)
|
||||
|
||||
- No more `gonzales` AST format and related code
|
||||
- `minify()` and `minifyBlock()` is always return an object as result now (i.e. `{ css: String, map: SourceMapGenerator or null }`)
|
||||
- `parse()`
|
||||
- Returns AST in new format (so called `internal`)
|
||||
- Dynamic scanner implemented
|
||||
- New AST format + dynamic scanner = performance boost and less memory consumption
|
||||
- No more `context` argument, context should be specified via `options`
|
||||
- Supported contexts now: `stylesheet`, `atrule`, `atruleExpression`, `ruleset`, `selector`, `simpleSelector`, `block`, `declaration` and `value`
|
||||
- Drop `needPositions` option, `positions` option should be used instead
|
||||
- Drop `needInfo` option, `info` object is attaching to nodes when some information is requested by `options`
|
||||
- `options` should be an object, otherwise it treats as empty object
|
||||
- `compress()`
|
||||
- No more AST converting (performance boost and less memory consumption)
|
||||
- Drop `outputAst` option
|
||||
- Returns an object as result instead of AST (i.e. `{ ast: Object }`)
|
||||
- Drop methods: `justDoIt()`, `stringify()`, `cleanInfo()`
|
||||
|
||||
## 1.8.1 (March 30, 2016)
|
||||
|
||||
- Don't remove spaces after function/braces/urls since unsafe (#289)
|
||||
|
||||
## 1.8.0 (March 24, 2016)
|
||||
|
||||
- Usage data support:
|
||||
- Filter rulesets by tag names, class names and ids white lists.
|
||||
- More aggressive ruleset moving using class name scopes information.
|
||||
- New CLI option `--usage` to pass usage data file.
|
||||
- Improve initial ruleset merge
|
||||
- Change order of ruleset processing, now it's left to right. Previously unmerged rulesets may prevent lookup and other rulesets merge.
|
||||
- Difference in pseudo signature just prevents ruleset merging, but don't stop lookup.
|
||||
- Simplify block comparison (performance).
|
||||
- New method `csso.minifyBlock()` for css block compression (e.g. `style` attribute content).
|
||||
- Ruleset merge improvement: at-rules with block (like `@media` or `@supports`) now can be skipped during ruleset merge lookup if doesn't contain something prevents it.
|
||||
- FIX: Add negation (`:not()`) to pseudo signature to avoid unsafe merge (old browsers doesn't support it).
|
||||
- FIX: Check nested parts of value when compute compatibility. It fixes unsafe property merging.
|
||||
|
||||
## 1.7.1 (March 16, 2016)
|
||||
|
||||
- pass block mode to tokenizer for correct parsing of declarations properties with `//` hack
|
||||
- fix wrongly `@import` and `@charset` removal on double exclamation comment
|
||||
|
||||
## 1.7.0 (March 10, 2016)
|
||||
|
||||
- support for [CSS Custom Properties](https://www.w3.org/TR/css-variables/) (#279)
|
||||
- rework RTBL properties merge – better merge for values with special units and don't merge values with CSS-wide keywords (#255)
|
||||
- remove redundant universal selectors (#178)
|
||||
- take in account `!important` when check for property overriding (#280)
|
||||
- don't merge `text-align` declarations with some values (#281)
|
||||
- add spaces around `/deep/` combinator on translate, since it together with universal selector can produce a comment
|
||||
- better keyword and property name resolving (tolerant to hacks and so on)
|
||||
- integration improvements
|
||||
- compression log function could be customized by `logger` option for `compress()` and `minify()`
|
||||
- make possible to set initial line and column for parser
|
||||
|
||||
## 1.6.4 (March 1, 2016)
|
||||
|
||||
- `npm` publish issue (#276)
|
||||
|
||||
## 1.6.3 (February 29, 2016)
|
||||
|
||||
- add `file` to generated source map since other tools can relay on it in source map transform chain
|
||||
|
||||
## 1.6.2 (February 29, 2016)
|
||||
|
||||
- tweak some parse error messages and their positions
|
||||
- fix `:not()` parsing and selector groups in `:not()` is supported now (#215)
|
||||
- `needPosition` parser option is deprecated, `positions` option should be used instead (`needPosition` is used still if `positions` option omitted)
|
||||
- expose internal AST API as `csso.internal.*`
|
||||
- `minify()` adds `sourcesContent` by default when source map is generated
|
||||
- bring back support for node.js `0.10` until major release (#275)
|
||||
|
||||
## 1.6.1 (February 28, 2016)
|
||||
|
||||
- fix exception on zero length dimension compress outside declaration (#273)
|
||||
|
||||
## 1.6.0 (February 27, 2016)
|
||||
|
||||
- **source maps support**
|
||||
- parser remake:
|
||||
- various parsing issues fixed
|
||||
- fix unicode sequence processing in ident (#191)
|
||||
- support for flags in attribute selector (#270)
|
||||
- position (line and column) of parse error (#109)
|
||||
- 4x performance boost, less memory consumption
|
||||
- compressor refactoring
|
||||
- internal AST is using doubly linked lists (with safe transformation support during iteration) instead of arrays
|
||||
- rename `restructuring` to `restructure` option for `minify()`/`compress()` (`restructuring` is alias for `restructure` now, with lower priority)
|
||||
- unquote urls when possible (#141, #60)
|
||||
- setup code coverage and a number of related fixes
|
||||
- add eslint to check unused things
|
||||
|
||||
## 1.5.4 (January 27, 2016)
|
||||
|
||||
- one more fix (in `restructRuleset` this time) with merge of rulesets when a ruleset with same specificity places between them (#264)
|
||||
- disable partial merge of rulesets in `@keyframes` rulesets (until sure it's correct)
|
||||
|
||||
## 1.5.3 (January 25, 2016)
|
||||
|
||||
- don't override display values with different browser support (#259)
|
||||
- fix publish issue (one of modules leak in development state)
|
||||
|
||||
## 1.5.2 (January 24, 2016)
|
||||
|
||||
- don't merge rulesets if between them a ruleset with same specificity (#264)
|
||||
|
||||
## 1.5.1 (January 14, 2016)
|
||||
|
||||
- ensure `-` is not used as an identifier in attribute selectors (thanks to @mathiasbynens)
|
||||
- fix broken `justDoIt()` function
|
||||
- various small fixes
|
||||
|
||||
## 1.5.0 (January 14, 2016)
|
||||
|
||||
### Parser
|
||||
|
||||
- attach minus to number
|
||||
|
||||
### Compressor
|
||||
|
||||
- split code base into small modules and related refactoring
|
||||
- introduce internal AST format for compressor (`gonzales`→`internal` and `internal`→`gonzales` convertors, walkers, translator)
|
||||
- various optimizations: no snapshots, using caches and indexes
|
||||
- sort selectors, merge selectors in alphabet order
|
||||
- compute selector's specificity
|
||||
- better ruleset restructuring, improve compression of partially equal blocks
|
||||
- better ruleset merge – not only closest but also disjoined by other rulesets when safe
|
||||
- join `@media` with same query
|
||||
- `outputAst` – new option to specify output AST format (`gonzales` by default for backward compatibility)
|
||||
- remove quotes surrounding attribute values in attribute selectors when possible (#73)
|
||||
- replace `from`→`0%` and `100%`→`to` at `@keyframes` (#205)
|
||||
- prevent partial merge of rulesets at `@keyframes` (#80, #197)
|
||||
|
||||
### API
|
||||
|
||||
- walker for `gonzales` AST was implemented
|
||||
|
||||
### CLI
|
||||
|
||||
- new option `--stat` (output stat in `stderr`)
|
||||
- new optional parameter `level` for `--debug` option
|
||||
|
||||
## 1.4.4 (December 10, 2015)
|
||||
|
||||
- prevent removal of spaces after braces that before identifier that breaking at-rules expressions (#258)
|
||||
|
||||
## 1.4.3 (December 4, 2015)
|
||||
|
||||
- fix unicode-range parsing that cause to wrong function detection (#250)
|
||||
|
||||
## 1.4.2 (November 9, 2015)
|
||||
|
||||
- allow spaces between `progid:` and rest part of value for IE's `filter` property as `autoprefixer` generates this kind of code (#249)
|
||||
- fixes for Windows:
|
||||
- correct processing new lines
|
||||
- normalize file content in test suite
|
||||
- fixes to work in strict mode (#252)
|
||||
- init compressor dictionaries for every css block (#248, #251)
|
||||
- bump uglify-js version
|
||||
|
||||
## 1.4.1 (October 20, 2015)
|
||||
|
||||
- allow merge for `display` property (#167, #244)
|
||||
- more accurate `rect` (`clip` property value) merge
|
||||
- fix typo when specifying options in cli (thanks to @Taritsyn)
|
||||
- fix safe unit values merge with keyword values (#244)
|
||||
- fix wrong descendant combinator removal (#246)
|
||||
- build browser version on `prepublish` (thanks to @silentroach)
|
||||
- parser: store whitespaces as single token (performance and reduce memory consumption)
|
||||
- rearrange compress tests layout
|
||||
|
||||
## 1.4 (October 16, 2015)
|
||||
|
||||
Bringing project back to life. Changed files structure, cleaned up and refactored most of sources.
|
||||
|
||||
### Common
|
||||
|
||||
- single code base (no more `src` folder)
|
||||
- build browser version with `browserify` (no more `make`, and `web` folder), browser version is available at `dist/csso-browser.js`
|
||||
- main file is `lib/index.js` now
|
||||
- minimal `node.js` version is `0.12` now
|
||||
- restrict file list to publish on npm (no more useless folders and files in package)
|
||||
- add `jscs` to control code style
|
||||
- automate `gh-pages` update
|
||||
- util functions reworked
|
||||
- translator reworked
|
||||
- test suite reworked
|
||||
- compressor refactored
|
||||
- initial parser refactoring
|
||||
|
||||
### API
|
||||
|
||||
- new method `minify(src, options)`, options:
|
||||
- `restructuring` – if set to `false`, disable structure optimisations (`true` by default)
|
||||
- `debug` - outputs intermediate state of CSS during compression (`false` by default)
|
||||
- deprecate `justDoIt()` method (use `minify` instead)
|
||||
- rename `treeToString()` method to `stringify()`
|
||||
- drop `printTree()` method
|
||||
- AST node info
|
||||
- `column` and `offset` added
|
||||
- `ln` renamed to `line`
|
||||
- fix line counting across multiple files and input with CR LF (#147)
|
||||
|
||||
### CLI
|
||||
|
||||
- completely reworked, use [clap](https://github.com/lahmatiy/clap) to parse argv
|
||||
- add support for input from stdin (#128)
|
||||
- drop undocumented and obsoleted options `--rule` and `--parser` (suppose nobody use it)
|
||||
- drop `-off` alias for `--restructure-off` as incorrect (only one letter options should starts with single `-`)
|
||||
- new option `--debug` that reflecting to `options.debug` for `minify`
|
||||
|
||||
### Parsing and optimizations
|
||||
|
||||
- keep all exclamation comments (#194)
|
||||
- add `/deep/` combinator support (#209)
|
||||
- attribute selector
|
||||
- allow colon in attribute name (#237)
|
||||
- support for namespaces (#233)
|
||||
- color
|
||||
- support all css/html colors
|
||||
- convert `hsla` to `rgba` and `hls` to `rgb`
|
||||
- convert `rgba` with 1 as alpha value to `rgb` (#122)
|
||||
- interpolate `rgb` and `rgba` percentage values to absolute values
|
||||
- replace percentage values in `rgba` for normalized/interpolated values
|
||||
- lowercase hex colors and color names (#169)
|
||||
- fix color minification when hex value replaced for color name (#176)
|
||||
- fit rgb values to 0..255 range (#181)
|
||||
- calc
|
||||
- remove spaces for multiple operator in calc
|
||||
- don't remove units inside calc (#222)
|
||||
- fix wrong white space removal around `+` and `-` (#228)
|
||||
- don't remove units in `flex` property as it could change value meaning (#200)
|
||||
- don't merge `\9` hack values (#231)
|
||||
- merge property values only if they have the same functions (#150, #227)
|
||||
- don't merge property values with some sort of units (#140, #161)
|
||||
- fix `!important` issue for `top-right-bottom-left` properties (#189)
|
||||
- fix `top-right-bottom-left` properties merge (#139, #175)
|
||||
- support for unicode-range (#148)
|
||||
- don't crash on ruleset with no selector (#135)
|
||||
- tolerant to class names that starts with digit (#99, #105)
|
||||
- fix background compressing (#170)
|
||||
|
||||
## 1.3.12 (October 8, 2015)
|
||||
|
||||
- Case insensitive check for `!important` (#187)
|
||||
- Fix problems with using `csso` as cli command on Windows (#83, #136, #142 and others)
|
||||
- Remove byte order marker (the UTF-8 BOM) from input
|
||||
- Don't strip space between funktion-funktion and funktion-vhash (#134)
|
||||
- Don't merge TRBL values having \9 (hack for IE8 in bootstrap) (#159, #214, #230, #231 and others)
|
||||
- Don't strip units off dimensions of non-length (#226, #229 and others)
|
||||
|
||||
## 1.3.7 (February 11, 2013)
|
||||
|
||||
- Gonzales 1.0.7.
|
||||
|
||||
## 1.3.6 (November 26, 2012)
|
||||
|
||||
- Gonzales 1.0.6.
|
||||
|
||||
## 1.3.5 (October 28, 2012)
|
||||
|
||||
- Gonzales 1.0.5.
|
||||
- Protecting copyright notices in CSS: https://github.com/css/csso/issues/92
|
||||
- Zero CSS throws an error: https://github.com/css/csso/issues/96
|
||||
- Don't minify the second `0s` in Firefox for animations: https://github.com/css/csso/issues/100
|
||||
- Japan manual
|
||||
- BEM ready documentation
|
||||
|
||||
## 1.3.4 (October 10, 2012)
|
||||
|
||||
- @page inside @media Causes Error: https://github.com/css/csso/issues/90
|
||||
|
||||
## 1.3.3 (October 9, 2012)
|
||||
|
||||
- CSSO 1.3.2 compresses ".t-1" and ".t-01" as identical classes: https://github.com/css/csso/issues/88
|
||||
|
||||
## 1.3.2 (October 8, 2012)
|
||||
|
||||
- filter + important breaks CSSO v1.3.1: https://github.com/css/csso/issues/87
|
||||
|
||||
## 1.3.1 (October 8, 2012)
|
||||
|
||||
- "filter" IE property breaks CSSO v1.3.0: https://github.com/css/csso/issues/86
|
||||
|
||||
## 1.3.0 (October 4, 2012)
|
||||
|
||||
- PeCode CSS parser replaced by Gonzales CSS parser
|
||||
19
build/node_modules/postcss-csso/node_modules/csso/LICENSE
generated
vendored
Normal file
19
build/node_modules/postcss-csso/node_modules/csso/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (C) 2011-2017 by Sergey Kryzhanovsky
|
||||
|
||||
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.
|
||||
376
build/node_modules/postcss-csso/node_modules/csso/README.md
generated
vendored
Normal file
376
build/node_modules/postcss-csso/node_modules/csso/README.md
generated
vendored
Normal file
@@ -0,0 +1,376 @@
|
||||
[](https://www.npmjs.com/package/csso)
|
||||
[](https://travis-ci.org/css/csso)
|
||||
[](https://coveralls.io/github/css/csso?branch=master)
|
||||
[](https://www.npmjs.com/package/csso)
|
||||
[](https://twitter.com/cssoptimizer)
|
||||
|
||||
CSSO (CSS Optimizer) is a CSS minifier. It performs three sort of transformations: cleaning (removing redundant), compression (replacement for shorter form) and restructuring (merge of declarations, rulesets and so on). As a result your CSS becomes much smaller.
|
||||
|
||||
[](https://www.yandex.com/)
|
||||
[](https://www.avito.ru/)
|
||||
|
||||
## Ready to use
|
||||
|
||||
- [Web interface](http://css.github.io/csso/csso.html)
|
||||
- [csso-cli](https://github.com/css/csso-cli) – command line interface
|
||||
- [gulp-csso](https://github.com/ben-eb/gulp-csso) – `Gulp` plugin
|
||||
- [grunt-csso](https://github.com/t32k/grunt-csso) – `Grunt` plugin
|
||||
- [broccoli-csso](https://github.com/sindresorhus/broccoli-csso) – `Broccoli` plugin
|
||||
- [postcss-csso](https://github.com/lahmatiy/postcss-csso) – `PostCSS` plugin
|
||||
- [csso-loader](https://github.com/sandark7/csso-loader) – `webpack` loader
|
||||
- [csso-webpack-plugin](https://github.com/zoobestik/csso-webpack-plugin) – `webpack` plugin
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install csso
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
<!-- MarkdownTOC -->
|
||||
|
||||
- [minify\(source\[, options\]\)](#minifysource-options)
|
||||
- [minifyBlock\(source\[, options\]\)](#minifyblocksource-options)
|
||||
- [compress\(ast\[, options\]\)](#compressast-options)
|
||||
- [Source maps](#source-maps)
|
||||
- [Usage data](#usage-data)
|
||||
- [White list filtering](#white-list-filtering)
|
||||
- [Black list filtering](#black-list-filtering)
|
||||
- [Scopes](#scopes)
|
||||
- [Debugging](#debugging)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
Basic usage:
|
||||
|
||||
```js
|
||||
var csso = require('csso');
|
||||
|
||||
var minifiedCss = csso.minify('.test { color: #ff0000; }').css;
|
||||
|
||||
console.log(minifiedCss);
|
||||
// .test{color:red}
|
||||
```
|
||||
|
||||
CSSO is based on [CSSTree](https://github.com/csstree/csstree) to parse CSS into AST, AST traversal and to generate AST back to CSS. All `CSSTree` API is available behind `syntax` field. You may minify CSS step by step:
|
||||
|
||||
```js
|
||||
var csso = require('csso');
|
||||
var ast = csso.syntax.parse('.test { color: #ff0000; }');
|
||||
var compressedAst = csso.compress(ast).ast;
|
||||
var minifiedCss = csso.syntax.translate(compressedAst);
|
||||
|
||||
console.log(minifiedCss);
|
||||
// .test{color:red}
|
||||
```
|
||||
|
||||
> Warning: CSSO uses early versions of CSSTree that still in active development. CSSO doesn't guarantee API behind `syntax` field or AST format will not change in future releases of CSSO, since it's subject to change in CSSTree. Be carefull with CSSO updates if you use `syntax` API until this warning removal.
|
||||
|
||||
### minify(source[, options])
|
||||
|
||||
Minify `source` CSS passed as `String`.
|
||||
|
||||
```js
|
||||
var result = csso.minify('.test { color: #ff0000; }', {
|
||||
restructure: false, // don't change CSS structure, i.e. don't merge declarations, rulesets etc
|
||||
debug: true // show additional debug information:
|
||||
// true or number from 1 to 3 (greater number - more details)
|
||||
});
|
||||
|
||||
console.log(result.css);
|
||||
// > .test{color:red}
|
||||
```
|
||||
|
||||
Returns an object with properties:
|
||||
|
||||
- css `String` – resulting CSS
|
||||
- map `Object` – instance of [`SourceMapGenerator`](https://github.com/mozilla/source-map#sourcemapgenerator) or `null`
|
||||
|
||||
Options:
|
||||
|
||||
- sourceMap
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Generate a source map when `true`.
|
||||
|
||||
- filename
|
||||
|
||||
Type: `String`
|
||||
Default: `'<unknown>'`
|
||||
|
||||
Filename of input CSS, uses for source map generation.
|
||||
|
||||
- debug
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Output debug information to `stderr`.
|
||||
|
||||
- beforeCompress
|
||||
|
||||
Type: `function(ast, options)` or `Array<function(ast, options)>` or `null`
|
||||
Default: `null`
|
||||
|
||||
Called right after parse is run.
|
||||
|
||||
- afterCompress
|
||||
|
||||
Type: `function(compressResult, options)` or `Array<function(compressResult, options)>` or `null`
|
||||
Default: `null`
|
||||
|
||||
Called right after [`compress()`](#compressast-options) is run.
|
||||
|
||||
- Other options are the same as for [`compress()`](#compressast-options) function.
|
||||
|
||||
### minifyBlock(source[, options])
|
||||
|
||||
The same as `minify()` but for list of declarations. Usually it's a `style` attribute value.
|
||||
|
||||
```js
|
||||
var result = csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000');
|
||||
|
||||
console.log(result.css);
|
||||
// > color:red
|
||||
```
|
||||
|
||||
### compress(ast[, options])
|
||||
|
||||
Does the main task – compress an AST.
|
||||
|
||||
> NOTE: `compress()` performs AST compression by transforming input AST by default (since AST cloning is expensive and needed in rare cases). Use `clone` option with truthy value in case you want to keep input AST untouched.
|
||||
|
||||
Returns an object with properties:
|
||||
|
||||
- ast `Object` – resulting AST
|
||||
|
||||
Options:
|
||||
|
||||
- restructure
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `true`
|
||||
|
||||
Disable or enable a structure optimisations.
|
||||
|
||||
- forceMediaMerge
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Enables merging of `@media` rules with the same media query by splitted by other rules. The optimisation is unsafe in general, but should work fine in most cases. Use it on your own risk.
|
||||
|
||||
- clone
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
Transform a copy of input AST if `true`. Useful in case of AST reuse.
|
||||
|
||||
- comments
|
||||
|
||||
Type: `String` or `Boolean`
|
||||
Default: `true`
|
||||
|
||||
Specify what comments to left:
|
||||
|
||||
- `'exclamation'` or `true` – left all exclamation comments (i.e. `/*! .. */`)
|
||||
- `'first-exclamation'` – remove every comments except first one
|
||||
- `false` – remove every comments
|
||||
|
||||
- usage
|
||||
|
||||
Type: `Object` or `null`
|
||||
Default: `null`
|
||||
|
||||
Usage data for advanced optimisations (see [Usage data](#usage-data) for details)
|
||||
|
||||
- logger
|
||||
|
||||
Type: `Function` or `null`
|
||||
Default: `null`
|
||||
|
||||
Function to track every step of transformation.
|
||||
|
||||
### Source maps
|
||||
|
||||
To get a source map set `true` for `sourceMap` option. Additianaly `filename` option can be passed to specify source file. When `sourceMap` option is `true`, `map` field of result object will contain a [`SourceMapGenerator`](https://github.com/mozilla/source-map#sourcemapgenerator) instance. This object can be mixed with another source map or translated to string.
|
||||
|
||||
```js
|
||||
var csso = require('csso');
|
||||
var css = fs.readFileSync('path/to/my.css', 'utf8');
|
||||
var result = csso.minify(css, {
|
||||
filename: 'path/to/my.css', // will be added to source map as reference to source file
|
||||
sourceMap: true // generate source map
|
||||
});
|
||||
|
||||
console.log(result);
|
||||
// { css: '...minified...', map: SourceMapGenerator {} }
|
||||
|
||||
console.log(result.map.toString());
|
||||
// '{ .. source map content .. }'
|
||||
```
|
||||
|
||||
Example of generating source map with respect of source map from input CSS:
|
||||
|
||||
```js
|
||||
var require('source-map');
|
||||
var csso = require('csso');
|
||||
var inputFile = 'path/to/my.css';
|
||||
var input = fs.readFileSync(inputFile, 'utf8');
|
||||
var inputMap = input.match(/\/\*# sourceMappingURL=(\S+)\s*\*\/\s*$/);
|
||||
var output = csso.minify(input, {
|
||||
filename: inputFile,
|
||||
sourceMap: true
|
||||
});
|
||||
|
||||
// apply input source map to output
|
||||
if (inputMap) {
|
||||
output.map.applySourceMap(
|
||||
new SourceMapConsumer(inputMap[1]),
|
||||
inputFile
|
||||
)
|
||||
}
|
||||
|
||||
// result CSS with source map
|
||||
console.log(
|
||||
output.css +
|
||||
'/*# sourceMappingURL=data:application/json;base64,' +
|
||||
new Buffer(output.map.toString()).toString('base64') +
|
||||
' */'
|
||||
);
|
||||
```
|
||||
|
||||
### Usage data
|
||||
|
||||
`CSSO` can use data about how `CSS` is used in a markup for better compression. File with this data (`JSON`) can be set using `usage` option. Usage data may contain following sections:
|
||||
|
||||
- `blacklist` – a set of black lists (see [Black list filtering](#black-list-filtering))
|
||||
- `tags` – white list of tags
|
||||
- `ids` – white list of ids
|
||||
- `classes` – white list of classes
|
||||
- `scopes` – groups of classes which never used with classes from other groups on the same element
|
||||
|
||||
All sections are optional. Value of `tags`, `ids` and `classes` should be an array of a string, value of `scopes` should be an array of arrays of strings. Other values are ignoring.
|
||||
|
||||
#### White list filtering
|
||||
|
||||
`tags`, `ids` and `classes` are using on clean stage to filter selectors that contain something not in the lists. Selectors are filtering only by those kind of simple selector which white list is specified. For example, if only `tags` list is specified then type selectors are checking, and if all type selectors in selector present in list or selector has no any type selector it isn't filter.
|
||||
|
||||
> `ids` and `classes` are case sensitive, `tags` – is not.
|
||||
|
||||
Input CSS:
|
||||
|
||||
```css
|
||||
* { color: green; }
|
||||
ul, ol, li { color: blue; }
|
||||
UL.foo, span.bar { color: red; }
|
||||
```
|
||||
|
||||
Usage data:
|
||||
|
||||
```json
|
||||
{
|
||||
"tags": ["ul", "LI"]
|
||||
}
|
||||
```
|
||||
|
||||
Resulting CSS:
|
||||
|
||||
```css
|
||||
*{color:green}ul,li{color:blue}ul.foo{color:red}
|
||||
```
|
||||
|
||||
Filtering performs for nested selectors too. `:not()` pseudos content is ignoring since the result of matching is unpredictable. Example for the same usage data as above:
|
||||
|
||||
```css
|
||||
:nth-child(2n of ul, ol) { color: red }
|
||||
:nth-child(3n + 1 of img) { color: yellow }
|
||||
:not(div, ol, ul) { color: green }
|
||||
:has(:matches(ul, ol), ul, ol) { color: blue }
|
||||
```
|
||||
|
||||
Turns into:
|
||||
|
||||
```css
|
||||
:nth-child(2n of ul){color:red}:not(div,ol,ul){color:green}:has(:matches(ul),ul){color:blue}
|
||||
```
|
||||
|
||||
#### Black list filtering
|
||||
|
||||
Black list filtering performs the same as white list filtering, but filters things that mentioned in the lists. `blacklist` can contain the lists `tags`, `ids` and `classes`.
|
||||
|
||||
Black list has a higher priority, so when something mentioned in the white list and in the black list then white list occurrence is ignoring. The `:not()` pseudos content ignoring as well.
|
||||
|
||||
```css
|
||||
* { color: green; }
|
||||
ul, ol, li { color: blue; }
|
||||
UL.foo, li.bar { color: red; }
|
||||
```
|
||||
|
||||
Usage data:
|
||||
|
||||
```json
|
||||
{
|
||||
"blacklist": {
|
||||
"tags": ["ul"]
|
||||
},
|
||||
"tags": ["ul", "LI"]
|
||||
}
|
||||
```
|
||||
|
||||
Resulting CSS:
|
||||
|
||||
```css
|
||||
*{color:green}li{color:blue}li.bar{color:red}
|
||||
```
|
||||
|
||||
#### Scopes
|
||||
|
||||
Scopes is designed for CSS scope isolation solutions such as [css-modules](https://github.com/css-modules/css-modules). Scopes are similar to namespaces and define lists of class names that exclusively used on some markup. This information allows the optimizer to move rules more agressive. Since it assumes selectors from different scopes don't match for the same element. This can improve rule merging.
|
||||
|
||||
Suppose we have a file:
|
||||
|
||||
```css
|
||||
.module1-foo { color: red; }
|
||||
.module1-bar { font-size: 1.5em; background: yellow; }
|
||||
|
||||
.module2-baz { color: red; }
|
||||
.module2-qux { font-size: 1.5em; background: yellow; width: 50px; }
|
||||
```
|
||||
|
||||
It can be assumed that first two rules are never used with the second two on the same markup. But we can't say that for sure without a markup review. The optimizer doesn't know it either and will perform safe transformations only. The result will be the same as input but with no spaces and some semicolons:
|
||||
|
||||
```css
|
||||
.module1-foo{color:red}.module1-bar{font-size:1.5em;background:#ff0}.module2-baz{color:red}.module2-qux{font-size:1.5em;background:#ff0;width:50px}
|
||||
```
|
||||
|
||||
With usage data `CSSO` can produce better output. If follow usage data is provided:
|
||||
|
||||
```json
|
||||
{
|
||||
"scopes": [
|
||||
["module1-foo", "module1-bar"],
|
||||
["module2-baz", "module2-qux"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The result will be (29 bytes extra saving):
|
||||
|
||||
```css
|
||||
.module1-foo,.module2-baz{color:red}.module1-bar,.module2-qux{font-size:1.5em;background:#ff0}.module2-qux{width:50px}
|
||||
```
|
||||
|
||||
If class name isn't mentioned in the `scopes` it belongs to default scope. `scopes` data doesn't affect `classes` whitelist. If class name mentioned in `scopes` but missed in `classes` (both sections are specified) it will be filtered.
|
||||
|
||||
Note that class name can't be set for several scopes. Also selector can't has a class names from different scopes. In both cases an exception will thrown.
|
||||
|
||||
Currently the optimizer doesn't care about changing order safety for out-of-bounds selectors (i.e. selectors that match to elements without class name, e.g. `.scope div` or `.scope ~ :last-child`). It assumes that scoped CSS modules doesn't relay on it's order. It may be fix in future if to be an issue.
|
||||
|
||||
### Debugging
|
||||
|
||||
> TODO
|
||||
8
build/node_modules/postcss-csso/node_modules/csso/dist/csso-browser.js
generated
vendored
Normal file
8
build/node_modules/postcss-csso/node_modules/csso/dist/csso-browser.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
65
build/node_modules/postcss-csso/node_modules/csso/lib/clean/Atrule.js
generated
vendored
Normal file
65
build/node_modules/postcss-csso/node_modules/csso/lib/clean/Atrule.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
var resolveKeyword = require('css-tree').keyword;
|
||||
|
||||
module.exports = function cleanAtrule(node, item, list) {
|
||||
if (node.block) {
|
||||
// otherwise removed at-rule don't prevent @import for removal
|
||||
if (this.stylesheet !== null) {
|
||||
this.stylesheet.firstAtrulesAllowed = false;
|
||||
}
|
||||
|
||||
if (node.block.children.isEmpty()) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (node.name) {
|
||||
case 'charset':
|
||||
if (!node.prelude || node.prelude.children.isEmpty()) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
// if there is any rule before @charset -> remove it
|
||||
if (item.prev) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'import':
|
||||
if (this.stylesheet === null || !this.stylesheet.firstAtrulesAllowed) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
// if there are some rules that not an @import or @charset before @import
|
||||
// remove it
|
||||
list.prevUntil(item.prev, function(rule) {
|
||||
if (rule.type === 'Atrule') {
|
||||
if (rule.name === 'import' || rule.name === 'charset') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.root.firstAtrulesAllowed = false;
|
||||
list.remove(item);
|
||||
return true;
|
||||
}, this);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
var keyword = resolveKeyword(node.name);
|
||||
if (keyword.name === 'keyframes' ||
|
||||
keyword.name === 'media' ||
|
||||
keyword.name === 'supports') {
|
||||
|
||||
// drop at-rule with no prelude
|
||||
if (!node.prelude || node.prelude.children.isEmpty()) {
|
||||
list.remove(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
3
build/node_modules/postcss-csso/node_modules/csso/lib/clean/Comment.js
generated
vendored
Normal file
3
build/node_modules/postcss-csso/node_modules/csso/lib/clean/Comment.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function cleanComment(data, item, list) {
|
||||
list.remove(item);
|
||||
};
|
||||
5
build/node_modules/postcss-csso/node_modules/csso/lib/clean/Declaration.js
generated
vendored
Normal file
5
build/node_modules/postcss-csso/node_modules/csso/lib/clean/Declaration.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = function cleanDeclartion(node, item, list) {
|
||||
if (node.value.children && node.value.children.isEmpty()) {
|
||||
list.remove(item);
|
||||
}
|
||||
};
|
||||
14
build/node_modules/postcss-csso/node_modules/csso/lib/clean/Operator.js
generated
vendored
Normal file
14
build/node_modules/postcss-csso/node_modules/csso/lib/clean/Operator.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// remove white spaces around operators when safe
|
||||
module.exports = function cleanWhitespace(node, item, list) {
|
||||
if (node.value === '+' || node.value === '-') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.prev !== null && item.prev.data.type === 'WhiteSpace') {
|
||||
list.remove(item.prev);
|
||||
}
|
||||
|
||||
if (item.next !== null && item.next.data.type === 'WhiteSpace') {
|
||||
list.remove(item.next);
|
||||
}
|
||||
};
|
||||
87
build/node_modules/postcss-csso/node_modules/csso/lib/clean/Rule.js
generated
vendored
Normal file
87
build/node_modules/postcss-csso/node_modules/csso/lib/clean/Rule.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var walk = require('css-tree').walk;
|
||||
|
||||
function cleanUnused(selectorList, usageData) {
|
||||
selectorList.children.each(function(selector, item, list) {
|
||||
var shouldRemove = false;
|
||||
|
||||
walk(selector, function(node) {
|
||||
// ignore nodes in nested selectors
|
||||
if (this.selector === null || this.selector === selectorList) {
|
||||
switch (node.type) {
|
||||
case 'SelectorList':
|
||||
// TODO: remove toLowerCase when pseudo selectors will be normalized
|
||||
// ignore selectors inside :not()
|
||||
if (this['function'] === null || this['function'].name.toLowerCase() !== 'not') {
|
||||
if (cleanUnused(node, usageData)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'ClassSelector':
|
||||
if (usageData.whitelist !== null &&
|
||||
usageData.whitelist.classes !== null &&
|
||||
!hasOwnProperty.call(usageData.whitelist.classes, node.name)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
if (usageData.blacklist !== null &&
|
||||
usageData.blacklist.classes !== null &&
|
||||
hasOwnProperty.call(usageData.blacklist.classes, node.name)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'IdSelector':
|
||||
if (usageData.whitelist !== null &&
|
||||
usageData.whitelist.ids !== null &&
|
||||
!hasOwnProperty.call(usageData.whitelist.ids, node.name)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
if (usageData.blacklist !== null &&
|
||||
usageData.blacklist.ids !== null &&
|
||||
hasOwnProperty.call(usageData.blacklist.ids, node.name)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'TypeSelector':
|
||||
// TODO: remove toLowerCase when type selectors will be normalized
|
||||
// ignore universal selectors
|
||||
if (node.name.charAt(node.name.length - 1) !== '*') {
|
||||
if (usageData.whitelist !== null &&
|
||||
usageData.whitelist.tags !== null &&
|
||||
!hasOwnProperty.call(usageData.whitelist.tags, node.name.toLowerCase())) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
if (usageData.blacklist !== null &&
|
||||
usageData.blacklist.tags !== null &&
|
||||
hasOwnProperty.call(usageData.blacklist.tags, node.name.toLowerCase())) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (shouldRemove) {
|
||||
list.remove(item);
|
||||
}
|
||||
});
|
||||
|
||||
return selectorList.children.isEmpty();
|
||||
}
|
||||
|
||||
module.exports = function cleanRuleset(node, item, list, options) {
|
||||
var usageData = options.usage;
|
||||
|
||||
if (usageData && (usageData.whitelist !== null || usageData.blacklist !== null)) {
|
||||
cleanUnused(node.prelude, usageData);
|
||||
}
|
||||
|
||||
if (node.prelude.children.isEmpty() ||
|
||||
node.block.children.isEmpty()) {
|
||||
list.remove(item);
|
||||
}
|
||||
};
|
||||
19
build/node_modules/postcss-csso/node_modules/csso/lib/clean/TypeSelector.js
generated
vendored
Normal file
19
build/node_modules/postcss-csso/node_modules/csso/lib/clean/TypeSelector.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// remove useless universal selector
|
||||
module.exports = function cleanType(node, item, list) {
|
||||
var name = item.data.name;
|
||||
|
||||
// check it's a non-namespaced universal selector
|
||||
if (name !== '*') {
|
||||
return;
|
||||
}
|
||||
|
||||
// remove when universal selector before other selectors
|
||||
var nextType = item.next && item.next.data.type;
|
||||
if (nextType === 'IdSelector' ||
|
||||
nextType === 'ClassSelector' ||
|
||||
nextType === 'AttributeSelector' ||
|
||||
nextType === 'PseudoClassSelector' ||
|
||||
nextType === 'PseudoElementSelector') {
|
||||
list.remove(item);
|
||||
}
|
||||
};
|
||||
19
build/node_modules/postcss-csso/node_modules/csso/lib/clean/WhiteSpace.js
generated
vendored
Normal file
19
build/node_modules/postcss-csso/node_modules/csso/lib/clean/WhiteSpace.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
module.exports = function cleanWhitespace(node, item, list) {
|
||||
// remove when first or last item in sequence
|
||||
if (item.next === null || item.prev === null) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
// remove when previous node is whitespace
|
||||
if (item.prev.data.type === 'WhiteSpace') {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((this.stylesheet !== null && this.stylesheet.children === list) ||
|
||||
(this.block !== null && this.block.children === list)) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
};
|
||||
18
build/node_modules/postcss-csso/node_modules/csso/lib/clean/index.js
generated
vendored
Normal file
18
build/node_modules/postcss-csso/node_modules/csso/lib/clean/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var walk = require('css-tree').walkUp;
|
||||
var handlers = {
|
||||
Atrule: require('./Atrule'),
|
||||
Rule: require('./Rule'),
|
||||
Declaration: require('./Declaration'),
|
||||
TypeSelector: require('./TypeSelector'),
|
||||
Comment: require('./Comment'),
|
||||
Operator: require('./Operator'),
|
||||
WhiteSpace: require('./WhiteSpace')
|
||||
};
|
||||
|
||||
module.exports = function(ast, options) {
|
||||
walk(ast, function(node, item, list) {
|
||||
if (handlers.hasOwnProperty(node.type)) {
|
||||
handlers[node.type].call(this, node, item, list, options);
|
||||
}
|
||||
});
|
||||
};
|
||||
192
build/node_modules/postcss-csso/node_modules/csso/lib/compress.js
generated
vendored
Normal file
192
build/node_modules/postcss-csso/node_modules/csso/lib/compress.js
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
var List = require('css-tree').List;
|
||||
var clone = require('css-tree').clone;
|
||||
var usageUtils = require('./usage');
|
||||
var clean = require('./clean');
|
||||
var replace = require('./replace');
|
||||
var restructure = require('./restructure');
|
||||
var walkRules = require('css-tree').walkRules;
|
||||
|
||||
function readChunk(children, specialComments) {
|
||||
var buffer = new List();
|
||||
var nonSpaceTokenInBuffer = false;
|
||||
var protectedComment;
|
||||
|
||||
children.nextUntil(children.head, function(node, item, list) {
|
||||
if (node.type === 'Comment') {
|
||||
if (!specialComments || node.value.charAt(0) !== '!') {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nonSpaceTokenInBuffer || protectedComment) {
|
||||
return true;
|
||||
}
|
||||
|
||||
list.remove(item);
|
||||
protectedComment = node;
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.type !== 'WhiteSpace') {
|
||||
nonSpaceTokenInBuffer = true;
|
||||
}
|
||||
|
||||
buffer.insert(list.remove(item));
|
||||
});
|
||||
|
||||
return {
|
||||
comment: protectedComment,
|
||||
stylesheet: {
|
||||
type: 'StyleSheet',
|
||||
loc: null,
|
||||
children: buffer
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function compressChunk(ast, firstAtrulesAllowed, num, options) {
|
||||
options.logger('Compress block #' + num, null, true);
|
||||
|
||||
var seed = 1;
|
||||
|
||||
if (ast.type === 'StyleSheet') {
|
||||
ast.firstAtrulesAllowed = firstAtrulesAllowed;
|
||||
ast.id = seed++;
|
||||
}
|
||||
|
||||
walkRules(ast, function markScopes(node) {
|
||||
if (node.type === 'Atrule' && node.block !== null) {
|
||||
node.block.id = seed++;
|
||||
}
|
||||
});
|
||||
options.logger('init', ast);
|
||||
|
||||
// remove redundant
|
||||
clean(ast, options);
|
||||
options.logger('clean', ast);
|
||||
|
||||
// replace nodes for shortened forms
|
||||
replace(ast, options);
|
||||
options.logger('replace', ast);
|
||||
|
||||
// structure optimisations
|
||||
if (options.restructuring) {
|
||||
restructure(ast, options);
|
||||
}
|
||||
|
||||
return ast;
|
||||
}
|
||||
|
||||
function getCommentsOption(options) {
|
||||
var comments = 'comments' in options ? options.comments : 'exclamation';
|
||||
|
||||
if (typeof comments === 'boolean') {
|
||||
comments = comments ? 'exclamation' : false;
|
||||
} else if (comments !== 'exclamation' && comments !== 'first-exclamation') {
|
||||
comments = false;
|
||||
}
|
||||
|
||||
return comments;
|
||||
}
|
||||
|
||||
function getRestructureOption(options) {
|
||||
return 'restructure' in options ? options.restructure :
|
||||
'restructuring' in options ? options.restructuring :
|
||||
true;
|
||||
}
|
||||
|
||||
function wrapBlock(block) {
|
||||
return new List().appendData({
|
||||
type: 'Rule',
|
||||
loc: null,
|
||||
prelude: {
|
||||
type: 'SelectorList',
|
||||
loc: null,
|
||||
children: new List().appendData({
|
||||
type: 'Selector',
|
||||
loc: null,
|
||||
children: new List().appendData({
|
||||
type: 'TypeSelector',
|
||||
loc: null,
|
||||
name: 'x'
|
||||
})
|
||||
})
|
||||
},
|
||||
block: block
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function compress(ast, options) {
|
||||
ast = ast || { type: 'StyleSheet', loc: null, children: new List() };
|
||||
options = options || {};
|
||||
|
||||
var compressOptions = {
|
||||
logger: typeof options.logger === 'function' ? options.logger : function() {},
|
||||
restructuring: getRestructureOption(options),
|
||||
forceMediaMerge: Boolean(options.forceMediaMerge),
|
||||
usage: options.usage ? usageUtils.buildIndex(options.usage) : false
|
||||
};
|
||||
var specialComments = getCommentsOption(options);
|
||||
var firstAtrulesAllowed = true;
|
||||
var input;
|
||||
var output = new List();
|
||||
var chunk;
|
||||
var chunkNum = 1;
|
||||
var chunkChildren;
|
||||
|
||||
if (options.clone) {
|
||||
ast = clone(ast);
|
||||
}
|
||||
|
||||
if (ast.type === 'StyleSheet') {
|
||||
input = ast.children;
|
||||
ast.children = output;
|
||||
} else {
|
||||
input = wrapBlock(ast);
|
||||
}
|
||||
|
||||
do {
|
||||
chunk = readChunk(input, Boolean(specialComments));
|
||||
compressChunk(chunk.stylesheet, firstAtrulesAllowed, chunkNum++, compressOptions);
|
||||
chunkChildren = chunk.stylesheet.children;
|
||||
|
||||
if (chunk.comment) {
|
||||
// add \n before comment if there is another content in output
|
||||
if (!output.isEmpty()) {
|
||||
output.insert(List.createItem({
|
||||
type: 'Raw',
|
||||
value: '\n'
|
||||
}));
|
||||
}
|
||||
|
||||
output.insert(List.createItem(chunk.comment));
|
||||
|
||||
// add \n after comment if chunk is not empty
|
||||
if (!chunkChildren.isEmpty()) {
|
||||
output.insert(List.createItem({
|
||||
type: 'Raw',
|
||||
value: '\n'
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
if (firstAtrulesAllowed && !chunkChildren.isEmpty()) {
|
||||
var lastRule = chunkChildren.last();
|
||||
|
||||
if (lastRule.type !== 'Atrule' ||
|
||||
(lastRule.name !== 'import' && lastRule.name !== 'charset')) {
|
||||
firstAtrulesAllowed = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (specialComments !== 'exclamation') {
|
||||
specialComments = false;
|
||||
}
|
||||
|
||||
output.appendList(chunkChildren);
|
||||
} while (!input.isEmpty());
|
||||
|
||||
return {
|
||||
ast: ast
|
||||
};
|
||||
};
|
||||
143
build/node_modules/postcss-csso/node_modules/csso/lib/index.js
generated
vendored
Normal file
143
build/node_modules/postcss-csso/node_modules/csso/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
var csstree = require('css-tree');
|
||||
var parse = csstree.parse;
|
||||
var compress = require('./compress');
|
||||
var translate = csstree.translate;
|
||||
var translateWithSourceMap = csstree.translateWithSourceMap;
|
||||
|
||||
function debugOutput(name, options, startTime, data) {
|
||||
if (options.debug) {
|
||||
console.error('## ' + name + ' done in %d ms\n', Date.now() - startTime);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function createDefaultLogger(level) {
|
||||
var lastDebug;
|
||||
|
||||
return function logger(title, ast) {
|
||||
var line = title;
|
||||
|
||||
if (ast) {
|
||||
line = '[' + ((Date.now() - lastDebug) / 1000).toFixed(3) + 's] ' + line;
|
||||
}
|
||||
|
||||
if (level > 1 && ast) {
|
||||
var css = translate(ast, true);
|
||||
|
||||
// when level 2, limit css to 256 symbols
|
||||
if (level === 2 && css.length > 256) {
|
||||
css = css.substr(0, 256) + '...';
|
||||
}
|
||||
|
||||
line += '\n ' + css + '\n';
|
||||
}
|
||||
|
||||
console.error(line);
|
||||
lastDebug = Date.now();
|
||||
};
|
||||
}
|
||||
|
||||
function copy(obj) {
|
||||
var result = {};
|
||||
|
||||
for (var key in obj) {
|
||||
result[key] = obj[key];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function buildCompressOptions(options) {
|
||||
options = copy(options);
|
||||
|
||||
if (typeof options.logger !== 'function' && options.debug) {
|
||||
options.logger = createDefaultLogger(options.debug);
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function runHandler(ast, options, handlers) {
|
||||
if (!Array.isArray(handlers)) {
|
||||
handlers = [handlers];
|
||||
}
|
||||
|
||||
handlers.forEach(function(fn) {
|
||||
fn(ast, options);
|
||||
});
|
||||
}
|
||||
|
||||
function minify(context, source, options) {
|
||||
options = options || {};
|
||||
|
||||
var filename = options.filename || '<unknown>';
|
||||
var result;
|
||||
|
||||
// parse
|
||||
var ast = debugOutput('parsing', options, Date.now(),
|
||||
parse(source, {
|
||||
context: context,
|
||||
filename: filename,
|
||||
positions: Boolean(options.sourceMap)
|
||||
})
|
||||
);
|
||||
|
||||
// before compress handlers
|
||||
if (options.beforeCompress) {
|
||||
debugOutput('beforeCompress', options, Date.now(),
|
||||
runHandler(ast, options, options.beforeCompress)
|
||||
);
|
||||
}
|
||||
|
||||
// compress
|
||||
var compressResult = debugOutput('compress', options, Date.now(),
|
||||
compress(ast, buildCompressOptions(options))
|
||||
);
|
||||
|
||||
// after compress handlers
|
||||
if (options.afterCompress) {
|
||||
debugOutput('afterCompress', options, Date.now(),
|
||||
runHandler(compressResult, options, options.afterCompress)
|
||||
);
|
||||
}
|
||||
|
||||
// translate
|
||||
if (options.sourceMap) {
|
||||
result = debugOutput('translateWithSourceMap', options, Date.now(), (function() {
|
||||
var tmp = translateWithSourceMap(compressResult.ast);
|
||||
tmp.map._file = filename; // since other tools can relay on file in source map transform chain
|
||||
tmp.map.setSourceContent(filename, source);
|
||||
return tmp;
|
||||
})());
|
||||
} else {
|
||||
result = debugOutput('translate', options, Date.now(), {
|
||||
css: translate(compressResult.ast),
|
||||
map: null
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function minifyStylesheet(source, options) {
|
||||
return minify('stylesheet', source, options);
|
||||
}
|
||||
|
||||
function minifyBlock(source, options) {
|
||||
return minify('declarationList', source, options);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
version: require('../package.json').version,
|
||||
|
||||
// main methods
|
||||
minify: minifyStylesheet,
|
||||
minifyBlock: minifyBlock,
|
||||
|
||||
// compress an AST
|
||||
compress: compress,
|
||||
|
||||
// css syntax parser/walkers/generator/etc
|
||||
syntax: csstree
|
||||
};
|
||||
9
build/node_modules/postcss-csso/node_modules/csso/lib/replace/Atrule.js
generated
vendored
Normal file
9
build/node_modules/postcss-csso/node_modules/csso/lib/replace/Atrule.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
var resolveKeyword = require('css-tree').keyword;
|
||||
var compressKeyframes = require('./atrule/keyframes');
|
||||
|
||||
module.exports = function(node) {
|
||||
// compress @keyframe selectors
|
||||
if (resolveKeyword(node.name).name === 'keyframes') {
|
||||
compressKeyframes(node);
|
||||
}
|
||||
};
|
||||
33
build/node_modules/postcss-csso/node_modules/csso/lib/replace/AttributeSelector.js
generated
vendored
Normal file
33
build/node_modules/postcss-csso/node_modules/csso/lib/replace/AttributeSelector.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// Can unquote attribute detection
|
||||
// Adopted implementation of Mathias Bynens
|
||||
// https://github.com/mathiasbynens/mothereff.in/blob/master/unquoted-attributes/eff.js
|
||||
var escapesRx = /\\([0-9A-Fa-f]{1,6})(\r\n|[ \t\n\f\r])?|\\./g;
|
||||
var blockUnquoteRx = /^(-?\d|--)|[\u0000-\u002c\u002e\u002f\u003A-\u0040\u005B-\u005E\u0060\u007B-\u009f]/;
|
||||
|
||||
function canUnquote(value) {
|
||||
if (value === '' || value === '-') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Escapes are valid, so replace them with a valid non-empty string
|
||||
value = value.replace(escapesRx, 'a');
|
||||
|
||||
return !blockUnquoteRx.test(value);
|
||||
}
|
||||
|
||||
module.exports = function(node) {
|
||||
var attrValue = node.value;
|
||||
|
||||
if (!attrValue || attrValue.type !== 'String') {
|
||||
return;
|
||||
}
|
||||
|
||||
var unquotedValue = attrValue.value.replace(/^(.)(.*)\1$/, '$2');
|
||||
if (canUnquote(unquotedValue)) {
|
||||
node.value = {
|
||||
type: 'Identifier',
|
||||
loc: attrValue.loc,
|
||||
name: unquotedValue
|
||||
};
|
||||
}
|
||||
};
|
||||
54
build/node_modules/postcss-csso/node_modules/csso/lib/replace/Dimension.js
generated
vendored
Normal file
54
build/node_modules/postcss-csso/node_modules/csso/lib/replace/Dimension.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
var packNumber = require('./Number').pack;
|
||||
var LENGTH_UNIT = {
|
||||
// absolute length units
|
||||
'px': true,
|
||||
'mm': true,
|
||||
'cm': true,
|
||||
'in': true,
|
||||
'pt': true,
|
||||
'pc': true,
|
||||
|
||||
// relative length units
|
||||
'em': true,
|
||||
'ex': true,
|
||||
'ch': true,
|
||||
'rem': true,
|
||||
|
||||
// viewport-percentage lengths
|
||||
'vh': true,
|
||||
'vw': true,
|
||||
'vmin': true,
|
||||
'vmax': true,
|
||||
'vm': true
|
||||
};
|
||||
|
||||
module.exports = function compressDimension(node, item) {
|
||||
var value = packNumber(node.value, item);
|
||||
|
||||
node.value = value;
|
||||
|
||||
if (value === '0' && this.declaration !== null && this.atrulePrelude === null) {
|
||||
var unit = node.unit.toLowerCase();
|
||||
|
||||
// only length values can be compressed
|
||||
if (!LENGTH_UNIT.hasOwnProperty(unit)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// issue #200: don't remove units in flex property as it could change value meaning
|
||||
if (this.declaration.property === 'flex') {
|
||||
return;
|
||||
}
|
||||
|
||||
// issue #222: don't remove units inside calc
|
||||
if (this['function'] && this['function'].name === 'calc') {
|
||||
return;
|
||||
}
|
||||
|
||||
item.data = {
|
||||
type: 'Number',
|
||||
loc: node.loc,
|
||||
value: value
|
||||
};
|
||||
}
|
||||
};
|
||||
39
build/node_modules/postcss-csso/node_modules/csso/lib/replace/Number.js
generated
vendored
Normal file
39
build/node_modules/postcss-csso/node_modules/csso/lib/replace/Number.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var OMIT_PLUSSIGN = /^(?:\+|(-))?0*(\d*)(?:\.0*|(\.\d*?)0*)?$/;
|
||||
var KEEP_PLUSSIGN = /^([\+\-])?0*(\d*)(?:\.0*|(\.\d*?)0*)?$/;
|
||||
var unsafeToRemovePlusSignAfter = {
|
||||
Dimension: true,
|
||||
HexColor: true,
|
||||
Identifier: true,
|
||||
Number: true,
|
||||
Raw: true,
|
||||
UnicodeRange: true
|
||||
};
|
||||
|
||||
function packNumber(value, item) {
|
||||
// omit plus sign only if no prev or prev is safe type
|
||||
var regexp = item && item.prev !== null && unsafeToRemovePlusSignAfter.hasOwnProperty(item.prev.data.type)
|
||||
? KEEP_PLUSSIGN
|
||||
: OMIT_PLUSSIGN;
|
||||
|
||||
// 100 -> '100'
|
||||
// 00100 -> '100'
|
||||
// +100 -> '100' (only when safe, e.g. omitting plus sign for 1px+1px leads to single dimension instead of two)
|
||||
// -100 -> '-100'
|
||||
// 0.123 -> '.123'
|
||||
// 0.12300 -> '.123'
|
||||
// 0.0 -> ''
|
||||
// 0 -> ''
|
||||
// -0 -> '-'
|
||||
value = String(value).replace(regexp, '$1$2$3');
|
||||
|
||||
if (value === '' || value === '-') {
|
||||
value = '0';
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
module.exports = function(node, item) {
|
||||
node.value = packNumber(node.value, item);
|
||||
};
|
||||
module.exports.pack = packNumber;
|
||||
12
build/node_modules/postcss-csso/node_modules/csso/lib/replace/String.js
generated
vendored
Normal file
12
build/node_modules/postcss-csso/node_modules/csso/lib/replace/String.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = function(node) {
|
||||
var value = node.value;
|
||||
|
||||
// remove escaped newlines, i.e.
|
||||
// .a { content: "foo\
|
||||
// bar"}
|
||||
// ->
|
||||
// .a { content: "foobar" }
|
||||
value = value.replace(/\\(\r\n|\r|\n|\f)/g, '');
|
||||
|
||||
node.value = value;
|
||||
};
|
||||
33
build/node_modules/postcss-csso/node_modules/csso/lib/replace/Url.js
generated
vendored
Normal file
33
build/node_modules/postcss-csso/node_modules/csso/lib/replace/Url.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
var UNICODE = '\\\\[0-9a-f]{1,6}(\\r\\n|[ \\n\\r\\t\\f])?';
|
||||
var ESCAPE = '(' + UNICODE + '|\\\\[^\\n\\r\\f0-9a-fA-F])';
|
||||
var NONPRINTABLE = '\u0000\u0008\u000b\u000e-\u001f\u007f';
|
||||
var SAFE_URL = new RegExp('^(' + ESCAPE + '|[^\"\'\\(\\)\\\\\\s' + NONPRINTABLE + '])*$', 'i');
|
||||
|
||||
module.exports = function(node) {
|
||||
var value = node.value;
|
||||
|
||||
if (value.type !== 'String') {
|
||||
return;
|
||||
}
|
||||
|
||||
var quote = value.value[0];
|
||||
var url = value.value.substr(1, value.value.length - 2);
|
||||
|
||||
// convert `\\` to `/`
|
||||
url = url.replace(/\\\\/g, '/');
|
||||
|
||||
// remove quotes when safe
|
||||
// https://www.w3.org/TR/css-syntax-3/#url-unquoted-diagram
|
||||
if (SAFE_URL.test(url)) {
|
||||
node.value = {
|
||||
type: 'Raw',
|
||||
loc: node.value.loc,
|
||||
value: url
|
||||
};
|
||||
} else {
|
||||
// use double quotes if string has no double quotes
|
||||
// otherwise use original quotes
|
||||
// TODO: make better quote type selection
|
||||
node.value.value = url.indexOf('"') === -1 ? '"' + url + '"' : quote + url + quote;
|
||||
}
|
||||
};
|
||||
20
build/node_modules/postcss-csso/node_modules/csso/lib/replace/Value.js
generated
vendored
Normal file
20
build/node_modules/postcss-csso/node_modules/csso/lib/replace/Value.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var resolveName = require('css-tree').property;
|
||||
var handlers = {
|
||||
'font': require('./property/font'),
|
||||
'font-weight': require('./property/font-weight'),
|
||||
'background': require('./property/background'),
|
||||
'border': require('./property/border'),
|
||||
'outline': require('./property/border')
|
||||
};
|
||||
|
||||
module.exports = function compressValue(node) {
|
||||
if (!this.declaration) {
|
||||
return;
|
||||
}
|
||||
|
||||
var property = resolveName(this.declaration.property);
|
||||
|
||||
if (handlers.hasOwnProperty(property.name)) {
|
||||
handlers[property.name](node);
|
||||
}
|
||||
};
|
||||
21
build/node_modules/postcss-csso/node_modules/csso/lib/replace/atrule/keyframes.js
generated
vendored
Normal file
21
build/node_modules/postcss-csso/node_modules/csso/lib/replace/atrule/keyframes.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
module.exports = function(node) {
|
||||
node.block.children.each(function(rule) {
|
||||
rule.prelude.children.each(function(simpleselector) {
|
||||
simpleselector.children.each(function(data, item) {
|
||||
if (data.type === 'Percentage' && data.value === '100') {
|
||||
item.data = {
|
||||
type: 'TypeSelector',
|
||||
loc: data.loc,
|
||||
name: 'to'
|
||||
};
|
||||
} else if (data.type === 'TypeSelector' && data.name === 'from') {
|
||||
item.data = {
|
||||
type: 'Percentage',
|
||||
loc: data.loc,
|
||||
value: '0'
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
510
build/node_modules/postcss-csso/node_modules/csso/lib/replace/color.js
generated
vendored
Normal file
510
build/node_modules/postcss-csso/node_modules/csso/lib/replace/color.js
generated
vendored
Normal file
@@ -0,0 +1,510 @@
|
||||
var lexer = require('css-tree').lexer;
|
||||
var packNumber = require('./Number').pack;
|
||||
|
||||
// http://www.w3.org/TR/css3-color/#svg-color
|
||||
var NAME_TO_HEX = {
|
||||
'aliceblue': 'f0f8ff',
|
||||
'antiquewhite': 'faebd7',
|
||||
'aqua': '0ff',
|
||||
'aquamarine': '7fffd4',
|
||||
'azure': 'f0ffff',
|
||||
'beige': 'f5f5dc',
|
||||
'bisque': 'ffe4c4',
|
||||
'black': '000',
|
||||
'blanchedalmond': 'ffebcd',
|
||||
'blue': '00f',
|
||||
'blueviolet': '8a2be2',
|
||||
'brown': 'a52a2a',
|
||||
'burlywood': 'deb887',
|
||||
'cadetblue': '5f9ea0',
|
||||
'chartreuse': '7fff00',
|
||||
'chocolate': 'd2691e',
|
||||
'coral': 'ff7f50',
|
||||
'cornflowerblue': '6495ed',
|
||||
'cornsilk': 'fff8dc',
|
||||
'crimson': 'dc143c',
|
||||
'cyan': '0ff',
|
||||
'darkblue': '00008b',
|
||||
'darkcyan': '008b8b',
|
||||
'darkgoldenrod': 'b8860b',
|
||||
'darkgray': 'a9a9a9',
|
||||
'darkgrey': 'a9a9a9',
|
||||
'darkgreen': '006400',
|
||||
'darkkhaki': 'bdb76b',
|
||||
'darkmagenta': '8b008b',
|
||||
'darkolivegreen': '556b2f',
|
||||
'darkorange': 'ff8c00',
|
||||
'darkorchid': '9932cc',
|
||||
'darkred': '8b0000',
|
||||
'darksalmon': 'e9967a',
|
||||
'darkseagreen': '8fbc8f',
|
||||
'darkslateblue': '483d8b',
|
||||
'darkslategray': '2f4f4f',
|
||||
'darkslategrey': '2f4f4f',
|
||||
'darkturquoise': '00ced1',
|
||||
'darkviolet': '9400d3',
|
||||
'deeppink': 'ff1493',
|
||||
'deepskyblue': '00bfff',
|
||||
'dimgray': '696969',
|
||||
'dimgrey': '696969',
|
||||
'dodgerblue': '1e90ff',
|
||||
'firebrick': 'b22222',
|
||||
'floralwhite': 'fffaf0',
|
||||
'forestgreen': '228b22',
|
||||
'fuchsia': 'f0f',
|
||||
'gainsboro': 'dcdcdc',
|
||||
'ghostwhite': 'f8f8ff',
|
||||
'gold': 'ffd700',
|
||||
'goldenrod': 'daa520',
|
||||
'gray': '808080',
|
||||
'grey': '808080',
|
||||
'green': '008000',
|
||||
'greenyellow': 'adff2f',
|
||||
'honeydew': 'f0fff0',
|
||||
'hotpink': 'ff69b4',
|
||||
'indianred': 'cd5c5c',
|
||||
'indigo': '4b0082',
|
||||
'ivory': 'fffff0',
|
||||
'khaki': 'f0e68c',
|
||||
'lavender': 'e6e6fa',
|
||||
'lavenderblush': 'fff0f5',
|
||||
'lawngreen': '7cfc00',
|
||||
'lemonchiffon': 'fffacd',
|
||||
'lightblue': 'add8e6',
|
||||
'lightcoral': 'f08080',
|
||||
'lightcyan': 'e0ffff',
|
||||
'lightgoldenrodyellow': 'fafad2',
|
||||
'lightgray': 'd3d3d3',
|
||||
'lightgrey': 'd3d3d3',
|
||||
'lightgreen': '90ee90',
|
||||
'lightpink': 'ffb6c1',
|
||||
'lightsalmon': 'ffa07a',
|
||||
'lightseagreen': '20b2aa',
|
||||
'lightskyblue': '87cefa',
|
||||
'lightslategray': '789',
|
||||
'lightslategrey': '789',
|
||||
'lightsteelblue': 'b0c4de',
|
||||
'lightyellow': 'ffffe0',
|
||||
'lime': '0f0',
|
||||
'limegreen': '32cd32',
|
||||
'linen': 'faf0e6',
|
||||
'magenta': 'f0f',
|
||||
'maroon': '800000',
|
||||
'mediumaquamarine': '66cdaa',
|
||||
'mediumblue': '0000cd',
|
||||
'mediumorchid': 'ba55d3',
|
||||
'mediumpurple': '9370db',
|
||||
'mediumseagreen': '3cb371',
|
||||
'mediumslateblue': '7b68ee',
|
||||
'mediumspringgreen': '00fa9a',
|
||||
'mediumturquoise': '48d1cc',
|
||||
'mediumvioletred': 'c71585',
|
||||
'midnightblue': '191970',
|
||||
'mintcream': 'f5fffa',
|
||||
'mistyrose': 'ffe4e1',
|
||||
'moccasin': 'ffe4b5',
|
||||
'navajowhite': 'ffdead',
|
||||
'navy': '000080',
|
||||
'oldlace': 'fdf5e6',
|
||||
'olive': '808000',
|
||||
'olivedrab': '6b8e23',
|
||||
'orange': 'ffa500',
|
||||
'orangered': 'ff4500',
|
||||
'orchid': 'da70d6',
|
||||
'palegoldenrod': 'eee8aa',
|
||||
'palegreen': '98fb98',
|
||||
'paleturquoise': 'afeeee',
|
||||
'palevioletred': 'db7093',
|
||||
'papayawhip': 'ffefd5',
|
||||
'peachpuff': 'ffdab9',
|
||||
'peru': 'cd853f',
|
||||
'pink': 'ffc0cb',
|
||||
'plum': 'dda0dd',
|
||||
'powderblue': 'b0e0e6',
|
||||
'purple': '800080',
|
||||
'rebeccapurple': '639',
|
||||
'red': 'f00',
|
||||
'rosybrown': 'bc8f8f',
|
||||
'royalblue': '4169e1',
|
||||
'saddlebrown': '8b4513',
|
||||
'salmon': 'fa8072',
|
||||
'sandybrown': 'f4a460',
|
||||
'seagreen': '2e8b57',
|
||||
'seashell': 'fff5ee',
|
||||
'sienna': 'a0522d',
|
||||
'silver': 'c0c0c0',
|
||||
'skyblue': '87ceeb',
|
||||
'slateblue': '6a5acd',
|
||||
'slategray': '708090',
|
||||
'slategrey': '708090',
|
||||
'snow': 'fffafa',
|
||||
'springgreen': '00ff7f',
|
||||
'steelblue': '4682b4',
|
||||
'tan': 'd2b48c',
|
||||
'teal': '008080',
|
||||
'thistle': 'd8bfd8',
|
||||
'tomato': 'ff6347',
|
||||
'turquoise': '40e0d0',
|
||||
'violet': 'ee82ee',
|
||||
'wheat': 'f5deb3',
|
||||
'white': 'fff',
|
||||
'whitesmoke': 'f5f5f5',
|
||||
'yellow': 'ff0',
|
||||
'yellowgreen': '9acd32'
|
||||
};
|
||||
|
||||
var HEX_TO_NAME = {
|
||||
'800000': 'maroon',
|
||||
'800080': 'purple',
|
||||
'808000': 'olive',
|
||||
'808080': 'gray',
|
||||
'00ffff': 'cyan',
|
||||
'f0ffff': 'azure',
|
||||
'f5f5dc': 'beige',
|
||||
'ffe4c4': 'bisque',
|
||||
'000000': 'black',
|
||||
'0000ff': 'blue',
|
||||
'a52a2a': 'brown',
|
||||
'ff7f50': 'coral',
|
||||
'ffd700': 'gold',
|
||||
'008000': 'green',
|
||||
'4b0082': 'indigo',
|
||||
'fffff0': 'ivory',
|
||||
'f0e68c': 'khaki',
|
||||
'00ff00': 'lime',
|
||||
'faf0e6': 'linen',
|
||||
'000080': 'navy',
|
||||
'ffa500': 'orange',
|
||||
'da70d6': 'orchid',
|
||||
'cd853f': 'peru',
|
||||
'ffc0cb': 'pink',
|
||||
'dda0dd': 'plum',
|
||||
'f00': 'red',
|
||||
'ff0000': 'red',
|
||||
'fa8072': 'salmon',
|
||||
'a0522d': 'sienna',
|
||||
'c0c0c0': 'silver',
|
||||
'fffafa': 'snow',
|
||||
'd2b48c': 'tan',
|
||||
'008080': 'teal',
|
||||
'ff6347': 'tomato',
|
||||
'ee82ee': 'violet',
|
||||
'f5deb3': 'wheat',
|
||||
'ffffff': 'white',
|
||||
'ffff00': 'yellow'
|
||||
};
|
||||
|
||||
function hueToRgb(p, q, t) {
|
||||
if (t < 0) {
|
||||
t += 1;
|
||||
}
|
||||
if (t > 1) {
|
||||
t -= 1;
|
||||
}
|
||||
if (t < 1 / 6) {
|
||||
return p + (q - p) * 6 * t;
|
||||
}
|
||||
if (t < 1 / 2) {
|
||||
return q;
|
||||
}
|
||||
if (t < 2 / 3) {
|
||||
return p + (q - p) * (2 / 3 - t) * 6;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
function hslToRgb(h, s, l, a) {
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
|
||||
if (s === 0) {
|
||||
r = g = b = l; // achromatic
|
||||
} else {
|
||||
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
||||
var p = 2 * l - q;
|
||||
|
||||
r = hueToRgb(p, q, h + 1 / 3);
|
||||
g = hueToRgb(p, q, h);
|
||||
b = hueToRgb(p, q, h - 1 / 3);
|
||||
}
|
||||
|
||||
return [
|
||||
Math.round(r * 255),
|
||||
Math.round(g * 255),
|
||||
Math.round(b * 255),
|
||||
a
|
||||
];
|
||||
}
|
||||
|
||||
function toHex(value) {
|
||||
value = value.toString(16);
|
||||
return value.length === 1 ? '0' + value : value;
|
||||
}
|
||||
|
||||
function parseFunctionArgs(functionArgs, count, rgb) {
|
||||
var cursor = functionArgs.head;
|
||||
var args = [];
|
||||
var wasValue = false;
|
||||
|
||||
while (cursor !== null) {
|
||||
var node = cursor.data;
|
||||
var type = node.type;
|
||||
|
||||
switch (type) {
|
||||
case 'Number':
|
||||
case 'Percentage':
|
||||
if (wasValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
wasValue = true;
|
||||
args.push({
|
||||
type: type,
|
||||
value: Number(node.value)
|
||||
});
|
||||
break;
|
||||
|
||||
case 'Operator':
|
||||
if (node.value === ',') {
|
||||
if (!wasValue) {
|
||||
return;
|
||||
}
|
||||
wasValue = false;
|
||||
} else if (wasValue || node.value !== '+') {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// something we couldn't understand
|
||||
return;
|
||||
}
|
||||
|
||||
cursor = cursor.next;
|
||||
}
|
||||
|
||||
if (args.length !== count) {
|
||||
// invalid arguments count
|
||||
// TODO: remove those tokens
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length === 4) {
|
||||
if (args[3].type !== 'Number') {
|
||||
// 4th argument should be a number
|
||||
// TODO: remove those tokens
|
||||
return;
|
||||
}
|
||||
|
||||
args[3].type = 'Alpha';
|
||||
}
|
||||
|
||||
if (rgb) {
|
||||
if (args[0].type !== args[1].type || args[0].type !== args[2].type) {
|
||||
// invalid color, numbers and percentage shouldn't be mixed
|
||||
// TODO: remove those tokens
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (args[0].type !== 'Number' ||
|
||||
args[1].type !== 'Percentage' ||
|
||||
args[2].type !== 'Percentage') {
|
||||
// invalid color, for hsl values should be: number, percentage, percentage
|
||||
// TODO: remove those tokens
|
||||
return;
|
||||
}
|
||||
|
||||
args[0].type = 'Angle';
|
||||
}
|
||||
|
||||
return args.map(function(arg) {
|
||||
var value = Math.max(0, arg.value);
|
||||
|
||||
switch (arg.type) {
|
||||
case 'Number':
|
||||
// fit value to [0..255] range
|
||||
value = Math.min(value, 255);
|
||||
break;
|
||||
|
||||
case 'Percentage':
|
||||
// convert 0..100% to value in [0..255] range
|
||||
value = Math.min(value, 100) / 100;
|
||||
|
||||
if (!rgb) {
|
||||
return value;
|
||||
}
|
||||
|
||||
value = 255 * value;
|
||||
break;
|
||||
|
||||
case 'Angle':
|
||||
// fit value to (-360..360) range
|
||||
return (((value % 360) + 360) % 360) / 360;
|
||||
|
||||
case 'Alpha':
|
||||
// fit value to [0..1] range
|
||||
return Math.min(value, 1);
|
||||
}
|
||||
|
||||
return Math.round(value);
|
||||
});
|
||||
}
|
||||
|
||||
function compressFunction(node, item, list) {
|
||||
var functionName = node.name;
|
||||
var args;
|
||||
|
||||
if (functionName === 'rgba' || functionName === 'hsla') {
|
||||
args = parseFunctionArgs(node.children, 4, functionName === 'rgba');
|
||||
|
||||
if (!args) {
|
||||
// something went wrong
|
||||
return;
|
||||
}
|
||||
|
||||
if (functionName === 'hsla') {
|
||||
args = hslToRgb.apply(null, args);
|
||||
node.name = 'rgba';
|
||||
}
|
||||
|
||||
if (args[3] === 0) {
|
||||
// try to replace `rgba(x, x, x, 0)` to `transparent`
|
||||
// always replace `rgba(0, 0, 0, 0)` to `transparent`
|
||||
// otherwise avoid replacement in gradients since it may break color transition
|
||||
// http://stackoverflow.com/questions/11829410/css3-gradient-rendering-issues-from-transparent-to-white
|
||||
var scopeFunctionName = this['function'] && this['function'].name;
|
||||
if ((args[0] === 0 && args[1] === 0 && args[2] === 0) ||
|
||||
!/^(?:to|from|color-stop)$|gradient$/i.test(scopeFunctionName)) {
|
||||
|
||||
item.data = {
|
||||
type: 'Identifier',
|
||||
loc: node.loc,
|
||||
name: 'transparent'
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (args[3] !== 1) {
|
||||
// replace argument values for normalized/interpolated
|
||||
node.children.each(function(node, item, list) {
|
||||
if (node.type === 'Operator') {
|
||||
if (node.value !== ',') {
|
||||
list.remove(item);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
item.data = {
|
||||
type: 'Number',
|
||||
loc: node.loc,
|
||||
value: packNumber(args.shift(), null)
|
||||
};
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// otherwise convert to rgb, i.e. rgba(255, 0, 0, 1) -> rgb(255, 0, 0)
|
||||
functionName = 'rgb';
|
||||
}
|
||||
|
||||
if (functionName === 'hsl') {
|
||||
args = args || parseFunctionArgs(node.children, 3, false);
|
||||
|
||||
if (!args) {
|
||||
// something went wrong
|
||||
return;
|
||||
}
|
||||
|
||||
// convert to rgb
|
||||
args = hslToRgb.apply(null, args);
|
||||
functionName = 'rgb';
|
||||
}
|
||||
|
||||
if (functionName === 'rgb') {
|
||||
args = args || parseFunctionArgs(node.children, 3, true);
|
||||
|
||||
if (!args) {
|
||||
// something went wrong
|
||||
return;
|
||||
}
|
||||
|
||||
// check if color is not at the end and not followed by space
|
||||
var next = item.next;
|
||||
if (next && next.data.type !== 'WhiteSpace') {
|
||||
list.insert(list.createItem({
|
||||
type: 'WhiteSpace',
|
||||
value: ' '
|
||||
}), next);
|
||||
}
|
||||
|
||||
item.data = {
|
||||
type: 'HexColor',
|
||||
loc: node.loc,
|
||||
value: toHex(args[0]) + toHex(args[1]) + toHex(args[2])
|
||||
};
|
||||
|
||||
compressHex(item.data, item);
|
||||
}
|
||||
}
|
||||
|
||||
function compressIdent(node, item) {
|
||||
if (this.declaration === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var color = node.name.toLowerCase();
|
||||
|
||||
if (NAME_TO_HEX.hasOwnProperty(color) &&
|
||||
lexer.matchDeclaration(this.declaration).isType(node, 'color')) {
|
||||
var hex = NAME_TO_HEX[color];
|
||||
|
||||
if (hex.length + 1 <= color.length) {
|
||||
// replace for shorter hex value
|
||||
item.data = {
|
||||
type: 'HexColor',
|
||||
loc: node.loc,
|
||||
value: hex
|
||||
};
|
||||
} else {
|
||||
// special case for consistent colors
|
||||
if (color === 'grey') {
|
||||
color = 'gray';
|
||||
}
|
||||
|
||||
// just replace value for lower cased name
|
||||
node.name = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function compressHex(node, item) {
|
||||
var color = node.value.toLowerCase();
|
||||
|
||||
// #112233 -> #123
|
||||
if (color.length === 6 &&
|
||||
color[0] === color[1] &&
|
||||
color[2] === color[3] &&
|
||||
color[4] === color[5]) {
|
||||
color = color[0] + color[2] + color[4];
|
||||
}
|
||||
|
||||
if (HEX_TO_NAME[color]) {
|
||||
item.data = {
|
||||
type: 'Identifier',
|
||||
loc: node.loc,
|
||||
name: HEX_TO_NAME[color]
|
||||
};
|
||||
} else {
|
||||
node.value = color;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
compressFunction: compressFunction,
|
||||
compressIdent: compressIdent,
|
||||
compressHex: compressHex
|
||||
};
|
||||
22
build/node_modules/postcss-csso/node_modules/csso/lib/replace/index.js
generated
vendored
Normal file
22
build/node_modules/postcss-csso/node_modules/csso/lib/replace/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
var walk = require('css-tree').walkUp;
|
||||
var handlers = {
|
||||
Atrule: require('./Atrule'),
|
||||
AttributeSelector: require('./AttributeSelector'),
|
||||
Value: require('./Value'),
|
||||
Dimension: require('./Dimension'),
|
||||
Percentage: require('./Number'),
|
||||
Number: require('./Number'),
|
||||
String: require('./String'),
|
||||
Url: require('./Url'),
|
||||
HexColor: require('./color').compressHex,
|
||||
Identifier: require('./color').compressIdent,
|
||||
Function: require('./color').compressFunction
|
||||
};
|
||||
|
||||
module.exports = function(ast) {
|
||||
walk(ast, function(node, item, list) {
|
||||
if (handlers.hasOwnProperty(node.type)) {
|
||||
handlers[node.type].call(this, node, item, list);
|
||||
}
|
||||
});
|
||||
};
|
||||
69
build/node_modules/postcss-csso/node_modules/csso/lib/replace/property/background.js
generated
vendored
Normal file
69
build/node_modules/postcss-csso/node_modules/csso/lib/replace/property/background.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
var List = require('css-tree').List;
|
||||
|
||||
module.exports = function compressBackground(node) {
|
||||
function lastType() {
|
||||
if (buffer.length) {
|
||||
return buffer[buffer.length - 1].type;
|
||||
}
|
||||
}
|
||||
|
||||
function flush() {
|
||||
if (lastType() === 'WhiteSpace') {
|
||||
buffer.pop();
|
||||
}
|
||||
|
||||
if (!buffer.length) {
|
||||
buffer.unshift(
|
||||
{
|
||||
type: 'Number',
|
||||
loc: null,
|
||||
value: '0'
|
||||
},
|
||||
{
|
||||
type: 'WhiteSpace',
|
||||
value: ' '
|
||||
},
|
||||
{
|
||||
type: 'Number',
|
||||
loc: null,
|
||||
value: '0'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
newValue.push.apply(newValue, buffer);
|
||||
|
||||
buffer = [];
|
||||
}
|
||||
|
||||
var newValue = [];
|
||||
var buffer = [];
|
||||
|
||||
node.children.each(function(node) {
|
||||
if (node.type === 'Operator' && node.value === ',') {
|
||||
flush();
|
||||
newValue.push(node);
|
||||
return;
|
||||
}
|
||||
|
||||
// remove defaults
|
||||
if (node.type === 'Identifier') {
|
||||
if (node.name === 'transparent' ||
|
||||
node.name === 'none' ||
|
||||
node.name === 'repeat' ||
|
||||
node.name === 'scroll') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// don't add redundant spaces
|
||||
if (node.type === 'WhiteSpace' && (!buffer.length || lastType() === 'WhiteSpace')) {
|
||||
return;
|
||||
}
|
||||
|
||||
buffer.push(node);
|
||||
});
|
||||
|
||||
flush();
|
||||
node.children = new List().fromArray(newValue);
|
||||
};
|
||||
31
build/node_modules/postcss-csso/node_modules/csso/lib/replace/property/border.js
generated
vendored
Normal file
31
build/node_modules/postcss-csso/node_modules/csso/lib/replace/property/border.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
function removeItemAndRedundantWhiteSpace(list, item) {
|
||||
var prev = item.prev;
|
||||
var next = item.next;
|
||||
|
||||
if (next !== null) {
|
||||
if (next.data.type === 'WhiteSpace' && (prev === null || prev.data.type === 'WhiteSpace')) {
|
||||
list.remove(next);
|
||||
}
|
||||
} else if (prev !== null && prev.data.type === 'WhiteSpace') {
|
||||
list.remove(prev);
|
||||
}
|
||||
|
||||
list.remove(item);
|
||||
}
|
||||
|
||||
module.exports = function compressBorder(node) {
|
||||
node.children.each(function(node, item, list) {
|
||||
if (node.type === 'Identifier' && node.name.toLowerCase() === 'none') {
|
||||
if (list.head === list.tail) {
|
||||
// replace `none` for zero when `none` is a single term
|
||||
item.data = {
|
||||
type: 'Number',
|
||||
loc: node.loc,
|
||||
value: '0'
|
||||
};
|
||||
} else {
|
||||
removeItemAndRedundantWhiteSpace(list, item);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
22
build/node_modules/postcss-csso/node_modules/csso/lib/replace/property/font-weight.js
generated
vendored
Normal file
22
build/node_modules/postcss-csso/node_modules/csso/lib/replace/property/font-weight.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = function compressFontWeight(node) {
|
||||
var value = node.children.head.data;
|
||||
|
||||
if (value.type === 'Identifier') {
|
||||
switch (value.name) {
|
||||
case 'normal':
|
||||
node.children.head.data = {
|
||||
type: 'Number',
|
||||
loc: value.loc,
|
||||
value: '400'
|
||||
};
|
||||
break;
|
||||
case 'bold':
|
||||
node.children.head.data = {
|
||||
type: 'Number',
|
||||
loc: value.loc,
|
||||
value: '700'
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
45
build/node_modules/postcss-csso/node_modules/csso/lib/replace/property/font.js
generated
vendored
Normal file
45
build/node_modules/postcss-csso/node_modules/csso/lib/replace/property/font.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
module.exports = function compressFont(node) {
|
||||
var list = node.children;
|
||||
|
||||
list.eachRight(function(node, item) {
|
||||
if (node.type === 'Identifier') {
|
||||
if (node.name === 'bold') {
|
||||
item.data = {
|
||||
type: 'Number',
|
||||
loc: node.loc,
|
||||
value: '700'
|
||||
};
|
||||
} else if (node.name === 'normal') {
|
||||
var prev = item.prev;
|
||||
|
||||
if (prev && prev.data.type === 'Operator' && prev.data.value === '/') {
|
||||
this.remove(prev);
|
||||
}
|
||||
|
||||
this.remove(item);
|
||||
} else if (node.name === 'medium') {
|
||||
var next = item.next;
|
||||
|
||||
if (!next || next.data.type !== 'Operator') {
|
||||
this.remove(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// remove redundant spaces
|
||||
list.each(function(node, item) {
|
||||
if (node.type === 'WhiteSpace') {
|
||||
if (!item.prev || !item.next || item.next.data.type === 'WhiteSpace') {
|
||||
this.remove(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (list.isEmpty()) {
|
||||
list.insert(list.createItem({
|
||||
type: 'Identifier',
|
||||
name: 'normal'
|
||||
}));
|
||||
}
|
||||
};
|
||||
104
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/1-mergeAtrule.js
generated
vendored
Normal file
104
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/1-mergeAtrule.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
var List = require('css-tree').List;
|
||||
var resolveKeyword = require('css-tree').keyword;
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var walkRulesRight = require('css-tree').walkRulesRight;
|
||||
|
||||
function addRuleToMap(map, item, list, single) {
|
||||
var node = item.data;
|
||||
var name = resolveKeyword(node.name).name;
|
||||
var id = node.name.toLowerCase() + '/' + (node.prelude ? node.prelude.id : null);
|
||||
|
||||
if (!hasOwnProperty.call(map, name)) {
|
||||
map[name] = Object.create(null);
|
||||
}
|
||||
|
||||
if (single) {
|
||||
delete map[name][id];
|
||||
}
|
||||
|
||||
if (!hasOwnProperty.call(map[name], id)) {
|
||||
map[name][id] = new List();
|
||||
}
|
||||
|
||||
map[name][id].append(list.remove(item));
|
||||
}
|
||||
|
||||
function relocateAtrules(ast, options) {
|
||||
var collected = Object.create(null);
|
||||
var topInjectPoint = null;
|
||||
|
||||
ast.children.each(function(node, item, list) {
|
||||
if (node.type === 'Atrule') {
|
||||
var keyword = resolveKeyword(node.name);
|
||||
|
||||
switch (keyword.name) {
|
||||
case 'keyframes':
|
||||
addRuleToMap(collected, item, list, true);
|
||||
return;
|
||||
|
||||
case 'media':
|
||||
if (options.forceMediaMerge) {
|
||||
addRuleToMap(collected, item, list, false);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (topInjectPoint === null &&
|
||||
keyword.name !== 'charset' &&
|
||||
keyword.name !== 'import') {
|
||||
topInjectPoint = item;
|
||||
}
|
||||
} else {
|
||||
if (topInjectPoint === null) {
|
||||
topInjectPoint = item;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (var atrule in collected) {
|
||||
for (var id in collected[atrule]) {
|
||||
ast.children.insertList(collected[atrule][id], atrule === 'media' ? null : topInjectPoint);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function isMediaRule(node) {
|
||||
return node.type === 'Atrule' && node.name === 'media';
|
||||
}
|
||||
|
||||
function processAtrule(node, item, list) {
|
||||
if (!isMediaRule(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var prev = item.prev && item.prev.data;
|
||||
|
||||
if (!prev || !isMediaRule(prev)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// merge @media with same query
|
||||
if (node.prelude &&
|
||||
prev.prelude &&
|
||||
node.prelude.id === prev.prelude.id) {
|
||||
prev.block.children.appendList(node.block.children);
|
||||
list.remove(item);
|
||||
|
||||
// TODO: use it when we can refer to several points in source
|
||||
// prev.loc = {
|
||||
// primary: prev.loc,
|
||||
// merged: node.loc
|
||||
// };
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function rejoinAtrule(ast, options) {
|
||||
relocateAtrules(ast, options);
|
||||
|
||||
walkRulesRight(ast, function(node, item, list) {
|
||||
if (node.type === 'Atrule') {
|
||||
processAtrule(node, item, list);
|
||||
}
|
||||
});
|
||||
};
|
||||
48
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/2-initialMergeRuleset.js
generated
vendored
Normal file
48
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/2-initialMergeRuleset.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
var walkRules = require('css-tree').walkRules;
|
||||
var utils = require('./utils');
|
||||
|
||||
function processRule(node, item, list) {
|
||||
var selectors = node.prelude.children;
|
||||
var declarations = node.block.children;
|
||||
|
||||
list.prevUntil(item.prev, function(prev) {
|
||||
// skip non-ruleset node if safe
|
||||
if (prev.type !== 'Rule') {
|
||||
return utils.unsafeToSkipNode.call(selectors, prev);
|
||||
}
|
||||
|
||||
var prevSelectors = prev.prelude.children;
|
||||
var prevDeclarations = prev.block.children;
|
||||
|
||||
// try to join rulesets with equal pseudo signature
|
||||
if (node.pseudoSignature === prev.pseudoSignature) {
|
||||
// try to join by selectors
|
||||
if (utils.isEqualSelectors(prevSelectors, selectors)) {
|
||||
prevDeclarations.appendList(declarations);
|
||||
list.remove(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
// try to join by declarations
|
||||
if (utils.isEqualDeclarations(declarations, prevDeclarations)) {
|
||||
utils.addSelectors(prevSelectors, selectors);
|
||||
list.remove(item);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// go to prev ruleset if has no selector similarities
|
||||
return utils.hasSimilarSelectors(selectors, prevSelectors);
|
||||
});
|
||||
}
|
||||
|
||||
// NOTE: direction should be left to right, since rulesets merge to left
|
||||
// ruleset. When direction right to left unmerged rulesets may prevent lookup
|
||||
// TODO: remove initial merge
|
||||
module.exports = function initialMergeRule(ast) {
|
||||
walkRules(ast, function(node, item, list) {
|
||||
if (node.type === 'Rule') {
|
||||
processRule(node, item, list);
|
||||
}
|
||||
});
|
||||
};
|
||||
42
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/3-disjoinRuleset.js
generated
vendored
Normal file
42
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/3-disjoinRuleset.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
var List = require('css-tree').List;
|
||||
var walkRulesRight = require('css-tree').walkRulesRight;
|
||||
|
||||
function processRule(node, item, list) {
|
||||
var selectors = node.prelude.children;
|
||||
|
||||
// generate new rule sets:
|
||||
// .a, .b { color: red; }
|
||||
// ->
|
||||
// .a { color: red; }
|
||||
// .b { color: red; }
|
||||
|
||||
// while there are more than 1 simple selector split for rulesets
|
||||
while (selectors.head !== selectors.tail) {
|
||||
var newSelectors = new List();
|
||||
newSelectors.insert(selectors.remove(selectors.head));
|
||||
|
||||
list.insert(list.createItem({
|
||||
type: 'Rule',
|
||||
loc: node.loc,
|
||||
prelude: {
|
||||
type: 'SelectorList',
|
||||
loc: node.prelude.loc,
|
||||
children: newSelectors
|
||||
},
|
||||
block: {
|
||||
type: 'Block',
|
||||
loc: node.block.loc,
|
||||
children: node.block.children.copy()
|
||||
},
|
||||
pseudoSignature: node.pseudoSignature
|
||||
}), item);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function disjoinRule(ast) {
|
||||
walkRulesRight(ast, function(node, item, list) {
|
||||
if (node.type === 'Rule') {
|
||||
processRule(node, item, list);
|
||||
}
|
||||
});
|
||||
};
|
||||
428
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/4-restructShorthand.js
generated
vendored
Normal file
428
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/4-restructShorthand.js
generated
vendored
Normal file
@@ -0,0 +1,428 @@
|
||||
var List = require('css-tree').List;
|
||||
var translate = require('css-tree').translate;
|
||||
var walkRulesRight = require('css-tree').walkRulesRight;
|
||||
|
||||
var REPLACE = 1;
|
||||
var REMOVE = 2;
|
||||
var TOP = 0;
|
||||
var RIGHT = 1;
|
||||
var BOTTOM = 2;
|
||||
var LEFT = 3;
|
||||
var SIDES = ['top', 'right', 'bottom', 'left'];
|
||||
var SIDE = {
|
||||
'margin-top': 'top',
|
||||
'margin-right': 'right',
|
||||
'margin-bottom': 'bottom',
|
||||
'margin-left': 'left',
|
||||
|
||||
'padding-top': 'top',
|
||||
'padding-right': 'right',
|
||||
'padding-bottom': 'bottom',
|
||||
'padding-left': 'left',
|
||||
|
||||
'border-top-color': 'top',
|
||||
'border-right-color': 'right',
|
||||
'border-bottom-color': 'bottom',
|
||||
'border-left-color': 'left',
|
||||
'border-top-width': 'top',
|
||||
'border-right-width': 'right',
|
||||
'border-bottom-width': 'bottom',
|
||||
'border-left-width': 'left',
|
||||
'border-top-style': 'top',
|
||||
'border-right-style': 'right',
|
||||
'border-bottom-style': 'bottom',
|
||||
'border-left-style': 'left'
|
||||
};
|
||||
var MAIN_PROPERTY = {
|
||||
'margin': 'margin',
|
||||
'margin-top': 'margin',
|
||||
'margin-right': 'margin',
|
||||
'margin-bottom': 'margin',
|
||||
'margin-left': 'margin',
|
||||
|
||||
'padding': 'padding',
|
||||
'padding-top': 'padding',
|
||||
'padding-right': 'padding',
|
||||
'padding-bottom': 'padding',
|
||||
'padding-left': 'padding',
|
||||
|
||||
'border-color': 'border-color',
|
||||
'border-top-color': 'border-color',
|
||||
'border-right-color': 'border-color',
|
||||
'border-bottom-color': 'border-color',
|
||||
'border-left-color': 'border-color',
|
||||
'border-width': 'border-width',
|
||||
'border-top-width': 'border-width',
|
||||
'border-right-width': 'border-width',
|
||||
'border-bottom-width': 'border-width',
|
||||
'border-left-width': 'border-width',
|
||||
'border-style': 'border-style',
|
||||
'border-top-style': 'border-style',
|
||||
'border-right-style': 'border-style',
|
||||
'border-bottom-style': 'border-style',
|
||||
'border-left-style': 'border-style'
|
||||
};
|
||||
|
||||
function TRBL(name) {
|
||||
this.name = name;
|
||||
this.loc = null;
|
||||
this.iehack = undefined;
|
||||
this.sides = {
|
||||
'top': null,
|
||||
'right': null,
|
||||
'bottom': null,
|
||||
'left': null
|
||||
};
|
||||
}
|
||||
|
||||
TRBL.prototype.getValueSequence = function(declaration, count) {
|
||||
var values = [];
|
||||
var iehack = '';
|
||||
var hasBadValues = declaration.value.children.some(function(child) {
|
||||
var special = false;
|
||||
|
||||
switch (child.type) {
|
||||
case 'Identifier':
|
||||
switch (child.name) {
|
||||
case '\\0':
|
||||
case '\\9':
|
||||
iehack = child.name;
|
||||
return;
|
||||
|
||||
case 'inherit':
|
||||
case 'initial':
|
||||
case 'unset':
|
||||
case 'revert':
|
||||
special = child.name;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Dimension':
|
||||
switch (child.unit) {
|
||||
// is not supported until IE11
|
||||
case 'rem':
|
||||
|
||||
// v* units is too buggy across browsers and better
|
||||
// don't merge values with those units
|
||||
case 'vw':
|
||||
case 'vh':
|
||||
case 'vmin':
|
||||
case 'vmax':
|
||||
case 'vm': // IE9 supporting "vm" instead of "vmin".
|
||||
special = child.unit;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'HexColor': // color
|
||||
case 'Number':
|
||||
case 'Percentage':
|
||||
break;
|
||||
|
||||
case 'Function':
|
||||
special = child.name;
|
||||
break;
|
||||
|
||||
case 'WhiteSpace':
|
||||
return false; // ignore space
|
||||
|
||||
default:
|
||||
return true; // bad value
|
||||
}
|
||||
|
||||
values.push({
|
||||
node: child,
|
||||
special: special,
|
||||
important: declaration.important
|
||||
});
|
||||
});
|
||||
|
||||
if (hasBadValues || values.length > count) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof this.iehack === 'string' && this.iehack !== iehack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.iehack = iehack; // move outside
|
||||
|
||||
return values;
|
||||
};
|
||||
|
||||
TRBL.prototype.canOverride = function(side, value) {
|
||||
var currentValue = this.sides[side];
|
||||
|
||||
return !currentValue || (value.important && !currentValue.important);
|
||||
};
|
||||
|
||||
TRBL.prototype.add = function(name, declaration) {
|
||||
function attemptToAdd() {
|
||||
var sides = this.sides;
|
||||
var side = SIDE[name];
|
||||
|
||||
if (side) {
|
||||
if (side in sides === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var values = this.getValueSequence(declaration, 1);
|
||||
|
||||
if (!values || !values.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// can mix only if specials are equal
|
||||
for (var key in sides) {
|
||||
if (sides[key] !== null && sides[key].special !== values[0].special) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.canOverride(side, values[0])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
sides[side] = values[0];
|
||||
return true;
|
||||
} else if (name === this.name) {
|
||||
var values = this.getValueSequence(declaration, 4);
|
||||
|
||||
if (!values || !values.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (values.length) {
|
||||
case 1:
|
||||
values[RIGHT] = values[TOP];
|
||||
values[BOTTOM] = values[TOP];
|
||||
values[LEFT] = values[TOP];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
values[BOTTOM] = values[TOP];
|
||||
values[LEFT] = values[RIGHT];
|
||||
break;
|
||||
|
||||
case 3:
|
||||
values[LEFT] = values[RIGHT];
|
||||
break;
|
||||
}
|
||||
|
||||
// can mix only if specials are equal
|
||||
for (var i = 0; i < 4; i++) {
|
||||
for (var key in sides) {
|
||||
if (sides[key] !== null && sides[key].special !== values[i].special) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
if (this.canOverride(SIDES[i], values[i])) {
|
||||
sides[SIDES[i]] = values[i];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!attemptToAdd.call(this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: use it when we can refer to several points in source
|
||||
// if (this.loc) {
|
||||
// this.loc = {
|
||||
// primary: this.loc,
|
||||
// merged: declaration.loc
|
||||
// };
|
||||
// } else {
|
||||
// this.loc = declaration.loc;
|
||||
// }
|
||||
if (!this.loc) {
|
||||
this.loc = declaration.loc;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
TRBL.prototype.isOkToMinimize = function() {
|
||||
var top = this.sides.top;
|
||||
var right = this.sides.right;
|
||||
var bottom = this.sides.bottom;
|
||||
var left = this.sides.left;
|
||||
|
||||
if (top && right && bottom && left) {
|
||||
var important =
|
||||
top.important +
|
||||
right.important +
|
||||
bottom.important +
|
||||
left.important;
|
||||
|
||||
return important === 0 || important === 4;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
TRBL.prototype.getValue = function() {
|
||||
var result = new List();
|
||||
var sides = this.sides;
|
||||
var values = [
|
||||
sides.top,
|
||||
sides.right,
|
||||
sides.bottom,
|
||||
sides.left
|
||||
];
|
||||
var stringValues = [
|
||||
translate(sides.top.node),
|
||||
translate(sides.right.node),
|
||||
translate(sides.bottom.node),
|
||||
translate(sides.left.node)
|
||||
];
|
||||
|
||||
if (stringValues[LEFT] === stringValues[RIGHT]) {
|
||||
values.pop();
|
||||
if (stringValues[BOTTOM] === stringValues[TOP]) {
|
||||
values.pop();
|
||||
if (stringValues[RIGHT] === stringValues[TOP]) {
|
||||
values.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
if (i) {
|
||||
result.appendData({ type: 'WhiteSpace', value: ' ' });
|
||||
}
|
||||
|
||||
result.appendData(values[i].node);
|
||||
}
|
||||
|
||||
if (this.iehack) {
|
||||
result.appendData({ type: 'WhiteSpace', value: ' ' });
|
||||
result.appendData({
|
||||
type: 'Identifier',
|
||||
loc: null,
|
||||
name: this.iehack
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Value',
|
||||
loc: null,
|
||||
children: result
|
||||
};
|
||||
};
|
||||
|
||||
TRBL.prototype.getDeclaration = function() {
|
||||
return {
|
||||
type: 'Declaration',
|
||||
loc: this.loc,
|
||||
important: this.sides.top.important,
|
||||
property: this.name,
|
||||
value: this.getValue()
|
||||
};
|
||||
};
|
||||
|
||||
function processRule(rule, shorts, shortDeclarations, lastShortSelector) {
|
||||
var declarations = rule.block.children;
|
||||
var selector = rule.prelude.children.first().id;
|
||||
|
||||
rule.block.children.eachRight(function(declaration, item) {
|
||||
var property = declaration.property;
|
||||
|
||||
if (!MAIN_PROPERTY.hasOwnProperty(property)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var key = MAIN_PROPERTY[property];
|
||||
var shorthand;
|
||||
var operation;
|
||||
|
||||
if (!lastShortSelector || selector === lastShortSelector) {
|
||||
if (key in shorts) {
|
||||
operation = REMOVE;
|
||||
shorthand = shorts[key];
|
||||
}
|
||||
}
|
||||
|
||||
if (!shorthand || !shorthand.add(property, declaration)) {
|
||||
operation = REPLACE;
|
||||
shorthand = new TRBL(key);
|
||||
|
||||
// if can't parse value ignore it and break shorthand children
|
||||
if (!shorthand.add(property, declaration)) {
|
||||
lastShortSelector = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
shorts[key] = shorthand;
|
||||
shortDeclarations.push({
|
||||
operation: operation,
|
||||
block: declarations,
|
||||
item: item,
|
||||
shorthand: shorthand
|
||||
});
|
||||
|
||||
lastShortSelector = selector;
|
||||
});
|
||||
|
||||
return lastShortSelector;
|
||||
}
|
||||
|
||||
function processShorthands(shortDeclarations, markDeclaration) {
|
||||
shortDeclarations.forEach(function(item) {
|
||||
var shorthand = item.shorthand;
|
||||
|
||||
if (!shorthand.isOkToMinimize()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.operation === REPLACE) {
|
||||
item.item.data = markDeclaration(shorthand.getDeclaration());
|
||||
} else {
|
||||
item.block.remove(item.item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function restructBlock(ast, indexer) {
|
||||
var stylesheetMap = {};
|
||||
var shortDeclarations = [];
|
||||
|
||||
walkRulesRight(ast, function(node) {
|
||||
if (node.type !== 'Rule') {
|
||||
return;
|
||||
}
|
||||
|
||||
var stylesheet = this.block || this.stylesheet;
|
||||
var ruleId = (node.pseudoSignature || '') + '|' + node.prelude.children.first().id;
|
||||
var ruleMap;
|
||||
var shorts;
|
||||
|
||||
if (!stylesheetMap.hasOwnProperty(stylesheet.id)) {
|
||||
ruleMap = {
|
||||
lastShortSelector: null
|
||||
};
|
||||
stylesheetMap[stylesheet.id] = ruleMap;
|
||||
} else {
|
||||
ruleMap = stylesheetMap[stylesheet.id];
|
||||
}
|
||||
|
||||
if (ruleMap.hasOwnProperty(ruleId)) {
|
||||
shorts = ruleMap[ruleId];
|
||||
} else {
|
||||
shorts = {};
|
||||
ruleMap[ruleId] = shorts;
|
||||
}
|
||||
|
||||
ruleMap.lastShortSelector = processRule.call(this, node, shorts, shortDeclarations, ruleMap.lastShortSelector);
|
||||
});
|
||||
|
||||
processShorthands(shortDeclarations, indexer.declaration);
|
||||
};
|
||||
296
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/6-restructBlock.js
generated
vendored
Normal file
296
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/6-restructBlock.js
generated
vendored
Normal file
@@ -0,0 +1,296 @@
|
||||
var resolveProperty = require('css-tree').property;
|
||||
var resolveKeyword = require('css-tree').keyword;
|
||||
var walkRulesRight = require('css-tree').walkRulesRight;
|
||||
var translate = require('css-tree').translate;
|
||||
var fingerprintId = 1;
|
||||
var dontRestructure = {
|
||||
'src': 1 // https://github.com/afelix/csso/issues/50
|
||||
};
|
||||
|
||||
var DONT_MIX_VALUE = {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/display#Browser_compatibility
|
||||
'display': /table|ruby|flex|-(flex)?box$|grid|contents|run-in/i,
|
||||
// https://developer.mozilla.org/en/docs/Web/CSS/text-align
|
||||
'text-align': /^(start|end|match-parent|justify-all)$/i
|
||||
};
|
||||
|
||||
var CURSOR_SAFE_VALUE = [
|
||||
'auto', 'crosshair', 'default', 'move', 'text', 'wait', 'help',
|
||||
'n-resize', 'e-resize', 's-resize', 'w-resize',
|
||||
'ne-resize', 'nw-resize', 'se-resize', 'sw-resize',
|
||||
'pointer', 'progress', 'not-allowed', 'no-drop', 'vertical-text', 'all-scroll',
|
||||
'col-resize', 'row-resize'
|
||||
];
|
||||
|
||||
var POSITION_SAFE_VALUE = [
|
||||
'static', 'relative', 'absolute', 'fixed'
|
||||
];
|
||||
|
||||
var NEEDLESS_TABLE = {
|
||||
'border-width': ['border'],
|
||||
'border-style': ['border'],
|
||||
'border-color': ['border'],
|
||||
'border-top': ['border'],
|
||||
'border-right': ['border'],
|
||||
'border-bottom': ['border'],
|
||||
'border-left': ['border'],
|
||||
'border-top-width': ['border-top', 'border-width', 'border'],
|
||||
'border-right-width': ['border-right', 'border-width', 'border'],
|
||||
'border-bottom-width': ['border-bottom', 'border-width', 'border'],
|
||||
'border-left-width': ['border-left', 'border-width', 'border'],
|
||||
'border-top-style': ['border-top', 'border-style', 'border'],
|
||||
'border-right-style': ['border-right', 'border-style', 'border'],
|
||||
'border-bottom-style': ['border-bottom', 'border-style', 'border'],
|
||||
'border-left-style': ['border-left', 'border-style', 'border'],
|
||||
'border-top-color': ['border-top', 'border-color', 'border'],
|
||||
'border-right-color': ['border-right', 'border-color', 'border'],
|
||||
'border-bottom-color': ['border-bottom', 'border-color', 'border'],
|
||||
'border-left-color': ['border-left', 'border-color', 'border'],
|
||||
'margin-top': ['margin'],
|
||||
'margin-right': ['margin'],
|
||||
'margin-bottom': ['margin'],
|
||||
'margin-left': ['margin'],
|
||||
'padding-top': ['padding'],
|
||||
'padding-right': ['padding'],
|
||||
'padding-bottom': ['padding'],
|
||||
'padding-left': ['padding'],
|
||||
'font-style': ['font'],
|
||||
'font-variant': ['font'],
|
||||
'font-weight': ['font'],
|
||||
'font-size': ['font'],
|
||||
'font-family': ['font'],
|
||||
'list-style-type': ['list-style'],
|
||||
'list-style-position': ['list-style'],
|
||||
'list-style-image': ['list-style']
|
||||
};
|
||||
|
||||
function getPropertyFingerprint(propertyName, declaration, fingerprints) {
|
||||
var realName = resolveProperty(propertyName).name;
|
||||
|
||||
if (realName === 'background') {
|
||||
return propertyName + ':' + translate(declaration.value);
|
||||
}
|
||||
|
||||
var declarationId = declaration.id;
|
||||
var fingerprint = fingerprints[declarationId];
|
||||
|
||||
if (!fingerprint) {
|
||||
switch (declaration.value.type) {
|
||||
case 'Value':
|
||||
var vendorId = '';
|
||||
var iehack = '';
|
||||
var special = {};
|
||||
var raw = false;
|
||||
|
||||
declaration.value.children.each(function walk(node) {
|
||||
switch (node.type) {
|
||||
case 'Value':
|
||||
case 'Brackets':
|
||||
case 'Parentheses':
|
||||
node.children.each(walk);
|
||||
break;
|
||||
|
||||
case 'Raw':
|
||||
raw = true;
|
||||
break;
|
||||
|
||||
case 'Identifier':
|
||||
var name = node.name;
|
||||
|
||||
if (!vendorId) {
|
||||
vendorId = resolveKeyword(name).vendor;
|
||||
}
|
||||
|
||||
if (/\\[09]/.test(name)) {
|
||||
iehack = RegExp.lastMatch;
|
||||
}
|
||||
|
||||
if (realName === 'cursor') {
|
||||
if (CURSOR_SAFE_VALUE.indexOf(name) === -1) {
|
||||
special[name] = true;
|
||||
}
|
||||
} else if (realName === 'position') {
|
||||
if (POSITION_SAFE_VALUE.indexOf(name) === -1) {
|
||||
special[name] = true;
|
||||
}
|
||||
} else if (DONT_MIX_VALUE.hasOwnProperty(realName)) {
|
||||
if (DONT_MIX_VALUE[realName].test(name)) {
|
||||
special[name] = true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'Function':
|
||||
var name = node.name;
|
||||
|
||||
if (!vendorId) {
|
||||
vendorId = resolveKeyword(name).vendor;
|
||||
}
|
||||
|
||||
if (name === 'rect') {
|
||||
// there are 2 forms of rect:
|
||||
// rect(<top>, <right>, <bottom>, <left>) - standart
|
||||
// rect(<top> <right> <bottom> <left>) – backwards compatible syntax
|
||||
// only the same form values can be merged
|
||||
var hasComma = node.children.some(function(node) {
|
||||
return node.type === 'Operator' && node.value === ',';
|
||||
});
|
||||
if (!hasComma) {
|
||||
name = 'rect-backward';
|
||||
}
|
||||
}
|
||||
|
||||
special[name + '()'] = true;
|
||||
|
||||
// check nested tokens too
|
||||
node.children.each(walk);
|
||||
|
||||
break;
|
||||
|
||||
case 'Dimension':
|
||||
var unit = node.unit;
|
||||
|
||||
switch (unit) {
|
||||
// is not supported until IE11
|
||||
case 'rem':
|
||||
|
||||
// v* units is too buggy across browsers and better
|
||||
// don't merge values with those units
|
||||
case 'vw':
|
||||
case 'vh':
|
||||
case 'vmin':
|
||||
case 'vmax':
|
||||
case 'vm': // IE9 supporting "vm" instead of "vmin".
|
||||
special[unit] = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
fingerprint = raw
|
||||
? '!' + fingerprintId++
|
||||
: '!' + Object.keys(special).sort() + '|' + iehack + vendorId;
|
||||
break;
|
||||
|
||||
case 'Raw':
|
||||
fingerprint = '!' + declaration.value.value;
|
||||
break;
|
||||
|
||||
default:
|
||||
fingerprint = translate(declaration.value);
|
||||
}
|
||||
|
||||
fingerprints[declarationId] = fingerprint;
|
||||
}
|
||||
|
||||
return propertyName + fingerprint;
|
||||
}
|
||||
|
||||
function needless(props, declaration, fingerprints) {
|
||||
var property = resolveProperty(declaration.property);
|
||||
|
||||
if (NEEDLESS_TABLE.hasOwnProperty(property.name)) {
|
||||
var table = NEEDLESS_TABLE[property.name];
|
||||
|
||||
for (var i = 0; i < table.length; i++) {
|
||||
var ppre = getPropertyFingerprint(property.prefix + table[i], declaration, fingerprints);
|
||||
var prev = props.hasOwnProperty(ppre) ? props[ppre] : null;
|
||||
|
||||
if (prev && (!declaration.important || prev.item.data.important)) {
|
||||
return prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function processRule(rule, item, list, props, fingerprints) {
|
||||
var declarations = rule.block.children;
|
||||
|
||||
declarations.eachRight(function(declaration, declarationItem) {
|
||||
var property = declaration.property;
|
||||
var fingerprint = getPropertyFingerprint(property, declaration, fingerprints);
|
||||
var prev = props[fingerprint];
|
||||
|
||||
if (prev && !dontRestructure.hasOwnProperty(property)) {
|
||||
if (declaration.important && !prev.item.data.important) {
|
||||
props[fingerprint] = {
|
||||
block: declarations,
|
||||
item: declarationItem
|
||||
};
|
||||
|
||||
prev.block.remove(prev.item);
|
||||
|
||||
// TODO: use it when we can refer to several points in source
|
||||
// declaration.loc = {
|
||||
// primary: declaration.loc,
|
||||
// merged: prev.item.data.loc
|
||||
// };
|
||||
} else {
|
||||
declarations.remove(declarationItem);
|
||||
|
||||
// TODO: use it when we can refer to several points in source
|
||||
// prev.item.data.loc = {
|
||||
// primary: prev.item.data.loc,
|
||||
// merged: declaration.loc
|
||||
// };
|
||||
}
|
||||
} else {
|
||||
var prev = needless(props, declaration, fingerprints);
|
||||
|
||||
if (prev) {
|
||||
declarations.remove(declarationItem);
|
||||
|
||||
// TODO: use it when we can refer to several points in source
|
||||
// prev.item.data.loc = {
|
||||
// primary: prev.item.data.loc,
|
||||
// merged: declaration.loc
|
||||
// };
|
||||
} else {
|
||||
declaration.fingerprint = fingerprint;
|
||||
|
||||
props[fingerprint] = {
|
||||
block: declarations,
|
||||
item: declarationItem
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (declarations.isEmpty()) {
|
||||
list.remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function restructBlock(ast) {
|
||||
var stylesheetMap = {};
|
||||
var fingerprints = Object.create(null);
|
||||
|
||||
walkRulesRight(ast, function(node, item, list) {
|
||||
if (node.type !== 'Rule') {
|
||||
return;
|
||||
}
|
||||
|
||||
var stylesheet = this.block || this.stylesheet;
|
||||
var ruleId = (node.pseudoSignature || '') + '|' + node.prelude.children.first().id;
|
||||
var ruleMap;
|
||||
var props;
|
||||
|
||||
if (!stylesheetMap.hasOwnProperty(stylesheet.id)) {
|
||||
ruleMap = {};
|
||||
stylesheetMap[stylesheet.id] = ruleMap;
|
||||
} else {
|
||||
ruleMap = stylesheetMap[stylesheet.id];
|
||||
}
|
||||
|
||||
if (ruleMap.hasOwnProperty(ruleId)) {
|
||||
props = ruleMap[ruleId];
|
||||
} else {
|
||||
props = {};
|
||||
ruleMap[ruleId] = props;
|
||||
}
|
||||
|
||||
processRule.call(this, node, item, list, props, fingerprints);
|
||||
});
|
||||
};
|
||||
87
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/7-mergeRuleset.js
generated
vendored
Normal file
87
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/7-mergeRuleset.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
var walkRules = require('css-tree').walkRules;
|
||||
var utils = require('./utils');
|
||||
|
||||
/*
|
||||
At this step all rules has single simple selector. We try to join by equal
|
||||
declaration blocks to first rule, e.g.
|
||||
|
||||
.a { color: red }
|
||||
b { ... }
|
||||
.b { color: red }
|
||||
->
|
||||
.a, .b { color: red }
|
||||
b { ... }
|
||||
*/
|
||||
|
||||
function processRule(node, item, list) {
|
||||
var selectors = node.prelude.children;
|
||||
var declarations = node.block.children;
|
||||
var nodeCompareMarker = selectors.first().compareMarker;
|
||||
var skippedCompareMarkers = {};
|
||||
|
||||
list.nextUntil(item.next, function(next, nextItem) {
|
||||
// skip non-ruleset node if safe
|
||||
if (next.type !== 'Rule') {
|
||||
return utils.unsafeToSkipNode.call(selectors, next);
|
||||
}
|
||||
|
||||
if (node.pseudoSignature !== next.pseudoSignature) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var nextFirstSelector = next.prelude.children.head;
|
||||
var nextDeclarations = next.block.children;
|
||||
var nextCompareMarker = nextFirstSelector.data.compareMarker;
|
||||
|
||||
// if next ruleset has same marked as one of skipped then stop joining
|
||||
if (nextCompareMarker in skippedCompareMarkers) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// try to join by selectors
|
||||
if (selectors.head === selectors.tail) {
|
||||
if (selectors.first().id === nextFirstSelector.data.id) {
|
||||
declarations.appendList(nextDeclarations);
|
||||
list.remove(nextItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// try to join by properties
|
||||
if (utils.isEqualDeclarations(declarations, nextDeclarations)) {
|
||||
var nextStr = nextFirstSelector.data.id;
|
||||
|
||||
selectors.some(function(data, item) {
|
||||
var curStr = data.id;
|
||||
|
||||
if (nextStr < curStr) {
|
||||
selectors.insert(nextFirstSelector, item);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!item.next) {
|
||||
selectors.insert(nextFirstSelector);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
list.remove(nextItem);
|
||||
return;
|
||||
}
|
||||
|
||||
// go to next ruleset if current one can be skipped (has no equal specificity nor element selector)
|
||||
if (nextCompareMarker === nodeCompareMarker) {
|
||||
return true;
|
||||
}
|
||||
|
||||
skippedCompareMarkers[nextCompareMarker] = true;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function mergeRule(ast) {
|
||||
walkRules(ast, function(node, item, list) {
|
||||
if (node.type === 'Rule') {
|
||||
processRule(node, item, list);
|
||||
}
|
||||
});
|
||||
};
|
||||
157
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/8-restructRuleset.js
generated
vendored
Normal file
157
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/8-restructRuleset.js
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
var List = require('css-tree').List;
|
||||
var walkRulesRight = require('css-tree').walkRulesRight;
|
||||
var utils = require('./utils');
|
||||
|
||||
function calcSelectorLength(list) {
|
||||
var length = 0;
|
||||
|
||||
list.each(function(data) {
|
||||
length += data.id.length + 1;
|
||||
});
|
||||
|
||||
return length - 1;
|
||||
}
|
||||
|
||||
function calcDeclarationsLength(tokens) {
|
||||
var length = 0;
|
||||
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
length += tokens[i].length;
|
||||
}
|
||||
|
||||
return (
|
||||
length + // declarations
|
||||
tokens.length - 1 // delimeters
|
||||
);
|
||||
}
|
||||
|
||||
function processRule(node, item, list) {
|
||||
var avoidRulesMerge = this.block !== null ? this.block.avoidRulesMerge : false;
|
||||
var selectors = node.prelude.children;
|
||||
var block = node.block;
|
||||
var disallowDownMarkers = Object.create(null);
|
||||
var allowMergeUp = true;
|
||||
var allowMergeDown = true;
|
||||
|
||||
list.prevUntil(item.prev, function(prev, prevItem) {
|
||||
// skip non-ruleset node if safe
|
||||
if (prev.type !== 'Rule') {
|
||||
return utils.unsafeToSkipNode.call(selectors, prev);
|
||||
}
|
||||
|
||||
var prevSelectors = prev.prelude.children;
|
||||
var prevBlock = prev.block;
|
||||
|
||||
if (node.pseudoSignature !== prev.pseudoSignature) {
|
||||
return true;
|
||||
}
|
||||
|
||||
allowMergeDown = !prevSelectors.some(function(selector) {
|
||||
return selector.compareMarker in disallowDownMarkers;
|
||||
});
|
||||
|
||||
// try prev ruleset if simpleselectors has no equal specifity and element selector
|
||||
if (!allowMergeDown && !allowMergeUp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// try to join by selectors
|
||||
if (allowMergeUp && utils.isEqualSelectors(prevSelectors, selectors)) {
|
||||
prevBlock.children.appendList(block.children);
|
||||
list.remove(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
// try to join by properties
|
||||
var diff = utils.compareDeclarations(block.children, prevBlock.children);
|
||||
|
||||
// console.log(diff.eq, diff.ne1, diff.ne2);
|
||||
|
||||
if (diff.eq.length) {
|
||||
if (!diff.ne1.length && !diff.ne2.length) {
|
||||
// equal blocks
|
||||
if (allowMergeDown) {
|
||||
utils.addSelectors(selectors, prevSelectors);
|
||||
list.remove(prevItem);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (!avoidRulesMerge) { /* probably we don't need to prevent those merges for @keyframes
|
||||
TODO: need to be checked */
|
||||
|
||||
if (diff.ne1.length && !diff.ne2.length) {
|
||||
// prevBlock is subset block
|
||||
var selectorLength = calcSelectorLength(selectors);
|
||||
var blockLength = calcDeclarationsLength(diff.eq); // declarations length
|
||||
|
||||
if (allowMergeUp && selectorLength < blockLength) {
|
||||
utils.addSelectors(prevSelectors, selectors);
|
||||
block.children = new List().fromArray(diff.ne1);
|
||||
}
|
||||
} else if (!diff.ne1.length && diff.ne2.length) {
|
||||
// node is subset of prevBlock
|
||||
var selectorLength = calcSelectorLength(prevSelectors);
|
||||
var blockLength = calcDeclarationsLength(diff.eq); // declarations length
|
||||
|
||||
if (allowMergeDown && selectorLength < blockLength) {
|
||||
utils.addSelectors(selectors, prevSelectors);
|
||||
prevBlock.children = new List().fromArray(diff.ne2);
|
||||
}
|
||||
} else {
|
||||
// diff.ne1.length && diff.ne2.length
|
||||
// extract equal block
|
||||
var newSelector = {
|
||||
type: 'SelectorList',
|
||||
loc: null,
|
||||
children: utils.addSelectors(prevSelectors.copy(), selectors)
|
||||
};
|
||||
var newBlockLength = calcSelectorLength(newSelector.children) + 2; // selectors length + curly braces length
|
||||
var blockLength = calcDeclarationsLength(diff.eq); // declarations length
|
||||
|
||||
// create new ruleset if declarations length greater than
|
||||
// ruleset description overhead
|
||||
if (allowMergeDown && blockLength >= newBlockLength) {
|
||||
var newRule = {
|
||||
type: 'Rule',
|
||||
loc: null,
|
||||
prelude: newSelector,
|
||||
block: {
|
||||
type: 'Block',
|
||||
loc: null,
|
||||
children: new List().fromArray(diff.eq)
|
||||
},
|
||||
pseudoSignature: node.pseudoSignature
|
||||
};
|
||||
|
||||
block.children = new List().fromArray(diff.ne1);
|
||||
prevBlock.children = new List().fromArray(diff.ne2.concat(diff.ne2overrided));
|
||||
list.insert(list.createItem(newRule), prevItem);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allowMergeUp) {
|
||||
// TODO: disallow up merge only if any property interception only (i.e. diff.ne2overrided.length > 0);
|
||||
// await property families to find property interception correctly
|
||||
allowMergeUp = !prevSelectors.some(function(prevSelector) {
|
||||
return selectors.some(function(selector) {
|
||||
return selector.compareMarker === prevSelector.compareMarker;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
prevSelectors.each(function(data) {
|
||||
disallowDownMarkers[data.compareMarker] = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function restructRule(ast) {
|
||||
walkRulesRight(ast, function(node, item, list) {
|
||||
if (node.type === 'Rule') {
|
||||
processRule.call(this, node, item, list);
|
||||
}
|
||||
});
|
||||
};
|
||||
35
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/index.js
generated
vendored
Normal file
35
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/index.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
var prepare = require('./prepare/index');
|
||||
var mergeAtrule = require('./1-mergeAtrule');
|
||||
var initialMergeRuleset = require('./2-initialMergeRuleset');
|
||||
var disjoinRuleset = require('./3-disjoinRuleset');
|
||||
var restructShorthand = require('./4-restructShorthand');
|
||||
var restructBlock = require('./6-restructBlock');
|
||||
var mergeRuleset = require('./7-mergeRuleset');
|
||||
var restructRuleset = require('./8-restructRuleset');
|
||||
|
||||
module.exports = function(ast, options) {
|
||||
// prepare ast for restructing
|
||||
var indexer = prepare(ast, options);
|
||||
options.logger('prepare', ast);
|
||||
|
||||
mergeAtrule(ast, options);
|
||||
options.logger('mergeAtrule', ast);
|
||||
|
||||
initialMergeRuleset(ast);
|
||||
options.logger('initialMergeRuleset', ast);
|
||||
|
||||
disjoinRuleset(ast);
|
||||
options.logger('disjoinRuleset', ast);
|
||||
|
||||
restructShorthand(ast, indexer);
|
||||
options.logger('restructShorthand', ast);
|
||||
|
||||
restructBlock(ast);
|
||||
options.logger('restructBlock', ast);
|
||||
|
||||
mergeRuleset(ast);
|
||||
options.logger('mergeRuleset', ast);
|
||||
|
||||
restructRuleset(ast);
|
||||
options.logger('restructRuleset', ast);
|
||||
};
|
||||
31
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
generated
vendored
Normal file
31
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/prepare/createDeclarationIndexer.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
var translate = require('css-tree').translate;
|
||||
|
||||
function Index() {
|
||||
this.seed = 0;
|
||||
this.map = Object.create(null);
|
||||
}
|
||||
|
||||
Index.prototype.resolve = function(str) {
|
||||
var index = this.map[str];
|
||||
|
||||
if (!index) {
|
||||
index = ++this.seed;
|
||||
this.map[str] = index;
|
||||
}
|
||||
|
||||
return index;
|
||||
};
|
||||
|
||||
module.exports = function createDeclarationIndexer() {
|
||||
var ids = new Index();
|
||||
|
||||
return function markDeclaration(node) {
|
||||
var id = translate(node);
|
||||
|
||||
node.id = ids.resolve(id);
|
||||
node.length = id.length;
|
||||
node.fingerprint = null;
|
||||
|
||||
return node;
|
||||
};
|
||||
};
|
||||
45
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/prepare/index.js
generated
vendored
Normal file
45
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/prepare/index.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
var resolveKeyword = require('css-tree').keyword;
|
||||
var walkRules = require('css-tree').walkRules;
|
||||
var translate = require('css-tree').translate;
|
||||
var createDeclarationIndexer = require('./createDeclarationIndexer');
|
||||
var processSelector = require('./processSelector');
|
||||
|
||||
function walk(node, markDeclaration, options) {
|
||||
switch (node.type) {
|
||||
case 'Rule':
|
||||
node.block.children.each(markDeclaration);
|
||||
processSelector(node, options.usage);
|
||||
break;
|
||||
|
||||
case 'Atrule':
|
||||
if (node.prelude) {
|
||||
node.prelude.id = null; // pre-init property to avoid multiple hidden class for translate
|
||||
node.prelude.id = translate(node.prelude);
|
||||
}
|
||||
|
||||
// compare keyframe selectors by its values
|
||||
// NOTE: still no clarification about problems with keyframes selector grouping (issue #197)
|
||||
if (resolveKeyword(node.name).name === 'keyframes') {
|
||||
node.block.avoidRulesMerge = true; /* probably we don't need to prevent those merges for @keyframes
|
||||
TODO: need to be checked */
|
||||
node.block.children.each(function(rule) {
|
||||
rule.prelude.children.each(function(simpleselector) {
|
||||
simpleselector.compareMarker = simpleselector.id;
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function prepare(ast, options) {
|
||||
var markDeclaration = createDeclarationIndexer();
|
||||
|
||||
walkRules(ast, function(node) {
|
||||
walk(node, markDeclaration, options);
|
||||
});
|
||||
|
||||
return {
|
||||
declaration: markDeclaration
|
||||
};
|
||||
};
|
||||
94
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/prepare/processSelector.js
generated
vendored
Normal file
94
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/prepare/processSelector.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
var translate = require('css-tree').translate;
|
||||
var specificity = require('./specificity');
|
||||
|
||||
var nonFreezePseudoElements = {
|
||||
'first-letter': true,
|
||||
'first-line': true,
|
||||
'after': true,
|
||||
'before': true
|
||||
};
|
||||
var nonFreezePseudoClasses = {
|
||||
'link': true,
|
||||
'visited': true,
|
||||
'hover': true,
|
||||
'active': true,
|
||||
'first-letter': true,
|
||||
'first-line': true,
|
||||
'after': true,
|
||||
'before': true
|
||||
};
|
||||
|
||||
module.exports = function freeze(node, usageData) {
|
||||
var pseudos = Object.create(null);
|
||||
var hasPseudo = false;
|
||||
|
||||
node.prelude.children.each(function(simpleSelector) {
|
||||
var tagName = '*';
|
||||
var scope = 0;
|
||||
|
||||
simpleSelector.children.each(function(node) {
|
||||
switch (node.type) {
|
||||
case 'ClassSelector':
|
||||
if (usageData && usageData.scopes) {
|
||||
var classScope = usageData.scopes[node.name] || 0;
|
||||
|
||||
if (scope !== 0 && classScope !== scope) {
|
||||
throw new Error('Selector can\'t has classes from different scopes: ' + translate(simpleSelector));
|
||||
}
|
||||
|
||||
scope = classScope;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'PseudoClassSelector':
|
||||
var name = node.name.toLowerCase();
|
||||
|
||||
if (!nonFreezePseudoClasses.hasOwnProperty(name)) {
|
||||
pseudos[name] = true;
|
||||
hasPseudo = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'PseudoElementSelector':
|
||||
var name = node.name.toLowerCase();
|
||||
|
||||
if (!nonFreezePseudoElements.hasOwnProperty(name)) {
|
||||
pseudos[name] = true;
|
||||
hasPseudo = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'TypeSelector':
|
||||
tagName = node.name.toLowerCase();
|
||||
break;
|
||||
|
||||
case 'AttributeSelector':
|
||||
if (node.flags) {
|
||||
pseudos['[' + node.flags.toLowerCase() + ']'] = true;
|
||||
hasPseudo = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'WhiteSpace':
|
||||
case 'Combinator':
|
||||
tagName = '*';
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
simpleSelector.compareMarker = specificity(simpleSelector).toString();
|
||||
simpleSelector.id = null; // pre-init property to avoid multiple hidden class
|
||||
simpleSelector.id = translate(simpleSelector);
|
||||
|
||||
if (scope) {
|
||||
simpleSelector.compareMarker += ':' + scope;
|
||||
}
|
||||
|
||||
if (tagName !== '*') {
|
||||
simpleSelector.compareMarker += ',' + tagName;
|
||||
}
|
||||
});
|
||||
|
||||
// add property to all rule nodes to avoid multiple hidden class
|
||||
node.pseudoSignature = hasPseudo && Object.keys(pseudos).sort().join(',');
|
||||
};
|
||||
57
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/prepare/specificity.js
generated
vendored
Normal file
57
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/prepare/specificity.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
module.exports = function specificity(simpleSelector) {
|
||||
var A = 0;
|
||||
var B = 0;
|
||||
var C = 0;
|
||||
|
||||
simpleSelector.children.each(function walk(node) {
|
||||
switch (node.type) {
|
||||
case 'SelectorList':
|
||||
case 'Selector':
|
||||
node.children.each(walk);
|
||||
break;
|
||||
|
||||
case 'IdSelector':
|
||||
A++;
|
||||
break;
|
||||
|
||||
case 'ClassSelector':
|
||||
case 'AttributeSelector':
|
||||
B++;
|
||||
break;
|
||||
|
||||
case 'PseudoClassSelector':
|
||||
switch (node.name.toLowerCase()) {
|
||||
case 'not':
|
||||
node.children.each(walk);
|
||||
break;
|
||||
|
||||
case 'before':
|
||||
case 'after':
|
||||
case 'first-line':
|
||||
case 'first-letter':
|
||||
C++;
|
||||
break;
|
||||
|
||||
// TODO: support for :nth-*(.. of <SelectorList>), :matches(), :has()
|
||||
|
||||
default:
|
||||
B++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'PseudoElementSelector':
|
||||
C++;
|
||||
break;
|
||||
|
||||
case 'TypeSelector':
|
||||
// ignore universal selector
|
||||
if (node.name.charAt(node.name.length - 1) !== '*') {
|
||||
C++;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return [A, B, C];
|
||||
};
|
||||
139
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/utils.js
generated
vendored
Normal file
139
build/node_modules/postcss-csso/node_modules/csso/lib/restructure/utils.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
function isEqualSelectors(a, b) {
|
||||
var cursor1 = a.head;
|
||||
var cursor2 = b.head;
|
||||
|
||||
while (cursor1 !== null && cursor2 !== null && cursor1.data.id === cursor2.data.id) {
|
||||
cursor1 = cursor1.next;
|
||||
cursor2 = cursor2.next;
|
||||
}
|
||||
|
||||
return cursor1 === null && cursor2 === null;
|
||||
}
|
||||
|
||||
function isEqualDeclarations(a, b) {
|
||||
var cursor1 = a.head;
|
||||
var cursor2 = b.head;
|
||||
|
||||
while (cursor1 !== null && cursor2 !== null && cursor1.data.id === cursor2.data.id) {
|
||||
cursor1 = cursor1.next;
|
||||
cursor2 = cursor2.next;
|
||||
}
|
||||
|
||||
return cursor1 === null && cursor2 === null;
|
||||
}
|
||||
|
||||
function compareDeclarations(declarations1, declarations2) {
|
||||
var result = {
|
||||
eq: [],
|
||||
ne1: [],
|
||||
ne2: [],
|
||||
ne2overrided: []
|
||||
};
|
||||
|
||||
var fingerprints = Object.create(null);
|
||||
var declarations2hash = Object.create(null);
|
||||
|
||||
for (var cursor = declarations2.head; cursor; cursor = cursor.next) {
|
||||
declarations2hash[cursor.data.id] = true;
|
||||
}
|
||||
|
||||
for (var cursor = declarations1.head; cursor; cursor = cursor.next) {
|
||||
var data = cursor.data;
|
||||
|
||||
if (data.fingerprint) {
|
||||
fingerprints[data.fingerprint] = data.important;
|
||||
}
|
||||
|
||||
if (declarations2hash[data.id]) {
|
||||
declarations2hash[data.id] = false;
|
||||
result.eq.push(data);
|
||||
} else {
|
||||
result.ne1.push(data);
|
||||
}
|
||||
}
|
||||
|
||||
for (var cursor = declarations2.head; cursor; cursor = cursor.next) {
|
||||
var data = cursor.data;
|
||||
|
||||
if (declarations2hash[data.id]) {
|
||||
// if declarations1 has overriding declaration, this is not a difference
|
||||
// but take in account !important - prev should be equal or greater than follow
|
||||
if (hasOwnProperty.call(fingerprints, data.fingerprint) &&
|
||||
Number(fingerprints[data.fingerprint]) >= Number(data.important)) {
|
||||
result.ne2overrided.push(data);
|
||||
} else {
|
||||
result.ne2.push(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function addSelectors(dest, source) {
|
||||
source.each(function(sourceData) {
|
||||
var newStr = sourceData.id;
|
||||
var cursor = dest.head;
|
||||
|
||||
while (cursor) {
|
||||
var nextStr = cursor.data.id;
|
||||
|
||||
if (nextStr === newStr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nextStr > newStr) {
|
||||
break;
|
||||
}
|
||||
|
||||
cursor = cursor.next;
|
||||
}
|
||||
|
||||
dest.insert(dest.createItem(sourceData), cursor);
|
||||
});
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
// check if simpleselectors has no equal specificity and element selector
|
||||
function hasSimilarSelectors(selectors1, selectors2) {
|
||||
return selectors1.some(function(a) {
|
||||
return selectors2.some(function(b) {
|
||||
return a.compareMarker === b.compareMarker;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// test node can't to be skipped
|
||||
function unsafeToSkipNode(node) {
|
||||
switch (node.type) {
|
||||
case 'Rule':
|
||||
// unsafe skip ruleset with selector similarities
|
||||
return hasSimilarSelectors(node.prelude.children, this);
|
||||
|
||||
case 'Atrule':
|
||||
// can skip at-rules with blocks
|
||||
if (node.block) {
|
||||
// unsafe skip at-rule if block contains something unsafe to skip
|
||||
return node.block.children.some(unsafeToSkipNode, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Declaration':
|
||||
return false;
|
||||
}
|
||||
|
||||
// unsafe by default
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isEqualSelectors: isEqualSelectors,
|
||||
isEqualDeclarations: isEqualDeclarations,
|
||||
compareDeclarations: compareDeclarations,
|
||||
addSelectors: addSelectors,
|
||||
hasSimilarSelectors: hasSimilarSelectors,
|
||||
unsafeToSkipNode: unsafeToSkipNode
|
||||
};
|
||||
79
build/node_modules/postcss-csso/node_modules/csso/lib/usage.js
generated
vendored
Normal file
79
build/node_modules/postcss-csso/node_modules/csso/lib/usage.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
function buildMap(list, caseInsensitive) {
|
||||
var map = Object.create(null);
|
||||
|
||||
if (!Array.isArray(list)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var name = list[i];
|
||||
|
||||
if (caseInsensitive) {
|
||||
name = name.toLowerCase();
|
||||
}
|
||||
|
||||
map[name] = true;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
function buildList(data) {
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var tags = buildMap(data.tags, true);
|
||||
var ids = buildMap(data.ids);
|
||||
var classes = buildMap(data.classes);
|
||||
|
||||
if (tags === null &&
|
||||
ids === null &&
|
||||
classes === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
tags: tags,
|
||||
ids: ids,
|
||||
classes: classes
|
||||
};
|
||||
}
|
||||
|
||||
function buildIndex(data) {
|
||||
var scopes = false;
|
||||
|
||||
if (data.scopes && Array.isArray(data.scopes)) {
|
||||
scopes = Object.create(null);
|
||||
|
||||
for (var i = 0; i < data.scopes.length; i++) {
|
||||
var list = data.scopes[i];
|
||||
|
||||
if (!list || !Array.isArray(list)) {
|
||||
throw new Error('Wrong usage format');
|
||||
}
|
||||
|
||||
for (var j = 0; j < list.length; j++) {
|
||||
var name = list[j];
|
||||
|
||||
if (hasOwnProperty.call(scopes, name)) {
|
||||
throw new Error('Class can\'t be used for several scopes: ' + name);
|
||||
}
|
||||
|
||||
scopes[name] = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
whitelist: buildList(data),
|
||||
blacklist: buildList(data.blacklist),
|
||||
scopes: scopes
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
buildIndex: buildIndex
|
||||
};
|
||||
117
build/node_modules/postcss-csso/node_modules/csso/package.json
generated
vendored
Normal file
117
build/node_modules/postcss-csso/node_modules/csso/package.json
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"csso@3.3.1",
|
||||
"/Users/asciidisco/Desktop/asciidisco.com/build"
|
||||
]
|
||||
],
|
||||
"_from": "csso@3.3.1",
|
||||
"_id": "csso@3.3.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-OjETffCFB/OzwxVL3eF0+5tXOXCMukVO6rEUxlkIhscE1KRObyg+zMrLUbkPn9kxgBrFWicc37Gv5/22dOh5EA==",
|
||||
"_location": "/postcss-csso/csso",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "csso@3.3.1",
|
||||
"name": "csso",
|
||||
"escapedName": "csso",
|
||||
"rawSpec": "3.3.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.3.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/postcss-csso"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/csso/-/csso-3.3.1.tgz",
|
||||
"_spec": "3.3.1",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Sergey Kryzhanovsky",
|
||||
"email": "skryzhanovsky@ya.ru",
|
||||
"url": "https://github.com/afelix"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/css/csso/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"css-tree": "1.0.0-alpha25"
|
||||
},
|
||||
"description": "CSS minifier with structural optimisations",
|
||||
"devDependencies": {
|
||||
"browserify": "^13.0.0",
|
||||
"coveralls": "^2.11.6",
|
||||
"eslint": "^2.2.0",
|
||||
"istanbul": "^0.4.2",
|
||||
"jscs": "~2.10.0",
|
||||
"mocha": "~2.4.2",
|
||||
"package-json-versionify": "^1.0.4",
|
||||
"source-map": "^0.5.6",
|
||||
"uglify-js": "^2.6.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"env": {
|
||||
"node": true,
|
||||
"mocha": true,
|
||||
"es6": true
|
||||
},
|
||||
"rules": {
|
||||
"no-duplicate-case": 2,
|
||||
"no-undef": 2,
|
||||
"no-unused-vars": [
|
||||
2,
|
||||
{
|
||||
"vars": "all",
|
||||
"args": "after-used"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist/csso-browser.js",
|
||||
"lib",
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/css/csso",
|
||||
"keywords": [
|
||||
"css",
|
||||
"compress",
|
||||
"minifier",
|
||||
"minify",
|
||||
"optimise",
|
||||
"optimisation",
|
||||
"csstree"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Roman Dvornov",
|
||||
"email": "rdvornov@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "csso",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/css/csso.git"
|
||||
},
|
||||
"scripts": {
|
||||
"browserify": "browserify -t package-json-versionify --standalone csso lib/index.js | uglifyjs --compress --mangle -o dist/csso-browser.js",
|
||||
"codestyle": "jscs lib test && eslint lib test",
|
||||
"codestyle-and-test": "npm run codestyle && npm test",
|
||||
"coverage": "istanbul cover _mocha -- -R dot",
|
||||
"coveralls": "istanbul cover _mocha --report lcovonly -- -R dot && cat ./coverage/lcov.info | coveralls",
|
||||
"gh-pages": "git clone -b gh-pages https://github.com/css/csso.git .gh-pages && npm run browserify && cp dist/csso-browser.js .gh-pages/ && cd .gh-pages && git commit -am \"update\" && git push && cd .. && rm -rf .gh-pages",
|
||||
"hydrogen": "node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --trace_hydrogen_file=code.cfg --print-opt-code bin/csso --stat -o /dev/null",
|
||||
"prepublish": "npm run browserify",
|
||||
"test": "mocha --reporter dot",
|
||||
"travis": "npm run codestyle-and-test && npm run coveralls"
|
||||
},
|
||||
"version": "3.3.1"
|
||||
}
|
||||
527
build/node_modules/postcss-csso/node_modules/postcss/CHANGELOG.md
generated
vendored
Normal file
527
build/node_modules/postcss-csso/node_modules/postcss/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,527 @@
|
||||
# Change Log
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 6.0.15
|
||||
* Add warning about missed `from` option on `process().then()` call.
|
||||
* Add IE 10 support.
|
||||
|
||||
## 6.0.14
|
||||
* Fix TypeScript definitions (by Jed Mao).
|
||||
|
||||
## 6.0.13
|
||||
* Fix TypeScript definitions for case of multiple PostCSS versions
|
||||
in `node_modules` (by Chris Eppstein).
|
||||
* Use `source-map` 0.6.
|
||||
|
||||
## 6.0.12
|
||||
* Don’t copy `*` hack to declaration indent.
|
||||
|
||||
## 6.0.11
|
||||
* Add upper case `!IMPORTANT` support.
|
||||
|
||||
## 6.0.10
|
||||
* Reduce PostCSS size in webpack bundle.
|
||||
|
||||
## 6.0.9
|
||||
* Improve error message for plugin with old PostCSS (by Igor Adamenko).
|
||||
|
||||
## 6.0.8
|
||||
* Fix Node.js 4.2.2 support.
|
||||
|
||||
## 6.0.7
|
||||
* Fix base64 decoding for old Node.js and browser.
|
||||
|
||||
## 6.0.6
|
||||
* Fix `end` position in at-rule without semicolon (by Oleh Kuchuk).
|
||||
|
||||
## 6.0.5
|
||||
* Move Babel config from `package.json` for `node_modules` compiling cases.
|
||||
|
||||
## 6.0.4
|
||||
* Fix parsing `;;` after rules.
|
||||
* Use Chalk 2.0.
|
||||
|
||||
## 6.0.3
|
||||
* Fix escape sequences parsing (by Oleh Kuchuk).
|
||||
* Added ability to force disable colors with an environment variable.
|
||||
* Improved color detection of some terminal apps.
|
||||
|
||||
## 6.0.2
|
||||
* Keep `raws.before` on moving `Root` children to new `Root`.
|
||||
|
||||
## 6.0.1
|
||||
* Fix parser extensibility to use it in Safe Parser.
|
||||
|
||||
## 6.0 “Marquis Orias”
|
||||
* Remove node.js 0.12 support.
|
||||
* Remove deprecated method from PostCSS 4.
|
||||
* Insert methods remove child from previous parent, instead of closing.
|
||||
* Insert methods and cloning doesn’t clean `raws` anymore.
|
||||
* Methods `moveTo`, `moveAfter`, `moveBefore` were deprecated.
|
||||
* Options was changed in `Plugin#process(css, processOptions, pluginOptions)`.
|
||||
* Add stream parser to reduce memory usage (by Oleh Kuchuk).
|
||||
* Add `before()`/`after()` shortcuts for `node.parent.insertBefore(node, x)`.
|
||||
* Add `Rule#raws.ownSemicolon` for semicolon after templates for `@apply`.
|
||||
* Use `babel-preset-env` to compile npm package.
|
||||
* Remove `js-base64` from dependencies (by Roman Dvornov).
|
||||
* Fix error message on single `:` in CSS.
|
||||
* Move tests to Jest.
|
||||
* Clean up test (by Gabriel Kalani).
|
||||
|
||||
## 5.2.18
|
||||
* Fix TypeScript definitions for case of multiple PostCSS versions
|
||||
in `node_modules` (by Chris Eppstein).
|
||||
|
||||
## 5.2.17
|
||||
* Add `postcss-sass` suggestion to syntax error on `.sass` input.
|
||||
|
||||
## 5.2.16
|
||||
* Better error on wrong argument in node constructor.
|
||||
|
||||
## 5.2.15
|
||||
* Fix TypeScript definitions (by bumbleblym).
|
||||
|
||||
## 5.2.14
|
||||
* Fix browser bundle building in webpack (by janschoenherr).
|
||||
|
||||
## 5.2.13
|
||||
* Do not add comment to important raws.
|
||||
* Fix JSDoc (by Dmitry Semigradsky).
|
||||
|
||||
## 5.2.12
|
||||
* Fix typo in deprecation message (by Garet McKinley).
|
||||
|
||||
## 5.2.11
|
||||
* Fix TypeScript definitions (by Jed Mao).
|
||||
|
||||
## 5.2.10
|
||||
* Fix TypeScript definitions (by Jed Mao).
|
||||
|
||||
## 5.2.9
|
||||
* Update TypeScript definitions (by Jed Mao).
|
||||
|
||||
## 5.2.8
|
||||
* Fix error message (by Ben Briggs).
|
||||
|
||||
## 5.2.7
|
||||
* Better error message on syntax object in plugins list.
|
||||
|
||||
## 5.2.6
|
||||
* Fix `postcss.vendor` for values with spaces (by 刘祺).
|
||||
|
||||
## 5.2.5
|
||||
* Better error message on unclosed string (by Ben Briggs).
|
||||
|
||||
## 5.2.4
|
||||
* Improve terminal CSS syntax highlight (by Simon Lydell).
|
||||
|
||||
## 5.2.3
|
||||
* Better color highlight in syntax error code frame.
|
||||
* Fix color highlight support in old systems.
|
||||
|
||||
## 5.2.2
|
||||
* Update `Processor#version`.
|
||||
|
||||
## 5.2.1
|
||||
* Fix source map path for CSS without `from` option (by Michele Locati).
|
||||
|
||||
## 5.2 “Duke Vapula”
|
||||
* Add syntax highlight to code frame in syntax error (by Andrey Popp).
|
||||
* Use Babel code frame style and size in syntax error.
|
||||
* Add `[` and `]` tokens to parse `[attr=;] {}` correctly.
|
||||
* Add `ignoreErrors` options to tokenizer (by Andrey Popp).
|
||||
* Fix error position on tab indent (by Simon Lydell).
|
||||
|
||||
## 5.1.2
|
||||
* Suggests SCSS/Less parsers on parse errors depends on file extension.
|
||||
|
||||
## 5.1.1
|
||||
* Fix TypeScript definitions (by Efremov Alexey).
|
||||
|
||||
## 5.1 “King and President Zagan”
|
||||
* Add URI in source map support (by Mark Finger).
|
||||
* Add `map.from` option (by Mark Finger).
|
||||
* Add `<no source>` mappings for nodes without source (by Bogdan Chadkin).
|
||||
* Add function value support to `map.prev` option (by Chris Montoro).
|
||||
* Add declaration value type check in shortcut creating (by 刘祺).
|
||||
* `Result#warn` now returns new created warning.
|
||||
* Don’t call plugin creator in `postcss.plugin` call.
|
||||
* Add source maps to PostCSS ES5 build.
|
||||
* Add JSDoc to PostCSS classes.
|
||||
* Clean npm package from unnecessary docs.
|
||||
|
||||
## 5.0.21
|
||||
* Fix support with input source mao with `utf8` encoding name.
|
||||
|
||||
## 5.0.20
|
||||
* Fix between raw value parsing (by David Clark).
|
||||
* Update TypeScript definitions (by Jed Mao).
|
||||
* Clean fake node.source after `append(string)`.
|
||||
|
||||
## 5.0.19
|
||||
* Fix indent-based syntaxes support.
|
||||
|
||||
## 5.0.18
|
||||
* Parse new lines according W3C CSS syntax specification.
|
||||
|
||||
## 5.0.17
|
||||
* Fix options argument in `Node#warn` (by Ben Briggs).
|
||||
* Fix TypeScript definitions (by Jed Mao).
|
||||
|
||||
## 5.0.16
|
||||
* Fix CSS syntax error position on unclosed quotes.
|
||||
|
||||
## 5.0.15
|
||||
* Fix `Node#clone()` on `null` value somewhere in node.
|
||||
|
||||
## 5.0.14
|
||||
* Allow to use PostCSS in webpack bundle without JSON loader.
|
||||
|
||||
## 5.0.13
|
||||
* Fix `index` and `word` options in `Warning#toString` (by Bogdan Chadkin).
|
||||
* Fix input source content loading in errors.
|
||||
* Fix map options on using `LazyResult` as input CSS.
|
||||
* 100% test coverage.
|
||||
* Use Babel 6.
|
||||
|
||||
## 5.0.12
|
||||
* Allow passing a previous map with no mappings (by Andreas Lind).
|
||||
|
||||
## 5.0.11
|
||||
* Increase plugins performance by 1.5 times.
|
||||
|
||||
## 5.0.10
|
||||
* Fix warning from nodes without source.
|
||||
|
||||
## 5.0.9
|
||||
* Fix source map type detection (by @asan).
|
||||
|
||||
## 5.0.8
|
||||
* Fixed a missed step in `5.0.7` that caused the module to be published as
|
||||
ES6 code.
|
||||
|
||||
## 5.0.7
|
||||
* PostCSS now requires that node 0.12 is installed via the engines property
|
||||
in package.json (by Howard Zuo).
|
||||
|
||||
## 5.0.6
|
||||
* Fix parsing nested at-rule without semicolon (by Matt Drake).
|
||||
* Trim `Declaration#value` (by Bogdan Chadkin).
|
||||
|
||||
## 5.0.5
|
||||
* Fix multi-tokens property parsing (by Matt Drake).
|
||||
|
||||
## 5.0.4
|
||||
* Fix start position in `Root#source`.
|
||||
* Fix source map annotation, when CSS uses `\r\n` (by Mohammad Younes).
|
||||
|
||||
## 5.0.3
|
||||
* Fix `url()` parsing.
|
||||
* Fix using `selectors` in `Rule` constructor.
|
||||
* Add start source to `Root` node.
|
||||
|
||||
## 5.0.2
|
||||
* Fix `remove(index)` to be compatible with 4.x plugin.
|
||||
|
||||
## 5.0.1
|
||||
* Fix PostCSS 4.x plugins compatibility.
|
||||
* Fix type definition loading (by Jed Mao).
|
||||
|
||||
## 5.0 “President Valac”
|
||||
* Remove `safe` option. Move Safe Parser to separate project.
|
||||
* `Node#toString` does not include `before` for root nodes.
|
||||
* Remove plugin returning `Root` API.
|
||||
* Remove Promise polyfill for node.js 0.10.
|
||||
* Deprecate `eachInside`, `eachDecl`, `eachRule`, `eachAtRule` and `eachComment`
|
||||
in favor of `walk`, `walkDecls`, `walkRules`, `walkAtRules` and `walkComments`
|
||||
(by Jed Mao).
|
||||
* Deprecate `Container#remove` and `Node#removeSelf`
|
||||
in favor of `Container#removeChild` and `Node#remove` (by Ben Briggs).
|
||||
* Deprecate `Node#replace` in favor of `replaceWith` (by Ben Briggs).
|
||||
* Deprecate raw properties in favor of `Node#raws` object.
|
||||
* Deprecate `Node#style` in favor of `raw`.
|
||||
* Deprecate `CssSyntaxError#generated` in favor of `input`.
|
||||
* Deprecate `Node#cleanStyles` in favor of `cleanRaws`.
|
||||
* Deprecate `Root#prevMap` in favor of `Root.source.input.map`.
|
||||
* Add `syntax`, `parser` and `stringifier` options for Custom Syntaxes.
|
||||
* Add stringifier option to `Node#toString`.
|
||||
* Add `Result#content` alias for non-CSS syntaxes.
|
||||
* Add `plugin.process(css)` shortcut to every plugin function (by Ben Briggs).
|
||||
* Add multiple nodes support to insert methods (by Jonathan Neal).
|
||||
* Add `Node#warn` shortcut (by Ben Briggs).
|
||||
* Add `word` and `index` options to errors and warnings (by David Clark).
|
||||
* Add `line`, `column` properties to `Warning`.
|
||||
* Use `supports-color` library to detect color support in error output.
|
||||
* Add type definitions for TypeScript plugin developers (by Jed Mao).
|
||||
* `Rule#selectors` setter detects separators.
|
||||
* Add `postcss.stringify` method.
|
||||
* Throw descriptive errors for incorrectly formatted plugins.
|
||||
* Add docs to npm release.
|
||||
* Fix `url()` parsing.
|
||||
* Fix Windows support (by Jed Mao).
|
||||
|
||||
## 4.1.16
|
||||
* Fix errors without stack trace.
|
||||
|
||||
## 4.1.15
|
||||
* Allow asynchronous plugins to change processor plugins list (by Ben Briggs).
|
||||
|
||||
## 4.1.14
|
||||
* Fix for plugins packs defined by `postcss.plugin`.
|
||||
|
||||
## 4.1.13
|
||||
* Fix input inlined source maps with UTF-8 encoding.
|
||||
|
||||
## 4.1.12
|
||||
* Update Promise polyfill.
|
||||
|
||||
## 4.1.11
|
||||
* Fix error message on wrong plugin format.
|
||||
|
||||
## 4.1.10
|
||||
* Fix Promise behavior on sync plugin errors.
|
||||
* Automatically fill `plugin` field in `CssSyntaxError`.
|
||||
* Fix warning message (by Ben Briggs).
|
||||
|
||||
## 4.1.9
|
||||
* Speed up `node.clone()`.
|
||||
|
||||
## 4.1.8
|
||||
* Accepts `Processor` instance in `postcss()` constructor too.
|
||||
|
||||
## 4.1.7
|
||||
* Speed up `postcss.list` (by Bogdan Chadkin).
|
||||
|
||||
## 4.1.6
|
||||
* Fix Promise behavior on parsing error.
|
||||
|
||||
## 4.1.5
|
||||
* Parse at-words in declaration values.
|
||||
|
||||
## 4.1.4
|
||||
* Fix Promise polyfill dependency (by Anton Yakushev and Matija Marohnić).
|
||||
|
||||
## 4.1.3
|
||||
* Add Promise polyfill for node.js 0.10 and IE.
|
||||
|
||||
## 4.1.2
|
||||
* List helpers can be accessed independently `var space = postcss.list.space`.
|
||||
|
||||
## 4.1.1
|
||||
* Show deprecated message only once.
|
||||
|
||||
## 4.1 “Marquis Andras”
|
||||
* Asynchronous plugin support.
|
||||
* Add warnings from plugins and `Result#messages`.
|
||||
* Add `postcss.plugin()` to create plugins with a standard API.
|
||||
* Insert nodes by CSS string.
|
||||
* Show version warning message on error from an outdated plugin.
|
||||
* Send `Result` instance to plugins as the second argument.
|
||||
* Add `CssSyntaxError#plugin`.
|
||||
* Add `CssSyntaxError#showSourceCode()`.
|
||||
* Add `postcss.list` and `postcss.vendor` aliases.
|
||||
* Add `Processor#version`.
|
||||
* Parse wrong closing bracket.
|
||||
* Parse `!important` statement with spaces and comments inside (by Ben Briggs).
|
||||
* Throw an error on declaration without `prop` or `value` (by Philip Peterson).
|
||||
* Fix source map mappings position.
|
||||
* Add indexed source map support.
|
||||
* Always set `error.generated`.
|
||||
* Clean all source map annotation comments.
|
||||
|
||||
## 4.0.6
|
||||
* Remove `babel` from released package dependencies (by Andres Suarez).
|
||||
|
||||
## 4.0.5
|
||||
* Fix error message on double colon in declaration.
|
||||
|
||||
## 4.0.4
|
||||
* Fix indent detection in some rare cases.
|
||||
|
||||
## 4.0.3
|
||||
* Faster API with 6to5 Loose mode.
|
||||
* Fix indexed source maps support.
|
||||
|
||||
## 4.0.2
|
||||
* Do not copy IE hacks to code style.
|
||||
|
||||
## 4.0.1
|
||||
* Add `source.input` to `Root` too.
|
||||
|
||||
## 4.0 “Duke Flauros”
|
||||
* Rename `Container#childs` to `nodes`.
|
||||
* Rename `PostCSS#processors` to `plugins`.
|
||||
* Add `Node#replaceValues()` method.
|
||||
* Add `Node#moveTo()`, `moveBefore()` and `moveAfter()` methods.
|
||||
* Add `Node#cloneBefore()` and `cloneAfter()` shortcuts.
|
||||
* Add `Node#next()`, `prev()` and `root()` shortcuts.
|
||||
* Add `Node#replaceWith()` method.
|
||||
* Add `Node#error()` method.
|
||||
* Add `Container#removeAll()` method.
|
||||
* Add filter argument to `eachDecl()` and `eachAtRule()`.
|
||||
* Add `Node#source.input` and move `source.file` or `source.id` to `input`.
|
||||
* Change code indent, when node was moved.
|
||||
* Better fix code style on `Rule`, `AtRule` and `Comment` nodes changes.
|
||||
* Allow to create rules and at-rules by hash shortcut in append methods.
|
||||
* Add class name to CSS syntax error output.
|
||||
|
||||
## 3.0.7
|
||||
* Fix IE filter parsing with multiple commands.
|
||||
* Safer way to consume PostCSS object as plugin (by Maxime Thirouin).
|
||||
|
||||
## 3.0.6
|
||||
* Fix missing semicolon when comment comes after last declaration.
|
||||
* Fix Safe Mode declaration parsing on unclosed blocks.
|
||||
|
||||
## 3.0.5
|
||||
* Fix parser to support difficult cases with backslash escape and brackets.
|
||||
* Add `CssSyntaxError#stack` (by Maxime Thirouin).
|
||||
|
||||
## 3.0.4
|
||||
* Fix Safe Mode on unknown word before declaration.
|
||||
|
||||
## 3.0.3
|
||||
* Increase tokenizer speed (by Roman Dvornov).
|
||||
|
||||
## 3.0.2
|
||||
* Fix empty comment parsing.
|
||||
* Fix `Root#normalize` in some inserts.
|
||||
|
||||
## 3.0.1
|
||||
* Fix Rhino JS runtime support.
|
||||
* Typo in deprecated warning (by Maxime Thirouin).
|
||||
|
||||
## 3.0 “Marquis Andrealphus”
|
||||
* New parser, which become the fastest ever CSS parser written in JavaScript.
|
||||
* Parser can now parse declarations and rules in one parent (like in `@page`)
|
||||
and nested declarations for plugins like `postcss-nested`.
|
||||
* Child nodes array is now in `childs` property, instead of `decls` and `rules`.
|
||||
* `map.inline` and `map.sourcesContent` options are now `true` by default.
|
||||
* Fix iterators (`each`, `insertAfter`) on children array changes.
|
||||
* Use previous source map to show origin source of CSS syntax error.
|
||||
* Use 6to5 ES6 compiler, instead of ES6 Transpiler.
|
||||
* Use code style for manually added rules from existing rules.
|
||||
* Use `from` option from previous source map `file` field.
|
||||
* Set `to` value to `from` if `to` option is missing.
|
||||
* Use better node source name when missing `from` option.
|
||||
* Show a syntax error when `;` is missed between declarations.
|
||||
* Allow to pass `PostCSS` instance or list of plugins to `use()` method.
|
||||
* Allow to pass `Result` instance to `process()` method.
|
||||
* Trim Unicode BOM on source maps parsing.
|
||||
* Parse at-rules without spaces like `@import"file"`.
|
||||
* Better previous `sourceMappingURL` annotation comment cleaning.
|
||||
* Do not remove previous `sourceMappingURL` comment on `map.annotation: false`.
|
||||
* Parse nameless at-rules in Safe Mode.
|
||||
* Fix source map generation for nodes without source.
|
||||
* Fix next child `before` if `Root` first child got removed.
|
||||
|
||||
## 2.2.6
|
||||
* Fix map generation for nodes without source (by Josiah Savary).
|
||||
|
||||
## 2.2.5
|
||||
* Fix source map with BOM marker support (by Mohammad Younes).
|
||||
* Fix source map paths (by Mohammad Younes).
|
||||
|
||||
## 2.2.4
|
||||
* Fix `prepend()` on empty `Root`.
|
||||
|
||||
## 2.2.3
|
||||
* Allow to use object shortcut in `use()` with functions like `autoprefixer`.
|
||||
|
||||
## 2.2.2
|
||||
* Add shortcut to set processors in `use()` via object with `.postcss` property.
|
||||
|
||||
## 2.2.1
|
||||
* Send `opts` from `Processor#process(css, opts)` to processors.
|
||||
|
||||
## 2.2 “Marquis Cimeies”
|
||||
* Use GNU style syntax error messages.
|
||||
* Add `Node#replace` method.
|
||||
* Add `CssSyntaxError#reason` property.
|
||||
|
||||
## 2.1.2
|
||||
* Fix UTF-8 support in inline source map.
|
||||
* Fix source map `sourcesContent` if there is no `from` and `to` options.
|
||||
|
||||
## 2.1.1
|
||||
* Allow to miss `to` and `from` options for inline source maps.
|
||||
* Add `Node#source.id` if file name is unknown.
|
||||
* Better detect splitter between rules in CSS concatenation tools.
|
||||
* Automatically clone node in insert methods.
|
||||
|
||||
## 2.1 “King Amdusias”
|
||||
* Change Traceur ES6 compiler to ES6 Transpiler.
|
||||
* Show broken CSS line in syntax error.
|
||||
|
||||
## 2.0 “King Belial”
|
||||
* Project was rewritten from CoffeeScript to ES6.
|
||||
* Add Safe Mode to works with live input or with hacks from legacy code.
|
||||
* More safer parser to pass all hacks from Browserhacks.com.
|
||||
* Use real properties instead of magic getter/setter for raw properties.
|
||||
|
||||
## 1.0 “Marquis Decarabia”
|
||||
* Save previous source map for each node to support CSS concatenation
|
||||
with multiple previous maps.
|
||||
* Add `map.sourcesContent` option to add origin content to `sourcesContent`
|
||||
inside map.
|
||||
* Allow to set different place of output map in annotation comment.
|
||||
* Allow to use arrays and `Root` in `Container#append` and same methods.
|
||||
* Add `Root#prevMap` with information about previous map.
|
||||
* Allow to use latest PostCSS from GitHub by npm.
|
||||
* `Result` now is lazy and it will generate output CSS only if you use `css`
|
||||
or `map` property.
|
||||
* Use separated `map.prev` option to set previous map.
|
||||
* Rename `inlineMap` option to `map.inline`.
|
||||
* Rename `mapAnnotation` option to `map.annotation`.
|
||||
* `Result#map` now return `SourceMapGenerator` object, instead of string.
|
||||
* Run previous map autodetect only if input CSS contains annotation comment.
|
||||
* Add `map: 'inline'` shortcut for `map: { inline: true }` option.
|
||||
* `Node#source.file` now will contains absolute path.
|
||||
* Clean `Declaration#between` style on node clone.
|
||||
|
||||
## 0.3.5
|
||||
* Allow to use `Root` or `Result` as first argument in `process()`.
|
||||
* Save parsed AST to `Result#root`.
|
||||
|
||||
## 0.3.4
|
||||
* Better space symbol detect to read UTF-8 BOM correctly.
|
||||
|
||||
## 0.3.3
|
||||
* Remove source map hacks by using new Mozilla’s `source-map` (by Simon Lydell).
|
||||
|
||||
## 0.3.2
|
||||
* Add URI encoding support for inline source maps.
|
||||
|
||||
## 0.3.1
|
||||
* Fix relative paths from previous source map.
|
||||
* Safer space split in `Rule#selectors` (by Simon Lydell).
|
||||
|
||||
## 0.3 “Prince Seere”
|
||||
* Add `Comment` node for comments between declarations or rules.
|
||||
* Add source map annotation comment to output CSS.
|
||||
* Allow to inline source map to annotation comment by data:uri.
|
||||
* Fix source maps on Windows.
|
||||
* Fix source maps for subdirectory (by Dmitry Nikitenko and Simon Lydell).
|
||||
* Autodetect previous source map.
|
||||
* Add `first` and `last` shortcuts to container nodes.
|
||||
* Parse `!important` to separated property in `Declaration`.
|
||||
* Allow to break iteration by returning `false`.
|
||||
* Copy code style to new nodes.
|
||||
* Add `eachInside` method to recursively iterate all nodes.
|
||||
* Add `selectors` shortcut to get selectors array.
|
||||
* Add `toResult` method to `Rule` to simplify work with several input files.
|
||||
* Clean declaration’s `value`, rule’s `selector` and at-rule’s `params`
|
||||
by storing spaces in `between` property.
|
||||
|
||||
## 0.2 “Duke Dantalion”
|
||||
* Add source map support.
|
||||
* Add shortcuts to create nodes.
|
||||
* Method `process()` now returns object with `css` and `map` keys.
|
||||
* Origin CSS file option was renamed from `file` to `from`.
|
||||
* Rename `Node#remove()` method to `removeSelf()` to fix name conflict.
|
||||
* Node source was moved to `source` property with origin file
|
||||
and node end position.
|
||||
* You can set own CSS generate function.
|
||||
|
||||
## 0.1 “Count Andromalius”
|
||||
* Initial release.
|
||||
20
build/node_modules/postcss-csso/node_modules/postcss/LICENSE
generated
vendored
Normal file
20
build/node_modules/postcss-csso/node_modules/postcss/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>
|
||||
|
||||
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.
|
||||
344
build/node_modules/postcss-csso/node_modules/postcss/README.cn.md
generated
vendored
Normal file
344
build/node_modules/postcss-csso/node_modules/postcss/README.cn.md
generated
vendored
Normal file
@@ -0,0 +1,344 @@
|
||||
# PostCSS [![Travis Build Status][travis-img]][travis] [![AppVeyor Build Status][appveyor-img]][appveyor] [![Gitter][chat-img]][chat]
|
||||
|
||||
<img align="right" width="95" height="95"
|
||||
alt="哲学家的石头 - PostCSS 的 logo"
|
||||
src="http://postcss.github.io/postcss/logo.svg">
|
||||
|
||||
[appveyor-img]: https://img.shields.io/appveyor/ci/ai/postcss.svg?label=windows
|
||||
[travis-img]: https://img.shields.io/travis/postcss/postcss.svg?label=unix
|
||||
[chat-img]: https://img.shields.io/badge/Gitter-Join_the_PostCSS_chat-brightgreen.svg
|
||||
[appveyor]: https://ci.appveyor.com/project/ai/postcss
|
||||
[travis]: https://travis-ci.org/postcss/postcss
|
||||
[chat]: https://gitter.im/postcss/postcss
|
||||
|
||||
PostCSS 是一个允许使用 JS 插件转换样式的工具。
|
||||
这些插件可以检查(lint)你的 CSS,支持 CSS Variables 和 Mixins,
|
||||
编译尚未被浏览器广泛支持的先进的 CSS 语法,内联图片,以及其它很多优秀的功能。
|
||||
|
||||
PostCSS 在工业界被广泛地应用,其中不乏很多有名的行业领导者,如:维基百科,Twitter,阿里巴巴,
|
||||
JetBrains。PostCSS 的 [Autoprefixer] 插件是最流行的 CSS 处理工具之一。
|
||||
|
||||
**Twitter 账号:** [@postcss](https://twitter.com/postcss)。<br>
|
||||
**支持 / 讨论:** [Gitter](https://gitter.im/postcss/postcss)。<br>
|
||||
|
||||
如果需要 PostCSS 商业支持(如咨询,提升公司的前端文化,
|
||||
PostCSS 插件),请联系 [Evil Martians](https://evilmartians.com/?utm_source=postcss)
|
||||
邮箱 <surrender@evilmartians.com>。
|
||||
|
||||
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
||||
|
||||
<a href="https://evilmartians.com/?utm_source=postcss">
|
||||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
||||
alt="由 Evil Martians 赞助" width="236" height="54">
|
||||
</a>
|
||||
|
||||
## 插件
|
||||
|
||||
截止到目前,PostCSS 有 200 多个插件。你可以在 [插件列表] 或 [搜索目录] 找到它们。
|
||||
下方的列表是我们最喜欢的插件 - 它们很好地演示了我们可以用 PostCSS 做些什么。
|
||||
|
||||
如果你有任何新的想法,[开发 PostCSS 插件] 非常简单易上手。
|
||||
|
||||
[搜索目录]: http://postcss.parts
|
||||
[插件列表]: https://github.com/postcss/postcss/blob/master/docs/plugins.md
|
||||
|
||||
### 解决全局 CSS 的问题
|
||||
|
||||
* [`postcss-use`] 允许你在 CSS 里明确地设置 PostCSS 插件,并且只在当前文件执行它们。
|
||||
* [`postcss-modules`] 和 [`react-css-modules`] 可以自动以组件为单位隔绝 CSS 选择器。
|
||||
* [`postcss-autoreset`] 是全局样式重置的又一个选择,它更适用于分离的组件。
|
||||
* [`postcss-initial`] 添加了 `all: initial` 的支持,重置了所有继承的样式。
|
||||
* [`cq-prolyfill`] 添加了容器查询的支持,允许添加响应于父元素宽度的样式.
|
||||
|
||||
### 提前使用先进的 CSS 特性
|
||||
|
||||
* [`autoprefixer`] 添加了 vendor 浏览器前缀,它使用 Can I Use 上面的数据。
|
||||
* [`postcss-cssnext`] 允许你使用未来的 CSS 特性(包括 `autoprefixer`)。
|
||||
* [`postcss-image-set-polyfill`] 为所有浏览器模拟了 [`image-set`] 函数逻辑。
|
||||
|
||||
### 更佳的 CSS 可读性
|
||||
|
||||
* [`precss`] 囊括了许多插件来支持类似 Sass 的特性,比如 CSS 变量,套嵌,mixins 等。
|
||||
* [`postcss-sorting`] 给规则的内容以及@规则排序。
|
||||
* [`postcss-utilities`] 囊括了最常用的简写方式和书写帮助。
|
||||
* [`short`] 添加并拓展了大量的缩写属性。
|
||||
|
||||
### 图片和字体
|
||||
|
||||
* [`postcss-assets`] 可以插入图片尺寸和内联文件。
|
||||
* [`postcss-sprites`] 能生成雪碧图。
|
||||
* [`font-magician`] 生成所有在 CSS 里需要的 `@font-face` 规则。
|
||||
* [`postcss-inline-svg`] 允许你内联 SVG 并定制它的样式。
|
||||
* [`postcss-write-svg`] 允许你在 CSS 里写简单的 SVG。
|
||||
|
||||
### 提示器(Linters)
|
||||
|
||||
* [`stylelint`] 是一个模块化的样式提示器。
|
||||
* [`stylefmt`] 是一个能根据 `stylelint` 规则自动优化 CSS 格式的工具。
|
||||
* [`doiuse`] 提示 CSS 的浏览器支持性,使用的数据来自于 Can I Use。
|
||||
* [`colorguard`] 帮助你保持一个始终如一的调色板。
|
||||
|
||||
### 其它
|
||||
|
||||
* [`postcss-rtl`] 在单个 CSS 文件里组合了两个方向(左到右,右到左)的样式。
|
||||
* [`cssnano`] 是一个模块化的 CSS 压缩器。
|
||||
* [`lost`] 是一个功能强大的 `calc()` 栅格系统。
|
||||
* [`rtlcss`] 镜像翻转 CSS 样式,适用于 right-to-left 的应用场景。
|
||||
|
||||
[`postcss-image-set-polyfill`]: https://github.com/SuperOl3g/postcss-image-set-polyfill
|
||||
[`postcss-inline-svg`]: https://github.com/TrySound/postcss-inline-svg
|
||||
[`react-css-modules`]: https://github.com/gajus/react-css-modules
|
||||
[`postcss-autoreset`]: https://github.com/maximkoretskiy/postcss-autoreset
|
||||
[`postcss-write-svg`]: https://github.com/jonathantneal/postcss-write-svg
|
||||
[`postcss-utilities`]: https://github.com/ismamz/postcss-utilities
|
||||
[`postcss-initial`]: https://github.com/maximkoretskiy/postcss-initial
|
||||
[`postcss-sprites`]: https://github.com/2createStudio/postcss-sprites
|
||||
[`postcss-modules`]: https://github.com/outpunk/postcss-modules
|
||||
[`postcss-sorting`]: https://github.com/hudochenkov/postcss-sorting
|
||||
[`postcss-cssnext`]: http://cssnext.io
|
||||
[`postcss-assets`]: https://github.com/assetsjs/postcss-assets
|
||||
[开发 PostCSS 插件]: https://github.com/postcss/postcss/blob/master/docs/writing-a-plugin.md
|
||||
[`font-magician`]: https://github.com/jonathantneal/postcss-font-magician
|
||||
[`autoprefixer`]: https://github.com/postcss/autoprefixer
|
||||
[`cq-prolyfill`]: https://github.com/ausi/cq-prolyfill
|
||||
[`postcss-rtl`]: https://github.com/vkalinichev/postcss-rtl
|
||||
[`postcss-use`]: https://github.com/postcss/postcss-use
|
||||
[`css-modules`]: https://github.com/css-modules/css-modules
|
||||
[`colorguard`]: https://github.com/SlexAxton/css-colorguard
|
||||
[`stylelint`]: https://github.com/stylelint/stylelint
|
||||
[`image-set`]: https://drafts.csswg.org/css-images-4/#image-set-notation
|
||||
[`stylefmt`]: https://github.com/morishitter/stylefmt
|
||||
[`cssnano`]: http://cssnano.co
|
||||
[`precss`]: https://github.com/jonathantneal/precss
|
||||
[`doiuse`]: https://github.com/anandthakker/doiuse
|
||||
[`rtlcss`]: https://github.com/MohammadYounes/rtlcss
|
||||
[`short`]: https://github.com/jonathantneal/postcss-short
|
||||
[`lost`]: https://github.com/peterramsing/lost
|
||||
|
||||
## 语法
|
||||
|
||||
PostCSS 可以转化样式到任意语法,不仅仅是 CSS。
|
||||
如果还没有支持你最喜欢的语法,你可以编写一个解释器以及(或者)一个 stringifier 来拓展 PostCSS。
|
||||
|
||||
* [`sugarss`] 是一个以缩进为基础的语法,类似于 Sass 和 Stylus。
|
||||
* [`postcss-html`] 允许你在 HTML / [Markdown](https://daringfireball.net/projects/markdown/syntax) / [Vue component](https://vue-loader.vuejs.org/) 里编写样式。
|
||||
* [`postcss-scss`] 允许你使用 SCSS *(但并没有将 SCSS 编译到 CSS)*。
|
||||
* [`postcss-sass`] 允许你使用 Sass *(但并没有将 Sass 编译到 CSS)*。
|
||||
* [`postcss-less`] 允许你使用 Less *(但并没有将 LESS 编译到 CSS)*。
|
||||
* [`postcss-less-engine`] 允许你使用 Less *(并且使用真正的 Less.js 把 LESS 编译到 CSS)*。
|
||||
* [`postcss-js`] 允许你在 JS 里编写样式,或者转换成 React 的内联样式/Radium/JSS。
|
||||
* [`postcss-safe-parser`] 查找并修复 CSS 语法错误。
|
||||
* [`midas`] 将 CSS 字符串转化成高亮的 HTML。
|
||||
|
||||
[`postcss-less-engine`]: https://github.com/Crunch/postcss-less
|
||||
[`postcss-safe-parser`]: https://github.com/postcss/postcss-safe-parser
|
||||
[`postcss-html`]: https://github.com/gucong3000/postcss-html
|
||||
[`postcss-scss`]: https://github.com/postcss/postcss-scss
|
||||
[`postcss-sass`]: https://github.com/AleshaOleg/postcss-sass
|
||||
[`postcss-less`]: https://github.com/webschik/postcss-less
|
||||
[`postcss-js`]: https://github.com/postcss/postcss-js
|
||||
[`sugarss`]: https://github.com/postcss/sugarss
|
||||
[`midas`]: https://github.com/ben-eb/midas
|
||||
|
||||
## 文章
|
||||
|
||||
* [一些你对 PostCSS 可能产生的误解](http://julian.io/some-things-you-may-think-about-postcss-and-you-might-be-wrong)
|
||||
* [PostCSS 究竟是什么,是做什么的](http://davidtheclark.com/its-time-for-everyone-to-learn-about-postcss)
|
||||
* [PostCSS 指南](http://webdesign.tutsplus.com/series/postcss-deep-dive--cms-889)
|
||||
|
||||
你可以在 [awesome-postcss](https://github.com/jjaderg/awesome-postcss) 列表里找到更多优秀的文章和视频。
|
||||
|
||||
## 书籍
|
||||
|
||||
* Alex Libby, Packt 的 [网页设计之精通 PostCSS](https://www.packtpub.com/web-development/mastering-postcss-web-design) (2016年6月)
|
||||
|
||||
## 使用方法
|
||||
|
||||
你可以通过简单的两步便开始使用 PostCSS:
|
||||
|
||||
1. 在你的构建工具中查找并添加 PostCSS 拓展。
|
||||
2. [选择插件]并将它们添加到你的 PostCSS 处理队列中。
|
||||
|
||||
[选择插件]: http://postcss.parts
|
||||
|
||||
### Webpack
|
||||
|
||||
在 `webpack.config.js` 里使用 [`postcss-loader`] :
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'style-loader',
|
||||
},
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
importLoaders: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
然后创建 `postcss.config.js`:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('precss'),
|
||||
require('autoprefixer')
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
[`postcss-loader`]: https://github.com/postcss/postcss-loader
|
||||
|
||||
### Gulp
|
||||
|
||||
使用 [`gulp-postcss`] 和 [`gulp-sourcemaps`].
|
||||
|
||||
```js
|
||||
gulp.task('css', function () {
|
||||
var postcss = require('gulp-postcss');
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
|
||||
return gulp.src('src/**/*.css')
|
||||
.pipe( sourcemaps.init() )
|
||||
.pipe( postcss([ require('precss'), require('autoprefixer') ]) )
|
||||
.pipe( sourcemaps.write('.') )
|
||||
.pipe( gulp.dest('build/') );
|
||||
});
|
||||
```
|
||||
|
||||
[`gulp-sourcemaps`]: https://github.com/floridoo/gulp-sourcemaps
|
||||
[`gulp-postcss`]: https://github.com/postcss/gulp-postcss
|
||||
|
||||
### npm run / CLI
|
||||
|
||||
如果需要在你的命令行界面或 npm 脚本里使用 PostCSS,你可以使用 [`postcss-cli`]。
|
||||
|
||||
```sh
|
||||
postcss --use autoprefixer -c options.json -o main.css css/*.css
|
||||
```
|
||||
|
||||
[`postcss-cli`]: https://github.com/postcss/postcss-cli
|
||||
|
||||
### 浏览器
|
||||
|
||||
如果你想编译浏览器里的 CSS 字符串(例如像 CodePen 一样的在线编辑器),
|
||||
只需使用 [Browserify] 或 [webpack]。它们会把 PostCSS 和插件文件打包进一个独立文件。
|
||||
|
||||
如果想要在 React 内联样式/JSS/Radium/其它 [CSS-in-JS] 里使用 PostCSS,
|
||||
你可以用 [`postcss-js`] 然后转换样式对象。
|
||||
|
||||
```js
|
||||
var postcss = require('postcss-js');
|
||||
var prefixer = postcss.sync([ require('autoprefixer') ]);
|
||||
|
||||
prefixer({ display: 'flex' }); //=> { display: ['-webkit-box', '-webkit-flex', '-ms-flexbox', 'flex'] }
|
||||
```
|
||||
|
||||
[`postcss-js`]: https://github.com/postcss/postcss-js
|
||||
[Browserify]: http://browserify.org/
|
||||
[CSS-in-JS]: https://github.com/MicheleBertoli/css-in-js
|
||||
[webpack]: https://webpack.github.io/
|
||||
|
||||
### 运行器
|
||||
|
||||
* **Grunt**: [`grunt-postcss`](https://github.com/nDmitry/grunt-postcss)
|
||||
* **HTML**: [`posthtml-postcss`](https://github.com/posthtml/posthtml-postcss)
|
||||
* **Stylus**: [`poststylus`](https://github.com/seaneking/poststylus)
|
||||
* **Rollup**: [`rollup-plugin-postcss`](https://github.com/egoist/rollup-plugin-postcss)
|
||||
* **Brunch**: [`postcss-brunch`](https://github.com/brunch/postcss-brunch)
|
||||
* **Broccoli**: [`broccoli-postcss`](https://github.com/jeffjewiss/broccoli-postcss)
|
||||
* **Meteor**: [`postcss`](https://atmospherejs.com/juliancwirko/postcss)
|
||||
* **ENB**: [`enb-postcss`](https://github.com/awinogradov/enb-postcss)
|
||||
* **Taskr**: [`taskr-postcss`](https://github.com/lukeed/taskr/tree/master/packages/postcss)
|
||||
* **Start**: [`start-postcss`](https://github.com/start-runner/postcss)
|
||||
* **Connect/Express**: [`postcss-middleware`](https://github.com/jedmao/postcss-middleware)
|
||||
|
||||
### JS API
|
||||
|
||||
对于其它的应用环境,你可以使用 JS API:
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const postcss = require('postcss');
|
||||
const precss = require('precss');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
|
||||
fs.readFile('src/app.css', (err, css) => {
|
||||
postcss([precss, autoprefixer])
|
||||
.process(css, { from: 'src/app.css', to: 'dest/app.css' })
|
||||
.then(result => {
|
||||
fs.writeFile('dest/app.css', result.css);
|
||||
if ( result.map ) fs.writeFile('dest/app.css.map', result.map);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
阅读 [PostCSS API 文档] 获取更多有关 JS API 的信息.
|
||||
|
||||
所有的 PostCSS 运行器应当通过 [PostCSS 运行器指南]。
|
||||
|
||||
[PostCSS 运行器指南]: https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md
|
||||
[PostCSS API 文档]: http://api.postcss.org/postcss.html
|
||||
|
||||
### 配置选项
|
||||
|
||||
绝大多数 PostCSS 运行器接受两个参数:
|
||||
|
||||
* 一个包含所需插件的数组
|
||||
* 一个配置选项的对象
|
||||
|
||||
常见的选项:
|
||||
|
||||
* `syntax`: 一个提供了语法解释器和 stringifier 的对象。
|
||||
* `parser`: 一个特殊的语法解释器(例如 [SCSS])。
|
||||
* `stringifier`: 一个特殊的语法 output 生成器(例如 [Midas])。
|
||||
* `map`: [source map 选项].
|
||||
* `from`: input 文件名称(大多数运行器自动设置了这个)。
|
||||
* `to`: output 文件名称(大多数运行器自动设置了这个)。
|
||||
|
||||
[source map 选项]: https://github.com/postcss/postcss/blob/master/docs/source-maps.md
|
||||
[Midas]: https://github.com/ben-eb/midas
|
||||
[SCSS]: https://github.com/postcss/postcss-scss
|
||||
|
||||
### Atom
|
||||
|
||||
* [`language-postcss`] 添加了 PostCSS 和 [SugarSS] 代码高亮。
|
||||
* [`source-preview-postcss`] 在一个独立窗口里实时预览生成的 CSS。
|
||||
|
||||
[SugarSS]: https://github.com/postcss/sugarss
|
||||
|
||||
### Sublime Text
|
||||
|
||||
* [`Syntax-highlighting-for-PostCSS`] 添加了 PostCSS 代码高亮。
|
||||
|
||||
[`Syntax-highlighting-for-PostCSS`]: https://github.com/hudochenkov/Syntax-highlighting-for-PostCSS
|
||||
[`source-preview-postcss`]: https://atom.io/packages/source-preview-postcss
|
||||
[`language-postcss`]: https://atom.io/packages/language-postcss
|
||||
|
||||
### Vim
|
||||
|
||||
* [`postcss.vim`] 添加了 PostCSS 代码高亮。
|
||||
|
||||
[`postcss.vim`]: https://github.com/stephenway/postcss.vim
|
||||
|
||||
### WebStorm
|
||||
|
||||
自 WebStorm 2016.3 开始,[提供了] 内建的 PostCSS 支持。
|
||||
|
||||
[提供了]: https://blog.jetbrains.com/webstorm/2016/08/webstorm-2016-3-early-access-preview/
|
||||
367
build/node_modules/postcss-csso/node_modules/postcss/README.md
generated
vendored
Normal file
367
build/node_modules/postcss-csso/node_modules/postcss/README.md
generated
vendored
Normal file
@@ -0,0 +1,367 @@
|
||||
# PostCSS [![Travis Build Status][travis-img]][travis] [![AppVeyor Build Status][appveyor-img]][appveyor] [![Gitter][chat-img]][chat]
|
||||
|
||||
<img align="right" width="95" height="95"
|
||||
alt="Philosopher’s stone, logo of PostCSS"
|
||||
src="http://postcss.github.io/postcss/logo.svg">
|
||||
|
||||
[appveyor-img]: https://img.shields.io/appveyor/ci/ai/postcss.svg?label=windows
|
||||
[travis-img]: https://img.shields.io/travis/postcss/postcss.svg?label=unix
|
||||
[chat-img]: https://img.shields.io/badge/Gitter-Join_the_PostCSS_chat-brightgreen.svg
|
||||
[appveyor]: https://ci.appveyor.com/project/ai/postcss
|
||||
[travis]: https://travis-ci.org/postcss/postcss
|
||||
[chat]: https://gitter.im/postcss/postcss
|
||||
|
||||
PostCSS is a tool for transforming styles with JS plugins.
|
||||
These plugins can lint your CSS, support variables and mixins,
|
||||
transpile future CSS syntax, inline images, and more.
|
||||
|
||||
PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba,
|
||||
and JetBrains. The [Autoprefixer] PostCSS plugin is one of the most popular
|
||||
CSS processors.
|
||||
|
||||
**Twitter account:** [@postcss](https://twitter.com/postcss).<br>
|
||||
**VK.com page:** [postcss](https://vk.com/postcss).<br>
|
||||
**Support / Discussion:** [Gitter](https://gitter.im/postcss/postcss).<br>
|
||||
**中文翻译**: [`README.cn.md`](./README.cn.md).
|
||||
|
||||
For PostCSS commercial support (consulting, improving the front-end culture
|
||||
of your company, PostCSS plugins), contact [Evil Martians](https://evilmartians.com/?utm_source=postcss)
|
||||
at <surrender@evilmartians.com>.
|
||||
|
||||
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
||||
|
||||
<a href="https://evilmartians.com/?utm_source=postcss">
|
||||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
||||
alt="Sponsored by Evil Martians" width="236" height="54">
|
||||
</a>
|
||||
|
||||
## Plugins
|
||||
|
||||
Currently, PostCSS has more than 200 plugins. You can find all of the plugins
|
||||
in the [plugins list] or in the [searchable catalog]. Below is a list
|
||||
of our favorite plugins — the best demonstrations of what can be built
|
||||
on top of PostCSS.
|
||||
|
||||
If you have any new ideas, [PostCSS plugin development] is really easy.
|
||||
|
||||
[searchable catalog]: http://postcss.parts
|
||||
[plugins list]: https://github.com/postcss/postcss/blob/master/docs/plugins.md
|
||||
|
||||
### Solve Global CSS Problem
|
||||
|
||||
* [`postcss-use`] allows you to explicitly set PostCSS plugins within CSS
|
||||
and execute them only for the current file.
|
||||
* [`postcss-modules`] and [`react-css-modules`] automatically isolate
|
||||
selectors within components.
|
||||
* [`postcss-autoreset`] is an alternative to using a global reset
|
||||
that is better for isolatable components.
|
||||
* [`postcss-initial`] adds `all: initial` support, which resets
|
||||
all inherited styles.
|
||||
* [`cq-prolyfill`] adds container query support, allowing styles that respond
|
||||
to the width of the parent.
|
||||
|
||||
### Use Future CSS, Today
|
||||
|
||||
* [`autoprefixer`] adds vendor prefixes, using data from Can I Use.
|
||||
* [`postcss-cssnext`] allows you to use future CSS features today
|
||||
(includes `autoprefixer`).
|
||||
* [`postcss-image-set-polyfill`] emulates [`image-set`] function logic for all browsers
|
||||
|
||||
### Better CSS Readability
|
||||
|
||||
* [`precss`] contains plugins for Sass-like features, like variables, nesting,
|
||||
and mixins.
|
||||
* [`postcss-sorting`] sorts the content of rules and at-rules.
|
||||
* [`postcss-utilities`] includes the most commonly used shortcuts and helpers.
|
||||
* [`short`] adds and extends numerous shorthand properties.
|
||||
|
||||
### Images and Fonts
|
||||
|
||||
* [`postcss-assets`] inserts image dimensions and inlines files.
|
||||
* [`postcss-sprites`] generates image sprites.
|
||||
* [`font-magician`] generates all the `@font-face` rules needed in CSS.
|
||||
* [`postcss-inline-svg`] allows you to inline SVG and customize its styles.
|
||||
* [`postcss-write-svg`] allows you to write simple SVG directly in your CSS.
|
||||
|
||||
### Linters
|
||||
|
||||
* [`stylelint`] is a modular stylesheet linter.
|
||||
* [`stylefmt`] is a tool that automatically formats CSS
|
||||
according `stylelint` rules.
|
||||
* [`doiuse`] lints CSS for browser support, using data from Can I Use.
|
||||
* [`colorguard`] helps you maintain a consistent color palette.
|
||||
|
||||
### Other
|
||||
|
||||
* [`postcss-rtl`] combines both-directional (left-to-right and right-to-left) styles in one CSS file.
|
||||
* [`cssnano`] is a modular CSS minifier.
|
||||
* [`lost`] is a feature-rich `calc()` grid system.
|
||||
* [`rtlcss`] mirrors styles for right-to-left locales.
|
||||
|
||||
[`postcss-image-set-polyfill`]: https://github.com/SuperOl3g/postcss-image-set-polyfill
|
||||
[PostCSS plugin development]: https://github.com/postcss/postcss/blob/master/docs/writing-a-plugin.md
|
||||
[`postcss-inline-svg`]: https://github.com/TrySound/postcss-inline-svg
|
||||
[`react-css-modules`]: https://github.com/gajus/react-css-modules
|
||||
[`postcss-autoreset`]: https://github.com/maximkoretskiy/postcss-autoreset
|
||||
[`postcss-write-svg`]: https://github.com/jonathantneal/postcss-write-svg
|
||||
[`postcss-utilities`]: https://github.com/ismamz/postcss-utilities
|
||||
[`postcss-initial`]: https://github.com/maximkoretskiy/postcss-initial
|
||||
[`postcss-sprites`]: https://github.com/2createStudio/postcss-sprites
|
||||
[`postcss-modules`]: https://github.com/outpunk/postcss-modules
|
||||
[`postcss-sorting`]: https://github.com/hudochenkov/postcss-sorting
|
||||
[`postcss-cssnext`]: http://cssnext.io
|
||||
[`postcss-assets`]: https://github.com/assetsjs/postcss-assets
|
||||
[`font-magician`]: https://github.com/jonathantneal/postcss-font-magician
|
||||
[`autoprefixer`]: https://github.com/postcss/autoprefixer
|
||||
[`cq-prolyfill`]: https://github.com/ausi/cq-prolyfill
|
||||
[`postcss-rtl`]: https://github.com/vkalinichev/postcss-rtl
|
||||
[`postcss-use`]: https://github.com/postcss/postcss-use
|
||||
[`css-modules`]: https://github.com/css-modules/css-modules
|
||||
[`colorguard`]: https://github.com/SlexAxton/css-colorguard
|
||||
[`stylelint`]: https://github.com/stylelint/stylelint
|
||||
[`image-set`]: https://drafts.csswg.org/css-images-4/#image-set-notation
|
||||
[`stylefmt`]: https://github.com/morishitter/stylefmt
|
||||
[`cssnano`]: http://cssnano.co
|
||||
[`precss`]: https://github.com/jonathantneal/precss
|
||||
[`doiuse`]: https://github.com/anandthakker/doiuse
|
||||
[`rtlcss`]: https://github.com/MohammadYounes/rtlcss
|
||||
[`short`]: https://github.com/jonathantneal/postcss-short
|
||||
[`lost`]: https://github.com/peterramsing/lost
|
||||
|
||||
## Syntaxes
|
||||
|
||||
PostCSS can transform styles in any syntax, not just CSS.
|
||||
If there is not yet support for your favorite syntax,
|
||||
you can write a parser and/or stringifier to extend PostCSS.
|
||||
|
||||
* [`sugarss`] is a indent-based syntax like Sass or Stylus.
|
||||
* [`postcss-html`] allows you to write styles in HTML / [Markdown](https://daringfireball.net/projects/markdown/syntax) / [Vue component](https://vue-loader.vuejs.org/)
|
||||
* [`postcss-scss`] allows you to work with SCSS
|
||||
*(but does not compile SCSS to CSS)*.
|
||||
* [`postcss-sass`] allows you to work with Sass
|
||||
*(but does not compile Sass to CSS)*.
|
||||
* [`postcss-less`] allows you to work with Less
|
||||
*(but does not compile LESS to CSS)*.
|
||||
* [`postcss-less-engine`] allows you to work with Less
|
||||
*(and DOES compile LESS to CSS using true Less.js evaluation)*.
|
||||
* [`postcss-js`] allows you to write styles in JS or transform
|
||||
React Inline Styles, Radium or JSS.
|
||||
* [`postcss-safe-parser`] finds and fixes CSS syntax errors.
|
||||
* [`midas`] converts a CSS string to highlighted HTML.
|
||||
|
||||
[`postcss-less-engine`]: https://github.com/Crunch/postcss-less
|
||||
[`postcss-safe-parser`]: https://github.com/postcss/postcss-safe-parser
|
||||
[`postcss-html`]: https://github.com/gucong3000/postcss-html
|
||||
[`postcss-scss`]: https://github.com/postcss/postcss-scss
|
||||
[`postcss-sass`]: https://github.com/AleshaOleg/postcss-sass
|
||||
[`postcss-less`]: https://github.com/webschik/postcss-less
|
||||
[`postcss-js`]: https://github.com/postcss/postcss-js
|
||||
[`sugarss`]: https://github.com/postcss/sugarss
|
||||
[`midas`]: https://github.com/ben-eb/midas
|
||||
|
||||
## Articles
|
||||
|
||||
* [Some things you may think about PostCSS… and you might be wrong](http://julian.io/some-things-you-may-think-about-postcss-and-you-might-be-wrong)
|
||||
* [What PostCSS Really Is; What It Really Does](http://davidtheclark.com/its-time-for-everyone-to-learn-about-postcss)
|
||||
* [PostCSS Guides](http://webdesign.tutsplus.com/series/postcss-deep-dive--cms-889)
|
||||
|
||||
More articles and videos you can find on [awesome-postcss](https://github.com/jjaderg/awesome-postcss) list.
|
||||
|
||||
## Books
|
||||
|
||||
* [Mastering PostCSS for Web Design](https://www.packtpub.com/web-development/mastering-postcss-web-design) by Alex Libby, Packt. (June 2016)
|
||||
|
||||
## Usage
|
||||
|
||||
You can start using PostCSS in just two steps:
|
||||
|
||||
1. Find and add PostCSS extensions for your build tool.
|
||||
2. [Select plugins] and add them to your PostCSS process.
|
||||
|
||||
[Select plugins]: http://postcss.parts
|
||||
|
||||
### Webpack
|
||||
|
||||
Use [`postcss-loader`] in `webpack.config.js`:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'style-loader',
|
||||
},
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
importLoaders: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then create `postcss.config.js`:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('precss'),
|
||||
require('autoprefixer')
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
[`postcss-loader`]: https://github.com/postcss/postcss-loader
|
||||
|
||||
### Gulp
|
||||
|
||||
Use [`gulp-postcss`] and [`gulp-sourcemaps`].
|
||||
|
||||
```js
|
||||
gulp.task('css', function () {
|
||||
var postcss = require('gulp-postcss');
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
|
||||
return gulp.src('src/**/*.css')
|
||||
.pipe( sourcemaps.init() )
|
||||
.pipe( postcss([ require('precss'), require('autoprefixer') ]) )
|
||||
.pipe( sourcemaps.write('.') )
|
||||
.pipe( gulp.dest('build/') );
|
||||
});
|
||||
```
|
||||
|
||||
[`gulp-sourcemaps`]: https://github.com/floridoo/gulp-sourcemaps
|
||||
[`gulp-postcss`]: https://github.com/postcss/gulp-postcss
|
||||
|
||||
### npm run / CLI
|
||||
|
||||
To use PostCSS from your command-line interface or with npm scripts
|
||||
there is [`postcss-cli`].
|
||||
|
||||
```sh
|
||||
postcss --use autoprefixer -c options.json -o main.css css/*.css
|
||||
```
|
||||
|
||||
[`postcss-cli`]: https://github.com/postcss/postcss-cli
|
||||
|
||||
### Browser
|
||||
|
||||
If you want to compile CSS string in browser (for instance, in live edit
|
||||
tools like CodePen), just use [Browserify] or [webpack]. They will pack
|
||||
PostCSS and plugins files into a single file.
|
||||
|
||||
To apply PostCSS plugins to React Inline Styles, JSS, Radium
|
||||
and other [CSS-in-JS], you can use [`postcss-js`] and transforms style objects.
|
||||
|
||||
```js
|
||||
var postcss = require('postcss-js');
|
||||
var prefixer = postcss.sync([ require('autoprefixer') ]);
|
||||
|
||||
prefixer({ display: 'flex' }); //=> { display: ['-webkit-box', '-webkit-flex', '-ms-flexbox', 'flex'] }
|
||||
```
|
||||
|
||||
[`postcss-js`]: https://github.com/postcss/postcss-js
|
||||
[Browserify]: http://browserify.org/
|
||||
[CSS-in-JS]: https://github.com/MicheleBertoli/css-in-js
|
||||
[webpack]: https://webpack.github.io/
|
||||
|
||||
### Runners
|
||||
|
||||
* **Grunt**: [`grunt-postcss`](https://github.com/nDmitry/grunt-postcss)
|
||||
* **HTML**: [`posthtml-postcss`](https://github.com/posthtml/posthtml-postcss)
|
||||
* **Stylus**: [`poststylus`](https://github.com/seaneking/poststylus)
|
||||
* **Rollup**: [`rollup-plugin-postcss`](https://github.com/egoist/rollup-plugin-postcss)
|
||||
* **Brunch**: [`postcss-brunch`](https://github.com/brunch/postcss-brunch)
|
||||
* **Broccoli**: [`broccoli-postcss`](https://github.com/jeffjewiss/broccoli-postcss)
|
||||
* **Meteor**: [`postcss`](https://atmospherejs.com/juliancwirko/postcss)
|
||||
* **ENB**: [`enb-postcss`](https://github.com/awinogradov/enb-postcss)
|
||||
* **Taskr**: [`taskr-postcss`](https://github.com/lukeed/taskr/tree/master/packages/postcss)
|
||||
* **Start**: [`start-postcss`](https://github.com/start-runner/postcss)
|
||||
* **Connect/Express**: [`postcss-middleware`](https://github.com/jedmao/postcss-middleware)
|
||||
|
||||
### JS API
|
||||
|
||||
For other environments, you can use the JS API:
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const postcss = require('postcss');
|
||||
const precss = require('precss');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
|
||||
fs.readFile('src/app.css', (err, css) => {
|
||||
postcss([precss, autoprefixer])
|
||||
.process(css, { from: 'src/app.css', to: 'dest/app.css' })
|
||||
.then(result => {
|
||||
fs.writeFile('dest/app.css', result.css);
|
||||
if ( result.map ) fs.writeFile('dest/app.css.map', result.map);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Read the [PostCSS API documentation] for more details about the JS API.
|
||||
|
||||
All PostCSS runners should pass [PostCSS Runner Guidelines].
|
||||
|
||||
[PostCSS Runner Guidelines]: https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md
|
||||
[PostCSS API documentation]: http://api.postcss.org/postcss.html
|
||||
|
||||
### Options
|
||||
|
||||
Most PostCSS runners accept two parameters:
|
||||
|
||||
* An array of plugins.
|
||||
* An object of options.
|
||||
|
||||
Common options:
|
||||
|
||||
* `syntax`: an object providing a syntax parser and a stringifier.
|
||||
* `parser`: a special syntax parser (for example, [SCSS]).
|
||||
* `stringifier`: a special syntax output generator (for example, [Midas]).
|
||||
* `map`: [source map options].
|
||||
* `from`: the input file name (most runners set it automatically).
|
||||
* `to`: the output file name (most runners set it automatically).
|
||||
|
||||
[source map options]: https://github.com/postcss/postcss/blob/master/docs/source-maps.md
|
||||
[Midas]: https://github.com/ben-eb/midas
|
||||
[SCSS]: https://github.com/postcss/postcss-scss
|
||||
|
||||
## Editors & IDE Integration
|
||||
|
||||
### Atom
|
||||
|
||||
* [`language-postcss`] adds PostCSS and [SugarSS] highlight.
|
||||
* [`source-preview-postcss`] previews your output CSS in a separate, live pane.
|
||||
|
||||
[SugarSS]: https://github.com/postcss/sugarss
|
||||
|
||||
### Sublime Text
|
||||
|
||||
* [`Syntax-highlighting-for-PostCSS`] adds PostCSS highlight.
|
||||
|
||||
[`Syntax-highlighting-for-PostCSS`]: https://github.com/hudochenkov/Syntax-highlighting-for-PostCSS
|
||||
[`source-preview-postcss`]: https://atom.io/packages/source-preview-postcss
|
||||
[`language-postcss`]: https://atom.io/packages/language-postcss
|
||||
|
||||
### Vim
|
||||
|
||||
* [`postcss.vim`] adds PostCSS highlight.
|
||||
|
||||
[`postcss.vim`]: https://github.com/stephenway/postcss.vim
|
||||
|
||||
### WebStorm
|
||||
|
||||
WebStorm 2016.3 [has] built-in PostCSS support.
|
||||
|
||||
[has]: https://blog.jetbrains.com/webstorm/2016/08/webstorm-2016-3-early-access-preview/
|
||||
195
build/node_modules/postcss-csso/node_modules/postcss/docs/guidelines/plugin.md
generated
vendored
Normal file
195
build/node_modules/postcss-csso/node_modules/postcss/docs/guidelines/plugin.md
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
# PostCSS Plugin Guidelines
|
||||
|
||||
A PostCSS plugin is a function that receives and, usually,
|
||||
transforms a CSS AST from the PostCSS parser.
|
||||
|
||||
The rules below are *mandatory* for all PostCSS plugins.
|
||||
|
||||
See also [ClojureWerkz’s recommendations] for open source projects.
|
||||
|
||||
[ClojureWerkz’s recommendations]: http://blog.clojurewerkz.org/blog/2013/04/20/how-to-make-your-open-source-project-really-awesome/
|
||||
|
||||
## 1. API
|
||||
|
||||
### 1.1 Clear name with `postcss-` prefix
|
||||
|
||||
The plugin’s purpose should be clear just by reading its name.
|
||||
If you wrote a transpiler for CSS 4 Custom Media, `postcss-custom-media`
|
||||
would be a good name. If you wrote a plugin to support mixins,
|
||||
`postcss-mixins` would be a good name.
|
||||
|
||||
The prefix `postcss-` shows that the plugin is part of the PostCSS ecosystem.
|
||||
|
||||
This rule is not mandatory for plugins that can run as independent tools,
|
||||
without the user necessarily knowing that it is powered by
|
||||
PostCSS — for example, [cssnext] and [Autoprefixer].
|
||||
|
||||
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
||||
[cssnext]: http://cssnext.io/
|
||||
|
||||
### 1.2. Do one thing, and do it well
|
||||
|
||||
Do not create multitool plugins. Several small, one-purpose plugins bundled into
|
||||
a plugin pack is usually a better solution.
|
||||
|
||||
For example, [cssnext] contains many small plugins,
|
||||
one for each W3C specification. And [cssnano] contains a separate plugin
|
||||
for each of its optimization.
|
||||
|
||||
[cssnext]: http://cssnext.io/
|
||||
[cssnano]: https://github.com/ben-eb/cssnano
|
||||
|
||||
### 1.3. Do not use mixins
|
||||
|
||||
Preprocessors libraries like Compass provide an API with mixins.
|
||||
|
||||
PostCSS plugins are different.
|
||||
A plugin cannot be just a set of mixins for [postcss-mixins].
|
||||
|
||||
To achieve your goal, consider transforming valid CSS
|
||||
or using custom at-rules and custom properties.
|
||||
|
||||
[postcss-mixins]: https://github.com/postcss/postcss-mixins
|
||||
|
||||
### 1.4. Create plugin by `postcss.plugin`
|
||||
|
||||
By wrapping your function in this method,
|
||||
you are hooking into a common plugin API:
|
||||
|
||||
```js
|
||||
module.exports = postcss.plugin('plugin-name', function (opts) {
|
||||
return function (root, result) {
|
||||
// Plugin code
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
## 2. Processing
|
||||
|
||||
### 2.1. Plugin must be tested
|
||||
|
||||
A CI service like [Travis] is also recommended for testing code in
|
||||
different environments. You should test in (at least) Node.js [active LTS](https://github.com/nodejs/LTS) and current stable version.
|
||||
|
||||
[Travis]: https://travis-ci.org/
|
||||
|
||||
### 2.2. Use asynchronous methods whenever possible
|
||||
|
||||
For example, use `fs.writeFile` instead of `fs.writeFileSync`:
|
||||
|
||||
```js
|
||||
postcss.plugin('plugin-sprite', function (opts) {
|
||||
return function (root, result) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
var sprite = makeSprite();
|
||||
fs.writeFile(opts.file, function (err) {
|
||||
if ( err ) return reject(err);
|
||||
resolve();
|
||||
})
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
### 2.3. Set `node.source` for new nodes
|
||||
|
||||
Every node must have a relevant `source` so PostCSS can generate
|
||||
an accurate source map.
|
||||
|
||||
So if you add new declaration based on some existing declaration, you should
|
||||
clone the existing declaration in order to save that original `source`.
|
||||
|
||||
```js
|
||||
if ( needPrefix(decl.prop) ) {
|
||||
decl.cloneBefore({ prop: '-webkit-' + decl.prop });
|
||||
}
|
||||
```
|
||||
|
||||
You can also set `source` directly, copying from some existing node:
|
||||
|
||||
```js
|
||||
if ( decl.prop === 'animation' ) {
|
||||
var keyframe = createAnimationByName(decl.value);
|
||||
keyframes.source = decl.source;
|
||||
decl.root().append(keyframes);
|
||||
}
|
||||
```
|
||||
|
||||
### 2.4. Use only the public PostCSS API
|
||||
|
||||
PostCSS plugins must not rely on undocumented properties or methods,
|
||||
which may be subject to change in any minor release. The public API
|
||||
is described in [API docs].
|
||||
|
||||
[API docs]: http://api.postcss.org/
|
||||
|
||||
## 3. Errors
|
||||
|
||||
### 3.1. Use `node.error` on CSS relevant errors
|
||||
|
||||
If you have an error because of input CSS (like an unknown name
|
||||
in a mixin plugin) you should use `node.error` to create an error
|
||||
that includes source position:
|
||||
|
||||
```js
|
||||
if ( typeof mixins[name] === 'undefined' ) {
|
||||
throw decl.error('Unknown mixin ' + name, { plugin: 'postcss-mixins' });
|
||||
}
|
||||
```
|
||||
|
||||
### 3.2. Use `result.warn` for warnings
|
||||
|
||||
Do not print warnings with `console.log` or `console.warn`,
|
||||
because some PostCSS runner may not allow console output.
|
||||
|
||||
```js
|
||||
if ( outdated(decl.prop) ) {
|
||||
result.warn(decl.prop + ' is outdated', { node: decl });
|
||||
}
|
||||
```
|
||||
|
||||
If CSS input is a source of the warning, the plugin must set the `node` option.
|
||||
|
||||
## 4. Documentation
|
||||
|
||||
### 4.1. Document your plugin in English
|
||||
|
||||
PostCSS plugins must have their `README.md` written in English. Do not be afraid
|
||||
of your English skills, as the open source community will fix your errors.
|
||||
|
||||
Of course, you are welcome to write documentation in other languages;
|
||||
just name them appropriately (e.g. `README.ja.md`).
|
||||
|
||||
### 4.2. Include input and output examples
|
||||
|
||||
The plugin's `README.md` must contain example input and output CSS.
|
||||
A clear example is the best way to describe how your plugin works.
|
||||
|
||||
The first section of the `README.md` is a good place to put examples.
|
||||
See [postcss-opacity](https://github.com/iamvdo/postcss-opacity) for an example.
|
||||
|
||||
Of course, this guideline does not apply if your plugin does not
|
||||
transform the CSS.
|
||||
|
||||
### 4.3. Maintain a changelog
|
||||
|
||||
PostCSS plugins must describe the changes of all their releases
|
||||
in a separate file, such as `CHANGELOG.md`, `History.md`, or [GitHub Releases].
|
||||
Visit [Keep A Changelog] for more information about how to write one of these.
|
||||
|
||||
Of course, you should be using [SemVer].
|
||||
|
||||
[Keep A Changelog]: http://keepachangelog.com/
|
||||
[GitHub Releases]: https://help.github.com/articles/creating-releases/
|
||||
[SemVer]: http://semver.org/
|
||||
|
||||
### 4.4. Include `postcss-plugin` keyword in `package.json`
|
||||
|
||||
PostCSS plugins written for npm must have the `postcss-plugin` keyword
|
||||
in their `package.json`. This special keyword will be useful for feedback about
|
||||
the PostCSS ecosystem.
|
||||
|
||||
For packages not published to npm, this is not mandatory, but is recommended
|
||||
if the package format can contain keywords.
|
||||
143
build/node_modules/postcss-csso/node_modules/postcss/docs/guidelines/runner.md
generated
vendored
Normal file
143
build/node_modules/postcss-csso/node_modules/postcss/docs/guidelines/runner.md
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
# PostCSS Runner Guidelines
|
||||
|
||||
A PostCSS runner is a tool that processes CSS through a user-defined list
|
||||
of plugins; for example, [`postcss-cli`] or [`gulp‑postcss`].
|
||||
These rules are mandatory for any such runners.
|
||||
|
||||
For single-plugin tools, like [`gulp-autoprefixer`],
|
||||
these rules are not mandatory but are highly recommended.
|
||||
|
||||
See also [ClojureWerkz’s recommendations] for open source projects.
|
||||
|
||||
[ClojureWerkz’s recommendations]: http://blog.clojurewerkz.org/blog/2013/04/20/how-to-make-your-open-source-project-really-awesome/
|
||||
[`gulp-autoprefixer`]: https://github.com/sindresorhus/gulp-autoprefixer
|
||||
[`gulp‑postcss`]: https://github.com/w0rm/gulp-postcss
|
||||
[`postcss-cli`]: https://github.com/postcss/postcss-cli
|
||||
|
||||
## 1. API
|
||||
|
||||
### 1.1. Accept functions in plugin parameters
|
||||
|
||||
If your runner uses a config file, it must be written in JavaScript, so that
|
||||
it can support plugins which accept a function, such as [`postcss-assets`]:
|
||||
|
||||
```js
|
||||
module.exports = [
|
||||
require('postcss-assets')({
|
||||
cachebuster: function (file) {
|
||||
return fs.statSync(file).mtime.getTime().toString(16);
|
||||
}
|
||||
})
|
||||
];
|
||||
```
|
||||
|
||||
[`postcss-assets`]: https://github.com/borodean/postcss-assets
|
||||
|
||||
## 2. Processing
|
||||
|
||||
### 2.1. Set `from` and `to` processing options
|
||||
|
||||
To ensure that PostCSS generates source maps and displays better syntax errors,
|
||||
runners must specify the `from` and `to` options. If your runner does not handle
|
||||
writing to disk (for example, a gulp transform), you should set both options
|
||||
to point to the same file:
|
||||
|
||||
```js
|
||||
processor.process({ from: file.path, to: file.path });
|
||||
```
|
||||
|
||||
### 2.2. Use only the asynchronous API
|
||||
|
||||
PostCSS runners must use only the asynchronous API.
|
||||
The synchronous API is provided only for debugging, is slower,
|
||||
and can’t work with asynchronous plugins.
|
||||
|
||||
```js
|
||||
processor.process(opts).then(function (result) {
|
||||
// processing is finished
|
||||
});
|
||||
```
|
||||
|
||||
### 2.3. Use only the public PostCSS API
|
||||
|
||||
PostCSS runners must not rely on undocumented properties or methods,
|
||||
which may be subject to change in any minor release. The public API
|
||||
is described in [API docs].
|
||||
|
||||
[API docs]: http://api.postcss.org/
|
||||
|
||||
## 3. Output
|
||||
|
||||
### 3.1. Don’t show JS stack for `CssSyntaxError`
|
||||
|
||||
PostCSS runners must not show a stack trace for CSS syntax errors,
|
||||
as the runner can be used by developers who are not familiar with JavaScript.
|
||||
Instead, handle such errors gracefully:
|
||||
|
||||
```js
|
||||
processor.process(opts).catch(function (error) {
|
||||
if ( error.name === 'CssSyntaxError' ) {
|
||||
process.stderr.write(error.message + error.showSourceCode());
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### 3.2. Display `result.warnings()`
|
||||
|
||||
PostCSS runners must output warnings from `result.warnings()`:
|
||||
|
||||
```js
|
||||
result.warnings().forEach(function (warn) {
|
||||
process.stderr.write(warn.toString());
|
||||
});
|
||||
```
|
||||
|
||||
See also [postcss-log-warnings] and [postcss-messages] plugins.
|
||||
|
||||
[postcss-log-warnings]: https://github.com/davidtheclark/postcss-log-warnings
|
||||
[postcss-messages]: https://github.com/postcss/postcss-messages
|
||||
|
||||
### 3.3. Allow the user to write source maps to different files
|
||||
|
||||
PostCSS by default will inline source maps in the generated file; however,
|
||||
PostCSS runners must provide an option to save the source map in a different
|
||||
file:
|
||||
|
||||
```js
|
||||
if ( result.map ) {
|
||||
fs.writeFile(opts.to + '.map', result.map.toString());
|
||||
}
|
||||
```
|
||||
|
||||
## 4. Documentation
|
||||
|
||||
### 4.1. Document your runner in English
|
||||
|
||||
PostCSS runners must have their `README.md` written in English. Do not be afraid
|
||||
of your English skills, as the open source community will fix your errors.
|
||||
|
||||
Of course, you are welcome to write documentation in other languages;
|
||||
just name them appropriately (e.g. `README.ja.md`).
|
||||
|
||||
### 4.2. Maintain a changelog
|
||||
|
||||
PostCSS runners must describe changes of all releases in a separate file,
|
||||
such as `ChangeLog.md`, `History.md`, or with [GitHub Releases].
|
||||
Visit [Keep A Changelog] for more information on how to write one of these.
|
||||
|
||||
Of course you should use [SemVer].
|
||||
|
||||
[Keep A Changelog]: http://keepachangelog.com/
|
||||
[GitHub Releases]: https://help.github.com/articles/creating-releases/
|
||||
[SemVer]: http://semver.org/
|
||||
|
||||
### 4.3. `postcss-runner` keyword in `package.json`
|
||||
|
||||
PostCSS runners written for npm must have the `postcss-runner` keyword
|
||||
in their `package.json`. This special keyword will be useful for feedback about
|
||||
the PostCSS ecosystem.
|
||||
|
||||
For packages not published to npm, this is not mandatory, but recommended
|
||||
if the package format is allowed to contain keywords.
|
||||
74
build/node_modules/postcss-csso/node_modules/postcss/docs/source-maps.md
generated
vendored
Normal file
74
build/node_modules/postcss-csso/node_modules/postcss/docs/source-maps.md
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# PostCSS and Source Maps
|
||||
|
||||
PostCSS has great [source maps] support. It can read and interpret maps
|
||||
from previous transformation steps, autodetect the format that you expect,
|
||||
and output both external and inline maps.
|
||||
|
||||
To ensure that you generate an accurate source map, you must indicate the input
|
||||
and output CSS file paths — using the options `from` and `to`, respectively.
|
||||
|
||||
To generate a new source map with the default options, simply set `map: true`.
|
||||
This will generate an inline source map that contains the source content.
|
||||
If you don’t want the map inlined, you can set `map.inline: false`.
|
||||
|
||||
```js
|
||||
processor
|
||||
.process(css, {
|
||||
from: 'app.sass.css',
|
||||
to: 'app.css',
|
||||
map: { inline: false },
|
||||
})
|
||||
.then(function (result) {
|
||||
result.map //=> '{ "version":3,
|
||||
// "file":"app.css",
|
||||
// "sources":["app.sass"],
|
||||
// "mappings":"AAAA,KAAI" }'
|
||||
});
|
||||
```
|
||||
|
||||
If PostCSS finds source maps from a previous transformation,
|
||||
it will automatically update that source map with the same options.
|
||||
|
||||
## Options
|
||||
|
||||
If you want more control over source map generation, you can define the `map`
|
||||
option as an object with the following parameters:
|
||||
|
||||
* `inline` boolean: indicates that the source map should be embedded
|
||||
in the output CSS as a Base64-encoded comment. By default, it is `true`.
|
||||
But if all previous maps are external, not inline, PostCSS will not embed
|
||||
the map even if you do not set this option.
|
||||
|
||||
If you have an inline source map, the `result.map` property will be empty,
|
||||
as the source map will be contained within the text of `result.css`.
|
||||
|
||||
* `prev` string, object, boolean or function: source map content from
|
||||
a previous processing step (for example, Sass compilation).
|
||||
PostCSS will try to read the previous source map automatically
|
||||
(based on comments within the source CSS), but you can use this option
|
||||
to identify it manually. If desired, you can omit the previous map
|
||||
with `prev: false`.
|
||||
|
||||
* `sourcesContent` boolean: indicates that PostCSS should set the origin
|
||||
content (for example, Sass source) of the source map. By default,
|
||||
it is `true`. But if all previous maps do not contain sources content,
|
||||
PostCSS will also leave it out even if you do not set this option.
|
||||
|
||||
* `annotation` boolean or string: indicates that PostCSS should add annotation
|
||||
comments to the CSS. By default, PostCSS will always add a comment with a path
|
||||
to the source map. PostCSS will not add annotations to CSS files that
|
||||
do not contain any comments.
|
||||
|
||||
By default, PostCSS presumes that you want to save the source map as
|
||||
`opts.to + '.map'` and will use this path in the annotation comment.
|
||||
A different path can be set by providing a string value for `annotation`.
|
||||
|
||||
If you have set `inline: true`, annotation cannot be disabled.
|
||||
|
||||
* `from` string: by default, PostCSS will set the `sources` property of the map
|
||||
to the value of the `from` option. If you want to override this behaviour, you
|
||||
can use `map.from` to explicitly set the source map's `sources` property.
|
||||
Path should be absolute or relative from generated file
|
||||
(`to` option in `process()` method).
|
||||
|
||||
[source maps]: http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/
|
||||
231
build/node_modules/postcss-csso/node_modules/postcss/docs/syntax.md
generated
vendored
Normal file
231
build/node_modules/postcss-csso/node_modules/postcss/docs/syntax.md
generated
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
# How to Write Custom Syntax
|
||||
|
||||
PostCSS can transform styles in any syntax, and is not limited to just CSS.
|
||||
By writing a custom syntax, you can transform styles in any desired format.
|
||||
|
||||
Writing a custom syntax is much harder than writing a PostCSS plugin, but
|
||||
it is an awesome adventure.
|
||||
|
||||
There are 3 types of PostCSS syntax packages:
|
||||
|
||||
* **Parser** to parse input string to node’s tree.
|
||||
* **Stringifier** to generate output string by node’s tree.
|
||||
* **Syntax** contains both parser and stringifier.
|
||||
|
||||
## Syntax
|
||||
|
||||
A good example of a custom syntax is [SCSS]. Some users may want to transform
|
||||
SCSS sources with PostCSS plugins, for example if they need to add vendor
|
||||
prefixes or change the property order. So this syntax should output SCSS from
|
||||
an SCSS input.
|
||||
|
||||
The syntax API is a very simple plain object, with `parse` & `stringify`
|
||||
functions:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
parse: require('./parse'),
|
||||
stringify: require('./stringify')
|
||||
};
|
||||
```
|
||||
|
||||
[SCSS]: https://github.com/postcss/postcss-scss
|
||||
|
||||
## Parser
|
||||
|
||||
A good example of a parser is [Safe Parser], which parses malformed/broken CSS.
|
||||
Because there is no point to generate broken output, this package only provides
|
||||
a parser.
|
||||
|
||||
The parser API is a function which receives a string & returns a [`Root`] node.
|
||||
The second argument is a function which receives an object with PostCSS options.
|
||||
|
||||
```js
|
||||
var postcss = require('postcss');
|
||||
|
||||
module.exports = function (css, opts) {
|
||||
var root = postcss.root();
|
||||
// Add other nodes to root
|
||||
return root;
|
||||
};
|
||||
```
|
||||
|
||||
[Safe Parser]: https://github.com/postcss/postcss-safe-parser
|
||||
[`Root`]: http://api.postcss.org/Root.html
|
||||
|
||||
### Main Theory
|
||||
|
||||
There are many books about parsers; but do not worry because CSS syntax is
|
||||
very easy, and so the parser will be much simpler than a programming language
|
||||
parser.
|
||||
|
||||
The default PostCSS parser contains two steps:
|
||||
|
||||
1. [Tokenizer] which reads input string character by character and builds a
|
||||
tokens array. For example, it joins space symbols to a `['space', '\n ']`
|
||||
token, and detects strings to a `['string', '"\"{"']` token.
|
||||
2. [Parser] which reads the tokens array, creates node instances and
|
||||
builds a tree.
|
||||
|
||||
[Tokenizer]: https://github.com/postcss/postcss/blob/master/lib/tokenize.es6
|
||||
[Parser]: https://github.com/postcss/postcss/blob/master/lib/parser.es6
|
||||
|
||||
### Performance
|
||||
|
||||
Parsing input is often the most time consuming task in CSS processors. So it
|
||||
is very important to have a fast parser.
|
||||
|
||||
The main rule of optimization is that there is no performance without a
|
||||
benchmark. You can look at [PostCSS benchmarks] to build your own.
|
||||
|
||||
Of parsing tasks, the tokenize step will often take the most time, so its
|
||||
performance should be prioritized. Unfortunately, classes, functions and
|
||||
high level structures can slow down your tokenizer. Be ready to write dirty
|
||||
code with repeated statements. This is why it is difficult to extend the
|
||||
default [PostCSS tokenizer]; copy & paste will be a necessary evil.
|
||||
|
||||
Second optimization is using character codes instead of strings.
|
||||
|
||||
```js
|
||||
// Slow
|
||||
string[i] === '{';
|
||||
|
||||
// Fast
|
||||
const OPEN_CURLY = 123; // `{'
|
||||
string.charCodeAt(i) === OPEN_CURLY;
|
||||
```
|
||||
|
||||
Third optimization is “fast jumps”. If you find open quotes, you can find
|
||||
next closing quote much faster by `indexOf`:
|
||||
|
||||
```js
|
||||
// Simple jump
|
||||
next = string.indexOf('"', currentPosition + 1);
|
||||
|
||||
// Jump by RegExp
|
||||
regexp.lastIndex = currentPosion + 1;
|
||||
regexp.text(string);
|
||||
next = regexp.lastIndex;
|
||||
```
|
||||
|
||||
The parser can be a well written class. There is no need in copy-paste and
|
||||
hardcore optimization there. You can extend the default [PostCSS parser].
|
||||
|
||||
[PostCSS benchmarks]: https://github.com/postcss/benchmark
|
||||
[PostCSS tokenizer]: https://github.com/postcss/postcss/blob/master/lib/tokenize.es6
|
||||
[PostCSS parser]: https://github.com/postcss/postcss/blob/master/lib/parser.es6
|
||||
|
||||
### Node Source
|
||||
|
||||
Every node should have `source` property to generate correct source map.
|
||||
This property contains `start` and `end` properties with `{ line, column }`,
|
||||
and `input` property with an [`Input`] instance.
|
||||
|
||||
Your tokenizer should save the original position so that you can propagate
|
||||
the values to the parser, to ensure that the source map is correctly updated.
|
||||
|
||||
[`Input`]: https://github.com/postcss/postcss/blob/master/lib/input.es6
|
||||
|
||||
### Raw Values
|
||||
|
||||
A good PostCSS parser should provide all information (including spaces symbols)
|
||||
to generate byte-to-byte equal output. It is not so difficult, but respectful
|
||||
for user input and allow integration smoke tests.
|
||||
|
||||
A parser should save all additional symbols to `node.raws` object.
|
||||
It is an open structure for you, you can add additional keys.
|
||||
For example, [SCSS parser] saves comment types (`/* */` or `//`)
|
||||
in `node.raws.inline`.
|
||||
|
||||
The default parser cleans CSS values from comments and spaces.
|
||||
It saves the original value with comments to `node.raws.value.raw` and uses it,
|
||||
if the node value was not changed.
|
||||
|
||||
[SCSS parser]: https://github.com/postcss/postcss-scss
|
||||
|
||||
### Tests
|
||||
|
||||
Of course, all parsers in the PostCSS ecosystem must have tests.
|
||||
|
||||
If your parser just extends CSS syntax (like [SCSS] or [Safe Parser]),
|
||||
you can use the [PostCSS Parser Tests]. It contains unit & integration tests.
|
||||
|
||||
[PostCSS Parser Tests]: https://github.com/postcss/postcss-parser-tests
|
||||
|
||||
## Stringifier
|
||||
|
||||
A style guide generator is a good example of a stringifier. It generates output
|
||||
HTML which contains CSS components. For this use case, a parser isn't necessary,
|
||||
so the package should just contain a stringifier.
|
||||
|
||||
The Stringifier API is little bit more complicated, than the parser API.
|
||||
PostCSS generates a source map, so a stringifier can’t just return a string.
|
||||
It must link every substring with its source node.
|
||||
|
||||
A Stringifier is a function which receives [`Root`] node and builder callback.
|
||||
Then it calls builder with every node’s string and node instance.
|
||||
|
||||
```js
|
||||
module.exports = function (root, builder) {
|
||||
// Some magic
|
||||
var string = decl.prop + ':' + decl.value + ';';
|
||||
builder(string, decl);
|
||||
// Some science
|
||||
};
|
||||
```
|
||||
|
||||
### Main Theory
|
||||
|
||||
PostCSS [default stringifier] is just a class with a method for each node type
|
||||
and many methods to detect raw properties.
|
||||
|
||||
In most cases it will be enough just to extend this class,
|
||||
like in [SCSS stringifier].
|
||||
|
||||
[default stringifier]: https://github.com/postcss/postcss/blob/master/lib/stringifier.es6
|
||||
[SCSS stringifier]: https://github.com/postcss/postcss-scss/blob/master/lib/scss-stringifier.es6
|
||||
|
||||
### Builder Function
|
||||
|
||||
A builder function will be passed to `stringify` function as second argument.
|
||||
For example, the default PostCSS stringifier class saves it
|
||||
to `this.builder` property.
|
||||
|
||||
Builder receives output substring and source node to append this substring
|
||||
to the final output.
|
||||
|
||||
Some nodes contain other nodes in the middle. For example, a rule has a `{`
|
||||
at the beginning, many declarations inside and a closing `}`.
|
||||
|
||||
For these cases, you should pass a third argument to builder function:
|
||||
`'start'` or `'end'` string:
|
||||
|
||||
```js
|
||||
this.builder(rule.selector + '{', rule, 'start');
|
||||
// Stringify declarations inside
|
||||
this.builder('}', rule, 'end');
|
||||
```
|
||||
|
||||
### Raw Values
|
||||
|
||||
A good PostCSS custom syntax saves all symbols and provide byte-to-byte equal
|
||||
output if there were no changes.
|
||||
|
||||
This is why every node has `node.raws` object to store space symbol, etc.
|
||||
|
||||
Be careful, because sometimes these raw properties will not be present; some
|
||||
nodes may be built manually, or may lose their indentation when they are moved
|
||||
to another parent node.
|
||||
|
||||
This is why the default stringifier has a `raw()` method to autodetect raw
|
||||
properties by other nodes. For example, it will look at other nodes to detect
|
||||
indent size and them multiply it with the current node depth.
|
||||
|
||||
### Tests
|
||||
|
||||
A stringifier must have tests too.
|
||||
|
||||
You can use unit and integration test cases from [PostCSS Parser Tests].
|
||||
Just compare input CSS with CSS after your parser and stringifier.
|
||||
|
||||
[PostCSS Parser Tests]: https://github.com/postcss/postcss-parser-tests
|
||||
97
build/node_modules/postcss-csso/node_modules/postcss/gulpfile.js
generated
vendored
Normal file
97
build/node_modules/postcss-csso/node_modules/postcss/gulpfile.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
'use strict';
|
||||
|
||||
const gulp = require('gulp');
|
||||
|
||||
gulp.task('clean', () => {
|
||||
let del = require('del');
|
||||
return del(['lib/*.js', 'postcss.js', 'build/', 'api/']);
|
||||
});
|
||||
|
||||
// Build
|
||||
|
||||
gulp.task('compile', () => {
|
||||
let sourcemaps = require('gulp-sourcemaps');
|
||||
let changed = require('gulp-changed');
|
||||
let babel = require('gulp-babel');
|
||||
return gulp.src('lib/*.es6')
|
||||
.pipe(changed('lib', { extension: '.js' }))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(babel({
|
||||
presets: [
|
||||
[
|
||||
'env',
|
||||
{
|
||||
targets: {
|
||||
browsers: 'last 2 version',
|
||||
node: 4
|
||||
},
|
||||
loose: true
|
||||
}
|
||||
]
|
||||
],
|
||||
plugins: ['add-module-exports', 'precompile-charcodes']
|
||||
}))
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('lib'));
|
||||
});
|
||||
|
||||
gulp.task('build:lib', ['compile'], () => {
|
||||
return gulp.src(['lib/*.js', 'lib/*.d.ts']).pipe(gulp.dest('build/lib'));
|
||||
});
|
||||
|
||||
gulp.task('build:package', () => {
|
||||
const editor = require('gulp-json-editor');
|
||||
return gulp.src('./package.json')
|
||||
.pipe(editor((json) => {
|
||||
delete json.babel;
|
||||
delete json.scripts;
|
||||
delete json.jest;
|
||||
delete json.eslintConfig;
|
||||
delete json['size-limit'];
|
||||
delete json['pre-commit'];
|
||||
delete json['lint-staged'];
|
||||
delete json.devDependencies;
|
||||
return json;
|
||||
}))
|
||||
.pipe(gulp.dest('build'));
|
||||
});
|
||||
|
||||
gulp.task('build:docs', () => {
|
||||
let ignore = require('fs').readFileSync('.npmignore').toString()
|
||||
.trim().split(/\n+/)
|
||||
.concat([
|
||||
'package.json', '.npmignore', 'lib/*', 'test/*',
|
||||
'node_modules/**/*', 'docs/api.md', 'docs/plugins.md',
|
||||
'docs/writing-a-plugin.md'
|
||||
]).map( i => '!' + i );
|
||||
return gulp.src(['**/*'].concat(ignore))
|
||||
.pipe(gulp.dest('build'));
|
||||
});
|
||||
|
||||
gulp.task('build', done => {
|
||||
let runSequence = require('run-sequence');
|
||||
runSequence('clean', ['build:lib', 'build:docs', 'build:package'], done);
|
||||
});
|
||||
|
||||
// Tests
|
||||
|
||||
gulp.task('integration', ['build'], done => {
|
||||
let postcss = require('./build');
|
||||
let real = require('postcss-parser-tests/real');
|
||||
real(done, css => {
|
||||
return postcss.parse(css).toResult({ map: { annotation: false } });
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('version', ['build:lib'], () => {
|
||||
let Processor = require('./lib/processor');
|
||||
let instance = new Processor();
|
||||
let pkg = require('./package');
|
||||
if ( pkg.version !== instance.version ) {
|
||||
throw new Error('Version in Processor is not equal to package.json');
|
||||
}
|
||||
});
|
||||
|
||||
// Common
|
||||
|
||||
gulp.task('default', ['version', 'integration']);
|
||||
131
build/node_modules/postcss-csso/node_modules/postcss/lib/at-rule.js
generated
vendored
Normal file
131
build/node_modules/postcss-csso/node_modules/postcss/lib/at-rule.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
61
build/node_modules/postcss-csso/node_modules/postcss/lib/comment.js
generated
vendored
Normal file
61
build/node_modules/postcss-csso/node_modules/postcss/lib/comment.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
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; }
|
||||
|
||||
/**
|
||||
* Represents a comment between declarations or statements (rule and at-rules).
|
||||
*
|
||||
* Comments inside selectors, at-rule parameters, or declaration values
|
||||
* will be stored in the `raws` properties explained above.
|
||||
*
|
||||
* @extends Node
|
||||
*/
|
||||
var Comment = function (_Node) {
|
||||
_inherits(Comment, _Node);
|
||||
|
||||
function Comment(defaults) {
|
||||
_classCallCheck(this, Comment);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, defaults));
|
||||
|
||||
_this.type = 'comment';
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @memberof Comment#
|
||||
* @member {string} text - the comment’s text
|
||||
*/
|
||||
|
||||
/**
|
||||
* @memberof Comment#
|
||||
* @member {object} raws - Information to generate byte-to-byte equal
|
||||
* node string as it was in the origin input.
|
||||
*
|
||||
* Every parser saves its own properties,
|
||||
* but the default CSS parser uses:
|
||||
*
|
||||
* * `before`: the space symbols before the node.
|
||||
* * `left`: the space symbols between `/*` and the comment’s text.
|
||||
* * `right`: the space symbols between the comment’s text.
|
||||
*/
|
||||
|
||||
|
||||
return Comment;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Comment;
|
||||
module.exports = exports['default'];
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbW1lbnQuZXM2Il0sIm5hbWVzIjpbIkNvbW1lbnQiLCJkZWZhdWx0cyIsInR5cGUiXSwibWFwcGluZ3MiOiI7Ozs7QUFBQTs7Ozs7Ozs7Ozs7O0FBRUE7Ozs7Ozs7O0lBUU1BLE87OztBQUVGLG1CQUFZQyxRQUFaLEVBQXNCO0FBQUE7O0FBQUEsaURBQ2xCLGlCQUFNQSxRQUFOLENBRGtCOztBQUVsQixVQUFLQyxJQUFMLEdBQVksU0FBWjtBQUZrQjtBQUdyQjs7QUFFRDs7Ozs7QUFLQTs7Ozs7Ozs7Ozs7Ozs7Ozs7a0JBY1dGLE8iLCJmaWxlIjoiY29tbWVudC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBOb2RlIGZyb20gJy4vbm9kZSc7XG5cbi8qKlxuICogUmVwcmVzZW50cyBhIGNvbW1lbnQgYmV0d2VlbiBkZWNsYXJhdGlvbnMgb3Igc3RhdGVtZW50cyAocnVsZSBhbmQgYXQtcnVsZXMpLlxuICpcbiAqIENvbW1lbnRzIGluc2lkZSBzZWxlY3RvcnMsIGF0LXJ1bGUgcGFyYW1ldGVycywgb3IgZGVjbGFyYXRpb24gdmFsdWVzXG4gKiB3aWxsIGJlIHN0b3JlZCBpbiB0aGUgYHJhd3NgIHByb3BlcnRpZXMgZXhwbGFpbmVkIGFib3ZlLlxuICpcbiAqIEBleHRlbmRzIE5vZGVcbiAqL1xuY2xhc3MgQ29tbWVudCBleHRlbmRzIE5vZGUge1xuXG4gICAgY29uc3RydWN0b3IoZGVmYXVsdHMpIHtcbiAgICAgICAgc3VwZXIoZGVmYXVsdHMpO1xuICAgICAgICB0aGlzLnR5cGUgPSAnY29tbWVudCc7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQG1lbWJlcm9mIENvbW1lbnQjXG4gICAgICogQG1lbWJlciB7c3RyaW5nfSB0ZXh0IC0gdGhlIGNvbW1lbnTigJlzIHRleHRcbiAgICAgKi9cblxuICAgIC8qKlxuICAgICAqIEBtZW1iZXJvZiBDb21tZW50I1xuICAgICAqIEBtZW1iZXIge29iamVjdH0gcmF3cyAtIEluZm9ybWF0aW9uIHRvIGdlbmVyYXRlIGJ5dGUtdG8tYnl0ZSBlcXVhbFxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUgc3RyaW5nIGFzIGl0IHdhcyBpbiB0aGUgb3JpZ2luIGlucHV0LlxuICAgICAqXG4gICAgICogRXZlcnkgcGFyc2VyIHNhdmVzIGl0cyBvd24gcHJvcGVydGllcyxcbiAgICAgKiBidXQgdGhlIGRlZmF1bHQgQ1NTIHBhcnNlciB1c2VzOlxuICAgICAqXG4gICAgICogKiBgYmVmb3JlYDogdGhlIHNwYWNlIHN5bWJvbHMgYmVmb3JlIHRoZSBub2RlLlxuICAgICAqICogYGxlZnRgOiB0aGUgc3BhY2Ugc3ltYm9scyBiZXR3ZWVuIGAvKmAgYW5kIHRoZSBjb21tZW504oCZcyB0ZXh0LlxuICAgICAqICogYHJpZ2h0YDogdGhlIHNwYWNlIHN5bWJvbHMgYmV0d2VlbiB0aGUgY29tbWVudOKAmXMgdGV4dC5cbiAgICAgKi9cbn1cblxuZXhwb3J0IGRlZmF1bHQgQ29tbWVudDtcbiJdfQ==
|
||||
907
build/node_modules/postcss-csso/node_modules/postcss/lib/container.js
generated
vendored
Normal file
907
build/node_modules/postcss-csso/node_modules/postcss/lib/container.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
256
build/node_modules/postcss-csso/node_modules/postcss/lib/css-syntax-error.js
generated
vendored
Normal file
256
build/node_modules/postcss-csso/node_modules/postcss/lib/css-syntax-error.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
101
build/node_modules/postcss-csso/node_modules/postcss/lib/declaration.js
generated
vendored
Normal file
101
build/node_modules/postcss-csso/node_modules/postcss/lib/declaration.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
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; }
|
||||
|
||||
/**
|
||||
* Represents a CSS declaration.
|
||||
*
|
||||
* @extends Node
|
||||
*
|
||||
* @example
|
||||
* const root = postcss.parse('a { color: black }');
|
||||
* const decl = root.first.first;
|
||||
* decl.type //=> 'decl'
|
||||
* decl.toString() //=> ' color: black'
|
||||
*/
|
||||
var Declaration = function (_Node) {
|
||||
_inherits(Declaration, _Node);
|
||||
|
||||
function Declaration(defaults) {
|
||||
_classCallCheck(this, Declaration);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Node.call(this, defaults));
|
||||
|
||||
_this.type = 'decl';
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @memberof Declaration#
|
||||
* @member {string} prop - the declaration’s property name
|
||||
*
|
||||
* @example
|
||||
* const root = postcss.parse('a { color: black }');
|
||||
* const decl = root.first.first;
|
||||
* decl.prop //=> 'color'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @memberof Declaration#
|
||||
* @member {string} value - the declaration’s value
|
||||
*
|
||||
* @example
|
||||
* const root = postcss.parse('a { color: black }');
|
||||
* const decl = root.first.first;
|
||||
* decl.value //=> 'black'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @memberof Declaration#
|
||||
* @member {boolean} important - `true` if the declaration
|
||||
* has an !important annotation.
|
||||
*
|
||||
* @example
|
||||
* const root = postcss.parse('a { color: black !important; color: red }');
|
||||
* root.first.first.important //=> true
|
||||
* root.first.last.important //=> undefined
|
||||
*/
|
||||
|
||||
/**
|
||||
* @memberof Declaration#
|
||||
* @member {object} raws - Information to generate byte-to-byte equal
|
||||
* node string as it was in the origin input.
|
||||
*
|
||||
* Every parser saves its own properties,
|
||||
* but the default CSS parser uses:
|
||||
*
|
||||
* * `before`: the space symbols before the node. It also stores `*`
|
||||
* and `_` symbols before the declaration (IE hack).
|
||||
* * `between`: the symbols between the property and value
|
||||
* for declarations.
|
||||
* * `important`: the content of the important statement,
|
||||
* if it is not just `!important`.
|
||||
*
|
||||
* PostCSS cleans declaration from comments and extra spaces,
|
||||
* but it stores origin content in raws properties.
|
||||
* As such, if you don’t change a declaration’s value,
|
||||
* PostCSS will use the raw value with comments.
|
||||
*
|
||||
* @example
|
||||
* const root = postcss.parse('a {\n color:black\n}')
|
||||
* root.first.first.raws //=> { before: '\n ', between: ':' }
|
||||
*/
|
||||
|
||||
return Declaration;
|
||||
}(_node2.default);
|
||||
|
||||
exports.default = Declaration;
|
||||
module.exports = exports['default'];
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRlY2xhcmF0aW9uLmVzNiJdLCJuYW1lcyI6WyJEZWNsYXJhdGlvbiIsImRlZmF1bHRzIiwidHlwZSJdLCJtYXBwaW5ncyI6Ijs7OztBQUFBOzs7Ozs7Ozs7Ozs7QUFFQTs7Ozs7Ozs7Ozs7SUFXTUEsVzs7O0FBRUYsdUJBQVlDLFFBQVosRUFBc0I7QUFBQTs7QUFBQSxpREFDbEIsaUJBQU1BLFFBQU4sQ0FEa0I7O0FBRWxCLFVBQUtDLElBQUwsR0FBWSxNQUFaO0FBRmtCO0FBR3JCOztBQUVEOzs7Ozs7Ozs7O0FBVUE7Ozs7Ozs7Ozs7QUFVQTs7Ozs7Ozs7Ozs7QUFXQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztrQkEyQldGLFciLCJmaWxlIjoiZGVjbGFyYXRpb24uanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgTm9kZSBmcm9tICcuL25vZGUnO1xuXG4vKipcbiAqIFJlcHJlc2VudHMgYSBDU1MgZGVjbGFyYXRpb24uXG4gKlxuICogQGV4dGVuZHMgTm9kZVxuICpcbiAqIEBleGFtcGxlXG4gKiBjb25zdCByb290ID0gcG9zdGNzcy5wYXJzZSgnYSB7IGNvbG9yOiBibGFjayB9Jyk7XG4gKiBjb25zdCBkZWNsID0gcm9vdC5maXJzdC5maXJzdDtcbiAqIGRlY2wudHlwZSAgICAgICAvLz0+ICdkZWNsJ1xuICogZGVjbC50b1N0cmluZygpIC8vPT4gJyBjb2xvcjogYmxhY2snXG4gKi9cbmNsYXNzIERlY2xhcmF0aW9uIGV4dGVuZHMgTm9kZSB7XG5cbiAgICBjb25zdHJ1Y3RvcihkZWZhdWx0cykge1xuICAgICAgICBzdXBlcihkZWZhdWx0cyk7XG4gICAgICAgIHRoaXMudHlwZSA9ICdkZWNsJztcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyb2YgRGVjbGFyYXRpb24jXG4gICAgICogQG1lbWJlciB7c3RyaW5nfSBwcm9wIC0gdGhlIGRlY2xhcmF0aW9u4oCZcyBwcm9wZXJ0eSBuYW1lXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGNvbnN0IHJvb3QgPSBwb3N0Y3NzLnBhcnNlKCdhIHsgY29sb3I6IGJsYWNrIH0nKTtcbiAgICAgKiBjb25zdCBkZWNsID0gcm9vdC5maXJzdC5maXJzdDtcbiAgICAgKiBkZWNsLnByb3AgLy89PiAnY29sb3InXG4gICAgICovXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyb2YgRGVjbGFyYXRpb24jXG4gICAgICogQG1lbWJlciB7c3RyaW5nfSB2YWx1ZSAtIHRoZSBkZWNsYXJhdGlvbuKAmXMgdmFsdWVcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogY29uc3Qgcm9vdCA9IHBvc3Rjc3MucGFyc2UoJ2EgeyBjb2xvcjogYmxhY2sgfScpO1xuICAgICAqIGNvbnN0IGRlY2wgPSByb290LmZpcnN0LmZpcnN0O1xuICAgICAqIGRlY2wudmFsdWUgLy89PiAnYmxhY2snXG4gICAgICovXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyb2YgRGVjbGFyYXRpb24jXG4gICAgICogQG1lbWJlciB7Ym9vbGVhbn0gaW1wb3J0YW50IC0gYHRydWVgIGlmIHRoZSBkZWNsYXJhdGlvblxuICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhcyBhbiAhaW1wb3J0YW50IGFubm90YXRpb24uXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGNvbnN0IHJvb3QgPSBwb3N0Y3NzLnBhcnNlKCdhIHsgY29sb3I6IGJsYWNrICFpbXBvcnRhbnQ7IGNvbG9yOiByZWQgfScpO1xuICAgICAqIHJvb3QuZmlyc3QuZmlyc3QuaW1wb3J0YW50IC8vPT4gdHJ1ZVxuICAgICAqIHJvb3QuZmlyc3QubGFzdC5pbXBvcnRhbnQgIC8vPT4gdW5kZWZpbmVkXG4gICAgICovXG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyb2YgRGVjbGFyYXRpb24jXG4gICAgICogQG1lbWJlciB7b2JqZWN0fSByYXdzIC0gSW5mb3JtYXRpb24gdG8gZ2VuZXJhdGUgYnl0ZS10by1ieXRlIGVxdWFsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgbm9kZSBzdHJpbmcgYXMgaXQgd2FzIGluIHRoZSBvcmlnaW4gaW5wdXQuXG4gICAgICpcbiAgICAgKiBFdmVyeSBwYXJzZXIgc2F2ZXMgaXRzIG93biBwcm9wZXJ0aWVzLFxuICAgICAqIGJ1dCB0aGUgZGVmYXVsdCBDU1MgcGFyc2VyIHVzZXM6XG4gICAgICpcbiAgICAgKiAqIGBiZWZvcmVgOiB0aGUgc3BhY2Ugc3ltYm9scyBiZWZvcmUgdGhlIG5vZGUuIEl0IGFsc28gc3RvcmVzIGAqYFxuICAgICAqICAgYW5kIGBfYCBzeW1ib2xzIGJlZm9yZSB0aGUgZGVjbGFyYXRpb24gKElFIGhhY2spLlxuICAgICAqICogYGJldHdlZW5gOiB0aGUgc3ltYm9scyBiZXR3ZWVuIHRoZSBwcm9wZXJ0eSBhbmQgdmFsdWVcbiAgICAgKiAgIGZvciBkZWNsYXJhdGlvbnMuXG4gICAgICogKiBgaW1wb3J0YW50YDogdGhlIGNvbnRlbnQgb2YgdGhlIGltcG9ydGFudCBzdGF0ZW1lbnQsXG4gICAgICogICBpZiBpdCBpcyBub3QganVzdCBgIWltcG9ydGFudGAuXG4gICAgICpcbiAgICAgKiBQb3N0Q1NTIGNsZWFucyBkZWNsYXJhdGlvbiBmcm9tIGNvbW1lbnRzIGFuZCBleHRyYSBzcGFjZXMsXG4gICAgICogYnV0IGl0IHN0b3JlcyBvcmlnaW4gY29udGVudCBpbiByYXdzIHByb3BlcnRpZXMuXG4gICAgICogQXMgc3VjaCwgaWYgeW91IGRvbuKAmXQgY2hhbmdlIGEgZGVjbGFyYXRpb27igJlzIHZhbHVlLFxuICAgICAqIFBvc3RDU1Mgd2lsbCB1c2UgdGhlIHJhdyB2YWx1ZSB3aXRoIGNvbW1lbnRzLlxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBjb25zdCByb290ID0gcG9zdGNzcy5wYXJzZSgnYSB7XFxuICBjb2xvcjpibGFja1xcbn0nKVxuICAgICAqIHJvb3QuZmlyc3QuZmlyc3QucmF3cyAvLz0+IHsgYmVmb3JlOiAnXFxuICAnLCBiZXR3ZWVuOiAnOicgfVxuICAgICAqL1xuXG59XG5cbmV4cG9ydCBkZWZhdWx0IERlY2xhcmF0aW9uO1xuIl19
|
||||
198
build/node_modules/postcss-csso/node_modules/postcss/lib/input.js
generated
vendored
Normal file
198
build/node_modules/postcss-csso/node_modules/postcss/lib/input.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
435
build/node_modules/postcss-csso/node_modules/postcss/lib/lazy-result.js
generated
vendored
Normal file
435
build/node_modules/postcss-csso/node_modules/postcss/lib/lazy-result.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
95
build/node_modules/postcss-csso/node_modules/postcss/lib/list.js
generated
vendored
Normal file
95
build/node_modules/postcss-csso/node_modules/postcss/lib/list.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
323
build/node_modules/postcss-csso/node_modules/postcss/lib/map-generator.js
generated
vendored
Normal file
323
build/node_modules/postcss-csso/node_modules/postcss/lib/map-generator.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
623
build/node_modules/postcss-csso/node_modules/postcss/lib/node.js
generated
vendored
Normal file
623
build/node_modules/postcss-csso/node_modules/postcss/lib/node.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
41
build/node_modules/postcss-csso/node_modules/postcss/lib/parse.js
generated
vendored
Normal file
41
build/node_modules/postcss-csso/node_modules/postcss/lib/parse.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = parse;
|
||||
|
||||
var _parser = require('./parser');
|
||||
|
||||
var _parser2 = _interopRequireDefault(_parser);
|
||||
|
||||
var _input = require('./input');
|
||||
|
||||
var _input2 = _interopRequireDefault(_input);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function parse(css, opts) {
|
||||
if (opts && opts.safe) {
|
||||
throw new Error('Option safe was removed. ' + 'Use parser: require("postcss-safe-parser")');
|
||||
}
|
||||
|
||||
var input = new _input2.default(css, opts);
|
||||
var parser = new _parser2.default(input);
|
||||
try {
|
||||
parser.parse();
|
||||
} catch (e) {
|
||||
if (e.name === 'CssSyntaxError' && opts && opts.from) {
|
||||
if (/\.scss$/i.test(opts.from)) {
|
||||
e.message += '\nYou tried to parse SCSS with ' + 'the standard CSS parser; ' + 'try again with the postcss-scss parser';
|
||||
} else if (/\.sass/i.test(opts.from)) {
|
||||
e.message += '\nYou tried to parse Sass with ' + 'the standard CSS parser; ' + 'try again with the postcss-sass parser';
|
||||
} else if (/\.less$/i.test(opts.from)) {
|
||||
e.message += '\nYou tried to parse Less with ' + 'the standard CSS parser; ' + 'try again with the postcss-less parser';
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
return parser.root;
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInBhcnNlLmVzNiJdLCJuYW1lcyI6WyJwYXJzZSIsImNzcyIsIm9wdHMiLCJzYWZlIiwiRXJyb3IiLCJpbnB1dCIsInBhcnNlciIsImUiLCJuYW1lIiwiZnJvbSIsInRlc3QiLCJtZXNzYWdlIiwicm9vdCJdLCJtYXBwaW5ncyI6Ijs7O2tCQUd3QkEsSzs7QUFIeEI7Ozs7QUFDQTs7Ozs7O0FBRWUsU0FBU0EsS0FBVCxDQUFlQyxHQUFmLEVBQW9CQyxJQUFwQixFQUEwQjtBQUNyQyxRQUFLQSxRQUFRQSxLQUFLQyxJQUFsQixFQUF5QjtBQUNyQixjQUFNLElBQUlDLEtBQUosQ0FBVSw4QkFDQSw0Q0FEVixDQUFOO0FBRUg7O0FBRUQsUUFBSUMsUUFBUSxvQkFBVUosR0FBVixFQUFlQyxJQUFmLENBQVo7QUFDQSxRQUFJSSxTQUFTLHFCQUFXRCxLQUFYLENBQWI7QUFDQSxRQUFJO0FBQ0FDLGVBQU9OLEtBQVA7QUFDSCxLQUZELENBRUUsT0FBT08sQ0FBUCxFQUFVO0FBQ1IsWUFBS0EsRUFBRUMsSUFBRixLQUFXLGdCQUFYLElBQStCTixJQUEvQixJQUF1Q0EsS0FBS08sSUFBakQsRUFBd0Q7QUFDcEQsZ0JBQUssV0FBV0MsSUFBWCxDQUFnQlIsS0FBS08sSUFBckIsQ0FBTCxFQUFrQztBQUM5QkYsa0JBQUVJLE9BQUYsSUFBYSxvQ0FDQSwyQkFEQSxHQUVBLHdDQUZiO0FBR0gsYUFKRCxNQUlPLElBQUssVUFBVUQsSUFBVixDQUFlUixLQUFLTyxJQUFwQixDQUFMLEVBQWlDO0FBQ3BDRixrQkFBRUksT0FBRixJQUFhLG9DQUNBLDJCQURBLEdBRUEsd0NBRmI7QUFHSCxhQUpNLE1BSUEsSUFBSyxXQUFXRCxJQUFYLENBQWdCUixLQUFLTyxJQUFyQixDQUFMLEVBQWtDO0FBQ3JDRixrQkFBRUksT0FBRixJQUFhLG9DQUNBLDJCQURBLEdBRUEsd0NBRmI7QUFHSDtBQUNKO0FBQ0QsY0FBTUosQ0FBTjtBQUNIOztBQUVELFdBQU9ELE9BQU9NLElBQWQ7QUFDSCIsImZpbGUiOiJwYXJzZS5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBQYXJzZXIgZnJvbSAnLi9wYXJzZXInO1xuaW1wb3J0IElucHV0ICBmcm9tICcuL2lucHV0JztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gcGFyc2UoY3NzLCBvcHRzKSB7XG4gICAgaWYgKCBvcHRzICYmIG9wdHMuc2FmZSApIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdPcHRpb24gc2FmZSB3YXMgcmVtb3ZlZC4gJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAnVXNlIHBhcnNlcjogcmVxdWlyZShcInBvc3Rjc3Mtc2FmZS1wYXJzZXJcIiknKTtcbiAgICB9XG5cbiAgICBsZXQgaW5wdXQgPSBuZXcgSW5wdXQoY3NzLCBvcHRzKTtcbiAgICBsZXQgcGFyc2VyID0gbmV3IFBhcnNlcihpbnB1dCk7XG4gICAgdHJ5IHtcbiAgICAgICAgcGFyc2VyLnBhcnNlKCk7XG4gICAgfSBjYXRjaCAoZSkge1xuICAgICAgICBpZiAoIGUubmFtZSA9PT0gJ0Nzc1N5bnRheEVycm9yJyAmJiBvcHRzICYmIG9wdHMuZnJvbSApIHtcbiAgICAgICAgICAgIGlmICggL1xcLnNjc3MkL2kudGVzdChvcHRzLmZyb20pICkge1xuICAgICAgICAgICAgICAgIGUubWVzc2FnZSArPSAnXFxuWW91IHRyaWVkIHRvIHBhcnNlIFNDU1Mgd2l0aCAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RoZSBzdGFuZGFyZCBDU1MgcGFyc2VyOyAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RyeSBhZ2FpbiB3aXRoIHRoZSBwb3N0Y3NzLXNjc3MgcGFyc2VyJztcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoIC9cXC5zYXNzL2kudGVzdChvcHRzLmZyb20pICkge1xuICAgICAgICAgICAgICAgIGUubWVzc2FnZSArPSAnXFxuWW91IHRyaWVkIHRvIHBhcnNlIFNhc3Mgd2l0aCAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RoZSBzdGFuZGFyZCBDU1MgcGFyc2VyOyAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RyeSBhZ2FpbiB3aXRoIHRoZSBwb3N0Y3NzLXNhc3MgcGFyc2VyJztcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoIC9cXC5sZXNzJC9pLnRlc3Qob3B0cy5mcm9tKSApIHtcbiAgICAgICAgICAgICAgICBlLm1lc3NhZ2UgKz0gJ1xcbllvdSB0cmllZCB0byBwYXJzZSBMZXNzIHdpdGggJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0aGUgc3RhbmRhcmQgQ1NTIHBhcnNlcjsgJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cnkgYWdhaW4gd2l0aCB0aGUgcG9zdGNzcy1sZXNzIHBhcnNlcic7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdGhyb3cgZTtcbiAgICB9XG5cbiAgICByZXR1cm4gcGFyc2VyLnJvb3Q7XG59XG4iXX0=
|
||||
534
build/node_modules/postcss-csso/node_modules/postcss/lib/parser.js
generated
vendored
Normal file
534
build/node_modules/postcss-csso/node_modules/postcss/lib/parser.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1305
build/node_modules/postcss-csso/node_modules/postcss/lib/postcss.d.ts
generated
vendored
Normal file
1305
build/node_modules/postcss-csso/node_modules/postcss/lib/postcss.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
292
build/node_modules/postcss-csso/node_modules/postcss/lib/postcss.js
generated
vendored
Normal file
292
build/node_modules/postcss-csso/node_modules/postcss/lib/postcss.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
170
build/node_modules/postcss-csso/node_modules/postcss/lib/previous-map.js
generated
vendored
Normal file
170
build/node_modules/postcss-csso/node_modules/postcss/lib/previous-map.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
240
build/node_modules/postcss-csso/node_modules/postcss/lib/processor.js
generated
vendored
Normal file
240
build/node_modules/postcss-csso/node_modules/postcss/lib/processor.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
206
build/node_modules/postcss-csso/node_modules/postcss/lib/result.js
generated
vendored
Normal file
206
build/node_modules/postcss-csso/node_modules/postcss/lib/result.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
129
build/node_modules/postcss-csso/node_modules/postcss/lib/root.js
generated
vendored
Normal file
129
build/node_modules/postcss-csso/node_modules/postcss/lib/root.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
123
build/node_modules/postcss-csso/node_modules/postcss/lib/rule.js
generated
vendored
Normal file
123
build/node_modules/postcss-csso/node_modules/postcss/lib/rule.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
'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 _list = require('./list');
|
||||
|
||||
var _list2 = _interopRequireDefault(_list);
|
||||
|
||||
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; }
|
||||
|
||||
/**
|
||||
* Represents a CSS rule: a selector followed by a declaration block.
|
||||
*
|
||||
* @extends Container
|
||||
*
|
||||
* @example
|
||||
* const root = postcss.parse('a{}');
|
||||
* const rule = root.first;
|
||||
* rule.type //=> 'rule'
|
||||
* rule.toString() //=> 'a{}'
|
||||
*/
|
||||
var Rule = function (_Container) {
|
||||
_inherits(Rule, _Container);
|
||||
|
||||
function Rule(defaults) {
|
||||
_classCallCheck(this, Rule);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _Container.call(this, defaults));
|
||||
|
||||
_this.type = 'rule';
|
||||
if (!_this.nodes) _this.nodes = [];
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* An array containing the rule’s individual selectors.
|
||||
* Groups of selectors are split at commas.
|
||||
*
|
||||
* @type {string[]}
|
||||
*
|
||||
* @example
|
||||
* const root = postcss.parse('a, b { }');
|
||||
* const rule = root.first;
|
||||
*
|
||||
* rule.selector //=> 'a, b'
|
||||
* rule.selectors //=> ['a', 'b']
|
||||
*
|
||||
* rule.selectors = ['a', 'strong'];
|
||||
* rule.selector //=> 'a, strong'
|
||||
*/
|
||||
|
||||
|
||||
_createClass(Rule, [{
|
||||
key: 'selectors',
|
||||
get: function get() {
|
||||
return _list2.default.comma(this.selector);
|
||||
},
|
||||
set: function set(values) {
|
||||
var match = this.selector ? this.selector.match(/,\s*/) : null;
|
||||
var sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen');
|
||||
this.selector = values.join(sep);
|
||||
}
|
||||
|
||||
/**
|
||||
* @memberof Rule#
|
||||
* @member {string} selector - the rule’s full selector represented
|
||||
* as a string
|
||||
*
|
||||
* @example
|
||||
* const root = postcss.parse('a, b { }');
|
||||
* const rule = root.first;
|
||||
* rule.selector //=> 'a, b'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @memberof Rule#
|
||||
* @member {object} raws - Information to generate byte-to-byte equal
|
||||
* node string as it was in the origin input.
|
||||
*
|
||||
* Every parser saves its own properties,
|
||||
* but the default CSS parser uses:
|
||||
*
|
||||
* * `before`: the space symbols before the node. It also stores `*`
|
||||
* and `_` symbols before the declaration (IE hack).
|
||||
* * `after`: the space symbols after the last child of the node
|
||||
* to the end of the node.
|
||||
* * `between`: the symbols between the property and value
|
||||
* for declarations, selector and `{` for rules, or last parameter
|
||||
* and `{` for at-rules.
|
||||
* * `semicolon`: contains `true` if the last child has
|
||||
* an (optional) semicolon.
|
||||
* * `ownSemicolon`: contains `true` if there is semicolon after rule.
|
||||
*
|
||||
* PostCSS cleans selectors from comments and extra spaces,
|
||||
* but it stores origin content in raws properties.
|
||||
* As such, if you don’t change a declaration’s value,
|
||||
* PostCSS will use the raw value with comments.
|
||||
*
|
||||
* @example
|
||||
* const root = postcss.parse('a {\n color:black\n}')
|
||||
* root.first.first.raws //=> { before: '', between: ' ', after: '\n' }
|
||||
*/
|
||||
|
||||
}]);
|
||||
|
||||
return Rule;
|
||||
}(_container2.default);
|
||||
|
||||
exports.default = Rule;
|
||||
module.exports = exports['default'];
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGUuZXM2Il0sIm5hbWVzIjpbIlJ1bGUiLCJkZWZhdWx0cyIsInR5cGUiLCJub2RlcyIsImNvbW1hIiwic2VsZWN0b3IiLCJ2YWx1ZXMiLCJtYXRjaCIsInNlcCIsInJhdyIsImpvaW4iXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBOzs7O0FBQ0E7Ozs7Ozs7Ozs7OztBQUVBOzs7Ozs7Ozs7OztJQVdNQSxJOzs7QUFFRixnQkFBWUMsUUFBWixFQUFzQjtBQUFBOztBQUFBLGlEQUNsQixzQkFBTUEsUUFBTixDQURrQjs7QUFFbEIsVUFBS0MsSUFBTCxHQUFZLE1BQVo7QUFDQSxRQUFLLENBQUMsTUFBS0MsS0FBWCxFQUFtQixNQUFLQSxLQUFMLEdBQWEsRUFBYjtBQUhEO0FBSXJCOztBQUVEOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozt3QkFnQmdCO0FBQ1osYUFBTyxlQUFLQyxLQUFMLENBQVcsS0FBS0MsUUFBaEIsQ0FBUDtBQUNILEs7c0JBRWFDLE0sRUFBUTtBQUNsQixVQUFJQyxRQUFRLEtBQUtGLFFBQUwsR0FBZ0IsS0FBS0EsUUFBTCxDQUFjRSxLQUFkLENBQW9CLE1BQXBCLENBQWhCLEdBQThDLElBQTFEO0FBQ0EsVUFBSUMsTUFBUUQsUUFBUUEsTUFBTSxDQUFOLENBQVIsR0FBbUIsTUFBTSxLQUFLRSxHQUFMLENBQVMsU0FBVCxFQUFvQixZQUFwQixDQUFyQztBQUNBLFdBQUtKLFFBQUwsR0FBZ0JDLE9BQU9JLElBQVAsQ0FBWUYsR0FBWixDQUFoQjtBQUNIOztBQUVEOzs7Ozs7Ozs7OztBQVdBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O2tCQStCV1IsSSIsImZpbGUiOiJydWxlLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IENvbnRhaW5lciBmcm9tICcuL2NvbnRhaW5lcic7XG5pbXBvcnQgbGlzdCAgICAgIGZyb20gJy4vbGlzdCc7XG5cbi8qKlxuICogUmVwcmVzZW50cyBhIENTUyBydWxlOiBhIHNlbGVjdG9yIGZvbGxvd2VkIGJ5IGEgZGVjbGFyYXRpb24gYmxvY2suXG4gKlxuICogQGV4dGVuZHMgQ29udGFpbmVyXG4gKlxuICogQGV4YW1wbGVcbiAqIGNvbnN0IHJvb3QgPSBwb3N0Y3NzLnBhcnNlKCdhe30nKTtcbiAqIGNvbnN0IHJ1bGUgPSByb290LmZpcnN0O1xuICogcnVsZS50eXBlICAgICAgIC8vPT4gJ3J1bGUnXG4gKiBydWxlLnRvU3RyaW5nKCkgLy89PiAnYXt9J1xuICovXG5jbGFzcyBSdWxlIGV4dGVuZHMgQ29udGFpbmVyIHtcblxuICAgIGNvbnN0cnVjdG9yKGRlZmF1bHRzKSB7XG4gICAgICAgIHN1cGVyKGRlZmF1bHRzKTtcbiAgICAgICAgdGhpcy50eXBlID0gJ3J1bGUnO1xuICAgICAgICBpZiAoICF0aGlzLm5vZGVzICkgdGhpcy5ub2RlcyA9IFtdO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEFuIGFycmF5IGNvbnRhaW5pbmcgdGhlIHJ1bGXigJlzIGluZGl2aWR1YWwgc2VsZWN0b3JzLlxuICAgICAqIEdyb3VwcyBvZiBzZWxlY3RvcnMgYXJlIHNwbGl0IGF0IGNvbW1hcy5cbiAgICAgKlxuICAgICAqIEB0eXBlIHtzdHJpbmdbXX1cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogY29uc3Qgcm9vdCA9IHBvc3Rjc3MucGFyc2UoJ2EsIGIgeyB9Jyk7XG4gICAgICogY29uc3QgcnVsZSA9IHJvb3QuZmlyc3Q7XG4gICAgICpcbiAgICAgKiBydWxlLnNlbGVjdG9yICAvLz0+ICdhLCBiJ1xuICAgICAqIHJ1bGUuc2VsZWN0b3JzIC8vPT4gWydhJywgJ2InXVxuICAgICAqXG4gICAgICogcnVsZS5zZWxlY3RvcnMgPSBbJ2EnLCAnc3Ryb25nJ107XG4gICAgICogcnVsZS5zZWxlY3RvciAvLz0+ICdhLCBzdHJvbmcnXG4gICAgICovXG4gICAgZ2V0IHNlbGVjdG9ycygpIHtcbiAgICAgICAgcmV0dXJuIGxpc3QuY29tbWEodGhpcy5zZWxlY3Rvcik7XG4gICAgfVxuXG4gICAgc2V0IHNlbGVjdG9ycyh2YWx1ZXMpIHtcbiAgICAgICAgbGV0IG1hdGNoID0gdGhpcy5zZWxlY3RvciA/IHRoaXMuc2VsZWN0b3IubWF0Y2goLyxcXHMqLykgOiBudWxsO1xuICAgICAgICBsZXQgc2VwICAgPSBtYXRjaCA/IG1hdGNoWzBdIDogJywnICsgdGhpcy5yYXcoJ2JldHdlZW4nLCAnYmVmb3JlT3BlbicpO1xuICAgICAgICB0aGlzLnNlbGVjdG9yID0gdmFsdWVzLmpvaW4oc2VwKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBAbWVtYmVyb2YgUnVsZSNcbiAgICAgKiBAbWVtYmVyIHtzdHJpbmd9IHNlbGVjdG9yIC0gdGhlIHJ1bGXigJlzIGZ1bGwgc2VsZWN0b3IgcmVwcmVzZW50ZWRcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXMgYSBzdHJpbmdcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogY29uc3Qgcm9vdCA9IHBvc3Rjc3MucGFyc2UoJ2EsIGIgeyB9Jyk7XG4gICAgICogY29uc3QgcnVsZSA9IHJvb3QuZmlyc3Q7XG4gICAgICogcnVsZS5zZWxlY3RvciAvLz0+ICdhLCBiJ1xuICAgICAqL1xuXG4gICAgLyoqXG4gICAgICogQG1lbWJlcm9mIFJ1bGUjXG4gICAgICogQG1lbWJlciB7b2JqZWN0fSByYXdzIC0gSW5mb3JtYXRpb24gdG8gZ2VuZXJhdGUgYnl0ZS10by1ieXRlIGVxdWFsXG4gICAgICogICAgICAgICAgICAgICAgICAgICAgICAgbm9kZSBzdHJpbmcgYXMgaXQgd2FzIGluIHRoZSBvcmlnaW4gaW5wdXQuXG4gICAgICpcbiAgICAgKiBFdmVyeSBwYXJzZXIgc2F2ZXMgaXRzIG93biBwcm9wZXJ0aWVzLFxuICAgICAqIGJ1dCB0aGUgZGVmYXVsdCBDU1MgcGFyc2VyIHVzZXM6XG4gICAgICpcbiAgICAgKiAqIGBiZWZvcmVgOiB0aGUgc3BhY2Ugc3ltYm9scyBiZWZvcmUgdGhlIG5vZGUuIEl0IGFsc28gc3RvcmVzIGAqYFxuICAgICAqICAgYW5kIGBfYCBzeW1ib2xzIGJlZm9yZSB0aGUgZGVjbGFyYXRpb24gKElFIGhhY2spLlxuICAgICAqICogYGFmdGVyYDogdGhlIHNwYWNlIHN5bWJvbHMgYWZ0ZXIgdGhlIGxhc3QgY2hpbGQgb2YgdGhlIG5vZGVcbiAgICAgKiAgIHRvIHRoZSBlbmQgb2YgdGhlIG5vZGUuXG4gICAgICogKiBgYmV0d2VlbmA6IHRoZSBzeW1ib2xzIGJldHdlZW4gdGhlIHByb3BlcnR5IGFuZCB2YWx1ZVxuICAgICAqICAgZm9yIGRlY2xhcmF0aW9ucywgc2VsZWN0b3IgYW5kIGB7YCBmb3IgcnVsZXMsIG9yIGxhc3QgcGFyYW1ldGVyXG4gICAgICogICBhbmQgYHtgIGZvciBhdC1ydWxlcy5cbiAgICAgKiAqIGBzZW1pY29sb25gOiBjb250YWlucyBgdHJ1ZWAgaWYgdGhlIGxhc3QgY2hpbGQgaGFzXG4gICAgICogICBhbiAob3B0aW9uYWwpIHNlbWljb2xvbi5cbiAgICAgKiAqIGBvd25TZW1pY29sb25gOiBjb250YWlucyBgdHJ1ZWAgaWYgdGhlcmUgaXMgc2VtaWNvbG9uIGFmdGVyIHJ1bGUuXG4gICAgICpcbiAgICAgKiBQb3N0Q1NTIGNsZWFucyBzZWxlY3RvcnMgZnJvbSBjb21tZW50cyBhbmQgZXh0cmEgc3BhY2VzLFxuICAgICAqIGJ1dCBpdCBzdG9yZXMgb3JpZ2luIGNvbnRlbnQgaW4gcmF3cyBwcm9wZXJ0aWVzLlxuICAgICAqIEFzIHN1Y2gsIGlmIHlvdSBkb27igJl0IGNoYW5nZSBhIGRlY2xhcmF0aW9u4oCZcyB2YWx1ZSxcbiAgICAgKiBQb3N0Q1NTIHdpbGwgdXNlIHRoZSByYXcgdmFsdWUgd2l0aCBjb21tZW50cy5cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogY29uc3Qgcm9vdCA9IHBvc3Rjc3MucGFyc2UoJ2Ege1xcbiAgY29sb3I6YmxhY2tcXG59JylcbiAgICAgKiByb290LmZpcnN0LmZpcnN0LnJhd3MgLy89PiB7IGJlZm9yZTogJycsIGJldHdlZW46ICcgJywgYWZ0ZXI6ICdcXG4nIH1cbiAgICAgKi9cblxufVxuXG5leHBvcnQgZGVmYXVsdCBSdWxlO1xuIl19
|
||||
344
build/node_modules/postcss-csso/node_modules/postcss/lib/stringifier.js
generated
vendored
Normal file
344
build/node_modules/postcss-csso/node_modules/postcss/lib/stringifier.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
17
build/node_modules/postcss-csso/node_modules/postcss/lib/stringify.js
generated
vendored
Normal file
17
build/node_modules/postcss-csso/node_modules/postcss/lib/stringify.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = stringify;
|
||||
|
||||
var _stringifier = require('./stringifier');
|
||||
|
||||
var _stringifier2 = _interopRequireDefault(_stringifier);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function stringify(node, builder) {
|
||||
var str = new _stringifier2.default(builder);
|
||||
str.stringify(node);
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0cmluZ2lmeS5lczYiXSwibmFtZXMiOlsic3RyaW5naWZ5Iiwibm9kZSIsImJ1aWxkZXIiLCJzdHIiXSwibWFwcGluZ3MiOiI7OztrQkFFd0JBLFM7O0FBRnhCOzs7Ozs7QUFFZSxTQUFTQSxTQUFULENBQW1CQyxJQUFuQixFQUF5QkMsT0FBekIsRUFBa0M7QUFDN0MsUUFBSUMsTUFBTSwwQkFBZ0JELE9BQWhCLENBQVY7QUFDQUMsUUFBSUgsU0FBSixDQUFjQyxJQUFkO0FBQ0giLCJmaWxlIjoic3RyaW5naWZ5LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFN0cmluZ2lmaWVyIGZyb20gJy4vc3RyaW5naWZpZXInO1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBzdHJpbmdpZnkobm9kZSwgYnVpbGRlcikge1xuICAgIGxldCBzdHIgPSBuZXcgU3RyaW5naWZpZXIoYnVpbGRlcik7XG4gICAgc3RyLnN0cmluZ2lmeShub2RlKTtcbn1cbiJdfQ==
|
||||
83
build/node_modules/postcss-csso/node_modules/postcss/lib/terminal-highlight.js
generated
vendored
Normal file
83
build/node_modules/postcss-csso/node_modules/postcss/lib/terminal-highlight.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _chalk = require('chalk');
|
||||
|
||||
var _chalk2 = _interopRequireDefault(_chalk);
|
||||
|
||||
var _tokenize = require('./tokenize');
|
||||
|
||||
var _tokenize2 = _interopRequireDefault(_tokenize);
|
||||
|
||||
var _input = require('./input');
|
||||
|
||||
var _input2 = _interopRequireDefault(_input);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var HIGHLIGHT_THEME = {
|
||||
'brackets': _chalk2.default.cyan,
|
||||
'at-word': _chalk2.default.cyan,
|
||||
'call': _chalk2.default.cyan,
|
||||
'comment': _chalk2.default.gray,
|
||||
'string': _chalk2.default.green,
|
||||
'class': _chalk2.default.yellow,
|
||||
'hash': _chalk2.default.magenta,
|
||||
'(': _chalk2.default.cyan,
|
||||
')': _chalk2.default.cyan,
|
||||
'{': _chalk2.default.yellow,
|
||||
'}': _chalk2.default.yellow,
|
||||
'[': _chalk2.default.yellow,
|
||||
']': _chalk2.default.yellow,
|
||||
':': _chalk2.default.yellow,
|
||||
';': _chalk2.default.yellow
|
||||
};
|
||||
|
||||
function getTokenType(_ref, processor) {
|
||||
var type = _ref[0],
|
||||
value = _ref[1];
|
||||
|
||||
if (type === 'word') {
|
||||
if (value[0] === '.') {
|
||||
return 'class';
|
||||
}
|
||||
if (value[0] === '#') {
|
||||
return 'hash';
|
||||
}
|
||||
}
|
||||
|
||||
if (!processor.endOfFile()) {
|
||||
var next = processor.nextToken();
|
||||
processor.back(next);
|
||||
if (next[0] === 'brackets' || next[0] === '(') return 'call';
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
function terminalHighlight(css) {
|
||||
var processor = (0, _tokenize2.default)(new _input2.default(css), { ignoreErrors: true });
|
||||
var result = '';
|
||||
|
||||
var _loop = function _loop() {
|
||||
var token = processor.nextToken();
|
||||
var color = HIGHLIGHT_THEME[getTokenType(token, processor)];
|
||||
if (color) {
|
||||
result += token[1].split(/\r?\n/).map(function (i) {
|
||||
return color(i);
|
||||
}).join('\n');
|
||||
} else {
|
||||
result += token[1];
|
||||
}
|
||||
};
|
||||
|
||||
while (!processor.endOfFile()) {
|
||||
_loop();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
exports.default = terminalHighlight;
|
||||
module.exports = exports['default'];
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlcm1pbmFsLWhpZ2hsaWdodC5lczYiXSwibmFtZXMiOlsiSElHSExJR0hUX1RIRU1FIiwiY3lhbiIsImdyYXkiLCJncmVlbiIsInllbGxvdyIsIm1hZ2VudGEiLCJnZXRUb2tlblR5cGUiLCJwcm9jZXNzb3IiLCJ0eXBlIiwidmFsdWUiLCJlbmRPZkZpbGUiLCJuZXh0IiwibmV4dFRva2VuIiwiYmFjayIsInRlcm1pbmFsSGlnaGxpZ2h0IiwiY3NzIiwiaWdub3JlRXJyb3JzIiwicmVzdWx0IiwidG9rZW4iLCJjb2xvciIsInNwbGl0IiwibWFwIiwiaSIsImpvaW4iXSwibWFwcGluZ3MiOiI7Ozs7QUFBQTs7OztBQUVBOzs7O0FBQ0E7Ozs7OztBQUVBLElBQU1BLGtCQUFrQjtBQUNwQixnQkFBWSxnQkFBTUMsSUFERTtBQUVwQixlQUFZLGdCQUFNQSxJQUZFO0FBR3BCLFlBQVksZ0JBQU1BLElBSEU7QUFJcEIsZUFBWSxnQkFBTUMsSUFKRTtBQUtwQixjQUFZLGdCQUFNQyxLQUxFO0FBTXBCLGFBQVksZ0JBQU1DLE1BTkU7QUFPcEIsWUFBWSxnQkFBTUMsT0FQRTtBQVFwQixTQUFZLGdCQUFNSixJQVJFO0FBU3BCLFNBQVksZ0JBQU1BLElBVEU7QUFVcEIsU0FBWSxnQkFBTUcsTUFWRTtBQVdwQixTQUFZLGdCQUFNQSxNQVhFO0FBWXBCLFNBQVksZ0JBQU1BLE1BWkU7QUFhcEIsU0FBWSxnQkFBTUEsTUFiRTtBQWNwQixTQUFZLGdCQUFNQSxNQWRFO0FBZXBCLFNBQVksZ0JBQU1BO0FBZkUsQ0FBeEI7O0FBa0JBLFNBQVNFLFlBQVQsT0FBcUNDLFNBQXJDLEVBQWdEO0FBQUEsUUFBekJDLElBQXlCO0FBQUEsUUFBbkJDLEtBQW1COztBQUM1QyxRQUFLRCxTQUFTLE1BQWQsRUFBdUI7QUFDbkIsWUFBS0MsTUFBTSxDQUFOLE1BQWEsR0FBbEIsRUFBd0I7QUFDcEIsbUJBQU8sT0FBUDtBQUNIO0FBQ0QsWUFBS0EsTUFBTSxDQUFOLE1BQWEsR0FBbEIsRUFBd0I7QUFDcEIsbUJBQU8sTUFBUDtBQUNIO0FBQ0o7O0FBRUQsUUFBSyxDQUFDRixVQUFVRyxTQUFWLEVBQU4sRUFBOEI7QUFDMUIsWUFBSUMsT0FBT0osVUFBVUssU0FBVixFQUFYO0FBQ0FMLGtCQUFVTSxJQUFWLENBQWVGLElBQWY7QUFDQSxZQUFLQSxLQUFLLENBQUwsTUFBWSxVQUFaLElBQTBCQSxLQUFLLENBQUwsTUFBWSxHQUEzQyxFQUFpRCxPQUFPLE1BQVA7QUFDcEQ7O0FBRUQsV0FBT0gsSUFBUDtBQUNIOztBQUVELFNBQVNNLGlCQUFULENBQTJCQyxHQUEzQixFQUFnQztBQUM1QixRQUFJUixZQUFZLHdCQUFVLG9CQUFVUSxHQUFWLENBQVYsRUFBMEIsRUFBRUMsY0FBYyxJQUFoQixFQUExQixDQUFoQjtBQUNBLFFBQUlDLFNBQVMsRUFBYjs7QUFGNEI7QUFJeEIsWUFBSUMsUUFBUVgsVUFBVUssU0FBVixFQUFaO0FBQ0EsWUFBSU8sUUFBUW5CLGdCQUFnQk0sYUFBYVksS0FBYixFQUFvQlgsU0FBcEIsQ0FBaEIsQ0FBWjtBQUNBLFlBQUtZLEtBQUwsRUFBYTtBQUNURixzQkFBVUMsTUFBTSxDQUFOLEVBQVNFLEtBQVQsQ0FBZSxPQUFmLEVBQ0xDLEdBREssQ0FDQTtBQUFBLHVCQUFLRixNQUFNRyxDQUFOLENBQUw7QUFBQSxhQURBLEVBRUxDLElBRkssQ0FFQSxJQUZBLENBQVY7QUFHSCxTQUpELE1BSU87QUFDSE4sc0JBQVVDLE1BQU0sQ0FBTixDQUFWO0FBQ0g7QUFadUI7O0FBRzVCLFdBQVEsQ0FBQ1gsVUFBVUcsU0FBVixFQUFULEVBQWlDO0FBQUE7QUFVaEM7QUFDRCxXQUFPTyxNQUFQO0FBQ0g7O2tCQUVjSCxpQiIsImZpbGUiOiJ0ZXJtaW5hbC1oaWdobGlnaHQuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgY2hhbGsgZnJvbSAnY2hhbGsnO1xuXG5pbXBvcnQgdG9rZW5pemVyIGZyb20gJy4vdG9rZW5pemUnO1xuaW1wb3J0IElucHV0ICAgIGZyb20gJy4vaW5wdXQnO1xuXG5jb25zdCBISUdITElHSFRfVEhFTUUgPSB7XG4gICAgJ2JyYWNrZXRzJzogY2hhbGsuY3lhbixcbiAgICAnYXQtd29yZCc6ICBjaGFsay5jeWFuLFxuICAgICdjYWxsJzogICAgIGNoYWxrLmN5YW4sXG4gICAgJ2NvbW1lbnQnOiAgY2hhbGsuZ3JheSxcbiAgICAnc3RyaW5nJzogICBjaGFsay5ncmVlbixcbiAgICAnY2xhc3MnOiAgICBjaGFsay55ZWxsb3csXG4gICAgJ2hhc2gnOiAgICAgY2hhbGsubWFnZW50YSxcbiAgICAnKCc6ICAgICAgICBjaGFsay5jeWFuLFxuICAgICcpJzogICAgICAgIGNoYWxrLmN5YW4sXG4gICAgJ3snOiAgICAgICAgY2hhbGsueWVsbG93LFxuICAgICd9JzogICAgICAgIGNoYWxrLnllbGxvdyxcbiAgICAnWyc6ICAgICAgICBjaGFsay55ZWxsb3csXG4gICAgJ10nOiAgICAgICAgY2hhbGsueWVsbG93LFxuICAgICc6JzogICAgICAgIGNoYWxrLnllbGxvdyxcbiAgICAnOyc6ICAgICAgICBjaGFsay55ZWxsb3dcbn07XG5cbmZ1bmN0aW9uIGdldFRva2VuVHlwZShbdHlwZSwgdmFsdWVdLCBwcm9jZXNzb3IpIHtcbiAgICBpZiAoIHR5cGUgPT09ICd3b3JkJyApIHtcbiAgICAgICAgaWYgKCB2YWx1ZVswXSA9PT0gJy4nICkge1xuICAgICAgICAgICAgcmV0dXJuICdjbGFzcyc7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCB2YWx1ZVswXSA9PT0gJyMnICkge1xuICAgICAgICAgICAgcmV0dXJuICdoYXNoJztcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGlmICggIXByb2Nlc3Nvci5lbmRPZkZpbGUoKSApIHtcbiAgICAgICAgbGV0IG5leHQgPSBwcm9jZXNzb3IubmV4dFRva2VuKCk7XG4gICAgICAgIHByb2Nlc3Nvci5iYWNrKG5leHQpO1xuICAgICAgICBpZiAoIG5leHRbMF0gPT09ICdicmFja2V0cycgfHwgbmV4dFswXSA9PT0gJygnICkgcmV0dXJuICdjYWxsJztcbiAgICB9XG5cbiAgICByZXR1cm4gdHlwZTtcbn1cblxuZnVuY3Rpb24gdGVybWluYWxIaWdobGlnaHQoY3NzKSB7XG4gICAgbGV0IHByb2Nlc3NvciA9IHRva2VuaXplcihuZXcgSW5wdXQoY3NzKSwgeyBpZ25vcmVFcnJvcnM6IHRydWUgfSk7XG4gICAgbGV0IHJlc3VsdCA9ICcnO1xuICAgIHdoaWxlICggIXByb2Nlc3Nvci5lbmRPZkZpbGUoKSApIHtcbiAgICAgICAgbGV0IHRva2VuID0gcHJvY2Vzc29yLm5leHRUb2tlbigpO1xuICAgICAgICBsZXQgY29sb3IgPSBISUdITElHSFRfVEhFTUVbZ2V0VG9rZW5UeXBlKHRva2VuLCBwcm9jZXNzb3IpXTtcbiAgICAgICAgaWYgKCBjb2xvciApIHtcbiAgICAgICAgICAgIHJlc3VsdCArPSB0b2tlblsxXS5zcGxpdCgvXFxyP1xcbi8pXG4gICAgICAgICAgICAgICAgLm1hcCggaSA9PiBjb2xvcihpKSApXG4gICAgICAgICAgICAgICAgLmpvaW4oJ1xcbicpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmVzdWx0ICs9IHRva2VuWzFdO1xuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiByZXN1bHQ7XG59XG5cbmV4cG9ydCBkZWZhdWx0IHRlcm1pbmFsSGlnaGxpZ2h0O1xuIl19
|
||||
306
build/node_modules/postcss-csso/node_modules/postcss/lib/tokenize.js
generated
vendored
Normal file
306
build/node_modules/postcss-csso/node_modules/postcss/lib/tokenize.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
52
build/node_modules/postcss-csso/node_modules/postcss/lib/vendor.js
generated
vendored
Normal file
52
build/node_modules/postcss-csso/node_modules/postcss/lib/vendor.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
/**
|
||||
* Contains helpers for working with vendor prefixes.
|
||||
*
|
||||
* @example
|
||||
* const vendor = postcss.vendor;
|
||||
*
|
||||
* @namespace vendor
|
||||
*/
|
||||
var vendor = {
|
||||
|
||||
/**
|
||||
* Returns the vendor prefix extracted from an input string.
|
||||
*
|
||||
* @param {string} prop - string with or without vendor prefix
|
||||
*
|
||||
* @return {string} vendor prefix or empty string
|
||||
*
|
||||
* @example
|
||||
* postcss.vendor.prefix('-moz-tab-size') //=> '-moz-'
|
||||
* postcss.vendor.prefix('tab-size') //=> ''
|
||||
*/
|
||||
prefix: function prefix(prop) {
|
||||
var match = prop.match(/^(-\w+-)/);
|
||||
if (match) {
|
||||
return match[0];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Returns the input string stripped of its vendor prefix.
|
||||
*
|
||||
* @param {string} prop - string with or without vendor prefix
|
||||
*
|
||||
* @return {string} string name without vendor prefixes
|
||||
*
|
||||
* @example
|
||||
* postcss.vendor.unprefixed('-moz-tab-size') //=> 'tab-size'
|
||||
*/
|
||||
unprefixed: function unprefixed(prop) {
|
||||
return prop.replace(/^-\w+-/, '');
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = vendor;
|
||||
module.exports = exports['default'];
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInZlbmRvci5lczYiXSwibmFtZXMiOlsidmVuZG9yIiwicHJlZml4IiwicHJvcCIsIm1hdGNoIiwidW5wcmVmaXhlZCIsInJlcGxhY2UiXSwibWFwcGluZ3MiOiI7OztBQUFBOzs7Ozs7OztBQVFBLElBQUlBLFNBQVM7O0FBRVQ7Ozs7Ozs7Ozs7O0FBV0FDLFVBYlMsa0JBYUZDLElBYkUsRUFhSTtBQUNULFlBQUlDLFFBQVFELEtBQUtDLEtBQUwsQ0FBVyxVQUFYLENBQVo7QUFDQSxZQUFLQSxLQUFMLEVBQWE7QUFDVCxtQkFBT0EsTUFBTSxDQUFOLENBQVA7QUFDSCxTQUZELE1BRU87QUFDSCxtQkFBTyxFQUFQO0FBQ0g7QUFDSixLQXBCUTs7O0FBc0JUOzs7Ozs7Ozs7O0FBVUFDLGNBaENTLHNCQWdDRUYsSUFoQ0YsRUFnQ1E7QUFDYixlQUFPQSxLQUFLRyxPQUFMLENBQWEsUUFBYixFQUF1QixFQUF2QixDQUFQO0FBQ0g7QUFsQ1EsQ0FBYjs7a0JBc0NlTCxNIiwiZmlsZSI6InZlbmRvci5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29udGFpbnMgaGVscGVycyBmb3Igd29ya2luZyB3aXRoIHZlbmRvciBwcmVmaXhlcy5cbiAqXG4gKiBAZXhhbXBsZVxuICogY29uc3QgdmVuZG9yID0gcG9zdGNzcy52ZW5kb3I7XG4gKlxuICogQG5hbWVzcGFjZSB2ZW5kb3JcbiAqL1xubGV0IHZlbmRvciA9IHtcblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIHZlbmRvciBwcmVmaXggZXh0cmFjdGVkIGZyb20gYW4gaW5wdXQgc3RyaW5nLlxuICAgICAqXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IHByb3AgLSBzdHJpbmcgd2l0aCBvciB3aXRob3V0IHZlbmRvciBwcmVmaXhcbiAgICAgKlxuICAgICAqIEByZXR1cm4ge3N0cmluZ30gdmVuZG9yIHByZWZpeCBvciBlbXB0eSBzdHJpbmdcbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogcG9zdGNzcy52ZW5kb3IucHJlZml4KCctbW96LXRhYi1zaXplJykgLy89PiAnLW1vei0nXG4gICAgICogcG9zdGNzcy52ZW5kb3IucHJlZml4KCd0YWItc2l6ZScpICAgICAgLy89PiAnJ1xuICAgICAqL1xuICAgIHByZWZpeChwcm9wKSB7XG4gICAgICAgIGxldCBtYXRjaCA9IHByb3AubWF0Y2goL14oLVxcdystKS8pO1xuICAgICAgICBpZiAoIG1hdGNoICkge1xuICAgICAgICAgICAgcmV0dXJuIG1hdGNoWzBdO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuICcnO1xuICAgICAgICB9XG4gICAgfSxcblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIGlucHV0IHN0cmluZyBzdHJpcHBlZCBvZiBpdHMgdmVuZG9yIHByZWZpeC5cbiAgICAgKlxuICAgICAqIEBwYXJhbSB7c3RyaW5nfSBwcm9wIC0gc3RyaW5nIHdpdGggb3Igd2l0aG91dCB2ZW5kb3IgcHJlZml4XG4gICAgICpcbiAgICAgKiBAcmV0dXJuIHtzdHJpbmd9IHN0cmluZyBuYW1lIHdpdGhvdXQgdmVuZG9yIHByZWZpeGVzXG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIHBvc3Rjc3MudmVuZG9yLnVucHJlZml4ZWQoJy1tb3otdGFiLXNpemUnKSAvLz0+ICd0YWItc2l6ZSdcbiAgICAgKi9cbiAgICB1bnByZWZpeGVkKHByb3ApIHtcbiAgICAgICAgcmV0dXJuIHByb3AucmVwbGFjZSgvXi1cXHcrLS8sICcnKTtcbiAgICB9XG5cbn07XG5cbmV4cG9ydCBkZWZhdWx0IHZlbmRvcjtcbiJdfQ==
|
||||
14
build/node_modules/postcss-csso/node_modules/postcss/lib/warn-once.js
generated
vendored
Normal file
14
build/node_modules/postcss-csso/node_modules/postcss/lib/warn-once.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = warnOnce;
|
||||
var printed = {};
|
||||
|
||||
function warnOnce(message) {
|
||||
if (printed[message]) return;
|
||||
printed[message] = true;
|
||||
|
||||
if (typeof console !== 'undefined' && console.warn) console.warn(message);
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndhcm4tb25jZS5lczYiXSwibmFtZXMiOlsid2Fybk9uY2UiLCJwcmludGVkIiwibWVzc2FnZSIsImNvbnNvbGUiLCJ3YXJuIl0sIm1hcHBpbmdzIjoiOzs7a0JBRXdCQSxRO0FBRnhCLElBQUlDLFVBQVUsRUFBZDs7QUFFZSxTQUFTRCxRQUFULENBQWtCRSxPQUFsQixFQUEyQjtBQUN0QyxRQUFLRCxRQUFRQyxPQUFSLENBQUwsRUFBd0I7QUFDeEJELFlBQVFDLE9BQVIsSUFBbUIsSUFBbkI7O0FBRUEsUUFBSyxPQUFPQyxPQUFQLEtBQW1CLFdBQW5CLElBQWtDQSxRQUFRQyxJQUEvQyxFQUFzREQsUUFBUUMsSUFBUixDQUFhRixPQUFiO0FBQ3pEIiwiZmlsZSI6Indhcm4tb25jZS5qcyIsInNvdXJjZXNDb250ZW50IjpbImxldCBwcmludGVkID0geyB9O1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiB3YXJuT25jZShtZXNzYWdlKSB7XG4gICAgaWYgKCBwcmludGVkW21lc3NhZ2VdICkgcmV0dXJuO1xuICAgIHByaW50ZWRbbWVzc2FnZV0gPSB0cnVlO1xuXG4gICAgaWYgKCB0eXBlb2YgY29uc29sZSAhPT0gJ3VuZGVmaW5lZCcgJiYgY29uc29sZS53YXJuICkgY29uc29sZS53YXJuKG1lc3NhZ2UpO1xufVxuIl19
|
||||
122
build/node_modules/postcss-csso/node_modules/postcss/lib/warning.js
generated
vendored
Normal file
122
build/node_modules/postcss-csso/node_modules/postcss/lib/warning.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
72
build/node_modules/postcss-csso/node_modules/postcss/package.json
generated
vendored
Normal file
72
build/node_modules/postcss-csso/node_modules/postcss/package.json
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"postcss@6.0.15",
|
||||
"/Users/asciidisco/Desktop/asciidisco.com/build"
|
||||
]
|
||||
],
|
||||
"_from": "postcss@6.0.15",
|
||||
"_id": "postcss@6.0.15",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-v/SpyMzLbtkmh45zUdaqLAaqXqzPdSrw8p4cQVO0/w6YiYfpj4k+Wkzhn68qk9br+H+0qfddhdPEVnbmBPfXVQ==",
|
||||
"_location": "/postcss-csso/postcss",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "postcss@6.0.15",
|
||||
"name": "postcss",
|
||||
"escapedName": "postcss",
|
||||
"rawSpec": "6.0.15",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "6.0.15"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/postcss-csso"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.15.tgz",
|
||||
"_spec": "6.0.15",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Andrey Sitnik",
|
||||
"email": "andrey@sitnik.ru"
|
||||
},
|
||||
"browser": {
|
||||
"supports-color": false,
|
||||
"chalk": false,
|
||||
"fs": false
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/postcss/postcss/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^2.3.0",
|
||||
"source-map": "^0.6.1",
|
||||
"supports-color": "^5.1.0"
|
||||
},
|
||||
"description": "Tool for transforming styles with JS plugins",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"homepage": "http://postcss.org/",
|
||||
"keywords": [
|
||||
"css",
|
||||
"postcss",
|
||||
"rework",
|
||||
"preprocessor",
|
||||
"parser",
|
||||
"source map",
|
||||
"transform",
|
||||
"manipulation",
|
||||
"transpiler"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/postcss",
|
||||
"name": "postcss",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/postcss/postcss.git"
|
||||
},
|
||||
"types": "lib/postcss.d.ts",
|
||||
"version": "6.0.15"
|
||||
}
|
||||
105
build/node_modules/postcss-csso/package.json
generated
vendored
Normal file
105
build/node_modules/postcss-csso/package.json
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"postcss-csso@3.0.0",
|
||||
"/Users/asciidisco/Desktop/asciidisco.com/build"
|
||||
]
|
||||
],
|
||||
"_from": "postcss-csso@3.0.0",
|
||||
"_id": "postcss-csso@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-5yvI9IMIJOofYqmYfn65ZTxxlYZ86jXzDMXwYqltx/kqGsSvHRw4gYkn5e/tCPPIgUeFP5MIhIkA02uoUEZsXA==",
|
||||
"_location": "/postcss-csso",
|
||||
"_phantomChildren": {
|
||||
"chalk": "2.3.0",
|
||||
"css-tree": "1.0.0-alpha25",
|
||||
"source-map": "0.6.1",
|
||||
"supports-color": "5.1.0"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "postcss-csso@3.0.0",
|
||||
"name": "postcss-csso",
|
||||
"escapedName": "postcss-csso",
|
||||
"rawSpec": "3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-csso/-/postcss-csso-3.0.0.tgz",
|
||||
"_spec": "3.0.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Roman Dvornov",
|
||||
"email": "rdvornov@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lahmatiy/postcss-csso/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"csso": "~3.3.0",
|
||||
"postcss": "^6.0.0"
|
||||
},
|
||||
"description": "PostCSS plugin to minify CSS using CSSO",
|
||||
"devDependencies": {
|
||||
"es6-promise-polyfill": "^1.2.0",
|
||||
"eslint": "^4.8.0",
|
||||
"jscs": "^3.0.0",
|
||||
"mocha": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"env": {
|
||||
"node": true,
|
||||
"mocha": true,
|
||||
"es6": true
|
||||
},
|
||||
"rules": {
|
||||
"no-undef": 2,
|
||||
"no-unused-vars": [
|
||||
2,
|
||||
{
|
||||
"vars": "all",
|
||||
"args": "after-used"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"index.js",
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/lahmatiy/postcss-csso",
|
||||
"keywords": [
|
||||
"css",
|
||||
"minifier",
|
||||
"minify",
|
||||
"compress",
|
||||
"optimisation",
|
||||
"csso",
|
||||
"postcss",
|
||||
"plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "postcss-csso",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lahmatiy/postcss-csso.git"
|
||||
},
|
||||
"scripts": {
|
||||
"codestyle": "jscs lib test.js && eslint lib test.js",
|
||||
"codestyle-and-test": "npm run codestyle && npm test",
|
||||
"test": "mocha --reporter dot",
|
||||
"travis": "npm run codestyle-and-test"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
||||
Reference in New Issue
Block a user