Comparing version 1.4.1 to 1.4.2
@@ -0,1 +1,11 @@ | ||
## 1.4.2 (November 9, 2015) | ||
- allow spaces between `progid:` and rest part of value for IE's `filter` property as `autoprefixer` generates this kind of code (#249) | ||
- fixes for Windows: | ||
- correct processing new lines | ||
- normalize file content in test suite | ||
- fixes to work in strict mode (#252) | ||
- init compressor dictionaries for every css block (#248, #251) | ||
- bump uglify-js version | ||
## 1.4.1 (October 20, 2015) | ||
@@ -2,0 +12,0 @@ |
@@ -9,9 +9,2 @@ var translate = require('../utils/translate'); | ||
function CSSOCompressor() { | ||
this.props = {}; | ||
this.shorts = {}; | ||
this.shorts2 = {}; | ||
this.shortGroupID = 0; | ||
this.lastShortGroupID = 0; | ||
this.lastShortSelector = 0; | ||
} | ||
@@ -123,2 +116,10 @@ | ||
function compressBlock(ast, restructuring) { | ||
this.props = {}; | ||
this.shorts = {}; | ||
this.shorts2 = {}; | ||
this.shortGroupID = 0; | ||
this.lastShortGroupID = 0; | ||
this.lastShortSelector = 0; | ||
// compression without restructure | ||
@@ -125,0 +126,0 @@ ast = this.walk(rules.cleanComments, ast, '/0', 'cleanComments'); |
@@ -42,3 +42,2 @@ module.exports = { | ||
Tilde: 'Tilde', // ~ | ||
Deep: 'Deep', // /deep/ | ||
@@ -45,0 +44,0 @@ Identifier: 'Identifier', |
@@ -710,5 +710,12 @@ var TokenType = require('./const.js'); | ||
tokens[_i].type === TokenType.GreaterThanSign || | ||
tokens[_i].type === TokenType.Deep || | ||
tokens[_i].type === TokenType.Tilde) return 1; | ||
tokens[_i].type === TokenType.Tilde) { | ||
return 1; | ||
} | ||
if (tokens[_i + 0].type === TokenType.Solidus && | ||
tokens[_i + 1].type === TokenType.Identifier && tokens[_i + 1].value === 'deep' && | ||
tokens[_i + 2].type === TokenType.Solidus) { | ||
return 3; | ||
} | ||
return fail(tokens[_i]); | ||
@@ -718,5 +725,14 @@ } | ||
function getCombinator() { | ||
var combinator = tokens[pos].value; | ||
if (tokens[pos].type === TokenType.Solidus) { | ||
combinator = '/deep/'; | ||
pos += 3; | ||
} else { | ||
pos += 1; | ||
} | ||
return needInfo? | ||
[getInfo(pos), NodeType.CombinatorType, tokens[pos++].value] : | ||
[NodeType.CombinatorType, tokens[pos++].value]; | ||
[getInfo(pos), NodeType.CombinatorType, combinator] : | ||
[NodeType.CombinatorType, combinator]; | ||
} | ||
@@ -1425,4 +1441,10 @@ | ||
if ((x = joinValues2(_i, 6)) === 'progid:DXImageTransform.Microsoft.') { | ||
_i += 6; | ||
if (_i < tokens.length - 1 && tokens[_i].value === 'progid' && tokens[_i + 1].type === TokenType.Colon) { | ||
_i += 2; | ||
} else return fail(tokens[_i]); | ||
if (l = checkSC(_i)) _i += l; | ||
if ((x = joinValues2(_i, 4)) === 'DXImageTransform.Microsoft.') { | ||
_i += 4; | ||
} else return fail(tokens[_i - 1]); | ||
@@ -1429,0 +1451,0 @@ |
@@ -49,3 +49,3 @@ var TokenType = require('./const.js'); | ||
function pushToken(type, ln, column, value) { | ||
tokens.push(x = { | ||
tokens.push({ | ||
type: type, | ||
@@ -86,5 +86,2 @@ value: value, | ||
pushToken(TokenType.CommentML, ln, pos - lineStartPos, parseMLComment(s)); | ||
} else if (!urlMode && c === '/' && s.substr(pos + 1, 5) === 'deep/') { | ||
pushToken(TokenType.Deep, ln, pos - lineStartPos, '/deep/'); | ||
pos += 5; | ||
} else if (!urlMode && c === '/' && cn === '/') { | ||
@@ -99,3 +96,3 @@ if (blockMode > 0) { | ||
pushToken(c === '"' ? TokenType.StringDQ : TokenType.StringSQ, ln, pos - lineStartPos, parseString(s, c)); | ||
} else if (c === ' ' || c === '\n' || c === '\r' || c === '\t') { | ||
} else if (c === ' ' || c === '\n' || c === '\r' || c === '\t' || c === '\f') { | ||
pushToken(TokenType.Space, ln, pos - lineStartPos, parseSpaces(s)); | ||
@@ -131,6 +128,14 @@ } else if (c in Punctuation) { | ||
var c = s.charAt(pos); | ||
if (c === '\n') { | ||
// \n or \f | ||
if (c === '\n' || c === '\f') { | ||
ln++; | ||
lineStartPos = pos; | ||
} else if (c !== ' ' && c !== '\r' && c !== '\t') { | ||
// \r + optional \n | ||
} else if (c === '\r') { | ||
ln++; | ||
if (s.charAt(pos + 1) === '\n') { | ||
pos++; | ||
} | ||
lineStartPos = pos; | ||
} else if (c !== ' ' && c !== '\t') { | ||
break; | ||
@@ -168,3 +173,2 @@ } | ||
if (s.charAt(pos) === '\n' || s.charAt(pos) === '\r') { | ||
pos++; | ||
break; | ||
@@ -174,3 +178,2 @@ } | ||
pos--; | ||
return s.substring(start, pos + 1); | ||
@@ -181,6 +184,23 @@ } | ||
var start = pos; | ||
var res = ''; | ||
for (pos = pos + 1; pos < s.length; pos++) { | ||
if (s.charAt(pos) === '\\') { | ||
pos++; | ||
var next = s.charAt(pos + 1); | ||
// \n or \f | ||
if (next === '\n' || next === '\f') { | ||
res += s.substring(start, pos); | ||
start = pos + 2; | ||
pos++; | ||
// \r + optional \n | ||
} else if (next === '\r') { | ||
res += s.substring(start, pos); | ||
if (s.charAt(pos + 2) === '\n') { | ||
pos++; | ||
} | ||
start = pos + 2; | ||
pos++; | ||
} else { | ||
pos++; | ||
} | ||
} else if (s.charAt(pos) === q) { | ||
@@ -191,3 +211,3 @@ break; | ||
return s.substring(start, pos + 1); | ||
return res + s.substring(start, pos + 1); | ||
} | ||
@@ -216,3 +236,3 @@ | ||
for (; pos < s.length; pos++) { | ||
c = s.charAt(pos); | ||
var c = s.charAt(pos); | ||
if (c === '\\') { | ||
@@ -219,0 +239,0 @@ pos++; |
{ | ||
"name": "csso", | ||
"description": "CSSO — CSS optimizer", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"homepage": "https://github.com/css/csso", | ||
@@ -23,3 +23,3 @@ "author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (https://github.com/afelix)", | ||
"dependencies": { | ||
"clap": "^1.0.8" | ||
"clap": "^1.0.9" | ||
}, | ||
@@ -30,3 +30,3 @@ "devDependencies": { | ||
"mocha": "~2.3.3", | ||
"uglify-js": ">= 2.4.24" | ||
"uglify-js": ">= 2.5.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
144993
4155
Updatedclap@^1.0.9