@teamnovu/nuxt-image 1.0.0-beta.1 → 1.0.0-beta.2

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/module.d.mts CHANGED
@@ -60,8 +60,8 @@ declare module '@nuxt/image' {
60
60
  interface ImageProviders {
61
61
  imgproxy: {
62
62
  baseURL: string;
63
- key: string;
64
- salt: string;
63
+ key?: string;
64
+ salt?: string;
65
65
  };
66
66
  }
67
67
  }
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.13.0"
6
6
  },
7
- "version": "1.0.0-beta.1",
7
+ "version": "1.0.0-beta.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "unknown"
@@ -50,8 +50,8 @@ export interface ImgproxyModifiers extends Omit<ImageModifiers, 'fit' | 'format'
50
50
  }
51
51
  interface ImgproxyOptions {
52
52
  baseURL: string;
53
- salt: string;
54
- key: string;
53
+ salt?: string;
54
+ key?: string;
55
55
  modifiers?: Partial<ImgproxyModifiers>;
56
56
  }
57
57
  interface ImgproxyContext {
@@ -110,8 +110,7 @@ function sign(salt, target, secret) {
110
110
  }
111
111
  const defaultModifiers = {
112
112
  resizingType: "auto",
113
- gravity: "ce",
114
- format: "webp"
113
+ gravity: "ce"
115
114
  };
116
115
  function resolveModifiers(modifiers) {
117
116
  const resolved = { ...modifiers };
@@ -146,14 +145,14 @@ export const getImage = (src, ctx) => {
146
145
  const key = ctx?.key ?? "";
147
146
  const salt = ctx?.salt ?? "";
148
147
  const modifiers = ctx?.modifiers ?? {};
149
- if (!key || !salt) {
150
- throw new Error("[imgproxy] `key` and `salt` are required - configure them in `image.imgproxy`.");
148
+ if (Boolean(key) !== Boolean(salt)) {
149
+ throw new Error("[imgproxy] `key` and `salt` must be configured together; set both to enable signing or neither to disable it.");
151
150
  }
152
151
  const merged = resolveModifiers(defu(modifiers, defaultModifiers));
153
152
  const encodedUrl = urlSafeBase64(src);
154
153
  const operations = generateOperations(merged);
155
154
  const path = joinURL("/", operations, encodedUrl);
156
- const signature = sign(salt, path, key);
155
+ const signature = key && salt ? sign(salt, path, key) : "_";
157
156
  return {
158
157
  url: joinURL(baseURL, signature, path)
159
158
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnovu/nuxt-image",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Responsive image module for Nuxt 4 with provider-agnostic focal-point handling and a Statamic adapter built on @nuxt/image.",
5
5
  "repository": {
6
6
  "type": "git",