Socket
Socket
Sign inDemoInstall

postcss-image-inliner

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-image-inliner - npm Package Compare versions

Comparing version 7.0.0 to 7.0.1

41

lib/image.js

@@ -30,10 +30,2 @@ 'use strict';

async function reduceAsync(array = [], reducer = (r) => r, initial) {
for (const index of array.keys()) {
initial = await reducer(initial, array[index]); /* eslint-disable-line no-await-in-loop */
}
return initial;
}
async function assertSize(resource, maxFileSize, throwError = true) {

@@ -81,22 +73,23 @@ const {mime, contents = ''} = resource || {};

function getDataUriMapping(urls = [], options = {}) {
return reduceAsync(
[...new Set(urls)],
async (result, url) => {
const file = await resolve(url, options);
if (file && file.mime && /image/.test(file.mime)) {
result[url] = await getDataUri(file, options);
} else if (options.largeFileCallback) {
const largeFile = await resolve(url, {...options, maxFileSize: 0});
if (largeFile && largeFile.mime && /image/.test(largeFile.mime)) {
result[url] = await options.largeFileCallback(largeFile);
}
async function getDataUriMapping(urls = [], options = {}) {
const uniqueUrls = [...new Set(urls)];
const promises = uniqueUrls.map(async (url) => {
const file = await resolve(url, options);
if (file && file.mime && /image/.test(file.mime)) {
return [url, await getDataUri(file, options)];
}
if (options.largeFileCallback) {
const largeFile = await resolve(url, {...options, maxFileSize: 0});
if (largeFile && largeFile.mime && /image/.test(largeFile.mime)) {
return [url, await options.largeFileCallback(largeFile)];
}
}
return result;
},
{}
);
return [url, null];
});
const results = await Promise.all(promises);
return Object.fromEntries(results);
}
module.exports.getDataUriMapping = getDataUriMapping;
{
"name": "postcss-image-inliner",
"version": "7.0.0",
"version": "7.0.1",
"description": "PostCSS plugin to inline images into css",

@@ -5,0 +5,0 @@ "keywords": [

@@ -97,1 +97,9 @@ # PostCSS Image Inliner [![Build Status][ci-img]][ci]

Fail on error.
#### filter
* Type: `regex`
* Default: `/^(background(?:-image)?)|(content)|(cursor)/`
* Required: `false`
Regex to match the CSS properties to be inlined.
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