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

gatsby-transformer-cloudinary

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-transformer-cloudinary - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [4.0.1](https://github.com/cloudinary-devs/gatsby-transformer-cloudinary/compare/v4.0.0...v4.0.1) (2022-10-10)
### Performance Improvements
* remove upload code only needed by gatsby-image ([#197](https://github.com/cloudinary-devs/gatsby-transformer-cloudinary/issues/197)) ([576f30f](https://github.com/cloudinary-devs/gatsby-transformer-cloudinary/commit/576f30f7f04545e8fc614cfeeb50784045d3037b)), closes [#188](https://github.com/cloudinary-devs/gatsby-transformer-cloudinary/issues/188)
# [4.0.0](https://github.com/cloudinary-devs/gatsby-transformer-cloudinary/compare/v3.0.0...v4.0.0) (2022-10-10)

@@ -2,0 +9,0 @@

34

node-creation/upload.js

@@ -16,13 +16,5 @@ const cloudinary = require('cloudinary').v2;

verifyRequiredOptions(reporter);
const {
apiKey,
apiSecret,
breakpointsMaxImages,
cloudName,
createDerived,
fluidMaxWidth,
fluidMinWidth,
uploadFolder,
useCloudinaryBreakpoints,
} = getPluginOptions();
const { apiKey, apiSecret, cloudName, uploadFolder } = getPluginOptions();
cloudinary.config({

@@ -42,22 +34,2 @@ cloud_name: cloudName,

// Each time we ask Cloudinary to calculate the responsive breakpoints for an
// image, Cloudinary bills us for one transformation. Since this API call
// gets called for every image every time our Gatsby cache gets cleared, this
// can get expensive very fast. This option should not be used outside of
// production. It's recommended that createDerived be set to true when
// useCloudinaryBreakpoints is set to true.This will store the derived images
// and prevent Cloudinary from using more transformations to recompute them
// in the future.
if (useCloudinaryBreakpoints) {
uploadOptions.responsive_breakpoints = [
{
create_derived: createDerived,
bytes_step: 20000,
min_width: fluidMinWidth,
max_width: fluidMaxWidth,
max_images: breakpointsMaxImages,
},
];
}
let attempts = 1;

@@ -64,0 +36,0 @@

@@ -40,5 +40,2 @@ const {

createDerived: false,
breakpointsMaxImages: 234,
fluidMaxWidth: 345,
fluidMinWidth: 456,
...options,

@@ -66,23 +63,2 @@ };

it('does not ask for responsive breakpoints when useCloudinaryBreakpoints is false', async () => {
const cloudinaryUpload = jest.fn();
cloudinary.uploader.upload = cloudinaryUpload;
const options = getDefaultOptions({ useCloudinaryBreakpoints: false });
getPluginOptions.mockReturnValue(options);
const args = getDefaultArgs();
await uploadImageToCloudinary(args);
const expectedUrl = args.url;
const expectedOptions = {
folder: options.uploadFolder,
overwrite: args.overwrite,
public_id: args.publicId,
resource_type: 'auto',
timeout: 5 * 60 * 1000,
};
expect(cloudinaryUpload).toHaveBeenCalledWith(expectedUrl, expectedOptions);
});
it('overwrites when passed overwrite:true', async () => {

@@ -109,35 +85,2 @@ const cloudinaryUpload = jest.fn();

it('asks for responsive breakpoints when useCloudinaryBreakpoints is true', async () => {
const cloudinaryUpload = jest.fn();
cloudinary.uploader.upload = cloudinaryUpload;
const options = getDefaultOptions({
useCloudinaryBreakpoints: true,
createDerived: 'createDerived',
});
getPluginOptions.mockReturnValue(options);
const args = getDefaultArgs();
await uploadImageToCloudinary(args);
const expectedUrl = args.url;
const expectedOptions = {
folder: options.uploadFolder,
overwrite: args.overwrite,
public_id: args.publicId,
resource_type: 'auto',
timeout: 5 * 60 * 1000,
responsive_breakpoints: [
{
bytes_step: 20000,
create_derived: options.createDerived,
max_images: options.breakpointsMaxImages,
max_width: options.fluidMaxWidth,
min_width: options.fluidMinWidth,
},
],
};
expect(cloudinaryUpload).toHaveBeenCalledWith(expectedUrl, expectedOptions);
});
it('returns the result returned from the Cloudinary uploader', async () => {

@@ -144,0 +87,0 @@ const cloudinaryUpload = jest.fn();

@@ -6,10 +6,4 @@ const { isArray } = require('lodash');

const defaultOptions = {
fluidMaxWidth: 1000,
fluidMinWidth: 50,
breakpointsMaxImages: 20,
createDerived: false,
useCloudinaryBreakpoints: false,
overwriteExisting: false,
enableDefaultTransformations: false,
alwaysUseDefaultBase64: false,
defaultTransformations: ['c_fill', 'g_auto', 'q_auto'],

@@ -16,0 +10,0 @@ transformTypes: ['CloudinaryAsset'],

{
"name": "gatsby-transformer-cloudinary",
"version": "4.0.0",
"version": "4.0.1",
"description": "Transform local files into Cloudinary-managed assets for Gatsby sites.",

@@ -5,0 +5,0 @@ "main": "index.js",

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