New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-plugin-inline-image

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-inline-image - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

7

index.js

@@ -20,2 +20,4 @@ const { stat, readFile } = require("fs/promises");

? 0
: options.limit === -1 || options.limit === "-1"
? -1
: parseInt(options.limit, 10) ||

@@ -52,3 +54,6 @@ parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || defLimit, 10) ||

let loader = "file";
if (typeof limit === "function") {
if (limit === -1) {
contents = await readFile(args.path);
loader = "dataurl";
} else if (typeof limit === "function") {
const r = limit(args);

@@ -55,0 +60,0 @@ if (

2

package.json
{
"name": "esbuild-plugin-inline-image",
"version": "0.0.6",
"version": "0.0.7",
"main": "index.js",

@@ -5,0 +5,0 @@ "repository": "https://github.com/natrim/esbuild-plugin-inline-image.git",

@@ -7,2 +7,4 @@ # esbuild-plugin-inline-image

*Well, technically can be used even for non images (just set the right extensions), but who would want that?*
## Instalation

@@ -61,2 +63,3 @@

- limit can also be set from env as `IMAGE_INLINE_SIZE_LIMIT`
- setting limit to 0 disables inlining, -1 will always inline
- in case you pass function, the image will be inlined if it returns `true` (or `Promise` that resolves to `true`)

@@ -71,3 +74,3 @@ - the function get's passed `onLoad` [args](https://esbuild.github.io/plugins/#load-arguments)

## Extras
## Examples

@@ -115,3 +118,3 @@ Use plugin multiple times to have different size for different extensions

Use function to inline all images
Set limit to -1 to inline all images

@@ -124,3 +127,3 @@ ```js

inlineImage({
limit: () => true
limit: -1
})

@@ -127,0 +130,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