@webstudio-is/image 0.96.0 → 0.98.0

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/lib/index.js CHANGED
@@ -156,7 +156,7 @@ var imagePlaceholderSvg = `data:image/svg+xml;base64,${btoa(`<svg
156
156
 
157
157
  // src/image-loaders.ts
158
158
  import warnOnce from "warn-once";
159
- var createImageLoader = (loaderOptions) => ({ width, src, quality }) => {
159
+ var createImageLoader = (loaderOptions) => ({ width, src, quality, format }) => {
160
160
  if (true) {
161
161
  warnOnce(
162
162
  allSizes.includes(width) === false,
@@ -167,7 +167,7 @@ var createImageLoader = (loaderOptions) => ({ width, src, quality }) => {
167
167
  const searchParams = new URLSearchParams();
168
168
  searchParams.set("width", width.toString());
169
169
  searchParams.set("quality", quality.toString());
170
- searchParams.set("format", "auto");
170
+ searchParams.set("format", format ?? "auto");
171
171
  return `${imageBaseUrl}${src}?${searchParams.toString()}`;
172
172
  };
173
173
  export {
@@ -89,6 +89,7 @@ export type ImageLoader = (props: {
89
89
  width: number;
90
90
  quality: number;
91
91
  src: string;
92
+ format?: "auto" | "raw";
92
93
  }) => string;
93
94
  export declare const allSizes: number[];
94
95
  export declare const getImageAttributes: (props: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/image",
3
- "version": "0.96.0",
3
+ "version": "0.98.0",
4
4
  "description": "Image optimization",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",