@@ -45,20 +45,7 @@ import type {
4545} from "./plugin.js" ;
4646import { entriesOf , throwError } from "./utils.js" ;
4747
48- export const cloudinaryPluginProps = { } as Record < CloudinaryKey , true > ;
49-
50- const validatePlugins = < const plugins extends readonly TransformationPlugin [ ] > (
51- ...plugins : plugins extends validatePlugins < plugins >
52- ? plugins
53- : validatePlugins < plugins >
54- ) => {
55- plugins . forEach ( ( plugin ) => {
56- Object . assign ( cloudinaryPluginProps , plugin . props ) ;
57- } ) ;
58- return plugins ;
59- } ;
60-
61- export const transformationPlugins = validatePlugins (
48+ export const transformationPlugins = [
6249 // Some features *must* be the first transformation applied
6350 // thus their plugins *must* come first in the chain
6451
@@ -96,10 +83,25 @@ export const transformationPlugins = validatePlugins(
9683 UnderlaysPlugin ,
9784 VersionPlugin ,
9885 ZoompanPlugin
99- ) ;
86+ ] as const ;
87+
88+ const getCloudinaryPluginProps = < const plugins extends readonly TransformationPlugin [ ] > (
89+ plugins : plugins extends validatePlugins < plugins >
90+ ? plugins
91+ : validatePlugins < plugins >
92+ ) : Record < CloudinaryKey , true > => {
93+ const cloudinaryPluginProps = { } as Record < CloudinaryKey , true > ;
94+
95+ plugins . forEach ( ( plugin ) => {
96+ Object . assign ( cloudinaryPluginProps , plugin . props ) ;
97+ } ) ;
98+
99+ return cloudinaryPluginProps ;
100+ } ;
101+
102+ export const cloudinaryPluginProps = /* #__PURE__ */ getCloudinaryPluginProps ( transformationPlugins ) ;
100103
101- // important this comes after `validatePlugins` is called so we've collected the props
102- export const cloudinaryPluginKeys : readonly CloudinaryKey [ ] = Object . keys (
104+ export const cloudinaryPluginKeys : readonly CloudinaryKey [ ] = /* #__PURE__ */ Object . keys (
103105 cloudinaryPluginProps
104106) as never ;
105107
@@ -355,7 +357,7 @@ type validatePlugins<
355357]
356358 ? validatePlugins <
357359 rest ,
358- [
360+ readonly [
359361 ...validated ,
360362 keyof opts & keyof next [ "inferOwnOptions" ] extends never
361363 ? // if the intersection is never, no options duplicate existing so the plugin is valid
0 commit comments