@vue-storefront/nuxt 11.0.0-next.5 → 11.0.0-next.8

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.json CHANGED
@@ -4,7 +4,7 @@
4
4
  },
5
5
  "configKey": "alokai",
6
6
  "name": "@vue-storefront/nuxt",
7
- "version": "11.0.0-next.5",
7
+ "version": "11.0.0-next.8",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -46,6 +46,7 @@ const module$1 = defineNuxtModule({
46
46
  nuxt.options.runtimeConfig.public[host.runtimeConfigKey] = nuxt.options.runtimeConfig.public[host.runtimeConfigKey] ?? "";
47
47
  }
48
48
  nuxt.options.runtimeConfig.public.alokaiImageOptimizer = { hosts: resolvedHosts };
49
+ nuxt.options.runtimeConfig.public.imageOptimizerEnabled ??= false;
49
50
  const nuxtOptions = nuxt.options;
50
51
  nuxtOptions.image = {
51
52
  ...nuxtOptions.image,
@@ -7,6 +7,9 @@ export default defineEventHandler(async (event) => {
7
7
  const hostKey = getRouterParam(event, "host");
8
8
  const rawPath = getRouterParam(event, "path") ?? "";
9
9
  const publicConfig = useRuntimeConfig(event).public;
10
+ if (!publicConfig.imageOptimizerEnabled) {
11
+ return errorResponse("Image optimizer is disabled", 404);
12
+ }
10
13
  const host = (publicConfig.alokaiImageOptimizer?.hosts ?? []).find(
11
14
  (entry) => entry.key === hostKey
12
15
  );
@@ -6,6 +6,9 @@ const warnedMissingHosts = /* @__PURE__ */ new Set();
6
6
  export default defineProvider({
7
7
  getImage(src, { modifiers = {} }) {
8
8
  const publicConfig = useRuntimeConfig().public;
9
+ if (!publicConfig.imageOptimizerEnabled) {
10
+ return { url: src };
11
+ }
9
12
  const hosts = publicConfig.alokaiImageOptimizer?.hosts ?? [];
10
13
  const url = buildProxyUrl({
11
14
  hosts,
@@ -50,6 +50,7 @@ export interface ImageOptimizerPublicConfig {
50
50
  alokaiImageOptimizer?: {
51
51
  hosts?: ResolvedImageOptimizerHost[];
52
52
  };
53
+ imageOptimizerEnabled?: boolean;
53
54
  }
54
55
  /**
55
56
  * Builds the path emitted after `/img-proxy/{key}` on the provider (client)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-storefront/nuxt",
3
- "version": "11.0.0-next.5",
3
+ "version": "11.0.0-next.8",
4
4
  "description": "Alokai dedicated features for Nuxt",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "pinia": "^3.0.4"
38
38
  },
39
39
  "devDependencies": {
40
- "@alokai/connect": "2.3.0-next.7",
40
+ "@alokai/connect": "2.3.0-next.10",
41
41
  "@nuxt/devtools": "^3.0.0",
42
42
  "@nuxt/image": "^2.0.0",
43
43
  "@nuxt/module-builder": "^1.0.2",
@@ -49,7 +49,7 @@
49
49
  "vitest": "4.0.18"
50
50
  },
51
51
  "peerDependencies": {
52
- "@alokai/connect": "2.3.0-next.7",
52
+ "@alokai/connect": "2.3.0-next.10",
53
53
  "@nuxt/image": "^2.0.0"
54
54
  },
55
55
  "peerDependenciesMeta": {