@uploadista/flow-images-photon 0.0.8 → 0.0.9
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.
- package/dist/common-DPK5llPw.cjs +1 -0
- package/dist/{common-DHkjD1Ly.js → common-KWfL09nL.mjs} +1 -1
- package/dist/common-KWfL09nL.mjs.map +1 -0
- package/dist/node.cjs +1 -1
- package/dist/node.d.cts +1 -2
- package/dist/node.d.cts.map +1 -1
- package/dist/{node.d.ts → node.d.mts} +2 -3
- package/dist/{node.d.ts.map → node.d.mts.map} +1 -1
- package/dist/node.mjs +2 -0
- package/dist/node.mjs.map +1 -0
- package/dist/serverless.cjs +1 -1
- package/dist/serverless.d.cts +1 -2
- package/dist/serverless.d.cts.map +1 -1
- package/dist/serverless.d.mts +7 -0
- package/dist/serverless.d.mts.map +1 -0
- package/dist/serverless.mjs +2 -0
- package/dist/serverless.mjs.map +1 -0
- package/package.json +8 -8
- package/dist/common-CBDoO3G0.cjs +0 -1
- package/dist/common-DHkjD1Ly.js.map +0 -1
- package/dist/node.js +0 -2
- package/dist/node.js.map +0 -1
- package/dist/serverless.d.ts +0 -8
- package/dist/serverless.d.ts.map +0 -1
- package/dist/serverless.js +0 -2
- package/dist/serverless.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>Math.round((e+2**-52)*100)/100,t=(t,n,r,i,a)=>{let o={};switch(t){case`contain`:{let e=i/n,t=a/r,s=Math.min(e,t);o={width:n*s,height:r*s};break}case`cover`:{let e=i/n,t=a/r,s=Math.max(e,t),c=n*s,l=r*s;if(c<i||l<a){let e=Math.max(i/n,a/r);o={width:n*e,height:r*e};break}o={width:c,height:l};break}case`fill`:o={width:i,height:a};break;case`none`:o={width:n,height:r};break;case`scale-down`:{let e=i/n,t=a/r,s=Math.min(1,Math.min(e,t));o={width:n*s,height:r*s};break}default:throw Error(`Invalid object fit value`)}if(!o?.width||!o?.height)throw Error(`Invalid dimensions`);return{width:e(o.width),height:e(o.height)}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const e=e=>Math.round((e+2**-52)*100)/100,t=(t,n,r,i,a)=>{let o={};switch(t){case`contain`:{let e=i/n,t=a/r,s=Math.min(e,t);o={width:n*s,height:r*s};break}case`cover`:{let e=i/n,t=a/r,s=Math.max(e,t),c=n*s,l=r*s;if(c<i||l<a){let e=Math.max(i/n,a/r);o={width:n*e,height:r*e};break}o={width:c,height:l};break}case`fill`:o={width:i,height:a};break;case`none`:o={width:n,height:r};break;case`scale-down`:{let e=i/n,t=a/r,s=Math.min(1,Math.min(e,t));o={width:n*s,height:r*s};break}default:throw Error(`Invalid object fit value`)}if(!o?.width||!o?.height)throw Error(`Invalid dimensions`);return{width:e(o.width),height:e(o.height)}};export{t};
|
|
2
|
-
//# sourceMappingURL=common-
|
|
2
|
+
//# sourceMappingURL=common-KWfL09nL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-KWfL09nL.mjs","names":["newSize: {\n width?: number;\n height?: number;\n }"],"sources":["../src/common.ts"],"sourcesContent":["export const round2dp = (num: number) =>\n Math.round((num + Number.EPSILON) * 100) / 100;\n\nexport const calculateImageSize = (\n objectFit: \"contain\" | \"cover\" | \"fill\" | \"none\" | \"scale-down\",\n currentWidth: number,\n currentHeight: number,\n containerWidth: number,\n containerHeight: number,\n) => {\n let newSize: {\n width?: number;\n height?: number;\n } = {};\n\n switch (objectFit) {\n case \"contain\": {\n // Calculate dimensions while maintaining aspect ratio\n const widthRatioContain = containerWidth / currentWidth;\n const heightRatioContain = containerHeight / currentHeight;\n const scaleContain = Math.min(widthRatioContain, heightRatioContain);\n newSize = {\n width: currentWidth * scaleContain,\n height: currentHeight * scaleContain,\n };\n break;\n }\n case \"cover\": {\n // Calculate dimensions while maintaining aspect ratio\n const widthRatioCover = containerWidth / currentWidth;\n const heightRatioCover = containerHeight / currentHeight;\n const scaleCover = Math.max(widthRatioCover, heightRatioCover);\n const newWidthCover = currentWidth * scaleCover;\n const newHeightCover = currentHeight * scaleCover;\n // Adjust dimensions if it doesn't cover the container completely\n if (newWidthCover < containerWidth || newHeightCover < containerHeight) {\n const scaleCoverAdjusted = Math.max(\n containerWidth / currentWidth,\n containerHeight / currentHeight,\n );\n newSize = {\n width: currentWidth * scaleCoverAdjusted,\n height: currentHeight * scaleCoverAdjusted,\n };\n break;\n }\n newSize = {\n width: newWidthCover,\n height: newHeightCover,\n };\n break;\n }\n case \"fill\":\n // Stretch image to fill container\n newSize = {\n width: containerWidth,\n height: containerHeight,\n };\n break;\n case \"none\":\n // Keep original image size\n newSize = {\n width: currentWidth,\n height: currentHeight,\n };\n break;\n case \"scale-down\": {\n // Calculate dimensions based on contain and none values\n const widthRatioScaleDown = containerWidth / currentWidth;\n const heightRatioScaleDown = containerHeight / currentHeight;\n const scaleScaleDown = Math.min(\n 1,\n Math.min(widthRatioScaleDown, heightRatioScaleDown),\n );\n newSize = {\n width: currentWidth * scaleScaleDown,\n height: currentHeight * scaleScaleDown,\n };\n break;\n }\n default:\n throw new Error(\"Invalid object fit value\");\n }\n\n if (!newSize?.width || !newSize?.height) {\n throw new Error(\"Invalid dimensions\");\n }\n\n return {\n width: round2dp(newSize.width),\n height: round2dp(newSize.height),\n };\n\n // return newSize;\n};\n"],"mappings":"AAAA,MAAa,EAAY,GACvB,KAAK,OAAO,UAAwB,IAAI,CAAG,IAEhC,GACX,EACA,EACA,EACA,EACA,IACG,CACH,IAAIA,EAGA,EAAE,CAEN,OAAQ,EAAR,CACE,IAAK,UAAW,CAEd,IAAM,EAAoB,EAAiB,EACrC,EAAqB,EAAkB,EACvC,EAAe,KAAK,IAAI,EAAmB,EAAmB,CACpE,EAAU,CACR,MAAO,EAAe,EACtB,OAAQ,EAAgB,EACzB,CACD,MAEF,IAAK,QAAS,CAEZ,IAAM,EAAkB,EAAiB,EACnC,EAAmB,EAAkB,EACrC,EAAa,KAAK,IAAI,EAAiB,EAAiB,CACxD,EAAgB,EAAe,EAC/B,EAAiB,EAAgB,EAEvC,GAAI,EAAgB,GAAkB,EAAiB,EAAiB,CACtE,IAAM,EAAqB,KAAK,IAC9B,EAAiB,EACjB,EAAkB,EACnB,CACD,EAAU,CACR,MAAO,EAAe,EACtB,OAAQ,EAAgB,EACzB,CACD,MAEF,EAAU,CACR,MAAO,EACP,OAAQ,EACT,CACD,MAEF,IAAK,OAEH,EAAU,CACR,MAAO,EACP,OAAQ,EACT,CACD,MACF,IAAK,OAEH,EAAU,CACR,MAAO,EACP,OAAQ,EACT,CACD,MACF,IAAK,aAAc,CAEjB,IAAM,EAAsB,EAAiB,EACvC,EAAuB,EAAkB,EACzC,EAAiB,KAAK,IAC1B,EACA,KAAK,IAAI,EAAqB,EAAqB,CACpD,CACD,EAAU,CACR,MAAO,EAAe,EACtB,OAAQ,EAAgB,EACzB,CACD,MAEF,QACE,MAAU,MAAM,2BAA2B,CAG/C,GAAI,CAAC,GAAS,OAAS,CAAC,GAAS,OAC/B,MAAU,MAAM,qBAAqB,CAGvC,MAAO,CACL,MAAO,EAAS,EAAQ,MAAM,CAC9B,OAAQ,EAAS,EAAQ,OAAO,CACjC"}
|
package/dist/node.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./common-
|
|
1
|
+
const e=require(`./common-DPK5llPw.cjs`);let t=require(`@cf-wasm/photon/node`),n=require(`@uploadista/core/flow`),r=require(`effect`);const i=e=>{let n=e.toRgb();return new t.Rgba(n.r,n.g,n.b,n.a)},a=(n,r,a,o)=>{let s=n.get_width(),c=n.get_height();if(!r&&!a)throw Error(`At least one of width or height is required`);if(r&&!a?a=Math.floor(r/s*c):a&&!r&&(r=Math.floor(a/c*s)),!r||!a)throw Error(`Invalid width or height`);if(r===s&&a===c)return n;let l=o?.fit||`cover`,u=e.t(l,s,c,r,a);n=(0,t.resize)(n,u.width,u.height,1);let[d,f]=[n.get_width(),n.get_height()];if(l===`contain`&&o?.fit_cover_letterbox_color){let e=Math.floor((r-d)/2),s=Math.floor((a-f)/2);s>0&&(n=(0,t.padding_top)(n,s,i(o.fit_cover_letterbox_color)),n=(0,t.padding_bottom)(n,s,i(o.fit_cover_letterbox_color))),e>0&&(n=(0,t.padding_left)(n,e,i(o.fit_cover_letterbox_color)),n=(0,t.padding_right)(n,e,i(o.fit_cover_letterbox_color)))}else if(l===`cover`){let e=Math.floor(d-r)/2,i=Math.floor(f-a)/2;n=(0,t.crop)(n,e,i,r+e,a+i)}return n},o=(e,t,n)=>{let r;switch(t){case`webp`:r=e.get_bytes_webp();break;case`jpeg`:r=e.get_bytes_jpeg(n?.jpeg_quality||100);break;case`png`:r=e.get_bytes();break;default:r=e.get_bytes_jpeg(n?.jpeg_quality||100)}return r},s=r.Layer.succeed(n.ImagePlugin,n.ImagePlugin.of({optimize:(e,{quality:n})=>{let i=t.PhotonImage.new_from_byteslice(e),a=i.get_bytes_jpeg(n);return i.free(),r.Effect.succeed(a)},resize:(e,{width:n,height:i,fit:o})=>{if(!n&&!i)throw Error(`Either width or height must be specified for resize`);let s=t.PhotonImage.new_from_byteslice(e),c=a(s,n??s.get_width(),i??s.get_height(),{fit:o}),l=c.get_bytes_webp();return s.free(),c.free(),r.Effect.succeed(l)}}));exports.autoResize=a,exports.imagePluginNode=s,exports.imageToFormat=o,exports.tinyColorToPhotonRGBA=i;
|
package/dist/node.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PhotonImage, Rgba } from "@cf-wasm/photon/node";
|
|
2
|
-
import { ImagePlugin } from "@uploadista/core/flow";
|
|
3
2
|
import { Layer } from "effect";
|
|
4
3
|
import tinycolor from "tinycolor2";
|
|
5
4
|
|
|
@@ -12,7 +11,7 @@ declare const autoResize: (image: PhotonImage, newWidth?: number, newHeight?: nu
|
|
|
12
11
|
declare const imageToFormat: (image: PhotonImage, format: "webp" | "jpeg" | "png", options?: {
|
|
13
12
|
jpeg_quality?: number;
|
|
14
13
|
}) => Uint8Array<ArrayBufferLike>;
|
|
15
|
-
declare const imagePluginNode: Layer.Layer<
|
|
14
|
+
declare const imagePluginNode: Layer.Layer<unknown, never, never>;
|
|
16
15
|
//#endregion
|
|
17
16
|
export { autoResize, imagePluginNode, imageToFormat, tinyColorToPhotonRGBA };
|
|
18
17
|
//# sourceMappingURL=node.d.cts.map
|
package/dist/node.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.cts","names":[],"sources":["../src/image-plugin-node.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node.d.cts","names":[],"sources":["../src/image-plugin-node.ts"],"sourcesContent":[],"mappings":";;;;;cAea,+BAAgC,SAAA,CAAU,aAAQ;cAKlD,oBACJ,2DAAA;EANI,GAAA,CAAA,EAAA,SAAA,GAAA,OAGZ,GAAA,MAAA;EAEY,yBAmFZ,CAAA,EA7E+B,SAAA,CAAU,QA6EzC;CAlFQ,EAAA,GAMN,WANM;AAKuB,cA+EnB,aA/E6B,EAAA,CAAA,KAAA,EAgFjC,WAhFiC,EAAA,MAAA,EAAA,MAAA,GAAA,MAAA,GAAA,KAAA,EAAA,OA6EzC,CA7EyC,EAAA;EACvC,YAAA,CAAA,EAAA,MAAA;CA4EF,EAAA,GAOE,UAPF,CAOE,eAPF,CAAA;AAEY,cA0BA,eAFZ,EAE2B,KAAA,CAAA,KAF3B,CAAA,OAAA,EAAA,KAAA,EAAA,KAAA,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PhotonImage, Rgba } from "@cf-wasm/photon/node";
|
|
2
|
-
import { ImagePlugin } from "@uploadista/core/flow";
|
|
3
2
|
import { Layer } from "effect";
|
|
4
3
|
import tinycolor from "tinycolor2";
|
|
5
4
|
|
|
@@ -12,7 +11,7 @@ declare const autoResize: (image: PhotonImage, newWidth?: number, newHeight?: nu
|
|
|
12
11
|
declare const imageToFormat: (image: PhotonImage, format: "webp" | "jpeg" | "png", options?: {
|
|
13
12
|
jpeg_quality?: number;
|
|
14
13
|
}) => Uint8Array<ArrayBufferLike>;
|
|
15
|
-
declare const imagePluginNode: Layer.Layer<
|
|
14
|
+
declare const imagePluginNode: Layer.Layer<unknown, never, never>;
|
|
16
15
|
//#endregion
|
|
17
16
|
export { autoResize, imagePluginNode, imageToFormat, tinyColorToPhotonRGBA };
|
|
18
|
-
//# sourceMappingURL=node.d.
|
|
17
|
+
//# sourceMappingURL=node.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.
|
|
1
|
+
{"version":3,"file":"node.d.mts","names":[],"sources":["../src/image-plugin-node.ts"],"sourcesContent":[],"mappings":";;;;;cAea,+BAAgC,SAAA,CAAU,aAAQ;cAKlD,oBACJ,2DAAA;EANI,GAAA,CAAA,EAAA,SAAA,GAAA,OAGZ,GAAA,MAAA;EAEY,yBAmFZ,CAAA,EA7E+B,SAAA,CAAU,QA6EzC;CAlFQ,EAAA,GAMN,WANM;AAKuB,cA+EnB,aA/E6B,EAAA,CAAA,KAAA,EAgFjC,WAhFiC,EAAA,MAAA,EAAA,MAAA,GAAA,MAAA,GAAA,KAAA,EAAA,OA6EzC,CA7EyC,EAAA;EACvC,YAAA,CAAA,EAAA,MAAA;CA4EF,EAAA,GAOE,UAPF,CAOE,eAPF,CAAA;AAEY,cA0BA,eAFZ,EAE2B,KAAA,CAAA,KAF3B,CAAA,OAAA,EAAA,KAAA,EAAA,KAAA,CAAA"}
|
package/dist/node.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./common-KWfL09nL.mjs";import{PhotonImage as t,Rgba as n,crop as r,padding_bottom as i,padding_left as a,padding_right as o,padding_top as s,resize as c}from"@cf-wasm/photon/node";import{ImagePlugin as l}from"@uploadista/core/flow";import{Effect as u,Layer as d}from"effect";const f=e=>{let t=e.toRgb();return new n(t.r,t.g,t.b,t.a)},p=(t,n,l,u)=>{let d=t.get_width(),p=t.get_height();if(!n&&!l)throw Error(`At least one of width or height is required`);if(n&&!l?l=Math.floor(n/d*p):l&&!n&&(n=Math.floor(l/p*d)),!n||!l)throw Error(`Invalid width or height`);if(n===d&&l===p)return t;let m=u?.fit||`cover`,h=e(m,d,p,n,l);t=c(t,h.width,h.height,1);let[g,_]=[t.get_width(),t.get_height()];if(m===`contain`&&u?.fit_cover_letterbox_color){let e=Math.floor((n-g)/2),r=Math.floor((l-_)/2);r>0&&(t=s(t,r,f(u.fit_cover_letterbox_color)),t=i(t,r,f(u.fit_cover_letterbox_color))),e>0&&(t=a(t,e,f(u.fit_cover_letterbox_color)),t=o(t,e,f(u.fit_cover_letterbox_color)))}else if(m===`cover`){let e=Math.floor(g-n)/2,i=Math.floor(_-l)/2;t=r(t,e,i,n+e,l+i)}return t},m=(e,t,n)=>{let r;switch(t){case`webp`:r=e.get_bytes_webp();break;case`jpeg`:r=e.get_bytes_jpeg(n?.jpeg_quality||100);break;case`png`:r=e.get_bytes();break;default:r=e.get_bytes_jpeg(n?.jpeg_quality||100)}return r},h=d.succeed(l,l.of({optimize:(e,{quality:n})=>{let r=t.new_from_byteslice(e),i=r.get_bytes_jpeg(n);return r.free(),u.succeed(i)},resize:(e,{width:n,height:r,fit:i})=>{if(!n&&!r)throw Error(`Either width or height must be specified for resize`);let a=t.new_from_byteslice(e),o=p(a,n??a.get_width(),r??a.get_height(),{fit:i}),s=o.get_bytes_webp();return a.free(),o.free(),u.succeed(s)}}));export{p as autoResize,h as imagePluginNode,m as imageToFormat,f as tinyColorToPhotonRGBA};
|
|
2
|
+
//# sourceMappingURL=node.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.mjs","names":["outputBytes: Uint8Array"],"sources":["../src/image-plugin-node.ts"],"sourcesContent":["import {\n crop,\n PhotonImage,\n padding_bottom,\n padding_left,\n padding_right,\n padding_top,\n Rgba,\n resize,\n} from \"@cf-wasm/photon/node\";\nimport { ImagePlugin } from \"@uploadista/core/flow\";\nimport { Effect, Layer } from \"effect\";\nimport type tinycolor from \"tinycolor2\";\nimport { calculateImageSize } from \"./common\";\n\nexport const tinyColorToPhotonRGBA = (color: tinycolor.Instance) => {\n const rgba = color.toRgb();\n return new Rgba(rgba.r, rgba.g, rgba.b, rgba.a);\n};\n\nexport const autoResize = (\n image: PhotonImage,\n newWidth?: number,\n newHeight?: number,\n options?: {\n fit?: \"contain\" | \"cover\" | \"fill\";\n fit_cover_letterbox_color?: tinycolor.Instance;\n },\n) => {\n const currentWidth = image.get_width();\n const currentHeight = image.get_height();\n\n if (!newWidth && !newHeight) {\n throw new Error(\"At least one of width or height is required\");\n }\n\n if (newWidth && !newHeight) {\n newHeight = Math.floor((newWidth / currentWidth) * currentHeight);\n } else if (newHeight && !newWidth) {\n newWidth = Math.floor((newHeight / currentHeight) * currentWidth);\n }\n\n if (!newWidth || !newHeight) {\n throw new Error(\"Invalid width or height\");\n }\n\n if (newWidth === currentWidth && newHeight === currentHeight) {\n return image;\n }\n\n const fit = options?.fit || \"cover\";\n\n const dem = calculateImageSize(\n fit,\n currentWidth,\n currentHeight,\n newWidth,\n newHeight,\n );\n\n image = resize(image, dem.width, dem.height, 1);\n\n const [updatedWidth, updatedHeight] = [image.get_width(), image.get_height()];\n\n if (fit === \"contain\" && options?.fit_cover_letterbox_color) {\n const paddingX = Math.floor((newWidth - updatedWidth) / 2);\n const paddingY = Math.floor((newHeight - updatedHeight) / 2);\n\n if (paddingY > 0) {\n image = padding_top(\n image,\n paddingY,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n image = padding_bottom(\n image,\n paddingY,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n }\n\n if (paddingX > 0) {\n image = padding_left(\n image,\n paddingX,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n image = padding_right(\n image,\n paddingX,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n }\n } else if (fit === \"cover\") {\n //crop to center\n const cropX = Math.floor(updatedWidth - newWidth) / 2;\n const cropY = Math.floor(updatedHeight - newHeight) / 2;\n\n //top left to down right\n image = crop(image, cropX, cropY, newWidth + cropX, newHeight + cropY);\n }\n\n return image;\n};\n\nexport const imageToFormat = (\n image: PhotonImage,\n format: \"webp\" | \"jpeg\" | \"png\",\n options?: {\n jpeg_quality?: number;\n },\n) => {\n let outputBytes: Uint8Array;\n\n switch (format) {\n case \"webp\":\n outputBytes = image.get_bytes_webp();\n break;\n case \"jpeg\":\n outputBytes = image.get_bytes_jpeg(options?.jpeg_quality || 100);\n break;\n case \"png\":\n outputBytes = image.get_bytes();\n break;\n default:\n outputBytes = image.get_bytes_jpeg(options?.jpeg_quality || 100);\n }\n\n return outputBytes;\n};\n\nexport const imagePluginNode = Layer.succeed(\n ImagePlugin,\n ImagePlugin.of({\n optimize: (inputBytes, { quality }) => {\n // create a PhotonImage instance\n const inputImage = PhotonImage.new_from_byteslice(inputBytes);\n\n // get jpeg bytes\n const outputBytes = inputImage.get_bytes_jpeg(quality);\n\n // call free() method to free memory\n inputImage.free();\n\n return Effect.succeed(outputBytes);\n },\n resize: (inputBytes, { width, height, fit }) => {\n if (!width && !height) {\n throw new Error(\"Either width or height must be specified for resize\");\n }\n // create a PhotonImage instance\n const inputImage = PhotonImage.new_from_byteslice(inputBytes);\n\n // resize image using photon\n const outputImage = autoResize(\n inputImage,\n width ?? inputImage.get_width(),\n height ?? inputImage.get_height(),\n { fit },\n );\n\n // get webp bytes\n const outputBytes = outputImage.get_bytes_webp();\n\n // for other formats\n // png : outputImage.get_bytes();\n // jpeg : outputImage.get_bytes_jpeg(quality);\n\n // call free() method to free memory\n inputImage.free();\n outputImage.free();\n\n return Effect.succeed(outputBytes);\n },\n }),\n);\n"],"mappings":"sSAeA,MAAa,EAAyB,GAA8B,CAClE,IAAM,EAAO,EAAM,OAAO,CAC1B,OAAO,IAAI,EAAK,EAAK,EAAG,EAAK,EAAG,EAAK,EAAG,EAAK,EAAE,EAGpC,G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,MACF,IAAK,OACH,EAAc,EAAM,eAAe,GAAS,cAAgB,IAAI,CAChE,MACF,IAAK,MACH,EAAc,EAAM,WAAW,CAC/B,MACF,QACE,EAAc,EAAM,eAAe,GAAS,cAAgB,IAAI,CAGpE,OAAO,GAGI,EAAkB,EAAM,QACnC,EACA,EAAY,GAAG,CACb,UAAW,EAAY,CAAE,aAAc,CAErC,IAAM,EAAa,EAAY,mBAAmB,EAAW,CAGvD,EAAc,EAAW,eAAe,EAAQ,CAKtD,OAFA,EAAW,MAAM,CAEV,EAAO,QAAQ,EAAY,EAEpC,QAAS,EAAY,CAAE,QAAO,SAAQ,SAAU,CAC9C,GAAI,CAAC,GAAS,CAAC,EACb,MAAU,MAAM,sDAAsD,CAGxE,IAAM,EAAa,EAAY,mBAAmB,EAAW,CAGvD,EAAc,EAClB,EACA,GAAS,EAAW,WAAW,CAC/B,GAAU,EAAW,YAAY,CACjC,CAAE,MAAK,CACR,CAGK,EAAc,EAAY,gBAAgB,CAUhD,OAHA,EAAW,MAAM,CACjB,EAAY,MAAM,CAEX,EAAO,QAAQ,EAAY,EAErC,CAAC,CACH"}
|
package/dist/serverless.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./common-
|
|
1
|
+
const e=require(`./common-DPK5llPw.cjs`);let t=require(`@uploadista/core/flow`),n=require(`effect`),r=require(`@cf-wasm/photon`);const i=e=>{let t=e.toRgb();return new r.Rgba(t.r,t.g,t.b,t.a)},a=(t,n,a,o)=>{let s=t.get_width(),c=t.get_height();if(!n&&!a)throw Error(`At least one of width or height is required`);if(n&&!a?a=Math.floor(n/s*c):a&&!n&&(n=Math.floor(a/c*s)),!n||!a)throw Error(`Invalid width or height`);if(n===s&&a===c)return t;let l=o?.fit||`cover`,u=e.t(l,s,c,n,a);t=(0,r.resize)(t,u.width,u.height,1);let[d,f]=[t.get_width(),t.get_height()];if(l===`contain`&&o?.fit_cover_letterbox_color){let e=Math.floor((n-d)/2),s=Math.floor((a-f)/2);s>0&&(t=(0,r.padding_top)(t,s,i(o.fit_cover_letterbox_color)),t=(0,r.padding_bottom)(t,s,i(o.fit_cover_letterbox_color))),e>0&&(t=(0,r.padding_left)(t,e,i(o.fit_cover_letterbox_color)),t=(0,r.padding_right)(t,e,i(o.fit_cover_letterbox_color)))}else if(l===`cover`){let e=Math.floor(d-n)/2,i=Math.floor(f-a)/2;t=(0,r.crop)(t,e,i,n+e,a+i)}return t},o=n.Layer.succeed(t.ImagePlugin,t.ImagePlugin.of({optimize:(e,{quality:t})=>{let i=r.PhotonImage.new_from_byteslice(e),a=i.get_bytes_jpeg(t);return i.free(),n.Effect.succeed(a)},resize:(e,{width:t,height:i,fit:o})=>{if(!t&&!i)throw Error(`Either width or height must be specified for resize`);let s=r.PhotonImage.new_from_byteslice(e),c=a(s,t??s.get_width(),i??s.get_height(),{fit:o}),l=c.get_bytes_webp();return s.free(),c.free(),n.Effect.succeed(l)}}));exports.imagePluginServerless=o;
|
package/dist/serverless.d.cts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ImagePlugin } from "@uploadista/core/flow";
|
|
2
1
|
import { Layer } from "effect";
|
|
3
2
|
|
|
4
3
|
//#region src/image-plugin-serverless.d.ts
|
|
5
|
-
declare const imagePluginServerless: Layer.Layer<
|
|
4
|
+
declare const imagePluginServerless: Layer.Layer<unknown, never, never>;
|
|
6
5
|
//#endregion
|
|
7
6
|
export { imagePluginServerless };
|
|
8
7
|
//# sourceMappingURL=serverless.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverless.d.cts","names":[],"sources":["../src/image-plugin-serverless.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serverless.d.cts","names":[],"sources":["../src/image-plugin-serverless.ts"],"sourcesContent":[],"mappings":";;;cAyGa,uBAAqB,KAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverless.d.mts","names":[],"sources":["../src/image-plugin-serverless.ts"],"sourcesContent":[],"mappings":";;;cAyGa,uBAAqB,KAAA,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./common-KWfL09nL.mjs";import{ImagePlugin as t}from"@uploadista/core/flow";import{Effect as n,Layer as r}from"effect";import{PhotonImage as i,Rgba as a,crop as o,padding_bottom as s,padding_left as c,padding_right as l,padding_top as u,resize as d}from"@cf-wasm/photon";const f=e=>{let t=e.toRgb();return new a(t.r,t.g,t.b,t.a)},p=(t,n,r,i)=>{let a=t.get_width(),p=t.get_height();if(!n&&!r)throw Error(`At least one of width or height is required`);if(n&&!r?r=Math.floor(n/a*p):r&&!n&&(n=Math.floor(r/p*a)),!n||!r)throw Error(`Invalid width or height`);if(n===a&&r===p)return t;let m=i?.fit||`cover`,h=e(m,a,p,n,r);t=d(t,h.width,h.height,1);let[g,_]=[t.get_width(),t.get_height()];if(m===`contain`&&i?.fit_cover_letterbox_color){let e=Math.floor((n-g)/2),a=Math.floor((r-_)/2);a>0&&(t=u(t,a,f(i.fit_cover_letterbox_color)),t=s(t,a,f(i.fit_cover_letterbox_color))),e>0&&(t=c(t,e,f(i.fit_cover_letterbox_color)),t=l(t,e,f(i.fit_cover_letterbox_color)))}else if(m===`cover`){let e=Math.floor(g-n)/2,i=Math.floor(_-r)/2;t=o(t,e,i,n+e,r+i)}return t},m=r.succeed(t,t.of({optimize:(e,{quality:t})=>{let r=i.new_from_byteslice(e),a=r.get_bytes_jpeg(t);return r.free(),n.succeed(a)},resize:(e,{width:t,height:r,fit:a})=>{if(!t&&!r)throw Error(`Either width or height must be specified for resize`);let o=i.new_from_byteslice(e),s=p(o,t??o.get_width(),r??o.get_height(),{fit:a}),c=s.get_bytes_webp();return o.free(),s.free(),n.succeed(c)}}));export{m as imagePluginServerless};
|
|
2
|
+
//# sourceMappingURL=serverless.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverless.mjs","names":[],"sources":["../src/image-plugin-serverless.ts"],"sourcesContent":["import {\n crop,\n PhotonImage,\n padding_bottom,\n padding_left,\n padding_right,\n padding_top,\n Rgba,\n resize,\n} from \"@cf-wasm/photon\";\nimport { ImagePlugin } from \"@uploadista/core/flow\";\nimport { Effect, Layer } from \"effect\";\nimport type tinycolor from \"tinycolor2\";\nimport { calculateImageSize } from \"./common\";\n\nconst tinyColorToPhotonRGBA = (color: tinycolor.Instance) => {\n const rgba = color.toRgb();\n return new Rgba(rgba.r, rgba.g, rgba.b, rgba.a);\n};\n\nconst autoResize = (\n image: PhotonImage,\n newWidth?: number,\n newHeight?: number,\n options?: {\n fit?: \"contain\" | \"cover\" | \"fill\";\n fit_cover_letterbox_color?: tinycolor.Instance;\n },\n) => {\n const currentWidth = image.get_width();\n const currentHeight = image.get_height();\n\n if (!newWidth && !newHeight) {\n throw new Error(\"At least one of width or height is required\");\n }\n\n if (newWidth && !newHeight) {\n newHeight = Math.floor((newWidth / currentWidth) * currentHeight);\n } else if (newHeight && !newWidth) {\n newWidth = Math.floor((newHeight / currentHeight) * currentWidth);\n }\n\n if (!newWidth || !newHeight) {\n throw new Error(\"Invalid width or height\");\n }\n\n if (newWidth === currentWidth && newHeight === currentHeight) {\n return image;\n }\n\n const fit = options?.fit || \"cover\";\n\n const dem = calculateImageSize(\n fit,\n currentWidth,\n currentHeight,\n newWidth,\n newHeight,\n );\n\n image = resize(image, dem.width, dem.height, 1);\n\n const [updatedWidth, updatedHeight] = [image.get_width(), image.get_height()];\n\n if (fit === \"contain\" && options?.fit_cover_letterbox_color) {\n const paddingX = Math.floor((newWidth - updatedWidth) / 2);\n const paddingY = Math.floor((newHeight - updatedHeight) / 2);\n\n if (paddingY > 0) {\n image = padding_top(\n image,\n paddingY,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n image = padding_bottom(\n image,\n paddingY,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n }\n\n if (paddingX > 0) {\n image = padding_left(\n image,\n paddingX,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n image = padding_right(\n image,\n paddingX,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n }\n } else if (fit === \"cover\") {\n //crop to center\n const cropX = Math.floor(updatedWidth - newWidth) / 2;\n const cropY = Math.floor(updatedHeight - newHeight) / 2;\n\n //top left to down right\n image = crop(image, cropX, cropY, newWidth + cropX, newHeight + cropY);\n }\n\n return image;\n};\n\nexport const imagePluginServerless = Layer.succeed(\n ImagePlugin,\n ImagePlugin.of({\n optimize: (inputBytes, { quality }) => {\n // create a PhotonImage instance\n const inputImage = PhotonImage.new_from_byteslice(inputBytes);\n\n // get jpeg bytes\n const outputBytes = inputImage.get_bytes_jpeg(quality);\n\n // call free() method to free memory\n inputImage.free();\n\n return Effect.succeed(outputBytes);\n },\n resize: (inputBytes, { width, height, fit }) => {\n if (!width && !height) {\n throw new Error(\"Either width or height must be specified for resize\");\n }\n // create a PhotonImage instance\n const inputImage = PhotonImage.new_from_byteslice(inputBytes);\n\n // resize image using photon\n const outputImage = autoResize(\n inputImage,\n width ?? inputImage.get_width(),\n height ?? inputImage.get_height(),\n { fit },\n );\n\n // get webp bytes\n const outputBytes = outputImage.get_bytes_webp();\n\n // for other formats\n // png : outputImage.get_bytes();\n // jpeg : outputImage.get_bytes_jpeg(quality);\n\n // call free() method to free memory\n inputImage.free();\n outputImage.free();\n\n return Effect.succeed(outputBytes);\n },\n }),\n);\n"],"mappings":"iSAeA,MAAM,EAAyB,GAA8B,CAC3D,IAAM,EAAO,EAAM,OAAO,CAC1B,OAAO,IAAI,EAAK,EAAK,EAAG,EAAK,EAAG,EAAK,EAAG,EAAK,EAAE,EAG3C,GACJ,EACA,EACA,EACA,IAIG,CACH,IAAM,EAAe,EAAM,WAAW,CAChC,EAAgB,EAAM,YAAY,CAExC,GAAI,CAAC,GAAY,CAAC,EAChB,MAAU,MAAM,8CAA8C,CAShE,GANI,GAAY,CAAC,EACf,EAAY,KAAK,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AAU,MAAM,sDAAsD,CAGxE,IAAM,EAAa,EAAY,mBAAmB,EAAW,CAGvD,EAAc,EAClB,EACA,GAAS,EAAW,WAAW,CAC/B,GAAU,EAAW,YAAY,CACjC,CAAE,MAAK,CACR,CAGK,EAAc,EAAY,gBAAgB,CAUhD,OAHA,EAAW,MAAM,CACjB,EAAY,MAAM,CAEX,EAAO,QAAQ,EAAY,EAErC,CAAC,CACH"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadista/flow-images-photon",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"description": "Photon image processing service for Uploadista Flow",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Uploadista",
|
|
8
8
|
"exports": {
|
|
9
|
-
"node": {
|
|
9
|
+
"./node": {
|
|
10
10
|
"types": "./dist/node.d.ts",
|
|
11
11
|
"import": "./dist/node.js",
|
|
12
12
|
"default": "./dist/node.js"
|
|
13
13
|
},
|
|
14
|
-
"serverless": {
|
|
14
|
+
"./serverless": {
|
|
15
15
|
"types": "./dist/serverless.d.ts",
|
|
16
16
|
"import": "./dist/serverless.js",
|
|
17
17
|
"default": "./dist/serverless.js"
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@cf-wasm/photon": "0.1.31",
|
|
22
|
-
"effect": "3.
|
|
22
|
+
"effect": "3.19.0",
|
|
23
23
|
"tinycolor2": "1.6.0",
|
|
24
24
|
"zod": "4.1.12",
|
|
25
|
-
"@uploadista/core": "0.0.
|
|
25
|
+
"@uploadista/core": "0.0.9"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/node": "24.
|
|
28
|
+
"@types/node": "24.10.0",
|
|
29
29
|
"@types/tinycolor2": "1.4.6",
|
|
30
|
-
"tsdown": "0.
|
|
31
|
-
"@uploadista/typescript-config": "0.0.
|
|
30
|
+
"tsdown": "0.16.0",
|
|
31
|
+
"@uploadista/typescript-config": "0.0.9"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "tsdown",
|
package/dist/common-CBDoO3G0.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=e=>Math.round((e+2**-52)*100)/100,l=(e,t,n,r,i)=>{let a={};switch(e){case`contain`:{let e=r/t,o=i/n,s=Math.min(e,o);a={width:t*s,height:n*s};break}case`cover`:{let e=r/t,o=i/n,s=Math.max(e,o),c=t*s,l=n*s;if(c<r||l<i){let e=Math.max(r/t,i/n);a={width:t*e,height:n*e};break}a={width:c,height:l};break}case`fill`:a={width:r,height:i};break;case`none`:a={width:t,height:n};break;case`scale-down`:{let e=r/t,o=i/n,s=Math.min(1,Math.min(e,o));a={width:t*s,height:n*s};break}default:throw Error(`Invalid object fit value`)}if(!a?.width||!a?.height)throw Error(`Invalid dimensions`);return{width:c(a.width),height:c(a.height)}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common-DHkjD1Ly.js","names":["newSize: {\n width?: number;\n height?: number;\n }"],"sources":["../src/common.ts"],"sourcesContent":["export const round2dp = (num: number) =>\n Math.round((num + Number.EPSILON) * 100) / 100;\n\nexport const calculateImageSize = (\n objectFit: \"contain\" | \"cover\" | \"fill\" | \"none\" | \"scale-down\",\n currentWidth: number,\n currentHeight: number,\n containerWidth: number,\n containerHeight: number,\n) => {\n let newSize: {\n width?: number;\n height?: number;\n } = {};\n\n switch (objectFit) {\n case \"contain\": {\n // Calculate dimensions while maintaining aspect ratio\n const widthRatioContain = containerWidth / currentWidth;\n const heightRatioContain = containerHeight / currentHeight;\n const scaleContain = Math.min(widthRatioContain, heightRatioContain);\n newSize = {\n width: currentWidth * scaleContain,\n height: currentHeight * scaleContain,\n };\n break;\n }\n case \"cover\": {\n // Calculate dimensions while maintaining aspect ratio\n const widthRatioCover = containerWidth / currentWidth;\n const heightRatioCover = containerHeight / currentHeight;\n const scaleCover = Math.max(widthRatioCover, heightRatioCover);\n const newWidthCover = currentWidth * scaleCover;\n const newHeightCover = currentHeight * scaleCover;\n // Adjust dimensions if it doesn't cover the container completely\n if (newWidthCover < containerWidth || newHeightCover < containerHeight) {\n const scaleCoverAdjusted = Math.max(\n containerWidth / currentWidth,\n containerHeight / currentHeight,\n );\n newSize = {\n width: currentWidth * scaleCoverAdjusted,\n height: currentHeight * scaleCoverAdjusted,\n };\n break;\n }\n newSize = {\n width: newWidthCover,\n height: newHeightCover,\n };\n break;\n }\n case \"fill\":\n // Stretch image to fill container\n newSize = {\n width: containerWidth,\n height: containerHeight,\n };\n break;\n case \"none\":\n // Keep original image size\n newSize = {\n width: currentWidth,\n height: currentHeight,\n };\n break;\n case \"scale-down\": {\n // Calculate dimensions based on contain and none values\n const widthRatioScaleDown = containerWidth / currentWidth;\n const heightRatioScaleDown = containerHeight / currentHeight;\n const scaleScaleDown = Math.min(\n 1,\n Math.min(widthRatioScaleDown, heightRatioScaleDown),\n );\n newSize = {\n width: currentWidth * scaleScaleDown,\n height: currentHeight * scaleScaleDown,\n };\n break;\n }\n default:\n throw new Error(\"Invalid object fit value\");\n }\n\n if (!newSize?.width || !newSize?.height) {\n throw new Error(\"Invalid dimensions\");\n }\n\n return {\n width: round2dp(newSize.width),\n height: round2dp(newSize.height),\n };\n\n // return newSize;\n};\n"],"mappings":"AAAA,MAAa,EAAY,GACvB,KAAK,OAAO,UAAwB,IAAI,CAAG,IAEhC,GACX,EACA,EACA,EACA,EACA,IACG,CACH,IAAIA,EAGA,EAAE,CAEN,OAAQ,EAAR,CACE,IAAK,UAAW,CAEd,IAAM,EAAoB,EAAiB,EACrC,EAAqB,EAAkB,EACvC,EAAe,KAAK,IAAI,EAAmB,EAAmB,CACpE,EAAU,CACR,MAAO,EAAe,EACtB,OAAQ,EAAgB,EACzB,CACD,MAEF,IAAK,QAAS,CAEZ,IAAM,EAAkB,EAAiB,EACnC,EAAmB,EAAkB,EACrC,EAAa,KAAK,IAAI,EAAiB,EAAiB,CACxD,EAAgB,EAAe,EAC/B,EAAiB,EAAgB,EAEvC,GAAI,EAAgB,GAAkB,EAAiB,EAAiB,CACtE,IAAM,EAAqB,KAAK,IAC9B,EAAiB,EACjB,EAAkB,EACnB,CACD,EAAU,CACR,MAAO,EAAe,EACtB,OAAQ,EAAgB,EACzB,CACD,MAEF,EAAU,CACR,MAAO,EACP,OAAQ,EACT,CACD,MAEF,IAAK,OAEH,EAAU,CACR,MAAO,EACP,OAAQ,EACT,CACD,MACF,IAAK,OAEH,EAAU,CACR,MAAO,EACP,OAAQ,EACT,CACD,MACF,IAAK,aAAc,CAEjB,IAAM,EAAsB,EAAiB,EACvC,EAAuB,EAAkB,EACzC,EAAiB,KAAK,IAC1B,EACA,KAAK,IAAI,EAAqB,EAAqB,CACpD,CACD,EAAU,CACR,MAAO,EAAe,EACtB,OAAQ,EAAgB,EACzB,CACD,MAEF,QACE,MAAU,MAAM,2BAA2B,CAG/C,GAAI,CAAC,GAAS,OAAS,CAAC,GAAS,OAC/B,MAAU,MAAM,qBAAqB,CAGvC,MAAO,CACL,MAAO,EAAS,EAAQ,MAAM,CAC9B,OAAQ,EAAS,EAAQ,OAAO,CACjC"}
|
package/dist/node.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./common-DHkjD1Ly.js";import{PhotonImage as t,Rgba as n,crop as r,padding_bottom as i,padding_left as a,padding_right as o,padding_top as s,resize as c}from"@cf-wasm/photon/node";import{ImagePlugin as l}from"@uploadista/core/flow";import{Effect as u,Layer as d}from"effect";const f=e=>{let t=e.toRgb();return new n(t.r,t.g,t.b,t.a)},p=(t,n,l,u)=>{let d=t.get_width(),p=t.get_height();if(!n&&!l)throw Error(`At least one of width or height is required`);if(n&&!l?l=Math.floor(n/d*p):l&&!n&&(n=Math.floor(l/p*d)),!n||!l)throw Error(`Invalid width or height`);if(n===d&&l===p)return t;let m=u?.fit||`cover`,h=e(m,d,p,n,l);t=c(t,h.width,h.height,1);let[g,_]=[t.get_width(),t.get_height()];if(m===`contain`&&u?.fit_cover_letterbox_color){let e=Math.floor((n-g)/2),r=Math.floor((l-_)/2);r>0&&(t=s(t,r,f(u.fit_cover_letterbox_color)),t=i(t,r,f(u.fit_cover_letterbox_color))),e>0&&(t=a(t,e,f(u.fit_cover_letterbox_color)),t=o(t,e,f(u.fit_cover_letterbox_color)))}else if(m===`cover`){let e=Math.floor(g-n)/2,i=Math.floor(_-l)/2;t=r(t,e,i,n+e,l+i)}return t},m=(e,t,n)=>{let r;switch(t){case`webp`:r=e.get_bytes_webp();break;case`jpeg`:r=e.get_bytes_jpeg(n?.jpeg_quality||100);break;case`png`:r=e.get_bytes();break;default:r=e.get_bytes_jpeg(n?.jpeg_quality||100)}return r},h=d.succeed(l,l.of({optimize:(e,{quality:n})=>{let r=t.new_from_byteslice(e),i=r.get_bytes_jpeg(n);return r.free(),u.succeed(i)},resize:(e,{width:n,height:r,fit:i})=>{if(!n&&!r)throw Error(`Either width or height must be specified for resize`);let a=t.new_from_byteslice(e),o=p(a,n??a.get_width(),r??a.get_height(),{fit:i}),s=o.get_bytes_webp();return a.free(),o.free(),u.succeed(s)}}));export{p as autoResize,h as imagePluginNode,m as imageToFormat,f as tinyColorToPhotonRGBA};
|
|
2
|
-
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","names":["outputBytes: Uint8Array"],"sources":["../src/image-plugin-node.ts"],"sourcesContent":["import {\n crop,\n PhotonImage,\n padding_bottom,\n padding_left,\n padding_right,\n padding_top,\n Rgba,\n resize,\n} from \"@cf-wasm/photon/node\";\nimport { ImagePlugin } from \"@uploadista/core/flow\";\nimport { Effect, Layer } from \"effect\";\nimport type tinycolor from \"tinycolor2\";\nimport { calculateImageSize } from \"./common\";\n\nexport const tinyColorToPhotonRGBA = (color: tinycolor.Instance) => {\n const rgba = color.toRgb();\n return new Rgba(rgba.r, rgba.g, rgba.b, rgba.a);\n};\n\nexport const autoResize = (\n image: PhotonImage,\n newWidth?: number,\n newHeight?: number,\n options?: {\n fit?: \"contain\" | \"cover\" | \"fill\";\n fit_cover_letterbox_color?: tinycolor.Instance;\n },\n) => {\n const currentWidth = image.get_width();\n const currentHeight = image.get_height();\n\n if (!newWidth && !newHeight) {\n throw new Error(\"At least one of width or height is required\");\n }\n\n if (newWidth && !newHeight) {\n newHeight = Math.floor((newWidth / currentWidth) * currentHeight);\n } else if (newHeight && !newWidth) {\n newWidth = Math.floor((newHeight / currentHeight) * currentWidth);\n }\n\n if (!newWidth || !newHeight) {\n throw new Error(\"Invalid width or height\");\n }\n\n if (newWidth === currentWidth && newHeight === currentHeight) {\n return image;\n }\n\n const fit = options?.fit || \"cover\";\n\n const dem = calculateImageSize(\n fit,\n currentWidth,\n currentHeight,\n newWidth,\n newHeight,\n );\n\n image = resize(image, dem.width, dem.height, 1);\n\n const [updatedWidth, updatedHeight] = [image.get_width(), image.get_height()];\n\n if (fit === \"contain\" && options?.fit_cover_letterbox_color) {\n const paddingX = Math.floor((newWidth - updatedWidth) / 2);\n const paddingY = Math.floor((newHeight - updatedHeight) / 2);\n\n if (paddingY > 0) {\n image = padding_top(\n image,\n paddingY,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n image = padding_bottom(\n image,\n paddingY,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n }\n\n if (paddingX > 0) {\n image = padding_left(\n image,\n paddingX,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n image = padding_right(\n image,\n paddingX,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n }\n } else if (fit === \"cover\") {\n //crop to center\n const cropX = Math.floor(updatedWidth - newWidth) / 2;\n const cropY = Math.floor(updatedHeight - newHeight) / 2;\n\n //top left to down right\n image = crop(image, cropX, cropY, newWidth + cropX, newHeight + cropY);\n }\n\n return image;\n};\n\nexport const imageToFormat = (\n image: PhotonImage,\n format: \"webp\" | \"jpeg\" | \"png\",\n options?: {\n jpeg_quality?: number;\n },\n) => {\n let outputBytes: Uint8Array;\n\n switch (format) {\n case \"webp\":\n outputBytes = image.get_bytes_webp();\n break;\n case \"jpeg\":\n outputBytes = image.get_bytes_jpeg(options?.jpeg_quality || 100);\n break;\n case \"png\":\n outputBytes = image.get_bytes();\n break;\n default:\n outputBytes = image.get_bytes_jpeg(options?.jpeg_quality || 100);\n }\n\n return outputBytes;\n};\n\nexport const imagePluginNode = Layer.succeed(\n ImagePlugin,\n ImagePlugin.of({\n optimize: (inputBytes, { quality }) => {\n // create a PhotonImage instance\n const inputImage = PhotonImage.new_from_byteslice(inputBytes);\n\n // get jpeg bytes\n const outputBytes = inputImage.get_bytes_jpeg(quality);\n\n // call free() method to free memory\n inputImage.free();\n\n return Effect.succeed(outputBytes);\n },\n resize: (inputBytes, { width, height, fit }) => {\n if (!width && !height) {\n throw new Error(\"Either width or height must be specified for resize\");\n }\n // create a PhotonImage instance\n const inputImage = PhotonImage.new_from_byteslice(inputBytes);\n\n // resize image using photon\n const outputImage = autoResize(\n inputImage,\n width ?? inputImage.get_width(),\n height ?? inputImage.get_height(),\n { fit },\n );\n\n // get webp bytes\n const outputBytes = outputImage.get_bytes_webp();\n\n // for other formats\n // png : outputImage.get_bytes();\n // jpeg : outputImage.get_bytes_jpeg(quality);\n\n // call free() method to free memory\n inputImage.free();\n outputImage.free();\n\n return Effect.succeed(outputBytes);\n },\n }),\n);\n"],"mappings":"qSAeA,MAAa,EAAyB,GAA8B,CAClE,IAAM,EAAO,EAAM,OAAO,CAC1B,OAAO,IAAI,EAAK,EAAK,EAAG,EAAK,EAAG,EAAK,EAAG,EAAK,EAAE,EAGpC,GACX,EACA,EACA,EACA,IAIG,CACH,IAAM,EAAe,EAAM,WAAW,CAChC,EAAgB,EAAM,YAAY,CAExC,GAAI,CAAC,GAAY,CAAC,EAChB,MAAU,MAAM,8CAA8C,CAShE,GANI,GAAY,CAAC,EACf,EAAY,KAAK,MAAO,EAAW,EAAgB,EAAc,CACxD,GAAa,CAAC,IACvB,EAAW,KAAK,MAAO,EAAY,EAAiB,EAAa,EAG/D,CAAC,GAAY,CAAC,EAChB,MAAU,MAAM,0BAA0B,CAG5C,GAAI,IAAa,GAAgB,IAAc,EAC7C,OAAO,EAGT,IAAM,EAAM,GAAS,KAAO,QAEtB,EAAM,EACV,EACA,EACA,EACA,EACA,EACD,CAED,EAAQ,EAAO,EAAO,EAAI,MAAO,EAAI,OAAQ,EAAE,CAE/C,GAAM,CAAC,EAAc,GAAiB,CAAC,EAAM,WAAW,CAAE,EAAM,YAAY,CAAC,CAE7E,GAAI,IAAQ,WAAa,GAAS,0BAA2B,CAC3D,IAAM,EAAW,KAAK,OAAO,EAAW,GAAgB,EAAE,CACpD,EAAW,KAAK,OAAO,EAAY,GAAiB,EAAE,CAExD,EAAW,IACb,EAAQ,EACN,EACA,EACA,EAAsB,EAAQ,0BAA0B,CACzD,CACD,EAAQ,EACN,EACA,EACA,EAAsB,EAAQ,0BAA0B,CACzD,EAGC,EAAW,IACb,EAAQ,EACN,EACA,EACA,EAAsB,EAAQ,0BAA0B,CACzD,CACD,EAAQ,EACN,EACA,EACA,EAAsB,EAAQ,0BAA0B,CACzD,UAEM,IAAQ,QAAS,CAE1B,IAAM,EAAQ,KAAK,MAAM,EAAe,EAAS,CAAG,EAC9C,EAAQ,KAAK,MAAM,EAAgB,EAAU,CAAG,EAGtD,EAAQ,EAAK,EAAO,EAAO,EAAO,EAAW,EAAO,EAAY,EAAM,CAGxE,OAAO,GAGI,GACX,EACA,EACA,IAGG,CACH,IAAIA,EAEJ,OAAQ,EAAR,CACE,IAAK,OACH,EAAc,EAAM,gBAAgB,CACpC,MACF,IAAK,OACH,EAAc,EAAM,eAAe,GAAS,cAAgB,IAAI,CAChE,MACF,IAAK,MACH,EAAc,EAAM,WAAW,CAC/B,MACF,QACE,EAAc,EAAM,eAAe,GAAS,cAAgB,IAAI,CAGpE,OAAO,GAGI,EAAkB,EAAM,QACnC,EACA,EAAY,GAAG,CACb,UAAW,EAAY,CAAE,aAAc,CAErC,IAAM,EAAa,EAAY,mBAAmB,EAAW,CAGvD,EAAc,EAAW,eAAe,EAAQ,CAKtD,OAFA,EAAW,MAAM,CAEV,EAAO,QAAQ,EAAY,EAEpC,QAAS,EAAY,CAAE,QAAO,SAAQ,SAAU,CAC9C,GAAI,CAAC,GAAS,CAAC,EACb,MAAU,MAAM,sDAAsD,CAGxE,IAAM,EAAa,EAAY,mBAAmB,EAAW,CAGvD,EAAc,EAClB,EACA,GAAS,EAAW,WAAW,CAC/B,GAAU,EAAW,YAAY,CACjC,CAAE,MAAK,CACR,CAGK,EAAc,EAAY,gBAAgB,CAUhD,OAHA,EAAW,MAAM,CACjB,EAAY,MAAM,CAEX,EAAO,QAAQ,EAAY,EAErC,CAAC,CACH"}
|
package/dist/serverless.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ImagePlugin } from "@uploadista/core/flow";
|
|
2
|
-
import { Layer } from "effect";
|
|
3
|
-
|
|
4
|
-
//#region src/image-plugin-serverless.d.ts
|
|
5
|
-
declare const imagePluginServerless: Layer.Layer<ImagePlugin, never, never>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { imagePluginServerless };
|
|
8
|
-
//# sourceMappingURL=serverless.d.ts.map
|
package/dist/serverless.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverless.d.ts","names":[],"sources":["../src/image-plugin-serverless.ts"],"sourcesContent":[],"mappings":";;;;cAyGa,uBAAqB,KAAA,CAAA,MAAA"}
|
package/dist/serverless.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./common-DHkjD1Ly.js";import{ImagePlugin as t}from"@uploadista/core/flow";import{Effect as n,Layer as r}from"effect";import{PhotonImage as i,Rgba as a,crop as o,padding_bottom as s,padding_left as c,padding_right as l,padding_top as u,resize as d}from"@cf-wasm/photon";const f=e=>{let t=e.toRgb();return new a(t.r,t.g,t.b,t.a)},p=(t,n,r,i)=>{let a=t.get_width(),p=t.get_height();if(!n&&!r)throw Error(`At least one of width or height is required`);if(n&&!r?r=Math.floor(n/a*p):r&&!n&&(n=Math.floor(r/p*a)),!n||!r)throw Error(`Invalid width or height`);if(n===a&&r===p)return t;let m=i?.fit||`cover`,h=e(m,a,p,n,r);t=d(t,h.width,h.height,1);let[g,_]=[t.get_width(),t.get_height()];if(m===`contain`&&i?.fit_cover_letterbox_color){let e=Math.floor((n-g)/2),a=Math.floor((r-_)/2);a>0&&(t=u(t,a,f(i.fit_cover_letterbox_color)),t=s(t,a,f(i.fit_cover_letterbox_color))),e>0&&(t=c(t,e,f(i.fit_cover_letterbox_color)),t=l(t,e,f(i.fit_cover_letterbox_color)))}else if(m===`cover`){let e=Math.floor(g-n)/2,i=Math.floor(_-r)/2;t=o(t,e,i,n+e,r+i)}return t},m=r.succeed(t,t.of({optimize:(e,{quality:t})=>{let r=i.new_from_byteslice(e),a=r.get_bytes_jpeg(t);return r.free(),n.succeed(a)},resize:(e,{width:t,height:r,fit:a})=>{if(!t&&!r)throw Error(`Either width or height must be specified for resize`);let o=i.new_from_byteslice(e),s=p(o,t??o.get_width(),r??o.get_height(),{fit:a}),c=s.get_bytes_webp();return o.free(),s.free(),n.succeed(c)}}));export{m as imagePluginServerless};
|
|
2
|
-
//# sourceMappingURL=serverless.js.map
|
package/dist/serverless.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverless.js","names":[],"sources":["../src/image-plugin-serverless.ts"],"sourcesContent":["import {\n crop,\n PhotonImage,\n padding_bottom,\n padding_left,\n padding_right,\n padding_top,\n Rgba,\n resize,\n} from \"@cf-wasm/photon\";\nimport { ImagePlugin } from \"@uploadista/core/flow\";\nimport { Effect, Layer } from \"effect\";\nimport type tinycolor from \"tinycolor2\";\nimport { calculateImageSize } from \"./common\";\n\nconst tinyColorToPhotonRGBA = (color: tinycolor.Instance) => {\n const rgba = color.toRgb();\n return new Rgba(rgba.r, rgba.g, rgba.b, rgba.a);\n};\n\nconst autoResize = (\n image: PhotonImage,\n newWidth?: number,\n newHeight?: number,\n options?: {\n fit?: \"contain\" | \"cover\" | \"fill\";\n fit_cover_letterbox_color?: tinycolor.Instance;\n },\n) => {\n const currentWidth = image.get_width();\n const currentHeight = image.get_height();\n\n if (!newWidth && !newHeight) {\n throw new Error(\"At least one of width or height is required\");\n }\n\n if (newWidth && !newHeight) {\n newHeight = Math.floor((newWidth / currentWidth) * currentHeight);\n } else if (newHeight && !newWidth) {\n newWidth = Math.floor((newHeight / currentHeight) * currentWidth);\n }\n\n if (!newWidth || !newHeight) {\n throw new Error(\"Invalid width or height\");\n }\n\n if (newWidth === currentWidth && newHeight === currentHeight) {\n return image;\n }\n\n const fit = options?.fit || \"cover\";\n\n const dem = calculateImageSize(\n fit,\n currentWidth,\n currentHeight,\n newWidth,\n newHeight,\n );\n\n image = resize(image, dem.width, dem.height, 1);\n\n const [updatedWidth, updatedHeight] = [image.get_width(), image.get_height()];\n\n if (fit === \"contain\" && options?.fit_cover_letterbox_color) {\n const paddingX = Math.floor((newWidth - updatedWidth) / 2);\n const paddingY = Math.floor((newHeight - updatedHeight) / 2);\n\n if (paddingY > 0) {\n image = padding_top(\n image,\n paddingY,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n image = padding_bottom(\n image,\n paddingY,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n }\n\n if (paddingX > 0) {\n image = padding_left(\n image,\n paddingX,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n image = padding_right(\n image,\n paddingX,\n tinyColorToPhotonRGBA(options.fit_cover_letterbox_color),\n );\n }\n } else if (fit === \"cover\") {\n //crop to center\n const cropX = Math.floor(updatedWidth - newWidth) / 2;\n const cropY = Math.floor(updatedHeight - newHeight) / 2;\n\n //top left to down right\n image = crop(image, cropX, cropY, newWidth + cropX, newHeight + cropY);\n }\n\n return image;\n};\n\nexport const imagePluginServerless = Layer.succeed(\n ImagePlugin,\n ImagePlugin.of({\n optimize: (inputBytes, { quality }) => {\n // create a PhotonImage instance\n const inputImage = PhotonImage.new_from_byteslice(inputBytes);\n\n // get jpeg bytes\n const outputBytes = inputImage.get_bytes_jpeg(quality);\n\n // call free() method to free memory\n inputImage.free();\n\n return Effect.succeed(outputBytes);\n },\n resize: (inputBytes, { width, height, fit }) => {\n if (!width && !height) {\n throw new Error(\"Either width or height must be specified for resize\");\n }\n // create a PhotonImage instance\n const inputImage = PhotonImage.new_from_byteslice(inputBytes);\n\n // resize image using photon\n const outputImage = autoResize(\n inputImage,\n width ?? inputImage.get_width(),\n height ?? inputImage.get_height(),\n { fit },\n );\n\n // get webp bytes\n const outputBytes = outputImage.get_bytes_webp();\n\n // for other formats\n // png : outputImage.get_bytes();\n // jpeg : outputImage.get_bytes_jpeg(quality);\n\n // call free() method to free memory\n inputImage.free();\n outputImage.free();\n\n return Effect.succeed(outputBytes);\n },\n }),\n);\n"],"mappings":"gSAeA,MAAM,EAAyB,GAA8B,CAC3D,IAAM,EAAO,EAAM,OAAO,CAC1B,OAAO,IAAI,EAAK,EAAK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