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

postcss-loader

Package Overview
Dependencies
Maintainers
3
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-loader - npm Package Compare versions

Comparing version 6.0.0 to 6.1.0

10

dist/index.js

@@ -10,4 +10,2 @@ "use strict";

var _postcss = _interopRequireDefault(require("postcss"));
var _semver = require("semver");

@@ -46,3 +44,9 @@

const configOption = typeof options.postcssOptions === "undefined" || typeof options.postcssOptions.config === "undefined" ? true : options.postcssOptions.config;
const postcssFactory = options.implementation || _postcss.default;
const postcssFactory = (0, _utils.getPostcssImplementation)(this, options.implementation);
if (!postcssFactory) {
callback(new Error(`The Postcss implementation "${options.implementation}" not found`));
return;
}
let loadedConfig;

@@ -49,0 +53,0 @@

@@ -42,3 +42,10 @@ {

"description": "The implementation of postcss to use, instead of the locally installed version (https://github.com/postcss/postcss-loader#implementation)",
"instanceof": "Function"
"anyOf": [
{
"type": "string"
},
{
"instanceof": "Function"
}
]
}

@@ -45,0 +52,0 @@ },

@@ -12,2 +12,3 @@ "use strict";

exports.findPackageJSONDir = findPackageJSONDir;
exports.getPostcssImplementation = getPostcssImplementation;

@@ -393,2 +394,22 @@ var _path = _interopRequireDefault(require("path"));

return dir;
}
function getPostcssImplementation(loaderContext, implementation) {
let resolvedImplementation = implementation;
if (!implementation || typeof implementation === "string") {
const postcssImplPkg = implementation || "postcss";
try {
// eslint-disable-next-line import/no-dynamic-require, global-require
resolvedImplementation = require(postcssImplPkg);
} catch (error) {
loaderContext.emitError(error); // eslint-disable-next-line consistent-return
return;
}
} // eslint-disable-next-line consistent-return
return resolvedImplementation;
}
{
"name": "postcss-loader",
"version": "6.0.0",
"version": "6.1.0",
"description": "PostCSS loader for webpack",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -600,3 +600,3 @@ <div align="center">

Type: `Function`
Type: `Function | String`

@@ -607,2 +607,4 @@ The special `implementation` option determines which implementation of PostCSS to use. Overrides the locally installed `peerDependency` version of `postcss`.

#### Function
**webpack.config.js**

@@ -631,2 +633,27 @@

#### String
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{
loader: "postcss-loader",
options: { implementation: require.resolve("postcss") },
},
{ loader: "sass-loader" },
],
},
],
},
};
```
## Examples

@@ -633,0 +660,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