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

@wix/image-kit

Package Overview
Dependencies
Maintainers
32
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wix/image-kit - npm Package Compare versions

Comparing version 1.21.0 to 1.22.0

16

dist/cjs/api/max/api.js

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

*
* @returns {{uri: string, srcset?: { dpr?: string[] }, css: {img: {}, container: {}}} | {uri: string, attr: {img: {}, container: {}}} | {}}
* @returns {ImageDataAttributes}
*/

@@ -47,7 +47,8 @@

shouldLoadHQImage = options.shouldLoadHQImage;
const canTransformImage = (0, _imageServiceUtils.isImageTransformApplicable)(src.id);
if (shouldLoadHQImage) {
if (!canTransformImage || shouldLoadHQImage) {
return getData(fittingType, src, target, { ...options,
autoEncode,
useSrcset: true
useSrcset: canTransformImage
});

@@ -93,3 +94,4 @@ }

css,
attr
attr,
transformed: true
};

@@ -106,3 +108,3 @@ }

*
* @returns {{uri: string, srcset?: { dpr?: string[] }, css: {img: {}, container: {}}} | {uri: string, attr: {img: {}, container: {}}} | {}}
* @returns {ImageDataAttributes}
*/

@@ -126,3 +128,5 @@

Object.assign(data, (0, _attributes.getAttributes)(transformObj, targetObj));
Object.assign(data, (0, _attributes.getAttributes)(transformObj, targetObj), {
transformed: transformObj.transformed
});
} else {

@@ -129,0 +133,0 @@ // empty data

@@ -35,2 +35,3 @@ "use strict";

const preferredExtension = fileExtension;
const canTransformImage = (0, _imageServiceUtils.isImageTransformApplicable)(src.id);
const transformsObj = {

@@ -60,6 +61,7 @@ fileName,

unsharpMask: {},
filters: {}
filters: {},
transformed: canTransformImage
};
if ((0, _imageServiceUtils.isImageTransformApplicable)(src.id)) {
if (canTransformImage) {
(0, _imageTransformParts.setTransformParts)(transformsObj, src, target);

@@ -66,0 +68,0 @@ (0, _imageTransformOptions.setTransformOptions)(transformsObj, options);

@@ -45,4 +45,6 @@ "use strict";

return _imageServiceConstants.emptyData;
return {
uri: ''
};
}
//# sourceMappingURL=index.js.map

@@ -194,3 +194,2 @@ "use strict";

* default empty data
* @type {{uri: '', css: {img: {}, container: {}}, attr: {img: {}, container: {}}}}
*/

@@ -208,3 +207,4 @@

container: {}
}
},
transformed: false
};

@@ -211,0 +211,0 @@ exports.emptyData = emptyData;

import { emptyData } from '../../helpers/imageServiceConstants';
import { isValidRequest } from '../../helpers/imageServiceUtils';
import { isImageTransformApplicable, isValidRequest, } from '../../helpers/imageServiceUtils';
import { getAttributes } from '../../engines/attributes';

@@ -18,3 +18,3 @@ import { getTransform, getTarget } from '../transform';

*
* @returns {{uri: string, srcset?: { dpr?: string[] }, css: {img: {}, container: {}}} | {uri: string, attr: {img: {}, container: {}}} | {}}
* @returns {ImageDataAttributes}
*/

