Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stylehacks

Package Overview
Dependencies
Maintainers
6
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylehacks - npm Package Compare versions

Comparing version 4.0.0-nightly.2020.1.9 to 4.0.0-nightly.2020.1.11

70

dist/index.js

@@ -8,4 +8,2 @@ "use strict";

var _postcss = _interopRequireDefault(require("postcss"));
var _browserslist = _interopRequireDefault(require("browserslist"));

@@ -17,41 +15,48 @@

const stylehacks = _postcss.default.plugin('stylehacks', (opts = {}) => {
return (css, result) => {
const resultOpts = result.opts || {};
const browsers = (0, _browserslist.default)(null, {
stats: resultOpts.stats,
path: __dirname,
env: resultOpts.env
});
function pluginCreator(opts = {}) {
return {
postcssPlugin: 'stylehacks',
const processors = _plugins.default.reduce((list, Plugin) => {
const hack = new Plugin(result);
const applied = browsers.some(browser => {
return hack.targets.some(target => browser === target);
OnceExit(css, {
result
}) {
const resultOpts = result.opts || {};
const browsers = (0, _browserslist.default)(null, {
stats: resultOpts.stats,
path: __dirname,
env: resultOpts.env
});
if (applied) {
return list;
}
const processors = _plugins.default.reduce((list, Plugin) => {
const hack = new Plugin(result);
const applied = browsers.some(browser => {
return hack.targets.some(target => browser === target);
});
return [...list, hack];
}, []);
css.walk(node => {
processors.forEach(proc => {
if (!~proc.nodeTypes.indexOf(node.type)) {
return;
if (applied) {
return list;
}
if (opts.lint) {
return proc.detectAndWarn(node);
}
return [...list, hack];
}, []);
return proc.detectAndResolve(node);
css.walk(node => {
processors.forEach(proc => {
if (!~proc.nodeTypes.indexOf(node.type)) {
return;
}
if (opts.lint) {
return proc.detectAndWarn(node);
}
return proc.detectAndResolve(node);
});
});
});
}
};
});
}
stylehacks.detect = node => {
pluginCreator.detect = node => {
return _plugins.default.some(Plugin => {

@@ -63,4 +68,5 @@ const hack = new Plugin();

var _default = stylehacks;
pluginCreator.postcss = true;
var _default = pluginCreator;
exports.default = _default;
module.exports = exports.default;

@@ -8,4 +8,2 @@ "use strict";

var _postcss = _interopRequireDefault(require("postcss"));
var _plugin = _interopRequireDefault(require("../plugin"));

@@ -17,7 +15,17 @@

var _postcss2 = require("../dictionary/postcss");
var _postcss = require("../dictionary/postcss");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _plugin.default)([_browsers.IE_6], [_postcss2.DECL], function (decl) {
function vendorPrefix(prop) {
let match = prop.match(/^(-\w+-)/);
if (match) {
return match[0];
}
return '';
}
var _default = (0, _plugin.default)([_browsers.IE_6], [_postcss.DECL], function (decl) {
const {

@@ -34,3 +42,3 @@ before

if (decl.prop[0] === '-' && decl.prop[1] !== '-' && _postcss.default.vendor.prefix(decl.prop) === '') {
if (decl.prop[0] === '-' && decl.prop[1] !== '-' && vendorPrefix(decl.prop) === '') {
this.push(decl, {

@@ -37,0 +45,0 @@ identifier: _identifiers.PROPERTY,

{
"name": "stylehacks",
"version": "4.0.0-nightly.2020.1.9",
"version": "4.0.0-nightly.2020.1.11",
"description": "Detect/remove browser hacks from CSS files.",

@@ -34,5 +34,4 @@ "main": "dist/index.js",

"dependencies": {
"browserslist": "^4.6.0",
"postcss": "^7.0.16",
"postcss-selector-parser": "^3.1.1"
"browserslist": "^4.16.0",
"postcss-selector-parser": "^6.0.4"
},

@@ -44,3 +43,9 @@ "bugs": {

"node": ">=10.13.0"
},
"devDependencies": {
"postcss": "^8.2.1"
},
"peerDependencies": {
"postcss": "^8.2.1"
}
}
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