🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

csso

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csso - npm Package Compare versions

Comparing version

to
5.0.1

2

lib/index.js

@@ -1,3 +0,3 @@

import { syntax } from './syntax.js';
import { version } from './version.js';
import * as syntax from './syntax.js';
import * as utils from './utils.js';

@@ -4,0 +4,0 @@

@@ -14,22 +14,48 @@ import { fork, string, url, tokenTypes as TYPE } from 'css-tree';

export const syntax = {
...fork({
node: {
String: {
generate(node) {
this.token(TYPE.String, encodeString(node.value));
}
},
Url: {
generate(node) {
const encodedUrl = url.encode(node.value);
const string = encodeString(node.value);
const {
lexer,
tokenize,
parse,
generate,
walk,
find,
findLast,
findAll,
fromPlainObject,
toPlainObject
} = fork({
node: {
String: {
generate(node) {
this.token(TYPE.String, encodeString(node.value));
}
},
Url: {
generate(node) {
const encodedUrl = url.encode(node.value);
const string = encodeString(node.value);
this.token(TYPE.Url, encodedUrl.length <= string.length + 5 ? encodedUrl : 'url(' + string + ')');
}
this.token(TYPE.Url,
encodedUrl.length <= string.length + 5 /* "url()".length */
? encodedUrl
: 'url(' + string + ')'
);
}
}
}),
}
});
export {
lexer,
tokenize,
parse,
generate,
walk,
find,
findLast,
findAll,
fromPlainObject,
toPlainObject,
specificity,
compress
};
{
"name": "csso",
"version": "5.0.0",
"version": "5.0.1",
"description": "CSS minifier with structural optimisations",

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

},
"./syntax": {
"import": "./lib/syntax.js",
"require": "./cjs/syntax.cjs"
},
"./dist/*": "./dist/*.js",

@@ -58,7 +62,6 @@ "./package.json": "./package.json"

"dependencies": {
"css-tree": "2.0.1"
"css-tree": "~2.0.3"
},
"devDependencies": {
"c8": "^7.10.0",
"coveralls": "^3.1.1",
"esbuild": "^0.14.1",

@@ -68,3 +71,3 @@ "eslint": "^7.24.0",

"rollup": "^2.60.2",
"source-map": "^0.6.1"
"source-map-js": "^1.0.1"
},

@@ -71,0 +74,0 @@ "engines": {

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

Also syntax can be imported using `csso/syntax` entry point:
```js
import { parse, compress, generate } from 'csso/syntax';
const ast = parse('.test { color: #ff0000; }');
const compressedAst = compress(ast).ast;
const minifiedCss = generate(compressedAst);
console.log(minifiedCss);
// .test{color:red}
```
> Warning: CSSO doesn't guarantee API behind a `syntax` field as well as AST format. Both might be changed with changes in CSSTree. If you rely heavily on `syntax` API, a better option might be to use CSSTree directly.

@@ -76,0 +89,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display