Socket
Socket
Sign inDemoInstall

postcss-image-inliner

Package Overview
Dependencies
143
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0 to 6.0.0

12

index.js
'use strict';
const debug = require('debug')('image-inliner');
const escapeRegExp = require('escape-string-regexp');
const {getDataUriMapping} = require('./lib/image');

@@ -12,2 +11,12 @@

strict: false,
svgoPlugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
],
};

@@ -44,2 +53,3 @@

const mapping = await getDataUriMapping([...urls], options);
const {default: escapeRegExp} = await import('escape-string-regexp');

@@ -46,0 +56,0 @@ root.walkDecls(

10

lib/image.js
'use strict';
const path = require('path');
const SVGO = require('svgo');
const {optimize /* , extendDefaultPlugins */} = require('svgo');
const filesize = require('filesize');

@@ -9,4 +9,2 @@ const debug = require('debug')('image-inliner');

const svgo = new SVGO();
// Borrowed from https://github.com/filamentgroup/directory-encoder/blob/master/lib/svg-uri-encoder.js

@@ -56,3 +54,7 @@ function encodeSvg(content) {

if (file.mime === 'image/svg+xml' && !options.b64Svg) {
const optimized = await svgo.optimize(file.contents.toString('utf-8'));
const optimized = await optimize(file.contents.toString('utf-8'), {
path: file.path,
multipass: true,
plugins: options.svgoPlugins,
});
return `data:image/svg+xml,${encodeSvg(optimized.data)}`;

@@ -59,0 +61,0 @@ }

{
"name": "postcss-image-inliner",
"version": "5.0.0",
"version": "6.0.0",
"description": "PostCSS plugin to inline images into css",

@@ -24,15 +24,20 @@ "keywords": [

"dependencies": {
"asset-resolver": "^3.0.4",
"debug": "^4.3.1",
"escape-string-regexp": "^4.0.0",
"filesize": "^6.1.0",
"svgo": "^1.3.2"
"asset-resolver": "^3.0.5",
"debug": "^4.3.4",
"escape-string-regexp": "^5.0.0",
"filesize": "^9.0.11",
"svgo": "^2.8.0"
},
"devDependencies": {
"chai": "^4.2.0",
"finalhandler": "^1.1.2",
"mocha": "^8.2.1",
"serve-static": "^1.14.1",
"postcss": "^8.3.0",
"xo": "^0.39.1"
"chai": "^4.3.6",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"eslint-config-xo": "^0.42.0",
"eslint-config-xo-space": "^0.33.0",
"eslint-plugin-prettier": "^4.2.1",
"finalhandler": "^1.2.0",
"mocha": "^10.0.0",
"postcss": "^8.4.16",
"prettier": "^2.7.1",
"serve-static": "^1.15.0"
},

@@ -43,5 +48,5 @@ "peerDependencies": {

"scripts": {
"xo": "xo",
"lint": "eslint **/*.js --fix",
"mocha": "mocha",
"test": "npm run xo && npm run mocha"
"test": "npm run lint && npm run mocha"
},

@@ -54,15 +59,25 @@ "prettier": {

},
"xo": {
"space": 2,
"prettier": true,
"eslintConfig": {
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": [
"xo-space",
"prettier"
],
"plugins": [
"prettier"
],
"rules": {
"capitalized-comments": "off",
"default-param-last": "off",
"promise/prefer-await-to-then": "off",
"import/extensions": 0
}
"prettier/prettier": [
"error"
]
},
"overrides": []
},
"engines": {
"node": "^10 || ^12 || >=14"
"node": "^12 || >=14"
}
}

@@ -75,2 +75,10 @@ # PostCSS Image Inliner [![Build Status][ci-img]][ci]

#### svgoPlugins
* Type: `array`
* Default: `[]`
* Required: `false`
Use custom svgo configuration for svg optimization
#### strict

@@ -77,0 +85,0 @@

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