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

rollup-generate-image-sizes

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-generate-image-sizes - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

13

dist/rollup-generate-image-sizes.cjs.js

@@ -16,2 +16,5 @@ 'use strict';

// A helper function for transform single items to array
const arrayify = (a) => (Array.isArray(a) ? a : [a]);
var index = (options = {}) => {

@@ -42,5 +45,8 @@ // Load options

// Glob for the directories
const dirGlob = arrayify(dir).length > 1 ? `{${arrayify(dir).join(',')}}` : arrayify(dir)[0];
return globby__default['default'](
// Finds all the images we want based on dir and inputFormat
`{${Array.isArray(dir) ? dir.join(',') : dir}}/**/!(*@*|*#*).{${inputFormat.join(',')}}`,
`${dirGlob}/**/!(*@*|*#*).{${inputFormat.join(',')}}`,
)

@@ -59,3 +65,3 @@ .then((images) => Promise.allSettled(

.then((metadata) => Promise.allSettled(
(Array.isArray(size) ? size : [size]).map((scaleWidth) => {
(arrayify(size)).map((scaleWidth) => {
// If the width we want to scale to is larger than the original

@@ -67,4 +73,5 @@ // width and forceUpscale is not set, we skip this.

return Promise.all(
(Array.isArray(outputFormat) ? outputFormat : [outputFormat])
(arrayify(outputFormat))
.map((format) => sharpObj
.clone()
.resize(scaleWidth)

@@ -71,0 +78,0 @@ .toFormat(format, { quality })

@@ -9,2 +9,5 @@ import globby from 'globby';

// A helper function for transform single items to array
const arrayify = (a) => (Array.isArray(a) ? a : [a]);
var index = (options = {}) => {

@@ -35,5 +38,8 @@ // Load options

// Glob for the directories
const dirGlob = arrayify(dir).length > 1 ? `{${arrayify(dir).join(',')}}` : arrayify(dir)[0];
return globby(
// Finds all the images we want based on dir and inputFormat
`{${Array.isArray(dir) ? dir.join(',') : dir}}/**/!(*@*|*#*).{${inputFormat.join(',')}}`,
`${dirGlob}/**/!(*@*|*#*).{${inputFormat.join(',')}}`,
)

@@ -52,3 +58,3 @@ .then((images) => Promise.allSettled(

.then((metadata) => Promise.allSettled(
(Array.isArray(size) ? size : [size]).map((scaleWidth) => {
(arrayify(size)).map((scaleWidth) => {
// If the width we want to scale to is larger than the original

@@ -60,4 +66,5 @@ // width and forceUpscale is not set, we skip this.

return Promise.all(
(Array.isArray(outputFormat) ? outputFormat : [outputFormat])
(arrayify(outputFormat))
.map((format) => sharpObj
.clone()
.resize(scaleWidth)

@@ -64,0 +71,0 @@ .toFormat(format, { quality })

{
"name": "rollup-generate-image-sizes",
"version": "0.0.1",
"version": "0.0.2",
"description": "Automatically generate image sizes for use in srcsets.",

@@ -5,0 +5,0 @@ "main": "dist/rollup-generate-image-sizes.cjs.js",

@@ -32,3 +32,3 @@ # rollup-generate-image-sizes

Note: All output files are named in the pattern `<original-filename>@<size>w.<file-extension>`. The plugin looks for the `@` symbol to determine which files have already been converted, which means that all files with the `@` will be ignored.
Note: All output files are named in the pattern `<original-filename>@<size>w.<file-extension>`. The plugin looks for the `@` symbol to determine which files have already been converted, which means that all files with the `@` will be ignored. Files with `#` are also ignored.

@@ -35,0 +35,0 @@ ### Configuration

@@ -9,2 +9,5 @@ import globby from 'globby';

// A helper function for transform single items to array
const arrayify = (a) => (Array.isArray(a) ? a : [a]);
export default (options = {}) => {

@@ -35,5 +38,8 @@ // Load options

// Glob for the directories
const dirGlob = arrayify(dir).length > 1 ? `{${arrayify(dir).join(',')}}` : arrayify(dir)[0];
return globby(
// Finds all the images we want based on dir and inputFormat
`{${Array.isArray(dir) ? dir.join(',') : dir}}/**/!(*@*|*#*).{${inputFormat.join(',')}}`,
`${dirGlob}/**/!(*@*|*#*).{${inputFormat.join(',')}}`,
)

@@ -52,3 +58,3 @@ .then((images) => Promise.allSettled(

.then((metadata) => Promise.allSettled(
(Array.isArray(size) ? size : [size]).map((scaleWidth) => {
(arrayify(size)).map((scaleWidth) => {
// If the width we want to scale to is larger than the original

@@ -60,4 +66,5 @@ // width and forceUpscale is not set, we skip this.

return Promise.all(
(Array.isArray(outputFormat) ? outputFormat : [outputFormat])
(arrayify(outputFormat))
.map((format) => sharpObj
.clone()
.resize(scaleWidth)

@@ -64,0 +71,0 @@ .toFormat(format, { quality })

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