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

postcss-loader

Package Overview
Dependencies
Maintainers
4
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 7.3.0 to 7.3.1

20

dist/index.js

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

var _path = _interopRequireDefault(require("path"));
var _semver = require("semver");
var _package = _interopRequireDefault(require("postcss/package.json"));
var _Warning = _interopRequireDefault(require("./Warning"));
var _options = _interopRequireDefault(require("./options.json"));

@@ -34,4 +32,10 @@ var _utils = require("./utils");

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

@@ -67,3 +71,5 @@ return;

// Reuse PostCSS AST from other loaders
if (meta && meta.ast && meta.ast.type === "postcss" && (0, _semver.satisfies)(meta.ast.version, `^${_package.default.version}`)) {
if (meta && meta.ast && meta.ast.type === "postcss" &&
// eslint-disable-next-line global-require
require("semver").satisfies(meta.ast.version, `^${_package.default.version}`)) {
({

@@ -80,3 +86,3 @@ root

try {
processor = postcssFactory(plugins);
processor = implementation(plugins);
result = await processor.process(root || content, processOptions);

@@ -120,3 +126,3 @@ } catch (error) {

for (const warning of result.warnings()) {
this.emitWarning(new _Warning.default(warning));
this.emitWarning((0, _utils.warningFactory)(warning));
}

@@ -123,0 +129,0 @@ for (const message of result.messages) {

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

exports.reportError = reportError;
exports.warningFactory = warningFactory;
var _path = _interopRequireDefault(require("path"));

@@ -20,3 +21,2 @@ var _url = _interopRequireDefault(require("url"));

var _cosmiconfig = require("cosmiconfig");
var _Error = _interopRequireDefault(require("./Error"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -395,11 +395,5 @@ const parentModule = module;

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 import/no-dynamic-require, global-require
resolvedImplementation = require(postcssImplPkg);
}

@@ -415,6 +409,40 @@

if (error.name === "CssSyntaxError") {
callback(new _Error.default(error));
callback(syntaxErrorFactory(error));
} else {
callback(error);
}
}
function warningFactory(obj) {
let message = "";
if (typeof obj.line !== "undefined") {
message += `(${obj.line}:${obj.column}) `;
}
if (typeof obj.plugin !== "undefined") {
message += `from "${obj.plugin}" plugin: `;
}
message += obj.text;
if (obj.node) {
message += `\n\nCode:\n ${obj.node.toString()}\n`;
}
const warning = new Error(message);
warning.stack = null;
return warning;
}
function syntaxErrorFactory(obj) {
let message = "\nSyntaxError\n\n";
if (typeof obj.line !== "undefined") {
message += `(${obj.line}:${obj.column}) `;
}
if (typeof obj.plugin !== "undefined") {
message += `from "${obj.plugin}" plugin: `;
}
message += obj.file ? `${obj.file} ` : "<css input> ";
message += `${obj.reason}`;
const code = obj.showSourceCode();
if (code) {
message += `\n\n${code}\n`;
}
const error = new Error(message);
error.stack = null;
return error;
}
{
"name": "postcss-loader",
"version": "7.3.0",
"version": "7.3.1",
"description": "PostCSS loader for webpack",

@@ -29,2 +29,5 @@ "license": "MIT",

"lint": "npm-run-all -l -p \"lint:**\"",
"fix:js": "npm run lint:js -- --fix",
"fix:prettier": "npm run lint:prettier -- --write",
"fix": "npm-run-all -l fix:js fix:prettier",
"test:only": "cross-env NODE_ENV=test jest",

@@ -31,0 +34,0 @@ "test:watch": "npm run test:only -- --watch",

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

Webpack chat: [![chat][chat]][chat-url]
Webpack discussion: [![discussion][discussion]][discussion-url]

@@ -1171,4 +1171,4 @@ PostCSS chat: [![chat-postcss][chat-postcss]][chat-postcss-url]

[cover-url]: https://codecov.io/gh/webpack-contrib/postcss-loader
[chat]: https://badges.gitter.im/webpack/webpack.svg
[chat-url]: https://gitter.im/webpack/webpack
[discussion]: https://img.shields.io/github/discussions/webpack/webpack
[discussion-url]: https://github.com/webpack/webpack/discussions
[chat-postcss]: https://badges.gitter.im/postcss/postcss.svg

@@ -1175,0 +1175,0 @@ [chat-postcss-url]: https://gitter.im/postcss/postcss

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