Socket
Socket
Sign inDemoInstall

csso

Package Overview
Dependencies
3
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.5.1 to 4.0.0

CHANGELOG.md

2

lib/clean/Rule.js

@@ -15,3 +15,3 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;

// ignore selectors inside :not()
if (this['function'] === null || this['function'].name.toLowerCase() !== 'not') {
if (this.function === null || this.function.name.toLowerCase() !== 'not') {
if (cleanUnused(node, usageData)) {

@@ -18,0 +18,0 @@ shouldRemove = true;

@@ -96,5 +96,7 @@ var List = require('css-tree').List;

function getRestructureOption(options) {
return 'restructure' in options ? options.restructure :
'restructuring' in options ? options.restructuring :
true;
if ('restructure' in options) {
return options.restructure;
}
return 'restructuring' in options ? options.restructuring : true;
}

@@ -101,0 +103,0 @@

@@ -111,3 +111,3 @@ var csstree = require('css-tree');

return tmp;
})());
}()));
} else {

@@ -138,7 +138,6 @@ result = debugOutput('generate', options, Date.now(), {

// compress an AST
compress: compress,
// css syntax parser/walkers/generator/etc
syntax: csstree
syntax: Object.assign({
compress: compress
}, csstree)
};

@@ -376,3 +376,3 @@ var lexer = require('css-tree').lexer;

// http://stackoverflow.com/questions/11829410/css3-gradient-rendering-issues-from-transparent-to-white
var scopeFunctionName = this['function'] && this['function'].name;
var scopeFunctionName = this.function && this.function.name;
if ((args[0] === 0 && args[1] === 0 && args[2] === 0) ||

@@ -379,0 +379,0 @@ !/^(?:to|from|color-stop)$|gradient$/i.test(scopeFunctionName)) {

@@ -46,3 +46,3 @@ var packNumber = require('./Number').pack;

// issue #222: don't remove units inside calc
if (this['function'] && this['function'].name === 'calc') {
if (this.function && this.function.name === 'calc') {
return;

@@ -49,0 +49,0 @@ }

@@ -154,2 +154,6 @@ var resolveProperty = require('css-tree').property;

if (/\\[09]/.test(unit)) {
iehack = RegExp.lastMatch;
}
switch (unit) {

@@ -156,0 +160,0 @@ // is not supported until IE11

@@ -127,3 +127,3 @@ var List = require('css-tree').List;

block.children = new List().fromArray(diff.ne1);
prevBlock.children = new List().fromArray(diff.ne2.concat(diff.ne2overrided));
prevBlock.children = new List().fromArray(diff.ne2overrided);
list.insert(list.createItem(newRule), prevItem);

@@ -130,0 +130,0 @@ return true;

@@ -36,3 +36,2 @@ module.exports = function specificity(simpleSelector) {

// TODO: support for :nth-*(.. of <SelectorList>), :matches(), :has()
default:

@@ -39,0 +38,0 @@ B++;

@@ -61,10 +61,10 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;

if (declarations2hash[data.id]) {
// if declarations1 has overriding declaration, this is not a difference
// but take in account !important - prev should be equal or greater than follow
if (hasOwnProperty.call(fingerprints, data.fingerprint) &&
Number(fingerprints[data.fingerprint]) >= Number(data.important)) {
result.ne2overrided.push(data);
} else {
// when declarations1 has an overriding declaration, this is not a difference
// unless no !important is used on prev and !important is used on the following
if (!hasOwnProperty.call(fingerprints, data.fingerprint) ||
(!fingerprints[data.fingerprint] && data.important)) {
result.ne2.push(data);
}
result.ne2overrided.push(data);
}

@@ -71,0 +71,0 @@ }

{
"name": "csso",
"version": "3.5.1",
"version": "4.0.0",
"description": "CSS minifier with structural optimisations",
"keywords": [
"css",
"compress",
"minifier",
"minify",
"optimise",
"optimisation",
"csstree"
],
"homepage": "https://github.com/css/csso",

@@ -28,2 +19,11 @@ "author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (https://github.com/afelix)",

},
"keywords": [
"css",
"compress",
"minifier",
"minify",
"optimise",
"optimisation",
"csstree"
],
"main": "./lib/index",

@@ -50,37 +50,36 @@ "eslintConfig": {

"test": "mocha --reporter dot",
"codestyle": "jscs lib test && eslint lib test",
"codestyle-and-test": "npm run codestyle && npm test",
"lint": "eslint lib test",
"lint-and-test": "npm run lint && npm test",
"build": "rollup --config && terser dist/csso.js --compress --mangle -o dist/csso.min.js",
"coverage": "nyc npm test",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"travis": "nyc npm run lint-and-test && npm run coveralls",
"hydrogen": "node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --trace_hydrogen_file=code.cfg --print-opt-code bin/csso --stat -o /dev/null",
"coverage": "istanbul cover _mocha -- -R dot",
"coveralls": "istanbul cover _mocha --report lcovonly -- -R dot && cat ./coverage/lcov.info | coveralls",
"travis": "npm run codestyle-and-test && npm run coveralls",
"browserify": "browserify -t package-json-versionify --standalone csso lib/index.js | uglifyjs --compress --mangle -o dist/csso-browser.js",
"gh-pages": "git clone --depth=1 -b gh-pages https://github.com/css/csso.git .gh-pages && npm run browserify && cp dist/csso-browser.js .gh-pages/ && cd .gh-pages && git commit -am \"update\" && git push && cd .. && rm -rf .gh-pages",
"prepublish": "npm run browserify",
"gh-pages": "git clone --depth=1 -b gh-pages https://github.com/css/csso.git .gh-pages && npm run build && cp dist/csso.min.js .gh-pages/ && cd .gh-pages && git commit -am \"update\" && git push && cd .. && rm -rf .gh-pages",
"prepublishOnly": "npm run build",
"postpublish": "npm run gh-pages"
},
"dependencies": {
"css-tree": "1.0.0-alpha.29"
"css-tree": "1.0.0-alpha.36"
},
"devDependencies": {
"browserify": "^13.0.0",
"coveralls": "^2.11.6",
"eslint": "^2.2.0",
"istanbul": "^0.4.2",
"jscs": "~3.0.7",
"mocha": "^3.5.3",
"package-json-versionify": "^1.0.4",
"coveralls": "^3.0.7",
"eslint": "^6.5.1",
"mocha": "^5.2.0",
"nyc": "^14.1.0",
"rollup": "^1.23.1",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"source-map": "^0.5.6",
"uglify-js": "^2.6.1"
"terser": "^4.3.8"
},
"engines": {
"node": ">=0.10.0"
"node": ">=8.0.0"
},
"files": [
"dist/csso-browser.js",
"lib",
"HISTORY.md",
"LICENSE",
"README.md"
"dist/csso.js",
"dist/csso.min.js",
"lib"
]
}

@@ -31,15 +31,14 @@ [![NPM version](https://img.shields.io/npm/v/csso.svg)](https://www.npmjs.com/package/csso)

<!-- MarkdownTOC -->
<!-- TOC depthfrom:3 -->
- [minify\(source\[, options\]\)](#minifysource-options)
- [minifyBlock\(source\[, options\]\)](#minifyblocksource-options)
- [compress\(ast\[, options\]\)](#compressast-options)
- [minify(source[, options])](#minifysource-options)
- [minifyBlock(source[, options])](#minifyblocksource-options)
- [syntax.compress(ast[, options])](#syntaxcompressast-options)
- [Source maps](#source-maps)
- [Usage data](#usage-data)
- [White list filtering](#white-list-filtering)
- [Black list filtering](#black-list-filtering)
- [Scopes](#scopes)
- [Debugging](#debugging)
- [White list filtering](#white-list-filtering)
- [Black list filtering](#black-list-filtering)
- [Scopes](#scopes)
<!-- /MarkdownTOC -->
<!-- /TOC -->

@@ -62,3 +61,3 @@ Basic usage:

var ast = csso.syntax.parse('.test { color: #ff0000; }');
var compressedAst = csso.compress(ast).ast;
var compressedAst = csso.syntax.compress(ast).ast;
var minifiedCss = csso.syntax.generate(compressedAst);

@@ -70,3 +69,3 @@

> Warning: CSSO uses early versions of CSSTree that still in active development. CSSO doesn't guarantee API behind `syntax` field or AST format will not change in future releases of CSSO, since it's subject to change in CSSTree. Be carefull with CSSO updates if you use `syntax` API until this warning removal.
> Warning: CSSO uses early versions of CSSTree that still in active development. CSSO doesn't guarantee API behind `syntax` field or AST format will not change in future releases of CSSO, since it's subject to change in CSSTree. Be careful with CSSO updates if you use `syntax` API until this warning removal.

@@ -128,5 +127,5 @@ ### minify(source[, options])

Called right after [`compress()`](#compressast-options) is run.
Called right after [`syntax.compress()`](#syntaxcompressast-options) is run.
- Other options are the same as for [`compress()`](#compressast-options) function.
- Other options are the same as for [`syntax.compress()`](#syntaxcompressast-options) function.

@@ -144,7 +143,7 @@ ### minifyBlock(source[, options])

### compress(ast[, options])
### syntax.compress(ast[, options])
Does the main task – compress an AST.
Does the main task – compress an AST. This is CSSO's extension in CSSTree syntax API.
> NOTE: `compress()` performs AST compression by transforming input AST by default (since AST cloning is expensive and needed in rare cases). Use `clone` option with truthy value in case you want to keep input AST untouched.
> NOTE: `syntax.compress()` performs AST compression by transforming input AST by default (since AST cloning is expensive and needed in rare cases). Use `clone` option with truthy value in case you want to keep input AST untouched.

@@ -378,5 +377,1 @@ Returns an object with properties:

Currently the optimizer doesn't care about changing order safety for out-of-bounds selectors (i.e. selectors that match to elements without class name, e.g. `.scope div` or `.scope ~ :last-child`). It assumes that scoped CSS modules doesn't relay on it's order. It may be fix in future if to be an issue.
### Debugging
> TODO

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc