mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-12 21:03:32 -06:00
Initial commit
This commit is contained in:
40
node_modules/stylehacks/CHANGELOG.md
generated
vendored
Executable file
40
node_modules/stylehacks/CHANGELOG.md
generated
vendored
Executable file
@@ -0,0 +1,40 @@
|
||||
# 2.3.2
|
||||
|
||||
* Resolves an issue where stylehacks would crash on CSS mixins.
|
||||
|
||||
# 2.3.1
|
||||
|
||||
* Upgraded postcss-selector-parser to `v2.0.0`.
|
||||
* Fixed an issue where stylehacks was not removing `*zoom: 1` from rules
|
||||
generated by other PostCSS plugins.
|
||||
|
||||
# 2.3.0
|
||||
|
||||
* Each warning now contains more information about the hack; what identifier
|
||||
it targets, what the hack is, and the browsers that it affects. E.g:
|
||||
|
||||
```js
|
||||
{
|
||||
browsers: [ 'ie 6', 'ie 5.5' ],
|
||||
identifier: 'selector',
|
||||
hack: '* html h1'
|
||||
}
|
||||
```
|
||||
|
||||
# 2.2.0
|
||||
|
||||
* Added `value\9` hack.
|
||||
|
||||
# 2.1.0
|
||||
|
||||
* Added `html ~ /**/ body .selector` hack.
|
||||
* Added a method to detect if a PostCSS node has any hacks.
|
||||
|
||||
# 2.0.0
|
||||
|
||||
* Added `body:empty` & `html:first-child` hacks.
|
||||
* Upgraded to PostCSS 5.
|
||||
|
||||
# 1.0.0
|
||||
|
||||
* Initial release.
|
22
node_modules/stylehacks/LICENSE-MIT
generated
vendored
Executable file
22
node_modules/stylehacks/LICENSE-MIT
generated
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
130
node_modules/stylehacks/README.md
generated
vendored
Executable file
130
node_modules/stylehacks/README.md
generated
vendored
Executable file
@@ -0,0 +1,130 @@
|
||||
# stylehacks [][ci] [][npm] [][deps]
|
||||
|
||||
> Detect/remove browser hacks from CSS files.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.org/package/stylehacks) do:
|
||||
|
||||
```
|
||||
npm install stylehacks --save
|
||||
```
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
In its default mode, stylehacks will remove hacks from your CSS file, based on
|
||||
the browsers that you wish to support.
|
||||
|
||||
### Input
|
||||
|
||||
```css
|
||||
h1 {
|
||||
_color: white;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
```css
|
||||
h1 {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### `stylehacks.detect(node)`
|
||||
|
||||
Type: `function`
|
||||
Returns: `boolean`
|
||||
|
||||
This method will take any PostCSS *node*, run applicable plugins depending on
|
||||
its type, then will return a boolean depending on whether it found any of
|
||||
the supported hacks. For example, if the `decl` node found below is passed to
|
||||
the `detect` function, it will return `true`. But if the `rule` node is passed,
|
||||
it will return `false` instead.
|
||||
|
||||
```css
|
||||
h1 { _color: red }
|
||||
```
|
||||
|
||||
### `stylehacks.process(css, [options]).then(function(result) {})`
|
||||
|
||||
#### options
|
||||
|
||||
##### browsers
|
||||
|
||||
Type: `string|array`
|
||||
Default: [browserslist defaults](https://github.com/ai/browserslist)
|
||||
|
||||
Specify the browsers that you wish to support. The string will be passed
|
||||
directly to browserslist and parsed, however if an array is passed instead then
|
||||
stylehacks will use it instead of parsing the browsers itself.
|
||||
|
||||
##### lint
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
If lint mode is enabled, stylehacks will not remove hacks from the CSS; instead,
|
||||
it will warn that hacks were found. When using stylehacks as a PostCSS plugin,
|
||||
you are expected to handle these messages yourself.
|
||||
|
||||
##### silent
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Used in combination with the lint option; disables all logging. When using the
|
||||
CLI, the process will exit with 0 or 1 as usual.
|
||||
|
||||
##### sourcemap
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Generate a sourcemap with the transformed CSS.
|
||||
|
||||
### `postcss([ stylehacks(opts) ])`
|
||||
|
||||
stylehacks can also be consumed as a PostCSS plugin. See the
|
||||
[documentation](https://github.com/postcss/postcss#usage) for examples for
|
||||
your environment.
|
||||
|
||||
### CLI
|
||||
|
||||
stylehacks also ships with a CLI app. To see the available options, just run:
|
||||
|
||||
```sh
|
||||
$ stylehacks --help
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
stylehacks works well with your existing PostCSS setup:
|
||||
|
||||
* [stylelint] - Comprehensive & modern CSS linter, to ensure that your code
|
||||
style rules are respected.
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests are welcome. If you add functionality, then please add unit tests
|
||||
to cover it.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Ben Briggs](http://beneb.info)
|
||||
|
||||
|
||||
[ci]: https://travis-ci.org/ben-eb/stylehacks
|
||||
[deps]: https://gemnasium.com/ben-eb/stylehacks
|
||||
[npm]: http://badge.fury.io/js/stylehacks
|
||||
[postcss]: https://github.com/postcss/postcss
|
||||
[stylelint]: https://github.com/stylelint/stylelint
|
69
node_modules/stylehacks/dist/cli.js
generated
vendored
Executable file
69
node_modules/stylehacks/dist/cli.js
generated
vendored
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var _fs = require('fs');
|
||||
|
||||
var _fs2 = _interopRequireDefault(_fs);
|
||||
|
||||
var _readFileStdin = require('read-file-stdin');
|
||||
|
||||
var _readFileStdin2 = _interopRequireDefault(_readFileStdin);
|
||||
|
||||
var _writeFileStdout = require('write-file-stdout');
|
||||
|
||||
var _writeFileStdout2 = _interopRequireDefault(_writeFileStdout);
|
||||
|
||||
var _minimist = require('minimist');
|
||||
|
||||
var _minimist2 = _interopRequireDefault(_minimist);
|
||||
|
||||
var _package = require('../package.json');
|
||||
|
||||
var _ = require('./');
|
||||
|
||||
var _2 = _interopRequireDefault(_);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var opts = (0, _minimist2.default)(process.argv.slice(2), {
|
||||
alias: {
|
||||
b: 'browsers',
|
||||
l: 'lint',
|
||||
h: 'help',
|
||||
s: 'sourcemap',
|
||||
v: 'version'
|
||||
}
|
||||
});
|
||||
|
||||
if (opts.version) {
|
||||
console.log(_package.version);
|
||||
} else {
|
||||
var file = opts._[0];
|
||||
var out = opts._[1];
|
||||
|
||||
if (file === 'help' || opts.help) {
|
||||
_fs2.default.createReadStream(__dirname + '/../usage.txt').pipe(process.stdout).on('close', function () {
|
||||
return process.exit(1);
|
||||
});
|
||||
} else {
|
||||
(0, _readFileStdin2.default)(file, function (err, buf) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
if (file) {
|
||||
opts.from = file;
|
||||
}
|
||||
if (out) {
|
||||
opts.to = out;
|
||||
}
|
||||
_2.default.process(String(buf), opts).then(function (result) {
|
||||
if (result.warnings().length) {
|
||||
process.exit(1);
|
||||
}
|
||||
if (!opts.lint) {
|
||||
(0, _writeFileStdout2.default)(result.css);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
9
node_modules/stylehacks/dist/dictionary/browsers.js
generated
vendored
Normal file
9
node_modules/stylehacks/dist/dictionary/browsers.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
var FF_2 = exports.FF_2 = 'firefox 2';
|
||||
var IE_5_5 = exports.IE_5_5 = 'ie 5.5';
|
||||
var IE_6 = exports.IE_6 = 'ie 6';
|
||||
var IE_7 = exports.IE_7 = 'ie 7';
|
||||
var IE_8 = exports.IE_8 = 'ie 8';
|
||||
var OP_9 = exports.OP_9 = 'opera 9';
|
7
node_modules/stylehacks/dist/dictionary/identifiers.js
generated
vendored
Normal file
7
node_modules/stylehacks/dist/dictionary/identifiers.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
var MEDIA_QUERY = exports.MEDIA_QUERY = 'media query';
|
||||
var PROPERTY = exports.PROPERTY = 'property';
|
||||
var SELECTOR = exports.SELECTOR = 'selector';
|
||||
var VALUE = exports.VALUE = 'value';
|
6
node_modules/stylehacks/dist/dictionary/postcss.js
generated
vendored
Normal file
6
node_modules/stylehacks/dist/dictionary/postcss.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
var ATRULE = exports.ATRULE = 'atrule';
|
||||
var DECL = exports.DECL = 'decl';
|
||||
var RULE = exports.RULE = 'rule';
|
5
node_modules/stylehacks/dist/dictionary/tags.js
generated
vendored
Normal file
5
node_modules/stylehacks/dist/dictionary/tags.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
var BODY = exports.BODY = 'body';
|
||||
var HTML = exports.HTML = 'html';
|
9
node_modules/stylehacks/dist/exists.js
generated
vendored
Normal file
9
node_modules/stylehacks/dist/exists.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = exists;
|
||||
function exists(selector, index, value) {
|
||||
var node = selector.at(index);
|
||||
return node && node.value === value;
|
||||
}
|
||||
module.exports = exports["default"];
|
53
node_modules/stylehacks/dist/formatter.js
generated
vendored
Normal file
53
node_modules/stylehacks/dist/formatter.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _path = require('path');
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
var _chalk = require('chalk');
|
||||
|
||||
var _chalk2 = _interopRequireDefault(_chalk);
|
||||
|
||||
var _textTable = require('text-table');
|
||||
|
||||
var _textTable2 = _interopRequireDefault(_textTable);
|
||||
|
||||
var _logSymbols = require('log-symbols');
|
||||
|
||||
var _logSymbols2 = _interopRequireDefault(_logSymbols);
|
||||
|
||||
var _plur = require('plur');
|
||||
|
||||
var _plur2 = _interopRequireDefault(_plur);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var logFrom = function logFrom(fromValue) {
|
||||
if (!fromValue.indexOf('<')) {
|
||||
return fromValue;
|
||||
}
|
||||
return _path2.default.relative(process.cwd(), fromValue);
|
||||
};
|
||||
|
||||
var hacksFound = function hacksFound(messages) {
|
||||
var num = messages.length + (0, _plur2.default)(' hack', messages.length);
|
||||
return '\n\n ' + _logSymbols2.default.error + ' ' + num + ' found.\n';
|
||||
};
|
||||
|
||||
exports.default = function (input) {
|
||||
var messages = input.messages;
|
||||
var source = input.source;
|
||||
|
||||
if (!messages.length) {
|
||||
return ' ' + _logSymbols2.default.success + ' No hacks found.';
|
||||
}
|
||||
|
||||
return _chalk2.default.underline(logFrom(source)) + '\n' + (0, _textTable2.default)(messages.map(function (msg) {
|
||||
var parts = msg.text.split(': ');
|
||||
return ['', _chalk2.default.gray('line ' + msg.node.source.start.line), _chalk2.default.gray('col ' + msg.node.source.start.column), parts[0], _chalk2.default.red(parts[1])];
|
||||
})) + hacksFound(messages);
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
128
node_modules/stylehacks/dist/index.js
generated
vendored
Executable file
128
node_modules/stylehacks/dist/index.js
generated
vendored
Executable file
@@ -0,0 +1,128 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _postcss = require('postcss');
|
||||
|
||||
var _postcss2 = _interopRequireDefault(_postcss);
|
||||
|
||||
var _postcssReporter = require('postcss-reporter');
|
||||
|
||||
var _postcssReporter2 = _interopRequireDefault(_postcssReporter);
|
||||
|
||||
var _browserslist = require('browserslist');
|
||||
|
||||
var _browserslist2 = _interopRequireDefault(_browserslist);
|
||||
|
||||
var _formatter = require('./formatter');
|
||||
|
||||
var _formatter2 = _interopRequireDefault(_formatter);
|
||||
|
||||
var _bodyEmpty = require('./plugins/bodyEmpty');
|
||||
|
||||
var _bodyEmpty2 = _interopRequireDefault(_bodyEmpty);
|
||||
|
||||
var _htmlCombinatorCommentBody = require('./plugins/htmlCombinatorCommentBody');
|
||||
|
||||
var _htmlCombinatorCommentBody2 = _interopRequireDefault(_htmlCombinatorCommentBody);
|
||||
|
||||
var _htmlFirstChild = require('./plugins/htmlFirstChild');
|
||||
|
||||
var _htmlFirstChild2 = _interopRequireDefault(_htmlFirstChild);
|
||||
|
||||
var _important = require('./plugins/important');
|
||||
|
||||
var _important2 = _interopRequireDefault(_important);
|
||||
|
||||
var _leadingStar = require('./plugins/leadingStar');
|
||||
|
||||
var _leadingStar2 = _interopRequireDefault(_leadingStar);
|
||||
|
||||
var _leadingUnderscore = require('./plugins/leadingUnderscore');
|
||||
|
||||
var _leadingUnderscore2 = _interopRequireDefault(_leadingUnderscore);
|
||||
|
||||
var _mediaSlash = require('./plugins/mediaSlash0');
|
||||
|
||||
var _mediaSlash2 = _interopRequireDefault(_mediaSlash);
|
||||
|
||||
var _mediaSlash3 = require('./plugins/mediaSlash9');
|
||||
|
||||
var _mediaSlash4 = _interopRequireDefault(_mediaSlash3);
|
||||
|
||||
var _slash = require('./plugins/slash9');
|
||||
|
||||
var _slash2 = _interopRequireDefault(_slash);
|
||||
|
||||
var _starHtml = require('./plugins/starHtml');
|
||||
|
||||
var _starHtml2 = _interopRequireDefault(_starHtml);
|
||||
|
||||
var _trailingSlashComma = require('./plugins/trailingSlashComma');
|
||||
|
||||
var _trailingSlashComma2 = _interopRequireDefault(_trailingSlashComma);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var plugins = [_bodyEmpty2.default, _htmlCombinatorCommentBody2.default, _htmlFirstChild2.default, _important2.default, _leadingStar2.default, _leadingUnderscore2.default, _mediaSlash2.default, _mediaSlash4.default, _slash2.default, _starHtml2.default, _trailingSlashComma2.default];
|
||||
|
||||
// plugins
|
||||
|
||||
|
||||
var stylehacks = _postcss2.default.plugin('stylehacks', function () {
|
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
var b = opts.browsers;
|
||||
var browsers = b instanceof Array ? b : (0, _browserslist2.default)(b);
|
||||
|
||||
return function (css, result) {
|
||||
var processors = plugins.reduce(function (list, Plugin) {
|
||||
var hack = new Plugin(result);
|
||||
var applied = browsers.some(function (browser) {
|
||||
return hack.targets.some(function (target) {
|
||||
return browser === target;
|
||||
});
|
||||
});
|
||||
if (applied) {
|
||||
return list;
|
||||
}
|
||||
return [].concat(list, [hack]);
|
||||
}, []);
|
||||
css.walk(function (node) {
|
||||
processors.forEach(function (proc) {
|
||||
if (!~proc.nodeTypes.indexOf(node.type)) {
|
||||
return;
|
||||
}
|
||||
if (opts.lint) {
|
||||
return proc.detectAndWarn(node);
|
||||
}
|
||||
return proc.detectAndResolve(node);
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
stylehacks.detect = function (node) {
|
||||
var hacked = plugins.some(function (Plugin) {
|
||||
var hack = new Plugin();
|
||||
return hack.any(node);
|
||||
});
|
||||
|
||||
return hacked;
|
||||
};
|
||||
|
||||
stylehacks.process = function (css) {
|
||||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
opts.reporter = {};
|
||||
opts.reporter.formatter = _formatter2.default;
|
||||
opts.map = opts.map || (opts.sourcemap ? true : null);
|
||||
var processor = (0, _postcss2.default)([stylehacks(opts)]);
|
||||
if (opts.lint && !opts.silent) {
|
||||
processor.use((0, _postcssReporter2.default)(opts.reporter));
|
||||
}
|
||||
return processor.process(css, opts);
|
||||
};
|
||||
|
||||
exports.default = stylehacks;
|
||||
module.exports = exports['default'];
|
14
node_modules/stylehacks/dist/isMixin.js
generated
vendored
Normal file
14
node_modules/stylehacks/dist/isMixin.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = isMixin;
|
||||
function isMixin(node) {
|
||||
var selector = node.selector;
|
||||
// If the selector ends with a ':' it is likely a part of a custom mixin.
|
||||
|
||||
if (!selector || selector[selector.length - 1] === ':') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
module.exports = exports['default'];
|
85
node_modules/stylehacks/dist/plugin.js
generated
vendored
Executable file
85
node_modules/stylehacks/dist/plugin.js
generated
vendored
Executable file
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
exports.default = plugin;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function plugin(targets, nodeTypes, detect) {
|
||||
var Plugin = function () {
|
||||
function Plugin(result) {
|
||||
_classCallCheck(this, Plugin);
|
||||
|
||||
this.nodes = [];
|
||||
this.result = result;
|
||||
this.targets = targets;
|
||||
this.nodeTypes = nodeTypes;
|
||||
}
|
||||
|
||||
Plugin.prototype.push = function push(node, metadata) {
|
||||
node._stylehacks = _extends({}, metadata, {
|
||||
message: "Bad " + metadata.identifier + ": " + metadata.hack,
|
||||
browsers: this.targets
|
||||
});
|
||||
this.nodes.push(node);
|
||||
};
|
||||
|
||||
Plugin.prototype.any = function any(node) {
|
||||
if (~this.nodeTypes.indexOf(node.type)) {
|
||||
detect.apply(this, arguments);
|
||||
return !!node._stylehacks;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
Plugin.prototype.detectAndResolve = function detectAndResolve() {
|
||||
this.nodes = [];
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
detect.apply(this, args);
|
||||
return this.resolve();
|
||||
};
|
||||
|
||||
Plugin.prototype.detectAndWarn = function detectAndWarn() {
|
||||
this.nodes = [];
|
||||
|
||||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
args[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
detect.apply(this, args);
|
||||
return this.warn();
|
||||
};
|
||||
|
||||
Plugin.prototype.resolve = function resolve() {
|
||||
return this.nodes.forEach(function (node) {
|
||||
return node.remove();
|
||||
});
|
||||
};
|
||||
|
||||
Plugin.prototype.warn = function warn() {
|
||||
var _this = this;
|
||||
|
||||
return this.nodes.forEach(function (node) {
|
||||
var _node$_stylehacks = node._stylehacks,
|
||||
message = _node$_stylehacks.message,
|
||||
browsers = _node$_stylehacks.browsers,
|
||||
identifier = _node$_stylehacks.identifier,
|
||||
hack = _node$_stylehacks.hack;
|
||||
|
||||
return node.warn(_this.result, message, { browsers: browsers, identifier: identifier, hack: hack });
|
||||
});
|
||||
};
|
||||
|
||||
return Plugin;
|
||||
}();
|
||||
|
||||
return Plugin;
|
||||
}
|
||||
module.exports = exports["default"];
|
50
node_modules/stylehacks/dist/plugins/bodyEmpty.js
generated
vendored
Normal file
50
node_modules/stylehacks/dist/plugins/bodyEmpty.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _postcssSelectorParser = require('postcss-selector-parser');
|
||||
|
||||
var _postcssSelectorParser2 = _interopRequireDefault(_postcssSelectorParser);
|
||||
|
||||
var _exists = require('../exists');
|
||||
|
||||
var _exists2 = _interopRequireDefault(_exists);
|
||||
|
||||
var _isMixin = require('../isMixin');
|
||||
|
||||
var _isMixin2 = _interopRequireDefault(_isMixin);
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _identifiers = require('../dictionary/identifiers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
var _tags = require('../dictionary/tags');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function analyse(ctx, rule) {
|
||||
return function (selectors) {
|
||||
selectors.each(function (selector) {
|
||||
if ((0, _exists2.default)(selector, 0, _tags.BODY) && (0, _exists2.default)(selector, 1, ':empty') && (0, _exists2.default)(selector, 2, ' ') && selector.at(3)) {
|
||||
ctx.push(rule, {
|
||||
identifier: _identifiers.SELECTOR,
|
||||
hack: selector.toString()
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.FF_2], [_postcss.RULE], function (rule) {
|
||||
if ((0, _isMixin2.default)(rule)) {
|
||||
return;
|
||||
}
|
||||
(0, _postcssSelectorParser2.default)(analyse(this, rule)).process(rule.selector);
|
||||
});
|
||||
module.exports = exports['default'];
|
52
node_modules/stylehacks/dist/plugins/htmlCombinatorCommentBody.js
generated
vendored
Normal file
52
node_modules/stylehacks/dist/plugins/htmlCombinatorCommentBody.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _postcssSelectorParser = require('postcss-selector-parser');
|
||||
|
||||
var _postcssSelectorParser2 = _interopRequireDefault(_postcssSelectorParser);
|
||||
|
||||
var _exists = require('../exists');
|
||||
|
||||
var _exists2 = _interopRequireDefault(_exists);
|
||||
|
||||
var _isMixin = require('../isMixin');
|
||||
|
||||
var _isMixin2 = _interopRequireDefault(_isMixin);
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _identifiers = require('../dictionary/identifiers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
var _tags = require('../dictionary/tags');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function analyse(ctx, rule) {
|
||||
return function (selectors) {
|
||||
selectors.each(function (selector) {
|
||||
if ((0, _exists2.default)(selector, 0, _tags.HTML) && ((0, _exists2.default)(selector, 1, '>') || (0, _exists2.default)(selector, 1, '~')) && selector.at(2) && selector.at(2).type === 'comment' && (0, _exists2.default)(selector, 3, ' ') && (0, _exists2.default)(selector, 4, _tags.BODY) && (0, _exists2.default)(selector, 5, ' ') && selector.at(6)) {
|
||||
ctx.push(rule, {
|
||||
identifier: _identifiers.SELECTOR,
|
||||
hack: selector.toString()
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.IE_5_5, _browsers.IE_6, _browsers.IE_7], [_postcss.RULE], function (rule) {
|
||||
if ((0, _isMixin2.default)(rule)) {
|
||||
return;
|
||||
}
|
||||
if (rule.raws.selector && rule.raws.selector.raw) {
|
||||
(0, _postcssSelectorParser2.default)(analyse(this, rule)).process(rule.raws.selector.raw);
|
||||
}
|
||||
});
|
||||
module.exports = exports['default'];
|
50
node_modules/stylehacks/dist/plugins/htmlFirstChild.js
generated
vendored
Normal file
50
node_modules/stylehacks/dist/plugins/htmlFirstChild.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _postcssSelectorParser = require('postcss-selector-parser');
|
||||
|
||||
var _postcssSelectorParser2 = _interopRequireDefault(_postcssSelectorParser);
|
||||
|
||||
var _exists = require('../exists');
|
||||
|
||||
var _exists2 = _interopRequireDefault(_exists);
|
||||
|
||||
var _isMixin = require('../isMixin');
|
||||
|
||||
var _isMixin2 = _interopRequireDefault(_isMixin);
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _identifiers = require('../dictionary/identifiers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
var _tags = require('../dictionary/tags');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function analyse(ctx, rule) {
|
||||
return function (selectors) {
|
||||
selectors.each(function (selector) {
|
||||
if ((0, _exists2.default)(selector, 0, _tags.HTML) && (0, _exists2.default)(selector, 1, ':first-child') && (0, _exists2.default)(selector, 2, ' ') && selector.at(3)) {
|
||||
ctx.push(rule, {
|
||||
identifier: _identifiers.SELECTOR,
|
||||
hack: selector.toString()
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.OP_9], [_postcss.RULE], function (rule) {
|
||||
if ((0, _isMixin2.default)(rule)) {
|
||||
return;
|
||||
}
|
||||
(0, _postcssSelectorParser2.default)(analyse(this, rule)).process(rule.selector);
|
||||
});
|
||||
module.exports = exports['default'];
|
25
node_modules/stylehacks/dist/plugins/important.js
generated
vendored
Executable file
25
node_modules/stylehacks/dist/plugins/important.js
generated
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.IE_5_5, _browsers.IE_6, _browsers.IE_7], [_postcss.DECL], function (decl) {
|
||||
var match = decl.value.match(/!\w/);
|
||||
if (match) {
|
||||
var hack = decl.value.substr(match.index, decl.value.length - 1);
|
||||
this.push(decl, {
|
||||
identifier: '!important',
|
||||
hack: hack
|
||||
});
|
||||
}
|
||||
});
|
||||
module.exports = exports['default'];
|
61
node_modules/stylehacks/dist/plugins/leadingStar.js
generated
vendored
Executable file
61
node_modules/stylehacks/dist/plugins/leadingStar.js
generated
vendored
Executable file
@@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _identifiers = require('../dictionary/identifiers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var hacks = '!_$_&_*_)_=_%_+_,_._/_`_]_#_~_?_:_|'.split('_');
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.IE_5_5, _browsers.IE_6, _browsers.IE_7], [_postcss.ATRULE, _postcss.DECL], function (node) {
|
||||
var _this = this;
|
||||
|
||||
if (node.type === _postcss.DECL) {
|
||||
// some values are not picked up by before, so ensure they are
|
||||
// at the beginning of the value
|
||||
hacks.some(function (hack) {
|
||||
if (!node.prop.indexOf(hack)) {
|
||||
_this.push(node, {
|
||||
identifier: _identifiers.PROPERTY,
|
||||
hack: node.prop
|
||||
});
|
||||
return true;
|
||||
}
|
||||
});
|
||||
var before = node.raws.before;
|
||||
|
||||
if (!before) {
|
||||
return;
|
||||
}
|
||||
hacks.some(function (hack) {
|
||||
if (~before.indexOf(hack)) {
|
||||
_this.push(node, {
|
||||
identifier: _identifiers.PROPERTY,
|
||||
hack: '' + before.trim() + node.prop
|
||||
});
|
||||
return true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// test for the @property: value; hack
|
||||
var name = node.name;
|
||||
|
||||
var len = name.length - 1;
|
||||
if (name.lastIndexOf(':') === len) {
|
||||
this.push(node, {
|
||||
identifier: _identifiers.PROPERTY,
|
||||
hack: '@' + name.substr(0, len)
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
module.exports = exports['default'];
|
30
node_modules/stylehacks/dist/plugins/leadingUnderscore.js
generated
vendored
Executable file
30
node_modules/stylehacks/dist/plugins/leadingUnderscore.js
generated
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _identifiers = require('../dictionary/identifiers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.IE_6], [_postcss.DECL], function (decl) {
|
||||
var before = decl.raws.before;
|
||||
|
||||
if (!before) {
|
||||
return;
|
||||
}
|
||||
if (~before.indexOf('_') || ~before.indexOf('-')) {
|
||||
this.push(decl, {
|
||||
identifier: _identifiers.PROPERTY,
|
||||
hack: '' + before.trim() + decl.prop
|
||||
});
|
||||
}
|
||||
});
|
||||
module.exports = exports['default'];
|
26
node_modules/stylehacks/dist/plugins/mediaSlash0.js
generated
vendored
Executable file
26
node_modules/stylehacks/dist/plugins/mediaSlash0.js
generated
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _identifiers = require('../dictionary/identifiers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.IE_8], [_postcss.ATRULE], function (rule) {
|
||||
var params = rule.params.trim();
|
||||
if (params === '\\0screen') {
|
||||
this.push(rule, {
|
||||
identifier: _identifiers.MEDIA_QUERY,
|
||||
hack: params
|
||||
});
|
||||
}
|
||||
});
|
||||
module.exports = exports['default'];
|
26
node_modules/stylehacks/dist/plugins/mediaSlash9.js
generated
vendored
Executable file
26
node_modules/stylehacks/dist/plugins/mediaSlash9.js
generated
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _identifiers = require('../dictionary/identifiers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.IE_5_5, _browsers.IE_6, _browsers.IE_7], [_postcss.ATRULE], function (rule) {
|
||||
var params = rule.params.trim();
|
||||
if (params === 'screen\\9') {
|
||||
this.push(rule, {
|
||||
identifier: _identifiers.MEDIA_QUERY,
|
||||
hack: params
|
||||
});
|
||||
}
|
||||
});
|
||||
module.exports = exports['default'];
|
26
node_modules/stylehacks/dist/plugins/slash9.js
generated
vendored
Normal file
26
node_modules/stylehacks/dist/plugins/slash9.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _identifiers = require('../dictionary/identifiers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.IE_6, _browsers.IE_7, _browsers.IE_8], [_postcss.DECL], function (decl) {
|
||||
var v = decl.value;
|
||||
if (v && v.length > 2 && v.indexOf('\\9') === v.length - 2) {
|
||||
this.push(decl, {
|
||||
identifier: _identifiers.VALUE,
|
||||
hack: v
|
||||
});
|
||||
}
|
||||
});
|
||||
module.exports = exports['default'];
|
50
node_modules/stylehacks/dist/plugins/starHtml.js
generated
vendored
Executable file
50
node_modules/stylehacks/dist/plugins/starHtml.js
generated
vendored
Executable file
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _postcssSelectorParser = require('postcss-selector-parser');
|
||||
|
||||
var _postcssSelectorParser2 = _interopRequireDefault(_postcssSelectorParser);
|
||||
|
||||
var _exists = require('../exists');
|
||||
|
||||
var _exists2 = _interopRequireDefault(_exists);
|
||||
|
||||
var _isMixin = require('../isMixin');
|
||||
|
||||
var _isMixin2 = _interopRequireDefault(_isMixin);
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _identifiers = require('../dictionary/identifiers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
var _tags = require('../dictionary/tags');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function analyse(ctx, rule) {
|
||||
return function (selectors) {
|
||||
selectors.each(function (selector) {
|
||||
if ((0, _exists2.default)(selector, 0, '*') && (0, _exists2.default)(selector, 1, ' ') && (0, _exists2.default)(selector, 2, _tags.HTML) && (0, _exists2.default)(selector, 3, ' ') && selector.at(4)) {
|
||||
ctx.push(rule, {
|
||||
identifier: _identifiers.SELECTOR,
|
||||
hack: selector.toString()
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.IE_5_5, _browsers.IE_6], [_postcss.RULE], function (rule) {
|
||||
if ((0, _isMixin2.default)(rule)) {
|
||||
return;
|
||||
}
|
||||
(0, _postcssSelectorParser2.default)(analyse(this, rule)).process(rule.selector);
|
||||
});
|
||||
module.exports = exports['default'];
|
35
node_modules/stylehacks/dist/plugins/trailingSlashComma.js
generated
vendored
Executable file
35
node_modules/stylehacks/dist/plugins/trailingSlashComma.js
generated
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _plugin = require('../plugin');
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _isMixin = require('../isMixin');
|
||||
|
||||
var _isMixin2 = _interopRequireDefault(_isMixin);
|
||||
|
||||
var _browsers = require('../dictionary/browsers');
|
||||
|
||||
var _identifiers = require('../dictionary/identifiers');
|
||||
|
||||
var _postcss = require('../dictionary/postcss');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = (0, _plugin2.default)([_browsers.IE_5_5, _browsers.IE_6, _browsers.IE_7], [_postcss.RULE], function (rule) {
|
||||
if ((0, _isMixin2.default)(rule)) {
|
||||
return;
|
||||
}
|
||||
var selector = rule.selector;
|
||||
|
||||
var trim = selector.trim();
|
||||
if (trim.lastIndexOf(',') === selector.length - 1 || trim.lastIndexOf('\\') === selector.length - 1) {
|
||||
this.push(rule, {
|
||||
identifier: _identifiers.SELECTOR,
|
||||
hack: selector
|
||||
});
|
||||
}
|
||||
});
|
||||
module.exports = exports['default'];
|
47
node_modules/stylehacks/node_modules/postcss-reporter/CHANGELOG.md
generated
vendored
Normal file
47
node_modules/stylehacks/node_modules/postcss-reporter/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# Changelog
|
||||
|
||||
## 1.4.1
|
||||
- Add `filter` option.
|
||||
- Add blacklist functionality to `plugins` option with `!` prefix`.
|
||||
|
||||
## 1.3.3
|
||||
- Fix regression that caused positions from sources without incoming sourcemaps not to be logged.
|
||||
|
||||
## 1.3.2
|
||||
- Find more accurate positions of preprocessed files with sourcemaps.
|
||||
|
||||
## 1.3.1
|
||||
- Fix Windows path bug.
|
||||
|
||||
## 1.3.0
|
||||
- Check individual messages for distinct sources, then group messages by those sources,
|
||||
instead of always using the PostCSS Result's source.
|
||||
- Output empty string from `formatter` if there are no messages, instead of `undefined`.
|
||||
|
||||
## 1.2.1
|
||||
- Handle variable and absent input sources.
|
||||
|
||||
## 1.2.0
|
||||
- Add `noIcon` and `noPlugin` options to both reporter and formatter.
|
||||
|
||||
## 1.1.0
|
||||
- Use PostCSS 5's line/column properties on warnings, instead of relying on the source node.
|
||||
|
||||
## 1.0.0
|
||||
- Upgrade to PostCSS 5.
|
||||
|
||||
## 0.4.0
|
||||
- Add `positionless` option (to both the reporter and the formatter), with default value `"first"`.
|
||||
- Cleaner npm install (files specified in `package.json`).
|
||||
|
||||
## 0.3.1
|
||||
- Remove leftover debugging log statement.
|
||||
|
||||
## 0.3.0
|
||||
- Add `sortByPosition` option (to both the reporter and the formatter), with default value `true`.
|
||||
|
||||
## 0.2.0
|
||||
- Alter `defaultFormatter` to use warning symbol and not repeat `# postcss-reporter`.
|
||||
|
||||
## 0.1.0
|
||||
- First release.
|
22
node_modules/stylehacks/node_modules/postcss-reporter/LICENSE
generated
vendored
Normal file
22
node_modules/stylehacks/node_modules/postcss-reporter/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 David Clark
|
||||
|
||||
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.
|
||||
|
134
node_modules/stylehacks/node_modules/postcss-reporter/README.md
generated
vendored
Normal file
134
node_modules/stylehacks/node_modules/postcss-reporter/README.md
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
# postcss-reporter
|
||||
[](https://travis-ci.org/postcss/postcss-reporter)[](https://ci.appveyor.com/project/davidtheclark/postcss-reporter)
|
||||
|
||||
A PostCSS plugin to `console.log()` the messages (warnings, etc.) registered by other PostCSS plugins.
|
||||
|
||||
## Purpose
|
||||
|
||||
As of PostCSS 4.1, a single PostCSS process can accumulate messages from all of the plugins it uses.
|
||||
Most of these messages are [warnings](https://github.com/postcss/postcss/blob/master/docs/guidelines/plugin.md#32-use-resultwarn-for-warnings).
|
||||
Presumably, plugin authors want you to see those messages.
|
||||
So this plugin exists to read the accumulated messages (or messages from only the plugins you've specified), format them, and print them to the console.
|
||||
|
||||
By default, the messages are formatted for human legibility and sorted according to the line/column positions attached to the messages. But another formatting function can be passed in with an option, and sorting can be turned of with an option.
|
||||
|
||||
## Example Output
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install postcss-reporter
|
||||
```
|
||||
|
||||
Version 1.0.0+ is compatible with PostCSS 5+. (Earlier versions are compatible with PostCSS 4.)
|
||||
|
||||
## Usage
|
||||
|
||||
Add it to your plugin list *after any plugins whose messages you want to log*, and optionally pass it an object of options.
|
||||
|
||||
For example, using [gulp-postcss](https://github.com/postcss/gulp-postcss):
|
||||
|
||||
```js
|
||||
gulp.task('css', function() {
|
||||
return gulp.src('./src/*.css')
|
||||
.pipe(postcss([
|
||||
bemLinter(),
|
||||
customProperties(),
|
||||
calc(),
|
||||
rejectAllColors(),
|
||||
reporter(myOptions) // <------ ding
|
||||
]))
|
||||
.pipe(gulp.dest('./dist'));
|
||||
});
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
**clearMessages** (boolean, default = `false`)
|
||||
|
||||
If true, the plugin will clear the result's messages after it logs them. This prevents other plugins, or the whatever runner you use, from logging the same information again and causing confusion.
|
||||
|
||||
**formatter** (function, default = the default formatter)
|
||||
|
||||
By default, this reporter will format the messages for human legibility in the console.
|
||||
To use another formatter, pass a function that
|
||||
|
||||
- accepts an object containing a `messages` array and a `source` string
|
||||
- returns the string to report
|
||||
|
||||
For example, you could write a formatter like this:
|
||||
|
||||
```js
|
||||
reporter({
|
||||
formatter: function(input) {
|
||||
return input.source + ' produced ' + input.messages.length + ' messages';
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
**plugins** (array of strings, default = `[]`)
|
||||
|
||||
If `plugins` is empty (as it is by default), the reporter will log messages from every PostCSS plugin.
|
||||
|
||||
There are 2 ways to limit output:
|
||||
|
||||
- **Whitelist:** Provide an array of the plugins whose messages you would like to show.
|
||||
For example, `{ plugins: ['postcss-bem-linter'] }` will only log messages from the `postcss-bem-linter` plugin.
|
||||
- **Blacklist:** Prefix all plugins in the array with `!` to specify only those plugins whose messages you would like to hide.
|
||||
(All other plugins will be shown.)
|
||||
For example, `{ plugins: ['!postcss-bem-linter'] }` will never log messages from the `postcss-bem-linter` plugin; but will log messages from every other plugin.
|
||||
|
||||
**filter** (function)
|
||||
|
||||
Provide a filter function. It receives the message object and returns a truthy or falsy value, indicating whether that particular message should be reported or not.
|
||||
|
||||
For example, `function(message) { return message.type === 'warning'; }` will only log `warning` messages, regardless of the plugin.
|
||||
|
||||
**throwError** (boolean, default = `false`)
|
||||
|
||||
If `true`, after the plugin logs your messages it will throw an error if it found any warnings.
|
||||
|
||||
**sortByPosition** (boolean, default = `true`)
|
||||
|
||||
If `false`, messages will not be sorted by line/column position.
|
||||
|
||||
**positionless** (`"first"|"last"|"any"`, default = `"first"`)
|
||||
|
||||
By default, messages without line/column positions will be grouped at the beginning of the output.
|
||||
To put them at the end, instead, use `"last"`.
|
||||
To not bother sorting these, use `"any"`.
|
||||
|
||||
**noIcon** (boolean, default = `false`)
|
||||
|
||||
If `true`, no exclamatory triangle icons will be printed next to warnings.
|
||||
|
||||
**noPlugin** (boolean, default = `false`)
|
||||
|
||||
If `true`, plugin names will not be printed in brackets after messages.
|
||||
|
||||
## How to get output without colors
|
||||
|
||||
If you would like no colors in the console output, simply pass `--no-colors` when you invoke whatever command runs this plugin. (This works because of [chalk](https://github.com/sindresorhus/chalk).)
|
||||
|
||||
## Standalone formatter
|
||||
|
||||
You can also use this module's formatter as a library, with following API:
|
||||
|
||||
```js
|
||||
var formatter = require('postcss-reporter/lib/formatter');
|
||||
var myFormatter = formatter(myOptions);
|
||||
// to use defaults, just pass no options: `formatter()`
|
||||
var warningLog = myFormatter({
|
||||
messages: someMessages,
|
||||
source: someSource
|
||||
});
|
||||
console.log(warningLog);
|
||||
```
|
||||
|
||||
These are the formatter's options:
|
||||
|
||||
- sortByPosition (boolean, default = `true`)
|
||||
- noIcon (boolean, default = `false`) - Do not print any warning exclamatory triangle icons
|
||||
- noPlugin (boolean, default = `false`) - Do not print plugin names
|
4
node_modules/stylehacks/node_modules/postcss-reporter/index.js
generated
vendored
Normal file
4
node_modules/stylehacks/node_modules/postcss-reporter/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var postcss = require('postcss');
|
||||
var reporter = require('./lib/reporter');
|
||||
|
||||
module.exports = postcss.plugin('postcss-reporter', reporter);
|
80
node_modules/stylehacks/node_modules/postcss-reporter/lib/formatter.js
generated
vendored
Normal file
80
node_modules/stylehacks/node_modules/postcss-reporter/lib/formatter.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
var chalk = require('chalk');
|
||||
var path = require('path');
|
||||
var symbols = require('log-symbols');
|
||||
var _ = require('lodash');
|
||||
var util = require('./util');
|
||||
|
||||
module.exports = function(opts) {
|
||||
var options = opts || {};
|
||||
var sortByPosition = (typeof options.sortByPosition !== 'undefined') ? options.sortByPosition : true;
|
||||
var positionless = options.positionless || 'first';
|
||||
|
||||
return function(input) {
|
||||
var messages = input.messages;
|
||||
var source = input.source;
|
||||
|
||||
if (!messages.length) return '';
|
||||
|
||||
var orderedMessages = _.sortBy(
|
||||
messages,
|
||||
function(m) {
|
||||
if (!m.line) return 1;
|
||||
if (positionless === 'any') return 1;
|
||||
if (positionless === 'first') return 2;
|
||||
if (positionless === 'last') return 0;
|
||||
},
|
||||
function(m) {
|
||||
if (!sortByPosition) return 1;
|
||||
return m.line;
|
||||
},
|
||||
function(m) {
|
||||
if (!sortByPosition) return 1;
|
||||
return m.column;
|
||||
}
|
||||
);
|
||||
|
||||
var output = '\n';
|
||||
|
||||
if (source) {
|
||||
output += chalk.bold.underline(logFrom(source)) + '\n';
|
||||
}
|
||||
|
||||
orderedMessages.forEach(function(w) {
|
||||
output += messageToString(w) + '\n';
|
||||
});
|
||||
|
||||
return output;
|
||||
|
||||
function messageToString(message) {
|
||||
var location = util.getLocation(message);
|
||||
var str = '';
|
||||
|
||||
if (location.line) {
|
||||
str += chalk.bold(location.line);
|
||||
}
|
||||
|
||||
if (location.column) {
|
||||
str += chalk.bold(':' + location.column)
|
||||
}
|
||||
|
||||
if (location.line || location.column) {
|
||||
str += '\t';
|
||||
}
|
||||
|
||||
if (!options.noIcon && message.type === 'warning') {
|
||||
str += chalk.yellow(symbols.warning + ' ');
|
||||
}
|
||||
|
||||
str += message.text;
|
||||
if (!options.noPlugin) {
|
||||
str += chalk.yellow(' [' + message.plugin + ']');
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function logFrom(fromValue) {
|
||||
if (fromValue.charAt(0) === '<') return fromValue;
|
||||
return path.relative(process.cwd(), fromValue).split(path.sep).join('/');
|
||||
}
|
||||
};
|
||||
};
|
75
node_modules/stylehacks/node_modules/postcss-reporter/lib/reporter.js
generated
vendored
Normal file
75
node_modules/stylehacks/node_modules/postcss-reporter/lib/reporter.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
var chalk = require('chalk');
|
||||
var _ = require('lodash');
|
||||
var defaultFormatter = require('./formatter');
|
||||
var util = require('./util');
|
||||
|
||||
module.exports = function(opts) {
|
||||
var options = opts || {};
|
||||
|
||||
var formatter = options.formatter || defaultFormatter({
|
||||
sortByPosition: (typeof options.sortByPosition !== 'undefined') ? options.sortByPosition : true,
|
||||
positionless: options.positionless || 'first',
|
||||
noIcon: options.noIcon,
|
||||
noPlugin: options.noPlugin,
|
||||
});
|
||||
|
||||
var pluginFilter;
|
||||
if (!options.plugins) {
|
||||
// Every plugin
|
||||
pluginFilter = function() { return true; };
|
||||
} else if (options.plugins.every(function(plugin) { return plugin[0] === '!'; })) {
|
||||
// Blacklist
|
||||
pluginFilter = function(message) {
|
||||
return options.plugins.indexOf('!' + message.plugin) === -1;
|
||||
};
|
||||
} else {
|
||||
// Whitelist
|
||||
pluginFilter = function(message) {
|
||||
return options.plugins.indexOf(message.plugin) !== -1;
|
||||
};
|
||||
}
|
||||
|
||||
var messageFilter = options.filter || function() { return true; };
|
||||
|
||||
return function(css, result) {
|
||||
var messagesToLog = result.messages
|
||||
.filter(pluginFilter)
|
||||
.filter(messageFilter);
|
||||
|
||||
var resultSource = (!result.root.source) ? ''
|
||||
: result.root.source.input.file || result.root.source.input.id
|
||||
|
||||
var sourceGroupedMessages = _.groupBy(messagesToLog, function(message) {
|
||||
return util.getLocation(message).file || resultSource;
|
||||
});
|
||||
|
||||
var report = '';
|
||||
_.forOwn(sourceGroupedMessages, function(messages, source) {
|
||||
report += formatter({
|
||||
messages: messages,
|
||||
source: source,
|
||||
});
|
||||
});
|
||||
|
||||
if (options.clearMessages) {
|
||||
result.messages = _.difference(result.messages, messagesToLog);
|
||||
}
|
||||
|
||||
if (!report) return;
|
||||
|
||||
console.log(report);
|
||||
|
||||
if (options.throwError && shouldThrowError()) {
|
||||
throw new Error(chalk.red.bold('\n** postcss-reporter: warnings or errors were found **'));
|
||||
}
|
||||
|
||||
function shouldThrowError() {
|
||||
return (
|
||||
messagesToLog.length
|
||||
&& messagesToLog.some(function(message) {
|
||||
return message.type === 'warning' || message.type === 'error';
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
20
node_modules/stylehacks/node_modules/postcss-reporter/lib/util.js
generated
vendored
Normal file
20
node_modules/stylehacks/node_modules/postcss-reporter/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var _ = require('lodash');
|
||||
|
||||
exports.getLocation = function(message) {
|
||||
var messageNode = message.node;
|
||||
|
||||
var location = {
|
||||
line: message.line,
|
||||
column: message.column,
|
||||
};
|
||||
|
||||
var messageInput = _.get(messageNode, 'source.input');
|
||||
|
||||
if (!messageInput) return location;
|
||||
|
||||
var originLocation = messageInput.origin && messageInput.origin(message.line, message.column)
|
||||
if (originLocation) return originLocation
|
||||
|
||||
location.file = messageInput.file || messageInput.id;
|
||||
return location;
|
||||
};
|
94
node_modules/stylehacks/node_modules/postcss-reporter/package.json
generated
vendored
Normal file
94
node_modules/stylehacks/node_modules/postcss-reporter/package.json
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"postcss-reporter@^1.3.3",
|
||||
"/Users/pmarsceill/_projects/just-the-docs/node_modules/stylehacks"
|
||||
]
|
||||
],
|
||||
"_from": "postcss-reporter@>=1.3.3 <2.0.0",
|
||||
"_id": "postcss-reporter@1.4.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/stylehacks/postcss-reporter",
|
||||
"_nodeVersion": "4.4.7",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/postcss-reporter-1.4.1.tgz_1467678653758_0.5163490162231028"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "david.dave.clark@gmail.com",
|
||||
"name": "davidtheclark"
|
||||
},
|
||||
"_npmVersion": "2.15.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "postcss-reporter",
|
||||
"raw": "postcss-reporter@^1.3.3",
|
||||
"rawSpec": "^1.3.3",
|
||||
"scope": null,
|
||||
"spec": ">=1.3.3 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/stylehacks"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-reporter/-/postcss-reporter-1.4.1.tgz",
|
||||
"_shasum": "c136f0a5b161915f379dd3765c61075f7e7b9af2",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "postcss-reporter@^1.3.3",
|
||||
"_where": "/Users/pmarsceill/_projects/just-the-docs/node_modules/stylehacks",
|
||||
"author": {
|
||||
"email": "david.dave.clark@gmail.com",
|
||||
"name": "David Clark",
|
||||
"url": "http://davidtheclark.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/postcss/postcss-reporter/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^1.0.0",
|
||||
"lodash": "^4.1.0",
|
||||
"log-symbols": "^1.0.2",
|
||||
"postcss": "^5.0.0"
|
||||
},
|
||||
"description": "Log PostCSS messages in the console",
|
||||
"devDependencies": {
|
||||
"eslint": "1.3.1",
|
||||
"less": "2.7.1",
|
||||
"source-map": "0.5.6",
|
||||
"stylelint": "6.8.0",
|
||||
"tape": "4.6.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "c136f0a5b161915f379dd3765c61075f7e7b9af2",
|
||||
"tarball": "https://registry.npmjs.org/postcss-reporter/-/postcss-reporter-1.4.1.tgz"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "24518056bcaebbd6252fecfdfa0ccca158a54797",
|
||||
"homepage": "https://github.com/postcss/postcss-reporter",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "davidtheclark",
|
||||
"email": "david.dave.clark@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "postcss-reporter",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/postcss/postcss-reporter.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "npm run lint && tape test",
|
||||
"visual": "node test/visual.js"
|
||||
},
|
||||
"version": "1.4.1"
|
||||
}
|
144
node_modules/stylehacks/package.json
generated
vendored
Normal file
144
node_modules/stylehacks/package.json
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"stylehacks@^2.3.0",
|
||||
"/Users/pmarsceill/_projects/just-the-docs/node_modules/stylelint"
|
||||
]
|
||||
],
|
||||
"_from": "stylehacks@>=2.3.0 <3.0.0",
|
||||
"_id": "stylehacks@2.3.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/stylehacks",
|
||||
"_nodeVersion": "6.9.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/stylehacks-2.3.2.tgz_1487794009384_0.21575713180936873"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "beneb.info@gmail.com",
|
||||
"name": "beneb"
|
||||
},
|
||||
"_npmVersion": "3.10.8",
|
||||
"_phantomChildren": {
|
||||
"chalk": "1.1.3",
|
||||
"lodash": "4.17.4",
|
||||
"log-symbols": "1.0.2",
|
||||
"postcss": "5.2.15"
|
||||
},
|
||||
"_requested": {
|
||||
"name": "stylehacks",
|
||||
"raw": "stylehacks@^2.3.0",
|
||||
"rawSpec": "^2.3.0",
|
||||
"scope": null,
|
||||
"spec": ">=2.3.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/stylelint"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-2.3.2.tgz",
|
||||
"_shasum": "64c83e0438a68c9edf449e8c552a7d9ab6009b0b",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "stylehacks@^2.3.0",
|
||||
"_where": "/Users/pmarsceill/_projects/just-the-docs/node_modules/stylelint",
|
||||
"author": {
|
||||
"email": "beneb.info@gmail.com",
|
||||
"name": "Ben Briggs",
|
||||
"url": "http://beneb.info"
|
||||
},
|
||||
"ava": {
|
||||
"require": "babel-register"
|
||||
},
|
||||
"bin": {
|
||||
"stylehacks": "dist/cli.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ben-eb/stylehacks/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"browserslist": "^1.1.3",
|
||||
"chalk": "^1.1.1",
|
||||
"log-symbols": "^1.0.2",
|
||||
"minimist": "^1.2.0",
|
||||
"plur": "^2.1.2",
|
||||
"postcss": "^5.0.18",
|
||||
"postcss-reporter": "^1.3.3",
|
||||
"postcss-selector-parser": "^2.0.0",
|
||||
"read-file-stdin": "^0.2.1",
|
||||
"text-table": "^0.2.0",
|
||||
"write-file-stdout": "0.0.2"
|
||||
},
|
||||
"description": "Detect/remove browser hacks from CSS files.",
|
||||
"devDependencies": {
|
||||
"ava": "^0.17.0",
|
||||
"babel-cli": "^6.5.1",
|
||||
"babel-core": "^6.5.2",
|
||||
"babel-plugin-add-module-exports": "^0.2.0",
|
||||
"babel-preset-es2015": "^6.5.0",
|
||||
"babel-preset-es2015-loose": "^7.0.0",
|
||||
"babel-preset-stage-0": "^6.5.0",
|
||||
"babel-register": "^6.9.0",
|
||||
"del-cli": "^0.2.0",
|
||||
"eslint": "^3.0.0",
|
||||
"eslint-config-cssnano": "^3.0.0",
|
||||
"eslint-plugin-babel": "^3.3.0",
|
||||
"eslint-plugin-import": "^2.0.1",
|
||||
"nyc": "^10.0.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "64c83e0438a68c9edf449e8c552a7d9ab6009b0b",
|
||||
"tarball": "https://registry.npmjs.org/stylehacks/-/stylehacks-2.3.2.tgz"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "cssnano"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE-MIT",
|
||||
"dist",
|
||||
"usage.txt"
|
||||
],
|
||||
"gitHead": "4dd3baac686dd6fa427e986c4542ab64dd71351f",
|
||||
"homepage": "https://github.com/ben-eb/stylehacks",
|
||||
"keywords": [
|
||||
"browsers",
|
||||
"css",
|
||||
"hack",
|
||||
"hacks",
|
||||
"optimise",
|
||||
"postcss",
|
||||
"postcss-plugin",
|
||||
"stylehacks"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "beneb",
|
||||
"email": "beneb.info@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "stylehacks",
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules",
|
||||
"src/__tests__"
|
||||
]
|
||||
},
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ben-eb/stylehacks.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
|
||||
"pretest": "eslint src",
|
||||
"report": "nyc report --reporter=html",
|
||||
"test": "nyc ava src/__tests__",
|
||||
"test-012": "nyc ava src/__tests__"
|
||||
},
|
||||
"version": "2.3.2"
|
||||
}
|
18
node_modules/stylehacks/usage.txt
generated
vendored
Normal file
18
node_modules/stylehacks/usage.txt
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
Usage: stylehacks [input] [output] {OPTIONS}
|
||||
|
||||
Options:
|
||||
|
||||
--browsers, -b Specify the browsers that you want to support.
|
||||
|
||||
--lint, -l Check the file for undesirable hacks, skipping removal.
|
||||
|
||||
--silent Used in combination with the lint option; disable all
|
||||
output, only return an exit code (0 for success).
|
||||
|
||||
--sourcemap -s Output a sourcemap with the CSS.
|
||||
|
||||
--no-color Disable colored console output.
|
||||
|
||||
--version, -v Outputs the version number.
|
||||
|
||||
--help, -h Outputs this help screen.
|
Reference in New Issue
Block a user