Socket
Socket
Sign inDemoInstall

postcss-modules-scope

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-modules-scope - npm Package Compare versions

Comparing version 1.0.0-beta1 to 1.0.0-beta2

41

lib/index.js

@@ -9,4 +9,2 @@ 'use strict';

function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }
var _postcss = require('postcss');

@@ -95,5 +93,5 @@

var importedNames = {};
css.eachRule(function (rule) {
css.walkRules(function (rule) {
if (/^:import\(.+\)$/.test(rule.selector)) {
rule.eachDecl(function (decl) {
rule.walkDecls(function (decl) {
importedNames[decl.prop] = true;

@@ -105,7 +103,7 @@ });

// Find any :local classes
css.eachRule(function (rule) {
css.walkRules(function (rule) {
var selector = _cssSelectorTokenizer2['default'].parse(rule.selector);
var newSelector = traverseNode(selector);
rule.selector = _cssSelectorTokenizer2['default'].stringify(newSelector);
rule.eachDecl('composes', function (decl) {
rule.walkDecls('composes', function (decl) {
var localNames = getSingleLocalNamesForComposes(selector);

@@ -128,5 +126,5 @@ var classes = decl.value.split(/\s+/);

});
decl.removeSelf();
decl.remove();
});
rule.eachDecl(function (decl) {
rule.walkDecls(function (decl) {
var tokens = decl.value.split(/(,|'[^']*'|"[^"]*")/);

@@ -149,21 +147,9 @@ tokens = tokens.map(function (token, idx) {

css.eachAtRule(function (atrule) {
// Find any :local keyframes and rewrite them
// Find any :local keyframes
css.walkAtRules(function (atrule) {
if (/keyframes$/.test(atrule.name)) {
var localKeyFrames = /^\s*:local\s*\((.+?)\)\s*$/.exec(atrule.params);
if (localKeyFrames) {
atrule.params = exportScopedName(localKeyFrames[1]);
var localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(atrule.params);
if (localMatch) {
atrule.params = exportScopedName(localMatch[1]);
}
// Find any local() custom media, export them, but leave them as they are
} else if (atrule.name === 'custom-media') {
var customMedia = /^\s*(--\S+)\s*(.*)$/.exec(atrule.params);
if (customMedia) {
var _customMedia = _slicedToArray(customMedia, 3);
var breakpointName = _customMedia[1];
var mediaExpr = _customMedia[2];
exports[breakpointName] = ['"' + mediaExpr + '"'];
atrule.params = '' + breakpointName + ' ' + mediaExpr;
}
}

@@ -181,3 +167,3 @@ });

value: exports[exportedName].join(' '),
before: '\n ',
raws: { before: '\n ' },
_autoprefixerDisabled: true

@@ -197,3 +183,2 @@ });

exports['default'] = processor;
module.exports = exports['default'];
/*match*/
module.exports = exports['default'];
{
"name": "postcss-modules-scope",
"version": "1.0.0-beta1",
"version": "1.0.0-beta2",
"description": "A CSS Modules transform to extract export statements from local-scope classes",

@@ -38,16 +38,16 @@ "main": "lib/index.js",

"css-selector-tokenizer": "^0.5.0",
"postcss": "^4.1.11"
"postcss": "^5.0.4"
},
"devDependencies": {
"babel": "^5.4.7",
"babel-eslint": "^3.1.9",
"babel-istanbul": "^0.2.10",
"babel-eslint": "^4.1.3",
"babel-istanbul": "^0.3.20",
"babelify": "^6.1.2",
"chokidar-cli": "^0.2.1",
"chokidar-cli": "^1.0.1",
"codecov.io": "^0.1.2",
"coveralls": "^2.11.2",
"css-selector-parser": "^1.0.4",
"eslint": "^0.21.2",
"eslint": "^1.5.0",
"mocha": "^2.2.5"
}
}

@@ -28,3 +28,3 @@ # CSS Modules: Scope Locals & Extend

import styles from './buttons.css'
elem.innerHTML = `<button class="${buttons.continueButton}">Continue</button>`
elem.innerHTML = `<button class="${styles.continueButton}">Continue</button>`
```

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