reduce-css-calc
Advanced tools
Comparing version
@@ -0,1 +1,5 @@ | ||
# 2.1.5 - 2018-09-20 | ||
- [Avoid breaking when seeing ` constant()`` or `env()`](https://github.com/MoOx/reduce-css-calc/commit/409c9ba2cd5e06e7f8f679f7f0c3c3a14ff3e673) by @dlee | ||
# 2.1.4 - 2018-01-22 | ||
@@ -87,6 +91,6 @@ | ||
- Fixed: security issue due to the usage of ``eval()``. | ||
- 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) | ||
[`math-expression-evaluator`](https://github.com/redhivesoftware/math-expression-evaluator) | ||
@@ -98,3 +102,3 @@ # 1.2.4 - 2016-06-09 | ||
http://jsbin.com/punivivipo/edit?html,css,output | ||
([#11](https://github.com/MoOx/reduce-css-calc/pull/11)) | ||
([#11](https://github.com/MoOx/reduce-css-calc/pull/11)) | ||
@@ -133,3 +137,3 @@ # 1.2.3 - 2016-04-28 | ||
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%) | ||
- Handle rounding issues (eg: 10% \* 20% now give 2%, not 2.0000000000000004%) | ||
@@ -146,3 +150,2 @@ # 1.1.1 - 2014-08-06 | ||
# 1.0.0 - 2014-08-04 | ||
@@ -149,0 +152,0 @@ |
@@ -35,2 +35,6 @@ 'use strict'; | ||
var contents = _postcssValueParser2.default.stringify(node.nodes); | ||
// skip constant() and env() | ||
if (contents.indexOf('constant') >= 0 || contents.indexOf('env') >= 0) return; | ||
var ast = _parser.parser.parse(contents); | ||
@@ -37,0 +41,0 @@ |
@@ -76,3 +76,3 @@ /* parser generated by jison 0.4.17 */ | ||
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,5],$V1=[1,3],$V2=[1,4],$V3=[1,24],$V4=[1,9],$V5=[1,10],$V6=[1,11],$V7=[1,12],$V8=[1,13],$V9=[1,14],$Va=[1,15],$Vb=[1,16],$Vc=[1,17],$Vd=[1,18],$Ve=[1,19],$Vf=[1,20],$Vg=[1,21],$Vh=[1,22],$Vi=[1,23],$Vj=[1,26],$Vk=[1,27],$Vl=[1,28],$Vm=[1,29],$Vn=[1,35],$Vo=[5,6,7,8,9,11],$Vp=[5,6,7,11]; | ||
var parser = {trace: function trace() { }, | ||
var parser = {trace: function trace () { }, | ||
yy: {}, | ||
@@ -157,3 +157,3 @@ symbols_: {"error":2,"expression":3,"math_expression":4,"EOF":5,"ADD":6,"SUB":7,"MUL":8,"DIV":9,"LPAREN":10,"RPAREN":11,"NESTED_CALC":12,"PREFIX":13,"css_variable":14,"css_value":15,"value":16,"NUMBER":17,"CSS_VAR":18,"LENGTH":19,"ANGLE":20,"TIME":21,"FREQ":22,"RES":23,"EMS":24,"EXS":25,"CHS":26,"REMS":27,"VHS":28,"VWS":29,"VMINS":30,"VMAXS":31,"PERCENTAGE":32,"$accept":0,"$end":1}, | ||
defaultActions: {25:[2,1]}, | ||
parseError: function parseError(str, hash) { | ||
parseError: function parseError (str, hash) { | ||
if (hash.recoverable) { | ||
@@ -445,3 +445,3 @@ this.trace(str); | ||
// test the lexed token: return FALSE when not a match, otherwise return token | ||
test_match:function (match, indexed_rule) { | ||
test_match:function(match, indexed_rule) { | ||
var token, | ||
@@ -576,3 +576,3 @@ lines, | ||
// return next match that has a token | ||
lex:function lex() { | ||
lex:function lex () { | ||
var r = this.next(); | ||
@@ -587,3 +587,3 @@ if (r) { | ||
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) | ||
begin:function begin(condition) { | ||
begin:function begin (condition) { | ||
this.conditionStack.push(condition); | ||
@@ -593,3 +593,3 @@ }, | ||
// pop the previously active lexer condition state off the condition stack | ||
popState:function popState() { | ||
popState:function popState () { | ||
var n = this.conditionStack.length - 1; | ||
@@ -604,3 +604,3 @@ if (n > 0) { | ||
// produce the lexer rule set which is active for the currently active lexer condition state | ||
_currentRules:function _currentRules() { | ||
_currentRules:function _currentRules () { | ||
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { | ||
@@ -614,3 +614,3 @@ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; | ||
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available | ||
topState:function topState(n) { | ||
topState:function topState (n) { | ||
n = this.conditionStack.length - 1 - Math.abs(n || 0); | ||
@@ -625,3 +625,3 @@ if (n >= 0) { | ||
// alias for begin(condition) | ||
pushState:function pushState(condition) { | ||
pushState:function pushState (condition) { | ||
this.begin(condition); | ||
@@ -734,3 +734,3 @@ }, | ||
exports.parse = function () { return parser.parse.apply(parser, arguments); }; | ||
exports.main = function commonjsMain(args) { | ||
exports.main = function commonjsMain (args) { | ||
if (!args[1]) { | ||
@@ -737,0 +737,0 @@ console.log('Usage: '+args[0]+' FILE'); |
{ | ||
"name": "reduce-css-calc", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"description": "Reduce CSS calc() function to the maximum", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"jison": "https://github.com/download13/jison#b7d6e0de7d2c2c1bde5451b8e99813843a473315", | ||
"npmpub": "^3.1.0" | ||
"npmpub": "^4.0.0" | ||
}, | ||
@@ -42,0 +42,0 @@ "dependencies": { |
49116
0.61%1041
0.19%