From e96113775912cc562b1a622e32909a1ae49df148 Mon Sep 17 00:00:00 2001 From: Colby Fayock Date: Fri, 1 Nov 2024 12:15:48 -0700 Subject: [PATCH] feat: upgrading util to migrated definitions (#63) --- astro-cloudinary/package.json | 6 +-- .../src/components/CldImage.astro | 27 +++++-------- pnpm-lock.yaml | 40 ++++++++----------- 3 files changed, 30 insertions(+), 43 deletions(-) diff --git a/astro-cloudinary/package.json b/astro-cloudinary/package.json index 5df0da1..98d3e66 100644 --- a/astro-cloudinary/package.json +++ b/astro-cloudinary/package.json @@ -37,9 +37,9 @@ "postpublish": "rm ./README.md && rm ./LICENSE" }, "dependencies": { - "@cloudinary-util/types": "1.5.7", - "@cloudinary-util/url-loader": "5.10.5", - "@cloudinary-util/util": "^3.3.2", + "@cloudinary-util/types": "1.6.0", + "@cloudinary-util/url-loader": "6.0.0", + "@cloudinary-util/util": "^4.1.0", "@cloudinary/url-gen": "^1.20.0", "@unpic/astro": "^0.0.47", "@unpic/core": "^0.0.49", diff --git a/astro-cloudinary/src/components/CldImage.astro b/astro-cloudinary/src/components/CldImage.astro index 6a45d77..b9969ba 100644 --- a/astro-cloudinary/src/components/CldImage.astro +++ b/astro-cloudinary/src/components/CldImage.astro @@ -2,7 +2,7 @@ import { type HTMLAttributes } from 'astro/types'; import { type UnpicImageProps } from '@unpic/core'; import { Image } from '@unpic/astro'; -import { transformationPlugins, type ConfigOptions, type ImageOptions } from '@cloudinary-util/url-loader'; +import { cloudinaryPluginKeys, type ConfigOptions, type ImageOptions } from '@cloudinary-util/url-loader'; import { generateImageLoader } from '../lib/loader'; @@ -27,6 +27,7 @@ const CLOUDINARY_PROPS = [ 'format', 'quality', 'strictTransformations', + ...cloudinaryPluginKeys // Excluded props that are managed by the component // 'height', @@ -34,20 +35,6 @@ const CLOUDINARY_PROPS = [ // 'width' ]; -// Collect all of the valid CldImage props that should only -// be applied to the URL construction and not applied to -// the underlaying Image component - -transformationPlugins.forEach(({ props }: { props: Record }) => { - Object.keys(props).forEach(prop => { - // If the prop already exists, flag it as a duplicate - if ( CLOUDINARY_PROPS.includes(prop) ) { - throw new Error(`Option ${prop} already exists!`); - } - CLOUDINARY_PROPS.push(prop); - }); -}); - // Collect all of the props that are intended to be passed // into the URL construction @@ -100,7 +87,7 @@ if (className) { imageClassName = `${imageClassName} ${className}`; } --- - +