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

postcss-modules-scope

Package Overview
Dependencies
Maintainers
1
Versions
28
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 0.0.6 to 0.0.7

33

lib/index.js

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

var hasOwnProperty = Object.prototype.hasOwnProperty;
function getSingleLocalNamesForComposes(selectors) {

@@ -89,2 +91,12 @@ return selectors.nodes.map(function (node) {

// Find any :import and remember imported names
var importedNames = {};
css.eachRule(function (rule) {
if (/^:import\(.+\)$/.test(rule.selector)) {
rule.eachDecl(function (decl) {
importedNames[decl.prop] = true;
});
}
});
// Find any :local classes

@@ -99,5 +111,15 @@ css.eachRule(function (rule) {

classes.forEach(function (className) {
localNames.forEach(function (exportedName) {
exports[exportedName].push(className);
});
if (hasOwnProperty.call(importedNames, className)) {
localNames.forEach(function (exportedName) {
exports[exportedName].push(className);
});
} else if (hasOwnProperty.call(exports, className)) {
localNames.forEach(function (exportedName) {
exports[className].forEach(function (item) {
exports[exportedName].push(item);
});
});
} else {
throw decl.error('referenced class name "' + className + '" in composes not found');
}
});

@@ -137,3 +159,3 @@ decl.removeSelf();

if (exportedNames.length > 0) {
css.prepend(_postcss2['default'].rule({
css.append(_postcss2['default'].rule({
selector: ':export',

@@ -144,3 +166,4 @@ nodes: exportedNames.map(function (exportedName) {

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

@@ -147,0 +170,0 @@ })

4

package.json
{
"name": "postcss-modules-scope",
"version": "0.0.6",
"version": "0.0.7",
"description": "A CSS Modules transform to extract export statements from local-scope classes",

@@ -37,3 +37,3 @@ "main": "lib/index.js",

"dependencies": {
"css-selector-tokenizer": "^0.3.1",
"css-selector-tokenizer": "^0.5.0",
"postcss": "^4.1.11"

@@ -40,0 +40,0 @@ },

# CSS Modules: Scope Locals & Extend
[![Build Status](https://travis-ci.org/css-modules/postcss-modules-scope.svg?branch=master)](https://travis-ci.org/css-modules/postcss-modules-scope)
Transforms:

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