@@ -26,4 +26,5 @@ function getPlaceholder(fittingType, src, target, options = {}) {

const { autoEncode = true, isSEOBot, shouldLoadHQImage } = options;
if (shouldLoadHQImage) {
return getData(fittingType, src, target, Object.assign(Object.assign({}, options), { autoEncode, useSrcset: true }));
const canTransformImage = isImageTransformApplicable(src.id);
if (!canTransformImage || shouldLoadHQImage) {
return getData(fittingType, src, target, Object.assign(Object.assign({}, options), { autoEncode, useSrcset: canTransformImage }));
}

@@ -48,3 +49,3 @@ const newTarget = Object.assign(Object.assign({}, target), validateTargetDimensions(src, target));

Object.assign(css.container, overrideCSS.container);
return { uri, css, attr };
return { uri, css, attr, transformed: true };
}

@@ -60,3 +61,3 @@ /**

*
* @returns {{uri: string, srcset?: { dpr?: string[] }, css: {img: {}, container: {}}} | {uri: string, attr: {img: {}, container: {}}} | {}}
* @returns {ImageDataAttributes}
*/

@@ -76,3 +77,5 @@ function getData(fittingType, src, target, options) {

// set the CSS or the SVG property
Object.assign(data, getAttributes(transformObj, targetObj));
Object.assign(data, getAttributes(transformObj, targetObj), {
transformed: transformObj.transformed,
});
}

@@ -79,0 +82,0 @@ else {

@@ -23,2 +23,3 @@ import { isSEOBot, getFileType, getFileName, getFileExtension, getDevicePixelRatio, getUpscaleString, isImageTransformApplicable, } from '../helpers/imageServiceUtils';

const preferredExtension = fileExtension;
const canTransformImage = isImageTransformApplicable(src.id);
const transformsObj = {

@@ -49,4 +50,5 @@ fileName,

filters: {},
transformed: canTransformImage,
};
if (isImageTransformApplicable(src.id)) {
if (canTransformImage) {
setTransformParts(transformsObj, src, target);

@@ -53,0 +55,0 @@ setTransformOptions(transformsObj, options);

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

import { emptyData, fittingTypes, alignTypes, htmlTag, upscaleMethods, } from '../../helpers/imageServiceConstants';
import { fittingTypes, alignTypes, htmlTag, upscaleMethods, } from '../../helpers/imageServiceConstants';
import { isValidRequest } from '../../helpers/imageServiceUtils';

@@ -27,5 +27,5 @@ import { populateGlobalFeatureSupport } from '../../helpers/populateFeatureSupport';

}
return emptyData;
return { uri: '' };
}
export { populateGlobalFeatureSupport, getData, fittingTypes, alignTypes, htmlTag, upscaleMethods, };
//# sourceMappingURL=index.js.map

@@ -137,3 +137,2 @@ /**

* default empty data
* @type {{uri: '', css: {img: {}, container: {}}, attr: {img: {}, container: {}}}}
*/

@@ -150,2 +149,3 @@ const emptyData = {

},
transformed: false,
};

@@ -152,0 +152,0 @@ const MAX_TRANSFORMED_IMAGE_WIDTH = 5000;

@@ -11,3 +11,3 @@ import type { ImageDataAttributes, FittingType, ImageTransformSource, ImageTransformTarget, ImageTransformOptions } from '../../types';

*
* @returns {{uri: string, srcset?: { dpr?: string[] }, css: {img: {}, container: {}}} | {uri: string, attr: {img: {}, container: {}}} | {}}
* @returns {ImageDataAttributes}
*/

@@ -24,3 +24,3 @@ declare function getPlaceholder(fittingType: FittingType, src: ImageTransformSource, target: ImageTransformTarget, options?: ImageTransformOptions): ImageDataAttributes;

*
* @returns {{uri: string, srcset?: { dpr?: string[] }, css: {img: {}, container: {}}} | {uri: string, attr: {img: {}, container: {}}} | {}}
* @returns {ImageDataAttributes}
*/

@@ -27,0 +27,0 @@ declare function getData(fittingType: FittingType, src: ImageTransformSource, target: ImageTransformTarget, options?: ImageTransformOptions): ImageDataAttributes;

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

import type { HTMLTag, AlignmentParam, AlignType, FittingType, FileType, ImageQuality, ImageQualityData, ImageTransformFiltersOption, TransformType, UpscaleMethod } from '../types';
import type { HTMLTag, AlignmentParam, AlignType, FittingType, FileType, ImageQuality, ImageQualityData, ImageTransformFiltersOption, TransformType, UpscaleMethod, ImageDataAttributes } from '../types';
/**

@@ -74,15 +74,4 @@ * image service api version

* default empty data
* @type {{uri: '', css: {img: {}, container: {}}, attr: {img: {}, container: {}}}}
*/
declare const emptyData: {
uri: string;
css: {
img: {};
container: {};
};
attr: {
img: {};
container: {};
};
};
declare const emptyData: ImageDataAttributes;
declare const SAFE_TRANSFORMED_AREA: number;

@@ -89,0 +78,0 @@ /**

@@ -134,15 +134,4 @@ export declare type FittingType = 'fill' | 'fit' | 'stretch' | 'original_size' | 'tile' | 'legacy_fill' | 'tile_horizontal' | 'tile_vertical' | 'fit_and_tile' | 'legacy_strip_tile' | 'legacy_strip_tile_horizontal' | 'legacy_strip_tile_vertical' | 'legacy_strip_fill' | 'legacy_strip_fit' | 'legacy_strip_fit_and_tile' | 'legacy_strip_original_size' | 'actual_size' | 'fitWidth' | 'fitHeight' | 'full' | 'legacy_tile' | 'legacy_tile_horizontal' | 'legacy_tile_vertical' | 'legacy_normal';

};
transformed: boolean;
};
/**
* the transform results
* @typedef {object} ImageTransformResult
* @property {string} uri the generated image uri, *without* base path
* @property {object} css CSS properties for the image and it's parent container, empty object for SVG
* @property {object} css.img CSS for the image element
* @property {object} css.container CSS for the image container
* @property {object} attr HTML Attributes for the image and it's parent container, empty object for bg and img types
* @property {object} attr.img HTML Attributes for the image element
* @property {object} attr.container HTML Attributes for the image container
*
*/
export declare type ImageTransformFiltersOption = {

@@ -202,2 +191,3 @@ contrast?: number;

};
transformed: boolean;
};

@@ -204,0 +194,0 @@ export declare type Dimensions = {

{
"name": "@wix/image-kit",
"description": "Standard library for generating canonical URL's for optimally consuming images at Wix",
"version": "1.21.0",
"version": "1.22.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "author": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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