@payloadcms/transformer-sharp 4.0.0-internal.f15737c → 4.0.0-internal.f2a04f7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/initSharpCollections.ts"],"sourcesContent":["import type { Config, SanitizedUploadConfig } from 'payload'\n\nimport type { SharpCollectionConfig } from './types.js'\n\nconst RESERVED_IMAGE_SIZE_NAMES = [\n 'filename',\n 'mimeType',\n 'filesize',\n 'width',\n 'height',\n 'url',\n 'thumbnailURL',\n 'variants',\n 'focalX',\n 'focalY',\n]\n\n/**\n * Validates `sharpTransformer({ collections })` against the config's real\n * collections, then writes a narrowed, Sharp-agnostic projection of\n * `variants`/`crop`/`focalPoint`/`hasImageAdjustments` back onto each\n * targeted collection's sanitized `upload` config, so core's own field\n * generation and Admin UI keep working without knowing about Sharp.\n */\nexport function initSharpCollections({\n collections,\n config,\n}: {\n collections: Partial<Record<string, SharpCollectionConfig>>\n config: Config\n}): Config {\n const errors: string[] = []\n\n for (const [slug, sharpConfig] of Object.entries(collections)) {\n if (!sharpConfig) {\n continue\n }\n\n const collection = config.collections?.find((candidate) => candidate.slug === slug)\n\n if (!collection) {\n errors.push(\n `sharpTransformer collections.\"${slug}\" does not match any configured collection slug.`,\n )\n continue\n }\n\n if (!collection.upload) {\n errors.push(\n `sharpTransformer collections.\"${slug}\" targets a collection whose \\`upload\\` option is not set. Enable uploads on \"${slug}\" first.`,\n )\n continue\n }\n\n const seenSizeNames = new Set<string>()\n\n for (const size of sharpConfig.variants ?? []) {\n if (typeof size.name !== 'string' || size.name.trim().length === 0) {\n errors.push(\n `sharpTransformer collections.\"${slug}\".variants has an entry missing a valid \\`name\\`.`,\n )\n continue\n }\n\n if (seenSizeNames.has(size.name)) {\n errors.push(\n `sharpTransformer collections.\"${slug}\".variants has a duplicate size name: \"${size.name}\".`,\n )\n }\n seenSizeNames.add(size.name)\n\n if (RESERVED_IMAGE_SIZE_NAMES.includes(size.name)) {\n errors.push(\n `sharpTransformer collections.\"${slug}\".variants uses reserved name \"${size.name}\", which collides with a built-in upload field. Choose a different name.`,\n )\n }\n }\n }\n\n if (errors.length > 0) {\n throw new Error(\n `Invalid \\`sharpTransformer({ collections })\\` configuration:\\n${errors.join('\\n')}`,\n )\n }\n\n // Write onto copies, never the caller's config or collection objects: a rebuilt config (e.g. on\n // a dev reload) would otherwise see `upload.variants` on the collection and reject it as authored.\n const sanitizedCollections = config.collections?.map((collection) => {\n const sharpConfig = collections[collection.slug]\n\n if (!sharpConfig || !collection.upload) {\n return collection\n }\n\n const authoredUpload = typeof collection.upload === 'object' ? collection.upload : {}\n\n const upload: Partial<SanitizedUploadConfig> = {\n ...authoredUpload,\n // Sharp's setting wins when given; otherwise keep the collection's own, so an\n // unset Sharp option can't silently re-enable a collection's `crop: false`.\n crop: sharpConfig.crop ?? authoredUpload.crop,\n focalPoint: sharpConfig.focalPoint ?? authoredUpload.focalPoint,\n hasImageAdjustments: Boolean(\n sharpConfig.resizeOptions ||\n sharpConfig.formatOptions ||\n sharpConfig.trimOptions ||\n sharpConfig.constructorOptions ||\n sharpConfig.withMetadata,\n ),\n variants: sharpConfig.variants?.map(({ name, admin, generateImageName }) => ({\n name,\n admin,\n generateImageName,\n })),\n }\n\n return { ...collection, upload }\n })\n\n return { ...config, collections: sanitizedCollections }\n}\n"],"names":["RESERVED_IMAGE_SIZE_NAMES","initSharpCollections","collections","config","errors","slug","sharpConfig","Object","entries","collection","find","candidate","push","upload","seenSizeNames","Set","size","variants","name","trim","length","has","add","includes","Error","join","sanitizedCollections","map","authoredUpload","crop","focalPoint","hasImageAdjustments","Boolean","resizeOptions","formatOptions","trimOptions","constructorOptions","withMetadata","admin","generateImageName"],"mappings":"AAIA,MAAMA,4BAA4B;IAChC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED;;;;;;CAMC,GACD,OAAO,SAASC,qBAAqB,EACnCC,WAAW,EAC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AAO;IAExF;IAEA,gGAAgG;IAChG,mGAAmG;IACnG,MAAMC,uBAAuBvB,OAAOD,WAAW,EAAEyB,IAAI,CAAClB;QACpD,MAAMH,cAAcJ,WAAW,CAACO,WAAWJ,IAAI,CAAC;QAEhD,IAAI,CAACC,eAAe,CAACG,WAAWI,MAAM,EAAE;YACtC,OAAOJ;QACT;QAEA,MAAMmB,iBAAiB,OAAOnB,WAAWI,MAAM,KAAK,WAAWJ,WAAWI,MAAM,GAAG,CAAC;QAEpF,MAAMA,SAAyC;YAC7C,GAAGe,cAAc;YACjB,8EAA8E;YAC9E,4EAA4E;YAC5EC,MAAMvB,YAAYuB,IAAI,IAAID,eAAeC,IAAI;YAC7CC,YAAYxB,YAAYwB,UAAU,IAAIF,eAAeE,UAAU;YAC/DC,qBAAqBC,QACnB1B,YAAY2B,aAAa,IACvB3B,YAAY4B,aAAa,IACzB5B,YAAY6B,WAAW,IACvB7B,YAAY8B,kBAAkB,IAC9B9B,YAAY+B,YAAY;YAE5BpB,UAAUX,YAAYW,QAAQ,EAAEU,IAAI,CAAC,EAAET,IAAI,EAAEoB,KAAK,EAAEC,iBAAiB,EAAE,GAAM,CAAA;oBAC3ErB;oBACAoB;oBACAC;gBACF,CAAA;QACF;QAEA,OAAO;YAAE,GAAG9B,UAAU;YAAEI;QAAO;IACjC;IAEA,OAAO;QAAE,GAAGV,MAAM;QAAED,aAAawB;IAAqB;AACxD"}
1
+ {"version":3,"sources":["../src/initSharpCollections.ts"],"sourcesContent":["import type { Config, SanitizedUploadConfig } from 'payload'\n\nimport type { SharpCollectionConfig } from './types.js'\n\nconst RESERVED_IMAGE_SIZE_NAMES = [\n 'filename',\n 'mimeType',\n 'filesize',\n 'width',\n 'height',\n 'url',\n 'thumbnailURL',\n 'variants',\n 'focalX',\n 'focalY',\n]\n\n/**\n * Validates `sharpTransformer({ collections })` against the config's real\n * collections, then writes a narrowed, Sharp-agnostic projection of\n * `variants`/`crop`/`focalPoint`/`hasImageAdjustments` back onto each\n * targeted collection's sanitized `upload` config, so core's own field\n * generation and Admin UI keep working without knowing about Sharp.\n */\nexport function initSharpCollections({\n collections,\n config,\n}: {\n collections: Partial<Record<string, SharpCollectionConfig>>\n config: Config\n}): Config {\n const errors: string[] = []\n\n for (const [slug, sharpConfig] of Object.entries(collections)) {\n if (!sharpConfig) {\n continue\n }\n\n const collection = config.collections?.find((candidate) => candidate.slug === slug)\n\n if (!collection) {\n errors.push(\n `sharpTransformer collections.\"${slug}\" does not match any configured collection slug.`,\n )\n continue\n }\n\n if (!collection.upload) {\n errors.push(\n `sharpTransformer collections.\"${slug}\" targets a collection whose \\`upload\\` option is not set. Enable uploads on \"${slug}\" first.`,\n )\n continue\n }\n\n const seenSizeNames = new Set<string>()\n\n for (const size of sharpConfig.variants ?? []) {\n if (typeof size.name !== 'string' || size.name.trim().length === 0) {\n errors.push(\n `sharpTransformer collections.\"${slug}\".variants has an entry missing a valid \\`name\\`.`,\n )\n continue\n }\n\n if (seenSizeNames.has(size.name)) {\n errors.push(\n `sharpTransformer collections.\"${slug}\".variants has a duplicate size name: \"${size.name}\".`,\n )\n }\n seenSizeNames.add(size.name)\n\n if (RESERVED_IMAGE_SIZE_NAMES.includes(size.name)) {\n errors.push(\n `sharpTransformer collections.\"${slug}\".variants uses reserved name \"${size.name}\", which collides with a built-in upload field. Choose a different name.`,\n )\n }\n }\n }\n\n if (errors.length > 0) {\n throw new Error(\n `Invalid \\`sharpTransformer({ collections })\\` configuration:\\n${errors.join('\\n')}`,\n )\n }\n\n // Write onto copies, never the caller's config or collection objects: a rebuilt config (e.g. on\n // a dev reload) would otherwise see `upload.variants` on the collection and reject it as authored.\n const sanitizedCollections = config.collections?.map((collection) => {\n const sharpConfig = collections[collection.slug]\n\n if (!sharpConfig || !collection.upload) {\n return collection\n }\n\n const authoredUpload = typeof collection.upload === 'object' ? collection.upload : {}\n\n const upload: Partial<SanitizedUploadConfig> = {\n ...authoredUpload,\n // Sharp's setting wins when given; otherwise keep the collection's own, so an\n // unset Sharp option can't silently re-enable a collection's `crop: false`.\n crop: sharpConfig.crop ?? authoredUpload.crop,\n focalPoint: sharpConfig.focalPoint ?? authoredUpload.focalPoint,\n hasImageAdjustments: Boolean(\n sharpConfig.resizeOptions ||\n sharpConfig.formatOptions ||\n sharpConfig.trimOptions ||\n sharpConfig.constructorOptions ||\n sharpConfig.withMetadata,\n ),\n variants: sharpConfig.variants?.map(({ name, admin, generateImageName }) => ({\n name,\n admin,\n generateImageName,\n })),\n }\n\n return { ...collection, upload }\n })\n\n return { ...config, collections: sanitizedCollections }\n}\n"],"names":["RESERVED_IMAGE_SIZE_NAMES","initSharpCollections","collections","config","errors","slug","sharpConfig","Object","entries","collection","find","candidate","push","upload","seenSizeNames","Set","size","variants","name","trim","length","has","add","includes","Error","join","sanitizedCollections","map","authoredUpload","crop","focalPoint","hasImageAdjustments","Boolean","resizeOptions","formatOptions","trimOptions","constructorOptions","withMetadata","admin","generateImageName"],"mappings":"AAIA,MAAMA,4BAA4B;IAChC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED;;;;;;CAMC,GACD,OAAO,SAASC,qBAAqB,EACnCC,WAAW,EACXC,MAAM,EAIP;IACC,MAAMC,SAAmB,EAAE;IAE3B,KAAK,MAAM,CAACC,MAAMC,YAAY,IAAIC,OAAOC,OAAO,CAACN,aAAc;QAC7D,IAAI,CAACI,aAAa;YAChB;QACF;QAEA,MAAMG,aAAaN,OAAOD,WAAW,EAAEQ,KAAK,CAACC,YAAcA,UAAUN,IAAI,KAAKA;QAE9E,IAAI,CAACI,YAAY;YACfL,OAAOQ,IAAI,CACT,CAAC,8BAA8B,EAAEP,KAAK,gDAAgD,CAAC;YAEzF;QACF;QAEA,IAAI,CAACI,WAAWI,MAAM,EAAE;YACtBT,OAAOQ,IAAI,CACT,CAAC,8BAA8B,EAAEP,KAAK,8EAA8E,EAAEA,KAAK,QAAQ,CAAC;YAEtI;QACF;QAEA,MAAMS,gBAAgB,IAAIC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ACnB1B,YAAY2B,aAAa,IACzB3B,YAAY4B,aAAa,IACzB5B,YAAY6B,WAAW,IACvB7B,YAAY8B,kBAAkB,IAC9B9B,YAAY+B,YAAY;YAE1BpB,UAAUX,YAAYW,QAAQ,EAAEU,IAAI,CAAC,EAAET,IAAI,EAAEoB,KAAK,EAAEC,iBAAiB,EAAE,GAAM,CAAA;oBAC3ErB;oBACAoB;oBACAC;gBACF,CAAA;QACF;QAEA,OAAO;YAAE,GAAG9B,UAAU;YAAEI;QAAO;IACjC;IAEA,OAAO;QAAE,GAAGV,MAAM;QAAED,aAAawB;IAAqB;AACxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"prepareLegacyUpload.d.ts","sourceRoot":"","sources":["../src/prepareLegacyUpload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgC,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAI/F,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAA0B,MAAM,YAAY,CAAA;AAsBhG;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,WAAW,EACX,eAAe,GAChB,EAAE;IACD,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAA;IAC3D,eAAe,EAAE,eAAe,CAAA;CACjC,GAAG,WAAW,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC,CA6G1D"}
1
+ {"version":3,"file":"prepareLegacyUpload.d.ts","sourceRoot":"","sources":["../src/prepareLegacyUpload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgC,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAI/F,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAA0B,MAAM,YAAY,CAAA;AAsBhG;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,WAAW,EACX,eAAe,GAChB,EAAE;IACD,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAA;IAC3D,eAAe,EAAE,eAAe,CAAA;CACjC,GAAG,WAAW,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC,CAqG1D"}
@@ -65,18 +65,11 @@ import { sanitizeResizeConfig } from './sanitizeResizeConfig.js';
65
65
  const results = [
66
66
  mainResult
67
67
  ];
68
- // A cropped upload derives its sizes from the crop output, not the original.
69
- const isCropped = Boolean(crop && mainResult.width && mainResult.height);
70
- const sizeSourceFile = isCropped ? mainResultFile : undefined;
71
- const sizeSourceDimensions = isCropped ? {
72
- height: mainResult.height,
73
- width: mainResult.width
74
- } : originalDimensions;
75
68
  // Same precedence `init()` applies: Sharp's setting, else the collection's own `focalPoint`.
76
69
  const effectiveFocalPoint = collectionUpload.focalPoint ?? req.payload.collections[collectionSlug]?.config.upload?.focalPoint;
77
70
  const focalPointEnabled = effectiveFocalPoint !== false;
78
71
  const variants = collectionUpload.variants;
79
- if (canProcessAsImage && Array.isArray(variants) && sizeSourceDimensions) {
72
+ if (canProcessAsImage && Array.isArray(variants) && originalDimensions) {
80
73
  const focalPoint = focalPointEnabled && uploadEdits?.focalPoint ? {
81
74
  x: isNumber(uploadEdits.focalPoint.x) ? Math.round(uploadEdits.focalPoint.x) : 50,
82
75
  y: isNumber(uploadEdits.focalPoint.y) ? Math.round(uploadEdits.focalPoint.y) : 50
@@ -85,7 +78,7 @@ import { sanitizeResizeConfig } from './sanitizeResizeConfig.js';
85
78
  const imageResizeConfig = sanitizeResizeConfig(rawConfig);
86
79
  const fieldPath = `variants.${imageResizeConfig.name}`;
87
80
  const resizeAction = getImageResizeAction({
88
- dimensions: sizeSourceDimensions,
81
+ dimensions: originalDimensions,
89
82
  hasFocalPoint: Boolean(focalPoint),
90
83
  imageResizeConfig
91
84
  });
@@ -96,13 +89,12 @@ import { sanitizeResizeConfig } from './sanitizeResizeConfig.js';
96
89
  }
97
90
  const sizeResultFile = await transform({
98
91
  fieldPath,
99
- file: sizeSourceFile,
100
92
  options: {
101
93
  collectionUpload,
102
94
  focalPoint: resizeAction === 'resizeWithFocalPoint' ? focalPoint : undefined,
103
95
  imageResizeConfig,
104
96
  kind: 'size',
105
- originalDimensions: sizeSourceDimensions
97
+ originalDimensions
106
98
  }
107
99
  });
108
100
  return describeResult({
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/prepareLegacyUpload.ts"],"sourcesContent":["import type { FocalPoint, ProbedImageSize } from 'payload'\nimport type { PreparedUploadTransformation, UploadTransformerInternal } from 'payload/internal'\n\nimport { isNumber } from 'payload/shared'\n\nimport type { SharpCollectionConfig, SharpDependency, SharpUploadTaskOptions } from './types.js'\n\nimport { canResizeImage } from './canResizeImage.js'\nimport { createSharpFromFile } from './createSharpFromFile.js'\nimport { getImageResizeAction } from './getImageResizeAction.js'\nimport { mapWithBoundedConcurrency } from './mapWithBoundedConcurrency.js'\nimport { sanitizeResizeConfig } from './sanitizeResizeConfig.js'\n\n/**\n * Sharp throws on truncated/header-only files. Returns `undefined` instead —\n * matching core's dependency-free probe — since unreadable dimensions shouldn't fail the upload.\n */\nasync function tryProbe(file: File, sharpDependency: SharpDependency) {\n try {\n const sharpFile = await createSharpFromFile({ file, sharpDependency })\n const metadata = await sharpFile.metadata()\n return metadata.width && metadata.height ? metadata : undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * Computes the legacy upload tasks (the main file, optionally cropped, and every\n * configured legacy image size) and hands each to the injected `transform` callback\n * exactly once. Reads the Sharp-owned config from `sharpTransformer({ collections })`\n * at factory-construction time — not from the sanitized collection, which only gets\n * the narrowed projection `init()` writes back.\n */\nexport function createPrepareLegacyUpload({\n collections,\n sharpDependency,\n}: {\n collections: Partial<Record<string, SharpCollectionConfig>>\n sharpDependency: SharpDependency\n}): NonNullable<UploadTransformerInternal['prepareUpload']> {\n return async ({ collectionSlug, file, req, transform, uploadEdits }) => {\n const collectionUpload = collections[collectionSlug] ?? {}\n\n const fileSupportsResize = canResizeImage(file.type)\n\n const cropData =\n uploadEdits && typeof uploadEdits === 'object' && 'crop' in uploadEdits\n ? uploadEdits.crop\n : undefined\n\n let originalDimensions: ProbedImageSize | undefined\n\n if (fileSupportsResize) {\n const originalMeta = await tryProbe(file, sharpDependency)\n if (originalMeta) {\n originalDimensions = { height: originalMeta.height, width: originalMeta.width }\n }\n }\n\n // Unreadable dimensions can't be cropped/resized — treat as non-resizable rather than failing the upload.\n const canProcessAsImage = fileSupportsResize && originalDimensions !== undefined\n\n const crop =\n cropData && originalDimensions\n ? {\n cropData,\n heightInPixels: uploadEdits.heightInPixels!,\n originalDimensions,\n widthInPixels: uploadEdits.widthInPixels!,\n }\n : undefined\n\n const mainResultFile = await transform({\n fieldPath: 'filename',\n options: { collectionUpload, crop, kind: 'main' } satisfies SharpUploadTaskOptions,\n })\n\n const mainResult = await describeResult({\n fieldPath: 'filename',\n fileSupportsResize: canProcessAsImage,\n resultFile: mainResultFile,\n sharpDependency,\n })\n\n const results: PreparedUploadTransformation[] = [mainResult]\n\n // A cropped upload derives its sizes from the crop output, not the original.\n const isCropped = Boolean(crop && mainResult.width && mainResult.height)\n const sizeSourceFile = isCropped ? mainResultFile : undefined\n const sizeSourceDimensions: ProbedImageSize | undefined = isCropped\n ? { height: mainResult.height!, width: mainResult.width! }\n : originalDimensions\n\n // Same precedence `init()` applies: Sharp's setting, else the collection's own `focalPoint`.\n const effectiveFocalPoint =\n collectionUpload.focalPoint ??\n req.payload.collections[collectionSlug]?.config.upload?.focalPoint\n const focalPointEnabled = effectiveFocalPoint !== false\n const variants = collectionUpload.variants\n\n if (canProcessAsImage && Array.isArray(variants) && sizeSourceDimensions) {\n const focalPoint: FocalPoint | undefined =\n focalPointEnabled && uploadEdits?.focalPoint\n ? {\n x: isNumber(uploadEdits.focalPoint.x) ? Math.round(uploadEdits.focalPoint.x) : 50,\n y: isNumber(uploadEdits.focalPoint.y) ? Math.round(uploadEdits.focalPoint.y) : 50,\n }\n : undefined\n\n const sizeResults = await mapWithBoundedConcurrency(variants, async (rawConfig) => {\n const imageResizeConfig = sanitizeResizeConfig(rawConfig)\n const fieldPath = `variants.${imageResizeConfig.name}` as const\n\n const resizeAction = getImageResizeAction({\n dimensions: sizeSourceDimensions,\n hasFocalPoint: Boolean(focalPoint),\n imageResizeConfig,\n })\n\n if (resizeAction === 'omit') {\n return { fieldPath } satisfies PreparedUploadTransformation\n }\n\n const sizeResultFile = await transform({\n fieldPath,\n file: sizeSourceFile,\n options: {\n collectionUpload,\n focalPoint: resizeAction === 'resizeWithFocalPoint' ? focalPoint : undefined,\n imageResizeConfig,\n kind: 'size',\n originalDimensions: sizeSourceDimensions,\n } satisfies SharpUploadTaskOptions,\n })\n\n return describeResult({\n fieldPath,\n fileSupportsResize: true,\n resultFile: sizeResultFile,\n sharpDependency,\n })\n })\n\n results.push(...sizeResults)\n }\n\n return results\n }\n}\n\nasync function describeResult({\n fieldPath,\n fileSupportsResize,\n resultFile,\n sharpDependency,\n}: {\n fieldPath: PreparedUploadTransformation['fieldPath']\n fileSupportsResize: boolean\n resultFile: File\n sharpDependency: SharpDependency\n}): Promise<PreparedUploadTransformation> {\n if (!fileSupportsResize) {\n return { fieldPath, file: resultFile, mimeType: resultFile.type }\n }\n\n const meta = await tryProbe(resultFile, sharpDependency)\n\n if (!meta) {\n return { fieldPath, file: resultFile, mimeType: resultFile.type }\n }\n\n // `tryProbe` never sets `animated: true`, so `meta.height` is already the\n // single-frame height — do not divide by page count here.\n return {\n fieldPath,\n file: resultFile,\n height: meta.height,\n mimeType: resultFile.type,\n width: meta.width,\n }\n}\n"],"names":["isNumber","canResizeImage","createSharpFromFile","getImageResizeAction","mapWithBoundedConcurrency","sanitizeResizeConfig","tryProbe","file","sharpDependency","sharpFile","metadata","width","height","undefined","createPrepareLegacyUpload","collections","collectionSlug","req","transform","uploadEdits","collectionUpload","fileSupportsResize","type","cropData","crop","originalDimensions","originalMeta","canProcessAsImage","heightInPixels","widthInPixels","mainResultFile","fieldPath","options","kind","mainResult","describeResult","resultFile","results","isCropped","Boolean","sizeSourceFile","sizeSourceDimensions","effectiveFocalPoint","focalPoint","payload","config","upload","focalPointEnabled","variants","Array","isArray","x","Math","round","y","sizeResults","rawConfig","imageResizeConfig","name","resizeAction","dimensions","hasFocalPoint","sizeResultFile","push","mimeType","meta"],"mappings":"AAGA,SAASA,QAAQ,QAAQ,iBAAgB;AAIzC,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,oBAAoB,QAAQ,4BAA2B;AAChE,SAASC,yBAAyB,QAAQ,iCAAgC;AAC1E,SAASC,oBAAoB,QAAQ,4BAA2B;AAEhE;;;CAGC,GACD,eAAeC,SAASC,IAAU,EAAEC,eAAgC;IAClE,IAAI;QACF,MAAMC,YAAY,MAAMP,oBAAoB;YAAEK;YAAMC;QAAgB;QACpE,MAAME,WAAW,MAAMD,UAAUC,QAAQ;QACzC,OAAOA,SAASC,KAAK,IAAID,SAASE,MAAM,GAAGF,WAAWG;IACxD,EAAE,OAAM;QACN,OAAOA;IACT;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,0BAA0B,EACxCC,WAAW,EACXP,eAAe,EAIhB;IACC,OAAO,OAAO,EAAEQ,cAAc,EAAET,IAAI,EAAEU,GAAG,EAAEC,SAAS,EAAEC,WAAW,EAAE;QACjE,MAAMC,mBAAmBL,WAAW,CAACC,eAAe,IAAI,CAAC;QAEzD,MAAMK,qBAAqBpB,eAAeM,KAAKe,IAAI;QAEnD,MAAMC,WACJJ,eAAe,OAAOA,gBAAgB,YAAY,UAAUA,cACxDA,YAAYK,IAAI,GAChBX;QAEN,IAAIY;QAEJ,IAAIJ,oBAAoB;YACtB,MAAMK,eAAe,MAAMpB,SAASC,MAAMC;YAC1C,IAAIkB,cAAc;gBAChBD,qBAAqB;oBAAEb,QAAQc,aAAad,MAAM;oBAAED,OAAOe,aAAaf,KAAK;gBAAC;YAChF;QACF;QAEA,0GAA0G;QAC1G,MAAMgB,oBAAoBN,sBAAsBI,uBAAu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,MAAMzB,YAAY,CAAC,SAAS,EAAE0B,kBAAkBC,IAAI,EAAE;gBAEtD,MAAMC,eAAexD,qBAAqB;oBACxCyD,YAAYnB;oBACZoB,eAAetB,QAAQI;oBACvBc;gBACF;gBAEA,IAAIE,iBAAiB,QAAQ;oBAC3B,OAAO;wBAAE5B;oBAAU;gBACrB;gBAEA,MAAM+B,iBAAiB,MAAM5C,UAAU;oBACrCa;oBACAxB,MAAMiC;oBACNR,SAAS;wBACPZ;wBACAuB,YAAYgB,iBAAiB,yBAAyBhB,aAAa9B;wBACnE4C;wBACAxB,MAAM;wBACNR,oBAAoBgB;oBACtB;gBACF;gBAEA,OAAON,eAAe;oBACpBJ;oBACAV,oBAAoB;oBACpBe,YAAY0B;oBACZtD;gBACF;YACF;YAEA6B,QAAQ0B,IAAI,IAAIR;QAClB;QAEA,OAAOlB;IACT;AACF;AAEA,eAAeF,eAAe,EAC5BJ,SAAS,EACTV,kBAAkB,EAClBe,UAAU,EACV5B,eAAe,EAMhB;IACC,IAAI,CAACa,oBAAoB;QACvB,OAAO;YAAEU;YAAWxB,MAAM6B;YAAY4B,UAAU5B,WAAWd,IAAI;QAAC;IAClE;IAEA,MAAM2C,OAAO,MAAM3D,SAAS8B,YAAY5B;IAExC,IAAI,CAACyD,MAAM;QACT,OAAO;YAAElC;YAAWxB,MAAM6B;YAAY4B,UAAU5B,WAAWd,IAAI;QAAC;IAClE;IAEA,0EAA0E;IAC1E,0DAA0D;IAC1D,OAAO;QACLS;QACAxB,MAAM6B;QACNxB,QAAQqD,KAAKrD,MAAM;QACnBoD,UAAU5B,WAAWd,IAAI;QACzBX,OAAOsD,KAAKtD,KAAK;IACnB;AACF"}
1
+ {"version":3,"sources":["../src/prepareLegacyUpload.ts"],"sourcesContent":["import type { FocalPoint, ProbedImageSize } from 'payload'\nimport type { PreparedUploadTransformation, UploadTransformerInternal } from 'payload/internal'\n\nimport { isNumber } from 'payload/shared'\n\nimport type { SharpCollectionConfig, SharpDependency, SharpUploadTaskOptions } from './types.js'\n\nimport { canResizeImage } from './canResizeImage.js'\nimport { createSharpFromFile } from './createSharpFromFile.js'\nimport { getImageResizeAction } from './getImageResizeAction.js'\nimport { mapWithBoundedConcurrency } from './mapWithBoundedConcurrency.js'\nimport { sanitizeResizeConfig } from './sanitizeResizeConfig.js'\n\n/**\n * Sharp throws on truncated/header-only files. Returns `undefined` instead —\n * matching core's dependency-free probe — since unreadable dimensions shouldn't fail the upload.\n */\nasync function tryProbe(file: File, sharpDependency: SharpDependency) {\n try {\n const sharpFile = await createSharpFromFile({ file, sharpDependency })\n const metadata = await sharpFile.metadata()\n return metadata.width && metadata.height ? metadata : undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * Computes the legacy upload tasks (the main file, optionally cropped, and every\n * configured legacy image size) and hands each to the injected `transform` callback\n * exactly once. Reads the Sharp-owned config from `sharpTransformer({ collections })`\n * at factory-construction time — not from the sanitized collection, which only gets\n * the narrowed projection `init()` writes back.\n */\nexport function createPrepareLegacyUpload({\n collections,\n sharpDependency,\n}: {\n collections: Partial<Record<string, SharpCollectionConfig>>\n sharpDependency: SharpDependency\n}): NonNullable<UploadTransformerInternal['prepareUpload']> {\n return async ({ collectionSlug, file, req, transform, uploadEdits }) => {\n const collectionUpload = collections[collectionSlug] ?? {}\n\n const fileSupportsResize = canResizeImage(file.type)\n\n const cropData =\n uploadEdits && typeof uploadEdits === 'object' && 'crop' in uploadEdits\n ? uploadEdits.crop\n : undefined\n\n let originalDimensions: ProbedImageSize | undefined\n\n if (fileSupportsResize) {\n const originalMeta = await tryProbe(file, sharpDependency)\n if (originalMeta) {\n originalDimensions = { height: originalMeta.height, width: originalMeta.width }\n }\n }\n\n // Unreadable dimensions can't be cropped/resized — treat as non-resizable rather than failing the upload.\n const canProcessAsImage = fileSupportsResize && originalDimensions !== undefined\n\n const crop =\n cropData && originalDimensions\n ? {\n cropData,\n heightInPixels: uploadEdits.heightInPixels!,\n originalDimensions,\n widthInPixels: uploadEdits.widthInPixels!,\n }\n : undefined\n\n const mainResultFile = await transform({\n fieldPath: 'filename',\n options: { collectionUpload, crop, kind: 'main' } satisfies SharpUploadTaskOptions,\n })\n\n const mainResult = await describeResult({\n fieldPath: 'filename',\n fileSupportsResize: canProcessAsImage,\n resultFile: mainResultFile,\n sharpDependency,\n })\n\n const results: PreparedUploadTransformation[] = [mainResult]\n\n // Same precedence `init()` applies: Sharp's setting, else the collection's own `focalPoint`.\n const effectiveFocalPoint =\n collectionUpload.focalPoint ??\n req.payload.collections[collectionSlug]?.config.upload?.focalPoint\n const focalPointEnabled = effectiveFocalPoint !== false\n const variants = collectionUpload.variants\n\n if (canProcessAsImage && Array.isArray(variants) && originalDimensions) {\n const focalPoint: FocalPoint | undefined =\n focalPointEnabled && uploadEdits?.focalPoint\n ? {\n x: isNumber(uploadEdits.focalPoint.x) ? Math.round(uploadEdits.focalPoint.x) : 50,\n y: isNumber(uploadEdits.focalPoint.y) ? Math.round(uploadEdits.focalPoint.y) : 50,\n }\n : undefined\n\n const sizeResults = await mapWithBoundedConcurrency(variants, async (rawConfig) => {\n const imageResizeConfig = sanitizeResizeConfig(rawConfig)\n const fieldPath = `variants.${imageResizeConfig.name}` as const\n\n const resizeAction = getImageResizeAction({\n dimensions: originalDimensions,\n hasFocalPoint: Boolean(focalPoint),\n imageResizeConfig,\n })\n\n if (resizeAction === 'omit') {\n return { fieldPath } satisfies PreparedUploadTransformation\n }\n\n const sizeResultFile = await transform({\n fieldPath,\n options: {\n collectionUpload,\n focalPoint: resizeAction === 'resizeWithFocalPoint' ? focalPoint : undefined,\n imageResizeConfig,\n kind: 'size',\n originalDimensions,\n } satisfies SharpUploadTaskOptions,\n })\n\n return describeResult({\n fieldPath,\n fileSupportsResize: true,\n resultFile: sizeResultFile,\n sharpDependency,\n })\n })\n\n results.push(...sizeResults)\n }\n\n return results\n }\n}\n\nasync function describeResult({\n fieldPath,\n fileSupportsResize,\n resultFile,\n sharpDependency,\n}: {\n fieldPath: PreparedUploadTransformation['fieldPath']\n fileSupportsResize: boolean\n resultFile: File\n sharpDependency: SharpDependency\n}): Promise<PreparedUploadTransformation> {\n if (!fileSupportsResize) {\n return { fieldPath, file: resultFile, mimeType: resultFile.type }\n }\n\n const meta = await tryProbe(resultFile, sharpDependency)\n\n if (!meta) {\n return { fieldPath, file: resultFile, mimeType: resultFile.type }\n }\n\n // `tryProbe` never sets `animated: true`, so `meta.height` is already the\n // single-frame height — do not divide by page count here.\n return {\n fieldPath,\n file: resultFile,\n height: meta.height,\n mimeType: resultFile.type,\n width: meta.width,\n }\n}\n"],"names":["isNumber","canResizeImage","createSharpFromFile","getImageResizeAction","mapWithBoundedConcurrency","sanitizeResizeConfig","tryProbe","file","sharpDependency","sharpFile","metadata","width","height","undefined","createPrepareLegacyUpload","collections","collectionSlug","req","transform","uploadEdits","collectionUpload","fileSupportsResize","type","cropData","crop","originalDimensions","originalMeta","canProcessAsImage","heightInPixels","widthInPixels","mainResultFile","fieldPath","options","kind","mainResult","describeResult","resultFile","results","effectiveFocalPoint","focalPoint","payload","config","upload","focalPointEnabled","variants","Array","isArray","x","Math","round","y","sizeResults","rawConfig","imageResizeConfig","name","resizeAction","dimensions","hasFocalPoint","Boolean","sizeResultFile","push","mimeType","meta"],"mappings":"AAGA,SAASA,QAAQ,QAAQ,iBAAgB;AAIzC,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,oBAAoB,QAAQ,4BAA2B;AAChE,SAASC,yBAAyB,QAAQ,iCAAgC;AAC1E,SAASC,oBAAoB,QAAQ,4BAA2B;AAEhE;;;CAGC,GACD,eAAeC,SAASC,IAAU,EAAEC,eAAgC;IAClE,IAAI;QACF,MAAMC,YAAY,MAAMP,oBAAoB;YAAEK;YAAMC;QAAgB;QACpE,MAAME,WAAW,MAAMD,UAAUC,QAAQ;QACzC,OAAOA,SAASC,KAAK,IAAID,SAASE,MAAM,GAAGF,WAAWG;IACxD,EAAE,OAAM;QACN,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E;IAC1E,0DAA0D;IAC1D,OAAO;QACLS;QACAxB,MAAM6B;QACNxB,QAAQkD,KAAKlD,MAAM;QACnBiD,UAAUzB,WAAWd,IAAI;QACzBX,OAAOmD,KAAKnD,KAAK;IACnB;AACF"}
package/package.json CHANGED
@@ -1,13 +1,8 @@
1
1
  {
2
2
  "name": "@payloadcms/transformer-sharp",
3
- "version": "4.0.0-internal.f15737c",
3
+ "version": "4.0.0-internal.f2a04f7",
4
4
  "description": "Official Sharp-based file transformer for Payload: request-time image resizing and upload-time image processing",
5
5
  "homepage": "https://payloadcms.com",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/payloadcms/payload.git",
9
- "directory": "packages/transformer-sharp"
10
- },
11
6
  "license": "MIT",
12
7
  "author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
13
8
  "maintainers": [
@@ -17,8 +12,18 @@
17
12
  "url": "https://payloadcms.com"
18
13
  }
19
14
  ],
20
- "sideEffects": false,
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/payloadcms/payload.git",
18
+ "directory": "packages/transformer-sharp"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
21
23
  "type": "module",
24
+ "sideEffects": false,
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
22
27
  "exports": {
23
28
  ".": {
24
29
  "import": "./dist/index.js",
@@ -26,19 +31,14 @@
26
31
  "default": "./dist/index.js"
27
32
  }
28
33
  },
29
- "main": "./dist/index.js",
30
- "types": "./dist/index.d.ts",
31
- "files": [
32
- "dist"
33
- ],
34
34
  "dependencies": {
35
35
  "sharp": "0.35.4"
36
36
  },
37
37
  "devDependencies": {
38
- "payload": "4.0.0-internal.f15737c"
38
+ "payload": "4.0.0-internal.f2a04f7"
39
39
  },
40
40
  "peerDependencies": {
41
- "payload": "4.0.0-internal.f15737c"
41
+ "payload": "4.0.0-internal.f2a04f7"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=24.15.0"