stylehacks
Advanced tools
Comparing version 4.0.0-nightly.2020.1.9 to 4.0.0-nightly.2020.1.11
@@ -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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
23844
552
0
1
+ Addedcssesc@3.0.0(transitive)
+ Addednanoid@3.3.7(transitive)
+ Addedpostcss@8.4.47(transitive)
+ Addedpostcss-selector-parser@6.1.2(transitive)
+ Addedsource-map-js@1.2.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedpostcss@^7.0.16
- Removeddot-prop@5.3.0(transitive)
- Removedindexes-of@1.0.1(transitive)
- Removedis-obj@2.0.0(transitive)
- Removedpicocolors@0.2.1(transitive)
- Removedpostcss@7.0.39(transitive)
- Removedpostcss-selector-parser@3.1.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removeduniq@1.0.1(transitive)
Updatedbrowserslist@^4.16.0