Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,53 @@
# 2.1.7
* Replaced the `has-own` module with `has`.
# 2.1.6
* Fixes an issue where the module would discard at-rules that were defined in
`@media` & `@supports` rules as well as the root. As this is legal to do in
CSS, the module now checks to see if the candidate rule has the same parent
as the cached rule. If it does, the rules are merged.
# 2.1.5
* Now compiled with babel 6.
# 2.1.4
* Fixed a range error which happened when duplicated at rules were found
in the stylesheet.
# 2.1.3
* Fixed an infinite loop regression in the last patch.
# 2.1.2
* Fixes a bug where sometimes values would be substituted by JS code.
# 2.1.1
* Updates postcss-value-parser to version 3 (thanks to @TrySound).
# 2.1.0
* Replaced css-list with postcss-value-parser, reduced AST iterations from 4
to 1 for increased performance.
# 2.0.0
* Upgraded to PostCSS 5.
# 1.0.2
* Minor boost in performance with reduced stringify passes.
# 1.0.1
* Fixes an issue where duplicated keyframes with the same name would cause
an infinite loop.
# 1.0.0
* Initial release.

View 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.

View File

@@ -0,0 +1,81 @@
# [postcss][postcss]-merge-idents [![Build Status](https://travis-ci.org/ben-eb/postcss-merge-idents.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/postcss-merge-idents.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/postcss-merge-idents.svg)][deps]
> Merge keyframe and counter style identifiers.
## Install
With [npm](https://npmjs.org/package/postcss-merge-idents) do:
```
npm install postcss-merge-idents --save
```
## Example
This module will merge identifiers such as `@keyframes` and `@counter-style`,
if their properties are identical. Then, it will update those declarations that
depend on the duplicated property.
### Input
```css
@keyframes rotate {
from { transform: rotate(0) }
to { transform: rotate(360deg) }
}
@keyframes flip {
from { transform: rotate(0) }
to { transform: rotate(360deg) }
}
.rotate {
animation-name: rotate
}
.flip {
animation-name: flip
}
```
### Output
```css
@keyframes flip {
from { transform: rotate(0) }
to { transform: rotate(360deg) }
}
.rotate {
animation-name: flip
}
.flip {
animation-name: flip
}
```
## Usage
See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
examples for your environment.
## 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/postcss-merge-idents
[deps]: https://gemnasium.com/ben-eb/postcss-merge-idents
[npm]: http://badge.fury.io/js/postcss-merge-idents
[postcss]: https://github.com/postcss/postcss

View File

@@ -0,0 +1,116 @@
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _has = require('has');
var _has2 = _interopRequireDefault(_has);
var _postcss = require('postcss');
var _postcssValueParser = require('postcss-value-parser');
var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function canonical(obj) {
return function recurse(key) {
if ((0, _has2.default)(obj, key) && obj[key] !== key) {
return recurse(obj[key]);
}
return key;
};
}
function sameParent(ruleA, ruleB) {
var hasParent = ruleA.parent && ruleB.parent;
var sameType = hasParent && ruleA.parent.type === ruleB.parent.type;
// If an at rule, ensure that the parameters are the same
if (hasParent && ruleA.parent.type !== 'root' && ruleB.parent.type !== 'root') {
sameType = sameType && ruleA.parent.params === ruleB.parent.params && ruleA.parent.name === ruleB.parent.name;
}
return hasParent ? sameType : true;
}
function mergeAtRules(css, pairs) {
pairs.forEach(function (pair) {
pair.cache = [];
pair.replacements = [];
pair.decls = [];
});
var relevant = void 0;
css.walk(function (node) {
if (node.type === 'atrule') {
relevant = pairs.filter(function (pair) {
return pair.atrule.test(node.name);
})[0];
if (!relevant) {
return;
}
if (relevant.cache.length < 1) {
relevant.cache.push(node);
return;
} else {
var _ret = function () {
var toString = node.nodes.toString();
relevant.cache.forEach(function (cached) {
if (cached.name === node.name && sameParent(cached, node) && cached.nodes.toString() === toString) {
cached.remove();
relevant.replacements[cached.params] = node.params;
}
});
relevant.cache.push(node);
return {
v: void 0
};
}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
}
if (node.type === 'decl') {
relevant = pairs.filter(function (pair) {
return pair.decl.test(node.prop);
})[0];
if (!relevant) {
return;
}
relevant.decls.push(node);
}
});
pairs.forEach(function (pair) {
var canon = canonical(pair.replacements);
pair.decls.forEach(function (decl) {
decl.value = (0, _postcssValueParser2.default)(decl.value).walk(function (node) {
if (node.type === 'word') {
node.value = canon(node.value);
}
if (node.type === 'space') {
node.value = ' ';
}
if (node.type === 'div') {
node.before = node.after = '';
}
}).toString();
});
});
}
exports.default = (0, _postcss.plugin)('postcss-merge-idents', function () {
return function (css) {
mergeAtRules(css, [{
atrule: /keyframes/,
decl: /animation/
}, {
atrule: /counter-style/,
decl: /(list-style|system)/
}]);
};
});
module.exports = exports['default'];

View File

@@ -0,0 +1,90 @@
{
"_args": [
[
"postcss-merge-idents@2.1.7",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "postcss-merge-idents@2.1.7",
"_id": "postcss-merge-idents@2.1.7",
"_inBundle": false,
"_integrity": "sha1-TFUwMTwI4dWzu/PSu8dH4njuonA=",
"_location": "/css-loader/postcss-merge-idents",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "postcss-merge-idents@2.1.7",
"name": "postcss-merge-idents",
"escapedName": "postcss-merge-idents",
"rawSpec": "2.1.7",
"saveSpec": null,
"fetchSpec": "2.1.7"
},
"_requiredBy": [
"/css-loader/cssnano"
],
"_resolved": "https://registry.npmjs.org/postcss-merge-idents/-/postcss-merge-idents-2.1.7.tgz",
"_spec": "2.1.7",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Ben Briggs",
"email": "beneb.info@gmail.com",
"url": "http://beneb.info"
},
"ava": {
"require": "babel-register"
},
"bugs": {
"url": "https://github.com/ben-eb/postcss-merge-idents/issues"
},
"dependencies": {
"has": "^1.0.1",
"postcss": "^5.0.10",
"postcss-value-parser": "^3.1.1"
},
"description": "Merge keyframe and counter style identifiers.",
"devDependencies": {
"ava": "^0.16.0",
"babel-cli": "^6.3.17",
"babel-core": "^6.3.26",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-stage-0": "^6.3.13",
"babel-register": "^6.9.0",
"del-cli": "^0.2.0",
"eslint": "^3.0.0",
"eslint-config-cssnano": "^3.0.0",
"eslint-plugin-babel": "^3.3.0",
"eslint-plugin-import": "^1.10.2"
},
"eslintConfig": {
"extends": "cssnano"
},
"files": [
"dist",
"LICENSE-MIT"
],
"homepage": "https://github.com/ben-eb/postcss-merge-idents",
"keywords": [
"css",
"merge",
"postcss",
"postcss-plugin"
],
"license": "MIT",
"main": "dist/index.js",
"name": "postcss-merge-idents",
"repository": {
"type": "git",
"url": "git+https://github.com/ben-eb/postcss-merge-idents.git"
},
"scripts": {
"prepublish": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
"pretest": "eslint src",
"test": "ava src/__tests__",
"test-012": "ava src/__tests__"
},
"version": "2.1.7"
}