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

unpic

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

unpic - npm Package Compare versions

Comparing version 3.16.0 to 3.16.1

2

esm/src/transformers/astro.d.ts

@@ -1,2 +0,2 @@

import { UrlParser, UrlTransformer, ShouldDelegateUrl } from "../types.js";
import { ShouldDelegateUrl, UrlParser, UrlTransformer } from "../types.js";
export interface AstroParams {

@@ -3,0 +3,0 @@ href: string;

@@ -1,2 +0,2 @@

import { getNumericParam, setParamIfDefined, toUrl, toCanonicalUrlString, } from "../utils.js";
import { getNumericParam, setParamIfDefined, toCanonicalUrlString, toUrl, } from "../utils.js";
import { getImageCdnForUrlByDomain } from "../detect.js";

@@ -42,3 +42,3 @@ export const delegateUrl = (url) => {

};
export const transform = ({ url: originalUrl, width, height, format, }) => {
export const transform = ({ url: originalUrl, width, height, format }) => {
const parsedUrl = toUrl(originalUrl);

@@ -45,0 +45,0 @@ const href = toCanonicalUrlString(new URL(parsedUrl.pathname, parsedUrl.origin));

@@ -1,2 +0,2 @@

import { getNumericParam, setParamIfDefined, toUrl, } from "../utils.js";
import { getNumericParam, setParamIfDefined, toUrl } from "../utils.js";
export const parse = (url) => {

@@ -13,3 +13,3 @@ const parsedUrl = toUrl(url);

params: {
quality
quality,
},

@@ -16,0 +16,0 @@ cdn: "cloudimage",

@@ -24,3 +24,3 @@ import { toUrl } from "../utils.js";

max_device_pixel_ratio: "maxdpr",
maxDevicePixelRatio: "maxdpr"
maxDevicePixelRatio: "maxdpr",
};

@@ -38,9 +38,9 @@ export const parse = (imageUrl) => {

switch (key_value[0]) {
case 'w':
case "w":
width = Number(key_value[1]);
break;
case 'h':
case "h":
height = Number(key_value[1]);
break;
case 'f':
case "f":
format = key_value[1];

@@ -68,6 +68,6 @@ break;

let keyArray = Object.keys(OBJECT_TO_DIRECTIVES_MAP);
let directive = keyArray.find(k => OBJECT_TO_DIRECTIVES_MAP[k] === key) || "";
let directive = keyArray.find((k) => OBJECT_TO_DIRECTIVES_MAP[k] === key) ||
"";
return directive;
}
;
export function getParameterArray(url) {

@@ -84,3 +84,2 @@ let url_string = url.toString();

}
;
export function getBaseUrl(url) {

@@ -94,8 +93,8 @@ let url_string = url.toString();

}
else
else {
baseUrl = url_string;
}
}
return baseUrl;
}
;
export const transform = ({ url: originalUrl, width, height, format }) => {

@@ -109,9 +108,12 @@ const url = toUrl(originalUrl);

}
if (width)
if (width) {
directives["width"] = width;
if (height)
}
if (height) {
directives["height"] = height;
if (format)
}
if (format) {
directives["format"] = format;
if (!directives.hasOwnProperty('fit')) {
}
if (!directives.hasOwnProperty("fit")) {
directives = { ...directives, "fit": "cropbox" };

@@ -129,3 +131,2 @@ }

}
;
export function build_IE_query_string(directives_string) {

@@ -137,3 +138,2 @@ if (directives_string && directives_string !== "") {

}
;
export function maybe_create_directive(directive, value) {

@@ -146,3 +146,2 @@ let translated_directive = OBJECT_TO_DIRECTIVES_MAP[directive];

}
;
export function getDirectives(paramArray) {

@@ -149,0 +148,0 @@ let directives = {};

import { toUrl } from "../utils.js";
const getTransformParams = (url) => {
const transforms = url.searchParams.get('tr') || "";
return transforms.split(',').reduce((acc, transform) => {
const [key, value] = transform.split('-');
const transforms = url.searchParams.get("tr") || "";
return transforms.split(",").reduce((acc, transform) => {
const [key, value] = transform.split("-");
acc[key] = value;

@@ -15,9 +15,9 @@ return acc;

transformParams.h = height ? Math.round(height) : height;
if (!transformParams.fm) {
transformParams.fm = 'auto';
if (!transformParams.f) {
transformParams.f = "auto";
}
if (format) {
transformParams.fm = format;
transformParams.f = format;
}
const tr = Object.keys(transformParams).map(key => {
const tr = Object.keys(transformParams).map((key) => {
const value = transformParams[key];

@@ -28,5 +28,5 @@ if (value) {

})
.filter(x => x)
.join(',');
url.searchParams.set('tr', tr);
.filter((x) => x)
.join(",");
url.searchParams.set("tr", tr);
return url;

@@ -39,3 +39,3 @@ };

const height = Number(transformParams.h) || undefined;
const format = transformParams.fm || undefined;
const format = transformParams.f || undefined;
parsed.search = "";

@@ -42,0 +42,0 @@ return {

@@ -5,3 +5,3 @@ {

"name": "unpic",
"version": "3.16.0",
"version": "3.16.1",
"description": "Universal image CDN translator",

@@ -33,2 +33,6 @@ "license": "MIT",

},
"./transformers/storyblok": {
"import": "./esm/src/transformers/storyblok.js",
"require": "./script/src/transformers/storyblok.js"
},
"./transformers/cloudinary": {

@@ -38,18 +42,22 @@ "import": "./esm/src/transformers/cloudinary.js",

},
"./transformers/builder.io": {
"import": "./esm/src/transformers/builder.io.js",
"require": "./script/src/transformers/builder.io.js"
"./transformers/imageengine": {
"import": "./esm/src/transformers/imageengine.js",
"require": "./script/src/transformers/imageengine.js"
},
"./transformers/imgix": {
"import": "./esm/src/transformers/imgix.js",
"require": "./script/src/transformers/imgix.js"
"./transformers/keycdn": {
"import": "./esm/src/transformers/keycdn.js",
"require": "./script/src/transformers/keycdn.js"
},
"./transformers/astro": {
"import": "./esm/src/transformers/astro.js",
"require": "./script/src/transformers/astro.js"
"./transformers/cloudimage": {
"import": "./esm/src/transformers/cloudimage.js",
"require": "./script/src/transformers/cloudimage.js"
},
"./transformers/wordpress": {
"import": "./esm/src/transformers/wordpress.js",
"require": "./script/src/transformers/wordpress.js"
"./transformers/contentful": {
"import": "./esm/src/transformers/contentful.js",
"require": "./script/src/transformers/contentful.js"
},
"./transformers/cloudflare": {
"import": "./esm/src/transformers/cloudflare.js",
"require": "./script/src/transformers/cloudflare.js"
},
"./transformers/kontent.ai": {

@@ -59,2 +67,6 @@ "import": "./esm/src/transformers/kontent.ai.js",

},
"./transformers/ipx": {
"import": "./esm/src/transformers/ipx.js",
"require": "./script/src/transformers/ipx.js"
},
"./transformers/shopify": {

@@ -64,6 +76,2 @@ "import": "./esm/src/transformers/shopify.js",

},
"./transformers/contentful": {
"import": "./esm/src/transformers/contentful.js",
"require": "./script/src/transformers/contentful.js"
},
"./transformers/netlify": {

@@ -73,6 +81,14 @@ "import": "./esm/src/transformers/netlify.js",

},
"./transformers/storyblok": {
"import": "./esm/src/transformers/storyblok.js",
"require": "./script/src/transformers/storyblok.js"
"./transformers/vercel": {
"import": "./esm/src/transformers/vercel.js",
"require": "./script/src/transformers/vercel.js"
},
"./transformers/astro": {
"import": "./esm/src/transformers/astro.js",
"require": "./script/src/transformers/astro.js"
},
"./transformers/wordpress": {
"import": "./esm/src/transformers/wordpress.js",
"require": "./script/src/transformers/wordpress.js"
},
"./transformers/bunny": {

@@ -82,10 +98,18 @@ "import": "./esm/src/transformers/bunny.js",

},
"./transformers/scene7": {
"import": "./esm/src/transformers/scene7.js",
"require": "./script/src/transformers/scene7.js"
"./transformers/imagekit": {
"import": "./esm/src/transformers/imagekit.js",
"require": "./script/src/transformers/imagekit.js"
},
"./transformers/imageengine": {
"import": "./esm/src/transformers/imageengine.js",
"require": "./script/src/transformers/imageengine.js"
"./transformers/imgix": {
"import": "./esm/src/transformers/imgix.js",
"require": "./script/src/transformers/imgix.js"
},
"./transformers/nextjs": {
"import": "./esm/src/transformers/nextjs.js",
"require": "./script/src/transformers/nextjs.js"
},
"./transformers/builder.io": {
"import": "./esm/src/transformers/builder.io.js",
"require": "./script/src/transformers/builder.io.js"
},
"./transformers/contentstack": {

@@ -95,2 +119,6 @@ "import": "./esm/src/transformers/contentstack.js",

},
"./transformers/scene7": {
"import": "./esm/src/transformers/scene7.js",
"require": "./script/src/transformers/scene7.js"
},
"./transformers/cloudflare_images": {

@@ -100,33 +128,5 @@ "import": "./esm/src/transformers/cloudflare_images.js",

},
"./transformers/imagekit": {
"import": "./esm/src/transformers/imagekit.js",
"require": "./script/src/transformers/imagekit.js"
},
"./transformers/directus": {
"import": "./esm/src/transformers/directus.js",
"require": "./script/src/transformers/directus.js"
},
"./transformers/cloudimage": {
"import": "./esm/src/transformers/cloudimage.js",
"require": "./script/src/transformers/cloudimage.js"
},
"./transformers/nextjs": {
"import": "./esm/src/transformers/nextjs.js",
"require": "./script/src/transformers/nextjs.js"
},
"./transformers/cloudflare": {
"import": "./esm/src/transformers/cloudflare.js",
"require": "./script/src/transformers/cloudflare.js"
},
"./transformers/ipx": {
"import": "./esm/src/transformers/ipx.js",
"require": "./script/src/transformers/ipx.js"
},
"./transformers/vercel": {
"import": "./esm/src/transformers/vercel.js",
"require": "./script/src/transformers/vercel.js"
},
"./transformers/keycdn": {
"import": "./esm/src/transformers/keycdn.js",
"require": "./script/src/transformers/keycdn.js"
}

@@ -133,0 +133,0 @@ },

@@ -1,2 +0,2 @@

import { UrlParser, UrlTransformer, ShouldDelegateUrl } from "../types.js";
import { ShouldDelegateUrl, UrlParser, UrlTransformer } from "../types.js";
export interface AstroParams {

@@ -3,0 +3,0 @@ href: string;

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

exports.parse = parse;
const transform = ({ url: originalUrl, width, height, format, }) => {
const transform = ({ url: originalUrl, width, height, format }) => {
const parsedUrl = (0, utils_js_1.toUrl)(originalUrl);

@@ -50,0 +50,0 @@ const href = (0, utils_js_1.toCanonicalUrlString)(new URL(parsedUrl.pathname, parsedUrl.origin));

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

params: {
quality
quality,
},

@@ -19,0 +19,0 @@ cdn: "cloudimage",

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

max_device_pixel_ratio: "maxdpr",
maxDevicePixelRatio: "maxdpr"
maxDevicePixelRatio: "maxdpr",
};

@@ -41,9 +41,9 @@ const parse = (imageUrl) => {

switch (key_value[0]) {
case 'w':
case "w":
width = Number(key_value[1]);
break;
case 'h':
case "h":
height = Number(key_value[1]);
break;
case 'f':
case "f":
format = key_value[1];

@@ -72,7 +72,7 @@ break;

let keyArray = Object.keys(exports.OBJECT_TO_DIRECTIVES_MAP);
let directive = keyArray.find(k => exports.OBJECT_TO_DIRECTIVES_MAP[k] === key) || "";
let directive = keyArray.find((k) => exports.OBJECT_TO_DIRECTIVES_MAP[k] === key) ||
"";
return directive;
}
exports.getDirective = getDirective;
;
function getParameterArray(url) {

@@ -90,3 +90,2 @@ let url_string = url.toString();

exports.getParameterArray = getParameterArray;
;
function getBaseUrl(url) {

@@ -100,4 +99,5 @@ let url_string = url.toString();

}
else
else {
baseUrl = url_string;
}
}

@@ -107,3 +107,2 @@ return baseUrl;

exports.getBaseUrl = getBaseUrl;
;
const transform = ({ url: originalUrl, width, height, format }) => {

@@ -117,9 +116,12 @@ const url = (0, utils_js_1.toUrl)(originalUrl);

}
if (width)
if (width) {
directives["width"] = width;
if (height)
}
if (height) {
directives["height"] = height;
if (format)
}
if (format) {
directives["format"] = format;
if (!directives.hasOwnProperty('fit')) {
}
if (!directives.hasOwnProperty("fit")) {
directives = { ...directives, "fit": "cropbox" };

@@ -139,3 +141,2 @@ }

exports.build_IE_directives = build_IE_directives;
;
function build_IE_query_string(directives_string) {

@@ -148,3 +149,2 @@ if (directives_string && directives_string !== "") {

exports.build_IE_query_string = build_IE_query_string;
;
function maybe_create_directive(directive, value) {

@@ -158,3 +158,2 @@ let translated_directive = exports.OBJECT_TO_DIRECTIVES_MAP[directive];

exports.maybe_create_directive = maybe_create_directive;
;
function getDirectives(paramArray) {

@@ -161,0 +160,0 @@ let directives = {};

@@ -6,5 +6,5 @@ "use strict";

const getTransformParams = (url) => {
const transforms = url.searchParams.get('tr') || "";
return transforms.split(',').reduce((acc, transform) => {
const [key, value] = transform.split('-');
const transforms = url.searchParams.get("tr") || "";
return transforms.split(",").reduce((acc, transform) => {
const [key, value] = transform.split("-");
acc[key] = value;

@@ -19,9 +19,9 @@ return acc;

transformParams.h = height ? Math.round(height) : height;
if (!transformParams.fm) {
transformParams.fm = 'auto';
if (!transformParams.f) {
transformParams.f = "auto";
}
if (format) {
transformParams.fm = format;
transformParams.f = format;
}
const tr = Object.keys(transformParams).map(key => {
const tr = Object.keys(transformParams).map((key) => {
const value = transformParams[key];

@@ -32,5 +32,5 @@ if (value) {

})
.filter(x => x)
.join(',');
url.searchParams.set('tr', tr);
.filter((x) => x)
.join(",");
url.searchParams.set("tr", tr);
return url;

@@ -44,3 +44,3 @@ };

const height = Number(transformParams.h) || undefined;
const format = transformParams.fm || undefined;
const format = transformParams.f || undefined;
parsed.search = "";

@@ -47,0 +47,0 @@ return {

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