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

postcss-modules-values-replace

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-modules-values-replace - npm Package Compare versions

Comparing version 1.2.1 to 2.0.0

31

index.js

@@ -1,6 +0,6 @@

import postcss from 'postcss';
import path from 'path';
import promisify from 'es6-promisify';
import { CachedInputFileSystem, NodeJsInputFileSystem, ResolverFactory } from 'enhanced-resolve';
import replaceSymbols, { replaceAll } from 'icss-replace-symbols';
const postcss = require('postcss');
const path = require('path');
const promisify = require('es6-promisify');
const { CachedInputFileSystem, NodeJsInputFileSystem, ResolverFactory } = require('enhanced-resolve');
const { replaceValueSymbols } = require('icss-utils');

@@ -25,5 +25,5 @@ const matchImports = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;

while (matches = matchValueDefinition.exec(atRule.params)) {
const [/* match*/, requiredName, middle, value, end] = matches;
const [/* match */, requiredName, middle, value, end] = matches;
// Add to the definitions, knowing that values can refer to each other
definition[requiredName] = replaceAll(existingDefinitions, value);
definition[requiredName] = replaceValueSymbols(value, existingDefinitions);

@@ -46,3 +46,3 @@ if (!requiredDefinitions) {

if (tokens) {
const [/* match*/, theirName, myName = theirName] = tokens;
const [/* match */, theirName, myName = theirName] = tokens;
imports[theirName] = myName;

@@ -71,6 +71,7 @@ } else {

// eslint-disable-next-line prefer-const
let [/* match*/, aliases, pathString] = matches;
let [/* match */, aliases, pathString] = matches;
// We can use constants for path names
if (existingDefinitions[pathString]) {
// eslint-disable-next-line prefer-destructuring
pathString = existingDefinitions[pathString];

@@ -140,3 +141,9 @@ }

});
replaceSymbols(root, definitions);
root.walk((node) => {
if (node.type === 'decl') {
// eslint-disable-next-line no-param-reassign
node.value = replaceValueSymbols(node.value, definitions);
}
});
};

@@ -146,4 +153,4 @@

const plugin = postcss.plugin(PLUGIN, factory);
module.exports = plugin; // support old good require
export default plugin;
module.exports = plugin;
exports.default = plugin;
{
"name": "postcss-modules-values-replace",
"version": "1.2.1",
"version": "2.0.0",
"description": "PostCSS plugin to work around CSS Modules values limitations",

@@ -11,6 +11,4 @@ "keywords": [

],
"main": "lib",
"files": [
"index.js",
"lib"
"index.js"
],

@@ -25,32 +23,18 @@ "author": "Eugene Datsky <eugene@datsky.ru>",

"dependencies": {
"@ava/babel-preset-stage-4": "^1.0.0",
"enhanced-resolve": "^3.1.0",
"es6-promisify": "^5.0.0",
"icss-replace-symbols": "^1.0.2",
"postcss": "^5.2.5"
"icss-utils": "^3.0.1",
"postcss": "^6.0.1"
},
"devDependencies": {
"ava": "^0.18.1",
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
"babel-polyfill": "^6.16.0",
"babel-register": "^6.22.0",
"eslint": "^3.9.0",
"eslint-config-airbnb-base": "^10.0.1",
"eslint-plugin-import": "^2.2.0"
"ava": "^0.24.0",
"eslint": "^4.15.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.5.0"
},
"scripts": {
"build": "babel --out-dir lib index.js",
"lint": "eslint *.js",
"prepublish": "npm run lint && npm run build",
"prepublish": "npm test",
"test": "npm run lint && ava"
},
"ava": {
"require": "babel-register"
},
"babel": {
"presets": [
"@ava/stage-4"
]
},
"eslintConfig": {

@@ -57,0 +41,0 @@ "extends": "eslint-config-airbnb-base"

@@ -75,3 +75,3 @@ # PostCSS Modules Values Replace [![Build Status][ci-img]][ci]

require('postcss-modules-values-replace')({fs: ctx.webpack._compiler.inputFileSystem}),
require('postcss-color-function'),
require('postcss-calc'),
]

@@ -157,3 +157,4 @@ });

[postcss-color-function] and other plugins probably won't work *inside* **@value** as they don't traverse media queries.
[postcss-calc] and [postcss-color-function] are known to work *inside* **@value** as they traverse media queries.
Experience with other plugins may differ if they ignore media queries.

@@ -160,0 +161,0 @@ ### Extracting values for programmatic use

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