diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-31 15:37:35 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-31 15:37:35 +0800 |
| commit | d5f14083061f2ce6a42313188443a42e30796320 (patch) | |
| tree | cc6a9889e08b29595a76a33b9e7b4ef84866468b /node_modules/laggard | |
| parent | b1a6ea021f29f182b62f9f81024a3d8ac8621b7f (diff) | |
added make browserlist(autoprefixer) work fixed
Diffstat (limited to 'node_modules/laggard')
19 files changed, 1060 insertions, 0 deletions
diff --git a/node_modules/laggard/node_modules/.bin/browserslist b/node_modules/laggard/node_modules/.bin/browserslist new file mode 120000 index 00000000..3cd991b2 --- /dev/null +++ b/node_modules/laggard/node_modules/.bin/browserslist @@ -0,0 +1 @@ +../browserslist/cli.js
\ No newline at end of file diff --git a/node_modules/laggard/node_modules/balanced-match/.npmignore b/node_modules/laggard/node_modules/balanced-match/.npmignore new file mode 100644 index 00000000..ae5d8c36 --- /dev/null +++ b/node_modules/laggard/node_modules/balanced-match/.npmignore @@ -0,0 +1,5 @@ +test +.gitignore +.travis.yml +Makefile +example.js diff --git a/node_modules/laggard/node_modules/balanced-match/LICENSE.md b/node_modules/laggard/node_modules/balanced-match/LICENSE.md new file mode 100644 index 00000000..2cdc8e41 --- /dev/null +++ b/node_modules/laggard/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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. diff --git a/node_modules/laggard/node_modules/balanced-match/README.md b/node_modules/laggard/node_modules/balanced-match/README.md new file mode 100644 index 00000000..08e918c0 --- /dev/null +++ b/node_modules/laggard/node_modules/balanced-match/README.md @@ -0,0 +1,91 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well! + +[](http://travis-ci.org/juliangruber/balanced-match) +[](https://www.npmjs.org/package/balanced-match) + +[](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ <a index>, <b index> ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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. diff --git a/node_modules/laggard/node_modules/balanced-match/index.js b/node_modules/laggard/node_modules/balanced-match/index.js new file mode 100644 index 00000000..e8d85870 --- /dev/null +++ b/node_modules/laggard/node_modules/balanced-match/index.js @@ -0,0 +1,58 @@ +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/node_modules/laggard/node_modules/balanced-match/package.json b/node_modules/laggard/node_modules/balanced-match/package.json new file mode 100644 index 00000000..720eb4d1 --- /dev/null +++ b/node_modules/laggard/node_modules/balanced-match/package.json @@ -0,0 +1,47 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "0.4.2", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "^4.6.0" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/node_modules/laggard/node_modules/postcss-reporter/CHANGELOG.md b/node_modules/laggard/node_modules/postcss-reporter/CHANGELOG.md new file mode 100644 index 00000000..97e25532 --- /dev/null +++ b/node_modules/laggard/node_modules/postcss-reporter/CHANGELOG.md @@ -0,0 +1,65 @@ +# Changelog + +## 5.0.0 + +- Move PostCSS from `peerDependencies` to `dependencies`. +- Drop support for Node 0.12. + +## 4.0.0 + +- Upgrade to PostCSS v6. (If you still use PostCSS v5, stick with v3 until you can upgrade your PostCSS.) +- Switched PostCSS to a peer dependency. + +## 3.0.0 + +- Replace `clearMessages` option with `clearReportedMessages` and `clearAllMessages`. + +## 2.0.0 + +- Only log warning messages (`type: "warning"`) by default. + +## 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. diff --git a/node_modules/laggard/node_modules/postcss-reporter/LICENSE b/node_modules/laggard/node_modules/postcss-reporter/LICENSE new file mode 100644 index 00000000..6d347c06 --- /dev/null +++ b/node_modules/laggard/node_modules/postcss-reporter/LICENSE @@ -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. + diff --git a/node_modules/laggard/node_modules/postcss-reporter/README.md b/node_modules/laggard/node_modules/postcss-reporter/README.md new file mode 100644 index 00000000..6842f131 --- /dev/null +++ b/node_modules/laggard/node_modules/postcss-reporter/README.md @@ -0,0 +1,143 @@ +# 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. + +*By default, only warnings are logged*. If you would like to see more messages, you can change the `filter` function. + +## 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 + +**clearReportedMessages** (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. + +By default, only messages with `type: "warning"` warnings are logged. (These are the messages produced when the plugin author uses PostCSS's `warn()` function.) + +For example, `function(message) { return true }` will only every message, regardless of the plugin or whether it's a warning or not. + +**clearAllMessages** (boolean, default = `false`) + +If `true`, not pass any messages into other plugins, or the whatever runner you use, for logging. + +**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 diff --git a/node_modules/laggard/node_modules/postcss-reporter/index.js b/node_modules/laggard/node_modules/postcss-reporter/index.js new file mode 100644 index 00000000..2a4e4136 --- /dev/null +++ b/node_modules/laggard/node_modules/postcss-reporter/index.js @@ -0,0 +1,4 @@ +var postcss = require('postcss'); +var reporter = require('./lib/reporter'); + +module.exports = postcss.plugin('postcss-reporter', reporter); diff --git a/node_modules/laggard/node_modules/postcss-reporter/lib/formatter.js b/node_modules/laggard/node_modules/postcss-reporter/lib/formatter.js new file mode 100644 index 00000000..b5719b8f --- /dev/null +++ b/node_modules/laggard/node_modules/postcss-reporter/lib/formatter.js @@ -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('/'); + } + }; +}; diff --git a/node_modules/laggard/node_modules/postcss-reporter/lib/reporter.js b/node_modules/laggard/node_modules/postcss-reporter/lib/reporter.js new file mode 100644 index 00000000..70781fba --- /dev/null +++ b/node_modules/laggard/node_modules/postcss-reporter/lib/reporter.js @@ -0,0 +1,81 @@ +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(message) { return (message.type === 'warning'); }; + + 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.clearReportedMessages) { + result.messages = _.difference(result.messages, messagesToLog); + } + + if (options.clearAllMessages) { + var messagesToClear = result.messages.filter(pluginFilter); + result.messages = _.difference(result.messages, messagesToClear); + } + + + 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'; + }) + ); + } + }; +}; diff --git a/node_modules/laggard/node_modules/postcss-reporter/lib/util.js b/node_modules/laggard/node_modules/postcss-reporter/lib/util.js new file mode 100644 index 00000000..76c649bc --- /dev/null +++ b/node_modules/laggard/node_modules/postcss-reporter/lib/util.js @@ -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; +}; diff --git a/node_modules/laggard/node_modules/postcss-reporter/package.json b/node_modules/laggard/node_modules/postcss-reporter/package.json new file mode 100644 index 00000000..7233b6f0 --- /dev/null +++ b/node_modules/laggard/node_modules/postcss-reporter/package.json @@ -0,0 +1,46 @@ +{ + "name": "postcss-reporter", + "version": "5.0.0", + "description": "Log PostCSS messages in the console", + "main": "index.js", + "scripts": { + "lint": "eslint .", + "test": "npm run lint && tape test", + "visual": "node test/visual.js" + }, + "files": [ + "index.js", + "lib" + ], + "repository": { + "type": "git", + "url": "https://github.com/postcss/postcss-reporter.git" + }, + "author": { + "name": "David Clark", + "email": "david.dave.clark@gmail.com", + "url": "http://davidtheclark.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/postcss/postcss-reporter/issues" + }, + "homepage": "https://github.com/postcss/postcss-reporter", + "devDependencies": { + "eslint": "1.3.1", + "less": "2.7.1", + "source-map": "0.5.6", + "strip-color": "^0.1.0", + "stylelint": "6.8.0", + "tape": "^4.7.0" + }, + "dependencies": { + "chalk": "^2.0.1", + "lodash": "^4.17.4", + "log-symbols": "^2.0.0", + "postcss": "^6.0.8" + }, + "engines": { + "node": ">=4" + } +} diff --git a/node_modules/laggard/node_modules/reduce-css-calc/CHANGELOG.md b/node_modules/laggard/node_modules/reduce-css-calc/CHANGELOG.md new file mode 100755 index 00000000..fff0c07c --- /dev/null +++ b/node_modules/laggard/node_modules/reduce-css-calc/CHANGELOG.md @@ -0,0 +1,87 @@ +# 1.3.0 - 2016-08-26 + +- Added: calc identifier from unresolved nested expressions are removed for + better browser support + ([#19](https://github.com/MoOx/reduce-css-calc/pull/19) - @ben-eb) + +# 1.2.8 - 2016-08-26 + +- Fixed: regression from 1.2.5 on calc() with value without leading 0 + ([#17](https://github.com/MoOx/reduce-css-calc/pull/17) - @ben-eb) + +# 1.2.7 - 2016-08-22 + +- Fixed: regression from 1.2.5 on calc() with value without leading 0 + (@MoOx) + +# 1.2.6 - 2016-08-22 + +- Fixed: regression from 1.2.5 on calc() on multiple lines + (@MoOx) + +# 1.2.5 - 2016-08-22 + +- Fixed: security issue due to the usage of ``eval()``. + This is to avoid an arbitrary code execution. + Now operations are resolved using + [``math-expression-evaluator``](https://github.com/redhivesoftware/math-expression-evaluator) + +# 1.2.4 - 2016-06-09 + +- Fixed: zero values are not unitless anymore. + Browsers do not calculate calc() with 0 unitless values. + http://jsbin.com/punivivipo/edit?html,css,output + ([#11](https://github.com/MoOx/reduce-css-calc/pull/11))
+ +# 1.2.3 - 2016-04-28 + +- Fixed: wrong rouding in some edge cases + ([#10](https://github.com/MoOx/reduce-css-calc/pull/10)) + +# 1.2.2 - 2016-04-19 + +- Fixed: Don't reduce expression containing CSS variables. + ([#9](https://github.com/MoOx/reduce-css-calc/pull/9)) + +# 1.2.1 - 2016-02-22 + +- Fixed: uppercase letters in units are now supported + ([#8](https://github.com/MoOx/reduce-css-calc/pull/8)) + +# 1.2.0 - 2014-11-24 + +- Decimal precision is now customisable as the `precision` option + +# 1.1.4 - 2014-11-12 + +- 5 decimals rounding for everything + +# 1.1.3 - 2014-08-13 + +- 5 decimals rounding for percentage + +# 1.1.2 - 2014-08-10 + +- Prevent infinite loop by adding a `Call stack overflow` +- Correctly ignore unrecognized values (safer evaluation for nested expressions, + see [postcss/postcss-calc#2](https://github.com/postcss/postcss-calc/issues/2)) +- Handle rounding issues (eg: 10% * 20% now give 2%, not 2.0000000000000004%) + +# 1.1.1 - 2014-08-06 + +- Fix issue when using mutiples differents prefixes in the same function + +# 1.1.0 - 2014-08-06 + +- support more complex formulas +- use `reduce-function-call` +- better error message + + +# 1.0.0 - 2014-08-04 + +First release + +- based on [rework-calc](https://github.com/reworkcss/rework-calc) v1.1.0 +- add error if the calc() embed an empty calc() or empty () +- jscs + jshint added before tests diff --git a/node_modules/laggard/node_modules/reduce-css-calc/LICENSE b/node_modules/laggard/node_modules/reduce-css-calc/LICENSE new file mode 100755 index 00000000..7cc9dd08 --- /dev/null +++ b/node_modules/laggard/node_modules/reduce-css-calc/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Maxime Thirouin & Joakim Bengtson + +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. diff --git a/node_modules/laggard/node_modules/reduce-css-calc/README.md b/node_modules/laggard/node_modules/reduce-css-calc/README.md new file mode 100755 index 00000000..0ba73d30 --- /dev/null +++ b/node_modules/laggard/node_modules/reduce-css-calc/README.md @@ -0,0 +1,72 @@ +# reduce-css-calc [](https://travis-ci.org/MoOx/reduce-css-calc) + +> Reduce CSS calc() function to the maximum. + +Particularly useful for packages like [rework-calc](https://github.com/reworkcss/rework-calc) or [postcss-calc](https://github.com/postcss/postcss-calc). + +## Installation + +```console +$ npm install reduce-css-calc +``` + +## Usage + +### `var reducedString = reduceCSSCalc(string, precision)` + +```javascript +var reduceCSSCalc = require('reduce-css-calc') + +reduceCSSCalc("calc(1 + 1)") +// 2 + +reduceCSSCalc("calc((6 / 2) - (4 * 2) + 1)") +// -4 + +reduceCSSCalc("calc(1/3)") +// 0.33333 + +reduceCSSCalc("calc(1/3)", 10) +// 0.3333333333 + +reduceCSSCalc("calc(3rem * 2 - 1rem)") +// 5rem + +reduceCSSCalc("calc(2 * 50%)") +// 100% + +reduceCSSCalc("calc(120% * 50%)") +// 60% + +reduceCSSCalc("a calc(1 + 1) b calc(1 - 1) c") +// a 2 b 0 c + +reduceCSSCalc("calc(calc(calc(1rem * 0.75) * 1.5) - 1rem)") +// 0.125rem + +reduceCSSCalc("calc(calc(calc(1rem * 0.75) * 1.5) - 1px)") +// calc(1.125rem - 1px) + +reduceCSSCalc("-moz-calc(100px / 2)") +// 50px + +reduceCSSCalc("-moz-calc(50% - 2em)") +// -moz-calc(50% - 2em) +``` + +See [unit tests](test/index.js) for others examples. + +## Contributing + +Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature. + +```console +$ git clone https://github.com/MoOx/reduce-css-calc.git +$ git checkout -b patch-1 +$ npm install +$ npm test +``` + +## [Changelog](CHANGELOG.md) + +## [License](LICENSE-MIT) diff --git a/node_modules/laggard/node_modules/reduce-css-calc/index.js b/node_modules/laggard/node_modules/reduce-css-calc/index.js new file mode 100755 index 00000000..3ec72471 --- /dev/null +++ b/node_modules/laggard/node_modules/reduce-css-calc/index.js @@ -0,0 +1,164 @@ +/** + * Module dependencies + */ +var balanced = require("balanced-match") +var reduceFunctionCall = require("reduce-function-call") +var mexp = require("math-expression-evaluator") + +/** + * Constantes + */ +var MAX_STACK = 100 // should be enough for a single calc()... +var NESTED_CALC_RE = /(\+|\-|\*|\\|[^a-z]|)(\s*)(\()/g + +/** + * Global variables + */ +var stack + +/** + * Expose reduceCSSCalc plugin + * + * @type {Function} + */ +module.exports = reduceCSSCalc + +/** + * Reduce CSS calc() in a string, whenever it's possible + * + * @param {String} value css input + */ +function reduceCSSCalc(value, decimalPrecision) { + stack = 0 + decimalPrecision = Math.pow(10, decimalPrecision === undefined ? 5 : decimalPrecision) + + // Allow calc() on multiple lines + value = value.replace(/\n+/g, " ") + + /** + * Evaluates an expression + * + * @param {String} expression + * @returns {String} + */ + function evaluateExpression (expression, functionIdentifier, call) { + if (stack++ > MAX_STACK) { + stack = 0 + throw new Error("Call stack overflow for " + call) + } + + if (expression === "") { + throw new Error(functionIdentifier + "(): '" + call + "' must contain a non-whitespace string") + } + + expression = evaluateNestedExpression(expression, call) + + var units = getUnitsInExpression(expression) + + // If the expression contains multiple units or CSS variables, + // then let the expression be (i.e. browser calc()) + if (units.length > 1 || expression.indexOf("var(") > -1) { + return functionIdentifier + "(" + expression + ")" + } + + var unit = units[0] || "" + + if (unit === "%") { + // Convert percentages to numbers, to handle expressions like: 50% * 50% (will become: 25%): + // console.log(expression) + expression = expression.replace(/\b[0-9\.]+%/g, function(percent) { + return parseFloat(percent.slice(0, -1)) * 0.01 + }) + } + + // Remove units in expression: + var toEvaluate = expression.replace(new RegExp(unit, "gi"), "") + var result + + try { + result = mexp.eval(toEvaluate) + } + catch (e) { + return functionIdentifier + "(" + expression + ")" + } + + // Transform back to a percentage result: + if (unit === "%") { + result *= 100 + } + + // adjust rounding shit + // (0.1 * 0.2 === 0.020000000000000004) + if (functionIdentifier.length || unit === "%") { + result = Math.round(result * decimalPrecision) / decimalPrecision + } + + // Add unit + result += unit + + return result + } + + /** + * Evaluates nested expressions + * + * @param {String} expression + * @returns {String} + */ + function evaluateNestedExpression(expression, call) { + // Remove the calc part from nested expressions to ensure + // better browser compatibility + expression = expression.replace(/((?:\-[a-z]+\-)?calc)/g, "") + var evaluatedPart = "" + var nonEvaluatedPart = expression + var matches + while ((matches = NESTED_CALC_RE.exec(nonEvaluatedPart))) { + if (matches[0].index > 0) { + evaluatedPart += nonEvaluatedPart.substring(0, matches[0].index) + } + + var balancedExpr = balanced("(", ")", nonEvaluatedPart.substring([0].index)) + if (balancedExpr.body === "") { + throw new Error("'" + expression + "' must contain a non-whitespace string") + } + + var evaluated = evaluateExpression(balancedExpr.body, "", call) + + evaluatedPart += balancedExpr.pre + evaluated + nonEvaluatedPart = balancedExpr.post + } + + return evaluatedPart + nonEvaluatedPart + } + + return reduceFunctionCall(value, /((?:\-[a-z]+\-)?calc)\(/, evaluateExpression) +} + +/** + * Checks what units are used in an expression + * + * @param {String} expression + * @returns {Array} + */ + +function getUnitsInExpression(expression) { + var uniqueUnits = [] + var uniqueLowerCaseUnits = [] + var unitRegEx = /[\.0-9]([%a-z]+)/gi + var matches = unitRegEx.exec(expression) + + while (matches) { + if (!matches || !matches[1]) { + continue + } + + if (uniqueLowerCaseUnits.indexOf(matches[1].toLowerCase()) === -1) { + uniqueUnits.push(matches[1]) + uniqueLowerCaseUnits.push(matches[1].toLowerCase()) + } + + matches = unitRegEx.exec(expression) + } + + return uniqueUnits +} diff --git a/node_modules/laggard/node_modules/reduce-css-calc/package.json b/node_modules/laggard/node_modules/reduce-css-calc/package.json new file mode 100644 index 00000000..6baa0601 --- /dev/null +++ b/node_modules/laggard/node_modules/reduce-css-calc/package.json @@ -0,0 +1,33 @@ +{ + "name": "reduce-css-calc", + "version": "1.3.0", + "description": "Reduce CSS calc() function to the maximum", + "keywords": [ + "css", + "calculation", + "calc" + ], + "author": "Maxime Thirouin", + "license": "MIT", + "repository": "https://github.com/MoOx/reduce-css-calc.git", + "files": [ + "index.js" + ], + "dependencies": { + "balanced-match": "^0.4.2", + "math-expression-evaluator": "^1.2.14", + "reduce-function-call": "^1.0.1" + }, + "devDependencies": { + "jscs": "^1.5.9", + "jshint": "^2.5.2", + "npmpub": "^3.0.3", + "tape": "^2.13.4" + }, + "scripts": { + "jscs": "jscs *.js **/*.js", + "jshint": "jshint . --exclude node_modules", + "test": "npm run jscs && npm run jshint && tape test", + "release": "npmpub" + } +} |
