@vue-storefront/nuxt 11.0.0-next.7 → 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
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,
|