New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

minify-html-literals

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minify-html-literals - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [1.3.2](https://github.com/asyncLiz/minify-html-literals/compare/v1.3.1...v1.3.2) (2020-08-18)
### Bug Fixes
* css tagged templates not respecting semicolons ([#22](https://github.com/asyncLiz/minify-html-literals/issues/22)) ([3651a0b](https://github.com/asyncLiz/minify-html-literals/commit/3651a0bc30167deccdfb21b4177827072df16cb5))
### [1.3.1](https://github.com/asyncLiz/minify-html-literals/compare/v1.3.0...v1.3.1) (2020-06-10)

@@ -7,0 +14,0 @@

4

package.json
{
"name": "minify-html-literals",
"version": "1.3.1",
"version": "1.3.2",
"description": "Minify HTML template literal strings",

@@ -81,3 +81,3 @@ "main": "index.js",

"source-map-support": "^0.5.6",
"standard-version": "^8.0.0",
"standard-version": "^9.0.0",
"ts-node": "^7.0.0",

@@ -84,0 +84,0 @@ "typescript": "^2.9.2"

@@ -75,1 +75,2 @@ import * as CleanCSS from 'clean-css';

export declare const defaultStrategy: Strategy<HTMLOptions, CleanCSS.Options>;
export declare function adjustMinifyCSSOptions(options?: CleanCSS.Options): CleanCSS.Options;

@@ -62,15 +62,4 @@ "use strict";

}
if (minifyCSSOptions && typeof minifyCSSOptions.level === 'undefined') {
minifyCSSOptions.level = {
1: {
transform(_property, value) {
if (value.startsWith('@TEMPLATE_EXPRESSION') &&
!value.endsWith(';')) {
// The CSS minifier has removed the semicolon from the placeholder
// and we need to add it back.
return `${value};`;
}
}
}
};
if (minifyCSSOptions) {
minifyCSSOptions = adjustMinifyCSSOptions(minifyCSSOptions);
}

@@ -83,3 +72,3 @@ return html_minifier_1.minify(html, {

minifyCSS(css, options = {}) {
const output = new CleanCSS(options).minify(css);
const output = new CleanCSS(adjustMinifyCSSOptions(options)).minify(css);
if (output.errors && output.errors.length) {

@@ -96,2 +85,57 @@ throw new Error(output.errors.join('\n\n'));

};
function adjustMinifyCSSOptions(options = {}) {
const levelOne = {
transform(_property, value) {
if (value.startsWith('@TEMPLATE_EXPRESSION') && !value.endsWith(';')) {
// The CSS minifier has removed the semicolon from the placeholder
// and we need to add it back.
return `${value};`;
}
else {
return value;
}
}
};
const level = options.level;
if (typeof level === 'undefined' || level === 1) {
return {
...options,
level: {
1: levelOne
}
};
}
else if (level === 2) {
return {
...options,
level: {
1: levelOne,
2: { all: true }
}
};
}
else if (level === 0) {
return {
...options,
level: 0
};
}
else {
const newLevel = { ...level };
if (!newLevel[1]) {
newLevel[1] = levelOne;
}
else {
newLevel[1] = {
...levelOne,
...newLevel[1]
};
}
return {
...options,
level: newLevel
};
}
}
exports.adjustMinifyCSSOptions = adjustMinifyCSSOptions;
//# sourceMappingURL=strategy.js.map

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc