csso
Advanced tools
Comparing version 1.3.8 to 1.3.9
@@ -857,5 +857,5 @@ function TRBL(name, imp) { | ||
if (token[2][2] === '0') { | ||
if (token[3][2] === 's' && (declaration = this.findDeclaration(token))) { | ||
if ((token[3][2] === 's' || token[3][2] === 'ms') && (declaration = this.findDeclaration(token))) { | ||
var declName = declaration[2][2][2]; | ||
if (declName === '-moz-transition') return; // https://github.com/css/csso/issues/82 | ||
if (declName === '-moz-transition' || declName === 'transition') return; // https://github.com/css/csso/issues/82, also support recent Fx versions | ||
if (declName === '-moz-animation' || declName === 'animation') return; // https://github.com/css/csso/issues/100 | ||
@@ -862,0 +862,0 @@ } |
{ | ||
"name": "csso", | ||
"description": "CSSO — CSS optimizer", | ||
"version": "1.3.8", | ||
"homepage": "http://github.com/css/csso", | ||
"author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (http://github.com/afelix)", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/css/csso.git" | ||
}, | ||
"bin": "./bin/csso", | ||
"main": "./lib/cssoapi", | ||
"engines": { "node": ">=0.4.0" }, | ||
"licenses": [ { "type": "MIT" } ] | ||
"name": "csso", | ||
"description": "CSSO — CSS optimizer", | ||
"version": "1.3.9", | ||
"homepage": "http://github.com/css/csso", | ||
"author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (http://github.com/afelix)", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/css/csso.git" | ||
}, | ||
"bin": "./bin/csso", | ||
"main": "./lib/cssoapi", | ||
"engines": { | ||
"node": ">=0.4.0" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT" | ||
} | ||
], | ||
"scripts": { | ||
"test": "./node_modules/mocha/bin/mocha ./test/test.js" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1.13.0" | ||
} | ||
} | ||
@@ -0,1 +1,3 @@ | ||
[![Build Status](https://travis-ci.org/css/csso.png?branch=master)](https://travis-ci.org/css/csso) | ||
# English | ||
@@ -20,3 +22,3 @@ | ||
<!-- Yandex.Metrika counter --> | ||
<img src="//mc.yandex.ru/watch/12831025" style="position:absolute; left:-9999px;" alt="" /> | ||
<img src="https://mc.yandex.ru/watch/12831025" style="position:absolute; left:-9999px;" alt="" /> | ||
<!-- /Yandex.Metrika counter --> |
121
test/test.js
@@ -1,71 +0,82 @@ | ||
var fs = require('fs'), | ||
csso = require('./../lib/cssoapi.js'), | ||
treeToString = csso.treeToString, | ||
_parse = csso.parse, | ||
_translate = csso.translate, | ||
_compress = csso.compress, | ||
_cleanInfo = require('./../lib/util.js').cleanInfo, | ||
d_dir = __dirname + '/data', | ||
d_list = fs.readdirSync(d_dir), | ||
okn = total = 0; | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var assert = require('assert'); | ||
var csso = require('../lib/cssoapi.js'); | ||
var utils = require('../lib/util.js'); | ||
var funcs = { | ||
'p': function parse(src, match) { | ||
return treeToString(_cleanInfo(_parse(src, match, true))); | ||
}, | ||
return csso.treeToString(clean(src, match)); | ||
}, | ||
'l': function translate(src, match) { | ||
return _translate(_cleanInfo(_parse(src, match, true))); | ||
}, | ||
return csso.translate(clean(src, match)); | ||
}, | ||
'cl': function translate(src, match) { | ||
return _translate(_cleanInfo(_compress(_parse(src, match, true)))); | ||
} | ||
return csso.translate(clean(src, match, true)); | ||
} | ||
}; | ||
d_list.forEach(function(rule_dir) { | ||
if (/^test/.test(rule_dir)) { | ||
var rule = rule_dir.substring(5), | ||
path = d_dir + '/' + rule_dir + '/', | ||
list = fs.readdirSync(path), | ||
ext, | ||
files = {}, | ||
k, a, b, c, src, t, r; | ||
function parse(src, match) { | ||
return csso.parse(src, match, true); | ||
} | ||
list.forEach(function(f) { | ||
var i = f.lastIndexOf('.'); | ||
function clean(src, match, compress) { | ||
var out = parse(src, match); | ||
if (compress) { | ||
out = csso.compress(out); | ||
} | ||
if (i !== -1) { | ||
ext = f.substring(i + 1); | ||
k = f.substring(0, i); | ||
if (!(k in files)) files[k] = {}; | ||
files[k][ext] = 1; | ||
} | ||
return utils.cleanInfo(out); | ||
} | ||
function readFile(path) { | ||
return fs.readFileSync(path).toString().trim(); | ||
} | ||
function runTest(files, filePrefix, rule) { | ||
var src = readFile(filePrefix + '.css'); | ||
var basename = path.relative(__dirname, filePrefix); | ||
var test = function(fn) { | ||
it('in ' + basename, function() { | ||
assert.equal(funcs[fn](src, rule), readFile(filePrefix + '.' + fn)); | ||
}); | ||
} | ||
for (var fn in funcs) { | ||
if (fn in files) { | ||
test(fn); | ||
} | ||
} | ||
} | ||
for (k in files) { | ||
if (files[k].css) { | ||
src = readFile(path + k + '.css').trim(); | ||
t = '\'' + rule + '\' / \'' + k + '.'; | ||
for (a in funcs) { | ||
if (a in files[k]) { | ||
total++; | ||
r = (((b = funcs[a](src, rule)) == (c = readFile(path + k + '.' + a).trim()))); | ||
r && okn++; | ||
if (!r) { | ||
console.log('FAIL: ' + t + a); | ||
console.log('======= expected'); | ||
console.log(c); | ||
console.log('======= result'); | ||
console.log(b); | ||
} | ||
} | ||
} | ||
function runTestsInDir(dir, rule) { | ||
var files = {}; | ||
fs.readdirSync(dir).forEach(function(f) { | ||
var ext = path.extname(f); | ||
if (ext) { | ||
var basename = path.basename(f, ext); | ||
if (!files[basename]) { | ||
files[basename] = {}; | ||
} | ||
files[basename][ext.substring(1)] = 1; | ||
} | ||
}); | ||
for (var k in files) { | ||
runTest(files[k], path.join(dir, k), rule); | ||
} | ||
}); | ||
} | ||
console.log('Total: ' + total + '. Ok: ' + okn + '. Fail: ' + (total - okn)); | ||
describe('CSSO', function() { | ||
var testDir = path.join(__dirname, 'data'); | ||
fs.readdirSync(testDir).forEach(function(ruleDir) { | ||
var dir = path.join(testDir, ruleDir); | ||
var stat = fs.statSync(dir); | ||
if (!stat.isDirectory()) { | ||
return; | ||
} | ||
function readFile(path) { | ||
return fs.readFileSync(path).toString(); | ||
} | ||
runTestsInDir(dir, ruleDir.substring(5)); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
515577
1343
11114
24
1
1