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

postcss-autoreset

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

postcss-autoreset - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

dist/rulesInjectorFabric.js

46

dist/index.js

@@ -1,42 +0,20 @@

'use strict';
import postcss from 'postcss';
import getRulesMatcher from './rulesMatcher';
import getResetRules from './resetRules';
import createRuleInjector from './rulesInjectorFabric';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _postcss = require('postcss');
var _postcss2 = _interopRequireDefault(_postcss);
var _rulesMatcher = require('./rulesMatcher');
var _rulesMatcher2 = _interopRequireDefault(_rulesMatcher);
var _resetRules = require('./resetRules');
var _resetRules2 = _interopRequireDefault(_resetRules);
exports['default'] = _postcss2['default'].plugin('postcss-autoreset', function () {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
export default postcss.plugin('postcss-autoreset', (opts = {}) => {
opts.rulesMatcher = opts.rulesMatcher || 'bem';
opts.reset = opts.reset || 'initial';
var rulesMatcher = (0, _rulesMatcher2['default'])(opts.rulesMatcher);
var resetRules = (0, _resetRules2['default'])(opts.reset);
return function (css) {
css.walkRules(function (rule) {
const rulesMatcher = getRulesMatcher(opts.rulesMatcher);
const resetRules = getResetRules(opts.reset);
const injectRule = createRuleInjector(resetRules);
return css => {
css.walkRules(rule => {
if (!rulesMatcher(rule)) {
return;
}
for (var prop in resetRules) {
if (!resetRules.hasOwnProperty(prop)) {
continue;
}
rule.prepend({ prop: prop, value: resetRules[prop] });
}
injectRule(rule);
});
};
});
module.exports = exports['default'];
});

@@ -1,13 +0,8 @@

'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var resetSizes = {
margin: '0',
padding: '0',
border: '0',
'font-size': '100%',
const resetSizes = {
margin: 0,
padding: 0,
border: 0,
fontSize: '100%',
font: 'inherit',
'vertical-align': 'baseline'
verticalAlign: 'baseline'
};

@@ -19,5 +14,3 @@

function getResetRules() {
var value = arguments.length <= 0 || arguments[0] === undefined ? 'initial' : arguments[0];
function getResetRules(value = 'initial') {
if (isObject(value)) {

@@ -35,3 +28,2 @@ return value;

exports['default'] = getResetRules;
module.exports = exports['default'];
export default getResetRules;

@@ -1,14 +0,9 @@

'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var matchers = {
bem: function bem(rule) {
const matchers = {
bem(rule) {
return !rule.selector.match(/--/);
},
suit: function suit(rule) {
var selector = rule.selector;
suit(rule) {
const selector = rule.selector;
return !(selector.match(/--/) || selector.match(/\.is\-/i));

@@ -18,5 +13,3 @@ }

function getRulesMatcher() {
var value = arguments.length <= 0 || arguments[0] === undefined ? 'bem' : arguments[0];
function getRulesMatcher(value = 'bem') {
if (typeof value === 'function') {

@@ -35,3 +28,2 @@ return value;

exports['default'] = getRulesMatcher;
module.exports = exports['default'];
export default getRulesMatcher;
{
"name": "postcss-autoreset",
"version": "1.0.1",
"version": "1.1.0",
"description": "PostCSS plugin for partial styles reset",

@@ -10,3 +10,4 @@ "main": "dist/index.js",

"tape": "babel-tape-runner 'test/*.js' | tap-difflet",
"test": "npm run lint && npm run tape"
"test": "npm run lint && npm run tape",
"precommit": "npm test"
},

@@ -36,13 +37,15 @@ "repository": {

"devDependencies": {
"babel": "^5.8.21",
"babel-eslint": "^4.1.1",
"babel-tape-runner": "^1.2.0",
"babel-cli": "^6.3.17",
"babel-eslint": "^5.0.0-beta6",
"babel-preset-stage-0": "^6.3.13",
"babel-tape-runner": "^2.0.0",
"eslint": "^1.2.1",
"tap-difflet": "^0.3.0",
"tap-spec": "^4.1.0",
"tape": "^4.2.0"
"husky": "^0.10.2",
"tap-difflet": "^0.4.0",
"tap-spec": "^4.1.0"
},
"dependencies": {
"postcss": "^5.0.4"
"postcss": "^5.0.4",
"postcss-js": "^0.1.1"
}
}
# PostCSS Auto Reset
[![Build Status][ci-img]][ci] [![NPM][npm-img]][npm] [![David DM][david-img]][david]

@@ -8,3 +9,3 @@

[PostCSS] plugin for automatic conditional rules reset. Useful for creation of
[PostCSS] plugin for automatic conditional rules reset. Useful for creation of
bullet-proof styles isolation in your extension. Can be used in combination with

@@ -55,3 +56,3 @@ [postcss-initial][initial].

## Options
## Options

@@ -65,3 +66,3 @@ ### reset

Use object to create your own reset.
Use object to create your own reset. CSS-in-JS notation is supported.

@@ -72,5 +73,5 @@ **Example**

reset: {
'margin': '0',
'padding': '0',
'border-radius': '0'
margin: 0,
padding: 0,
borderRadius: 0
}

@@ -77,0 +78,0 @@ })])

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