Socket
Socket
Sign inDemoInstall

css-loader

Package Overview
Dependencies
95
Maintainers
7
Versions
151
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.2.2 to 5.2.3

6

CHANGELOG.md

@@ -5,2 +5,8 @@ # Changelog

### [5.2.3](https://github.com/webpack-contrib/css-loader/compare/v5.2.2...v5.2.3) (2021-04-19)
### Bug Fixes
* improve performance
### [5.2.2](https://github.com/webpack-contrib/css-loader/compare/v5.2.1...v5.2.2) (2021-04-16)

@@ -7,0 +13,0 @@

4

dist/plugins/postcss-import-parser.js

@@ -22,3 +22,3 @@ "use strict";

const lastCommentIndex = atRule.raws.afterName.lastIndexOf("/*");
const matched = atRule.raws.afterName.slice(lastCommentIndex).match(_utils.webpackIgnoreCommentRegexp);
const matched = atRule.raws.afterName.slice(lastCommentIndex).match(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);

@@ -33,3 +33,3 @@ if (matched && matched[2] === "true") {

if (prevNode && prevNode.type === "comment") {
const matched = prevNode.text.match(_utils.webpackIgnoreCommentRegexp);
const matched = prevNode.text.match(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);

@@ -36,0 +36,0 @@ if (matched && matched[2] === "true") {

@@ -48,3 +48,3 @@ "use strict";

const matched = prevValueNode.value.match(_utils.webpackIgnoreCommentRegexp);
const matched = prevValueNode.value.match(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);
return matched && matched[2] === "true";

@@ -78,3 +78,3 @@ }

const lastCommentIndex = declaration.raws.between.lastIndexOf("/*");
const matched = declaration.raws.between.slice(lastCommentIndex).match(_utils.webpackIgnoreCommentRegexp);
const matched = declaration.raws.between.slice(lastCommentIndex).match(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);

@@ -90,3 +90,3 @@ if (matched) {

if (prevNode && prevNode.type === "comment") {
const matched = prevNode.text.match(_utils.webpackIgnoreCommentRegexp);
const matched = prevNode.text.match(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);

@@ -93,0 +93,0 @@ if (matched) {

@@ -25,3 +25,3 @@ "use strict";

exports.combineRequests = combineRequests;
exports.webpackIgnoreCommentRegexp = void 0;
exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;

@@ -50,8 +50,5 @@ var _url = require("url");

*/
const whitespace = "[\\x20\\t\\r\\n\\f]";
const unescapeRegExp = new RegExp(`\\\\([\\da-f]{1,6}${whitespace}?|(${whitespace})|.)`, "ig");
const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
const webpackIgnoreCommentRegexp = /webpackIgnore:(\s+)?(true|false)/; // eslint-disable-next-line no-useless-escape
const WEBPACK_IGNORE_COMMENT_REGEXP = /webpackIgnore:(\s+)?(true|false)/; // eslint-disable-next-line no-useless-escape
exports.webpackIgnoreCommentRegexp = webpackIgnoreCommentRegexp;
exports.WEBPACK_IGNORE_COMMENT_REGEXP = WEBPACK_IGNORE_COMMENT_REGEXP;
const regexSingleEscape = /[ -,.\/:-@[\]\^`{-~]/;

@@ -104,16 +101,83 @@ const regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;

function gobbleHex(str) {
const lower = str.toLowerCase();
let hex = "";
let spaceTerminated = false; // eslint-disable-next-line no-undefined
for (let i = 0; i < 6 && lower[i] !== undefined; i++) {
const code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
const valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
spaceTerminated = code === 32;
if (!valid) {
break;
}
hex += lower[i];
}
if (hex.length === 0) {
// eslint-disable-next-line no-undefined
return undefined;
}
const codePoint = parseInt(hex, 16);
const isSurrogate = codePoint >= 0xd800 && codePoint <= 0xdfff; // Add special case for
// "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
// https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10ffff) {
return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
}
return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
}
const CONTAINS_ESCAPE = /\\/;
function unescape(str) {
return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => {
const high = `0x${escaped}` - 0x10000;
/* eslint-disable line-comment-position */
// NaN means non-codepoint
// Workaround erroneous numeric interpretation of +"0x"
// eslint-disable-next-line no-self-compare
const needToProcess = CONTAINS_ESCAPE.test(str);
return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint
String.fromCharCode(high + 0x10000) : // Supplemental Plane codepoint (surrogate pair)
// eslint-disable-next-line no-bitwise
String.fromCharCode(high >> 10 | 0xd800, high & 0x3ff | 0xdc00);
/* eslint-enable line-comment-position */
});
if (!needToProcess) {
return str;
}
let ret = "";
for (let i = 0; i < str.length; i++) {
if (str[i] === "\\") {
const gobbled = gobbleHex(str.slice(i + 1, i + 7)); // eslint-disable-next-line no-undefined
if (gobbled !== undefined) {
ret += gobbled[0];
i += gobbled[1]; // eslint-disable-next-line no-continue
continue;
} // Retain a pair of \\ if double escaped `\\\\`
// https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
if (str[i + 1] === "\\") {
ret += "\\";
i += 1; // eslint-disable-next-line no-continue
continue;
} // if \\ is at the end of the string retain it
// https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
if (str.length === i + 1) {
ret += str[i];
} // eslint-disable-next-line no-continue
continue;
}
ret += str[i];
}
return ret;
}

@@ -150,2 +214,4 @@

const NATIVE_WIN32_PATH = /^[A-Z]:[/\\]|^\\\\/i;
function normalizeUrl(url, isStringValue) {

@@ -158,3 +224,3 @@ let normalizedUrl = url.replace(/^( |\t\n|\r\n|\r|\f)*/g, "").replace(/( |\t\n|\r\n|\r|\f)*$/g, "");

if (matchNativeWin32Path.test(url)) {
if (NATIVE_WIN32_PATH.test(url)) {
try {

@@ -693,3 +759,3 @@ normalizedUrl = decodeURI(normalizedUrl);

if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !matchNativeWin32Path.test(url)) {
if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !NATIVE_WIN32_PATH.test(url)) {
return false;

@@ -696,0 +762,0 @@ } // `#` URLs

{
"name": "css-loader",
"version": "5.2.2",
"version": "5.2.3",
"description": "css loader module for webpack",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc