New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 3.1.0 to 3.2.0

20

index.js

@@ -6,2 +6,3 @@ const postcss = require('postcss');

const valuesParser = require('postcss-values-parser');
const { urlToRequest } = require('loader-utils');

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

resolve: resolveOptions = {},
preprocessValues = false,
importsAsModuleRequests = false,
} = {}) => async (root, rootResult) => {

@@ -149,6 +152,19 @@ const resolver = ResolverFactory.createResolver(Object.assign(

let preprocessPlugins = [];
if (preprocessValues) {
const rootPlugins = rootResult.processor.plugins;
const oursPluginIndex = rootPlugins
.findIndex(plugin => plugin.postcssPlugin === PLUGIN);
preprocessPlugins = rootPlugins.slice(0, oursPluginIndex);
}
async function walkFile(from, dir, requiredDefinitions) {
const resolvedFrom = await resolve(concordContext, dir, from);
const request = importsAsModuleRequests ? urlToRequest(from) : from;
const resolvedFrom = await resolve(concordContext, dir, request);
const content = await readFile(resolvedFrom);
const result = await postcss([walkerPlugin(walk, requiredDefinitions, walkFile)])
const plugins = [
...preprocessPlugins,
walkerPlugin(walk, requiredDefinitions, walkFile),
];
const result = await postcss(plugins)
.process(content, { from: resolvedFrom });

@@ -155,0 +171,0 @@

5

package.json
{
"name": "postcss-modules-values-replace",
"version": "3.1.0",
"version": "3.2.0",
"description": "PostCSS plugin to work around CSS Modules values limitations",

@@ -24,3 +24,4 @@ "keywords": [

"es6-promisify": "^5.0.0",
"postcss": "^6.0.1",
"loader-utils": "^2.0.0",
"postcss": "^7.0.0",
"postcss-values-parser": "^1.3.1"

@@ -27,0 +28,0 @@ },

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

[postcss-color-function]: https://github.com/postcss/postcss-color-function
[postcss-modules-tilda]: https://github.com/princed/postcss-modules-tilda
[postcss-modules-values]: https://github.com/css-modules/postcss-modules-values

@@ -113,2 +114,11 @@ [modules-values-extract]: https://github.com/alexhisen/modules-values-extract

#### preprocessValues `boolean`
When enabled, permit plugins defined earlier in the PostCSS pipeline to modify `@value` declarations before they are recorded by this plugin.
#### importsAsModuleRequests `boolean`
When enabled, value imports will be resolved as module requests, in line with `css-loader`'s resolution logic [as of 2.0.0](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md#200-2018-12-07).
If your code is written with pre-2.0 import syntax, and utilises [postcss-modules-tilda] for compatibility, this option is not required.
### calc() and @value

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