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.1.0 to 1.1.1

44

dist/index.js

@@ -1,14 +0,35 @@

import postcss from 'postcss';
import getRulesMatcher from './rulesMatcher';
import getResetRules from './resetRules';
import createRuleInjector from './rulesInjectorFabric';
'use strict';
export default postcss.plugin('postcss-autoreset', (opts = {}) => {
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);
var _rulesInjectorFabric = require('./rulesInjectorFabric');
var _rulesInjectorFabric2 = _interopRequireDefault(_rulesInjectorFabric);
exports['default'] = _postcss2['default'].plugin('postcss-autoreset', function () {
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
opts.rulesMatcher = opts.rulesMatcher || 'bem';
opts.reset = opts.reset || 'initial';
const rulesMatcher = getRulesMatcher(opts.rulesMatcher);
const resetRules = getResetRules(opts.reset);
const injectRule = createRuleInjector(resetRules);
return css => {
css.walkRules(rule => {
var rulesMatcher = (0, _rulesMatcher2['default'])(opts.rulesMatcher);
var resetRules = (0, _resetRules2['default'])(opts.reset);
var injectRule = (0, _rulesInjectorFabric2['default'])(resetRules);
return function (css) {
css.walkRules(function (rule) {
if (!rulesMatcher(rule)) {

@@ -20,2 +41,3 @@ return;

};
});
});
module.exports = exports['default'];

@@ -1,2 +0,7 @@

const resetSizes = {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var resetSizes = {
margin: 0,

@@ -14,3 +19,5 @@ padding: 0,

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

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

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

@@ -1,8 +0,20 @@

import jsToCss from 'postcss-js/parser';
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _postcssJsParser = require('postcss-js/parser');
var _postcssJsParser2 = _interopRequireDefault(_postcssJsParser);
function rulesInjectorFabric(obj) {
const rootProto = jsToCss(obj);
return rule => {
const root = rootProto.clone();
root.each(node => node.source = rule.source);
var rootProto = (0, _postcssJsParser2['default'])(obj);
return function (rule) {
var root = rootProto.clone();
root.each(function (node) {
return node.source = rule.source;
});
rule.insertBefore(rule.nodes[0], root);

@@ -12,2 +24,3 @@ };

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

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

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

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

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

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

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

@@ -36,9 +36,8 @@ "main": "dist/index.js",

"devDependencies": {
"babel-cli": "^6.3.17",
"babel-eslint": "^5.0.0-beta6",
"babel-preset-stage-0": "^6.3.13",
"babel-tape-runner": "^2.0.0",
"babel": "^5.8.21",
"babel-eslint": "^4.1.1",
"babel-tape-runner": "^1.2.0",
"eslint": "^1.2.1",
"husky": "^0.10.2",
"tap-difflet": "^0.4.0",
"tap-difflet": "^0.3.0",
"tap-spec": "^4.1.0"

@@ -45,0 +44,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