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

postcss-modules

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-modules - npm Package Compare versions

Comparing version 4.1.3 to 4.2.0

10

build/index.js

@@ -112,4 +112,12 @@ "use strict";

const loader = getLoader(opts, loaderPlugins);
const parser = new _parser2.default(loader.fetch.bind(loader));
const fetcher = function fetcher(file, relativeTo, depTrace) {
const resolvedResult = typeof opts.resolve === 'function' && opts.resolve(file);
const resolvedFile = resolvedResult instanceof Promise ? resolvedResult : Promise.resolve(resolvedResult);
return resolvedFile.then(function (f = file) {
return loader.fetch.call(loader, f || file, relativeTo, depTrace);
});
};
const parser = new _parser2.default(fetcher);
yield (0, _postcss2.default)([...pluginList, parser.plugin()]).process(css, {

@@ -116,0 +124,0 @@ from: inputFile

# Changelog
## 4.2.0
- Added the `resolve` option to configure lookup paths for composes/from by @kamilic https://github.com/madyankin/postcss-modules/pull/126
## 4.1.3

@@ -4,0 +8,0 @@

@@ -51,2 +51,4 @@ import type { Plugin } from "postcss";

Loader?: typeof Loader;
resolve?: (file: string) => string | Promise<string>;
}

@@ -53,0 +55,0 @@

2

package.json
{
"name": "postcss-modules",
"version": "4.1.3",
"version": "4.2.0",
"description": "PostCSS plugin to use CSS Modules everywhere",

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

@@ -8,4 +8,12 @@ # postcss-modules

What is this? For example, you have the following CSS:
## Support the developer
I maintain the plugin in my free time, so I don't receive any payment for this work.
To have better docs, new features and integrations with frameworks, you can [support me on Patreon](https://www.patreon.com/bePatron?u=25976212).
## What is this?
For example, you have the following CSS:
```css

@@ -207,2 +215,20 @@ /* styles.css */

### Resolve path alias
You can rewrite paths for `composes/from` by using `resolve` options.
It's useful when you need to resolve custom path alias.
```js
postcss([
require("postcss-modules")({
resolve: function (file) {
return file.replace(/^@/, process.cwd());
},
}),
]);
```
`resolve` may also return a `Promise<string>`.
## Integration with templates

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