Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@modular-css/processor

Package Overview
Dependencies
23
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 28.1.5 to 29.0.0

4

lib/identifiers.js

@@ -5,3 +5,3 @@ "use strict";

const parser = createParser((selectors) => {
const classExtractionParser = createParser((selectors) => {
const values = [];

@@ -19,2 +19,2 @@

// Find all classes that comprise a selector and return 'em
exports.parse = (selector) => parser.transformSync(selector);
exports.parse = (selector) => classExtractionParser.transformSync(selector);
{
"name": "@modular-css/processor",
"version": "28.1.5",
"version": "29.0.0",
"description": "A streamlined reinterpretation of CSS Modules",

@@ -5,0 +5,0 @@ "main": "./processor.js",

"use strict";
const createParser = require("postcss-selector-parser");
const identifiers = require("../lib/identifiers.js");

@@ -9,2 +11,13 @@ const { selectorKey } = require("../lib/keys.js");

const validationParser = createParser((selectors) => {
const selector = selectors.at(0);
if(selector.nodes.length !== 1) {
return false;
}
return selector.nodes[0].type === "class";
});
const plugin = "modular-css-composition";

@@ -25,2 +38,15 @@

const { parent, value } = decl;
// https://github.com/tivac/modular-css/issues/238
// https://github.com/tivac/modular-css/issues/918
if(
parent.parent.type === "atrule" ||
parent.selectors.some((selector) => !validationParser.transformSync(selector))
) {
throw parent.error(
"Only simple singular class selectors may use composition", {
word : parent.selector,
}
);
}

@@ -35,23 +61,12 @@ // Map of scoped classnames to the originals

);
const selectors = parent.selectors.map(identifiers.parse);
// https://github.com/tivac/modular-css/issues/238
if(selectors.some(({ length }) => length > 1)) {
throw decl.error(
"Only simple singular selectors may use composition", {
word : parent.selector,
}
);
}
const details = parser.parse(value);
if(details.source) {
details.source = processor.resolve(from, details.source);
}
details.refs.forEach(({ global, name }) => {
let ref;
if(details.source) {

@@ -65,6 +80,6 @@ // External refs should already exist, so they don't get added

ref = processor._addSelector(from, name);
if(!available[name]) {
const rel = relative(processor.options.cwd, from);
throw decl.error(

@@ -77,5 +92,8 @@ `Invalid composes reference, .${name} does not exist in ${rel}`, {

}
// Go get all the classes from the parent selector
const classSelectors = parent.selectors.map(identifiers.parse);
// Update graph with all the dependency information
selectors.forEach((parts) =>
classSelectors.forEach((parts) =>
parts.forEach((part) => {

@@ -82,0 +100,0 @@ const src = processor._addSelector(from, selectorMap.get(part));

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc