@scayle/storefront-nuxt 7.80.0 → 7.81.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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.81.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Support enabling or disabling optional server-side plugins
8
+
9
+ Plugins with optional behavior can now be disabled at build time through `env` variables.
10
+
11
+ - `SFC_PLUGIN_CONFIG_VALIDATION_ENABLED` This plugin executes during app startup and validates the runtime config, exiting with an error if a problem is found. It is enabled by default and can be disabled by setting this variable to `false`.
12
+ - `SFC_PLUGIN_POWERED_BY_ENABLED` This plugin sets the `X-Powered-By-Header` on every HTTP response to incude SCAYLE. It is enabled by default and can be disabled by setting this variable to `false`.
13
+ - `SFC_PLUGIN_RUNTIME_PERFORMANCE_ENABLED` This plugin improves performance by computing the runtime configuration at startup rather than for every request. It is enabled by default and can be disabled by setting this variable to `false`.
14
+
15
+ - Add a plugin to cache the runtime config
16
+
17
+ This change adds a Nitro plugin to calculate the runtime config at startup, rather than for every requests. It offers significant performance improvements for large runtime configs.
18
+
19
+ ### Patch Changes
20
+
21
+ - Add import for runtimeConfig plugin
22
+ - Revert type of `publicShopData` to `string[]`
23
+
3
24
  ## 7.80.0
4
25
 
5
26
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.282cc1d9.mjs';
1
+ export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.ed010583.mjs';
2
2
  export { rpcCall } from './rpc.mjs';
3
3
  export * from '@scayle/storefront-core';
4
4
  export { LogLevel } from '@scayle/storefront-core';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.282cc1d9.js';
1
+ export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.ed010583.js';
2
2
  export { rpcCall } from './rpc.js';
3
3
  export * from '@scayle/storefront-core';
4
4
  export { LogLevel } from '@scayle/storefront-core';
package/dist/module.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { M as ModuleBaseOptions } from './shared/storefront-nuxt.282cc1d9.mjs';
3
- export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.282cc1d9.mjs';
2
+ import { M as ModuleBaseOptions } from './shared/storefront-nuxt.ed010583.mjs';
3
+ export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.ed010583.mjs';
4
4
  export { LogLevel } from '@scayle/storefront-core';
5
5
  import '@scayle/unstorage-compression-driver';
6
6
  import 'unstorage';
package/dist/module.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { M as ModuleBaseOptions } from './shared/storefront-nuxt.282cc1d9.js';
3
- export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.282cc1d9.js';
2
+ import { M as ModuleBaseOptions } from './shared/storefront-nuxt.ed010583.js';
3
+ export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.ed010583.js';
4
4
  export { LogLevel } from '@scayle/storefront-core';
5
5
  import '@scayle/unstorage-compression-driver';
6
6
  import 'unstorage';
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.79.1",
3
+ "version": "7.80.0",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -65,7 +65,7 @@ export default {
65
65
  }`;
66
66
  }
67
67
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
68
- const PACKAGE_VERSION = "7.79.1";
68
+ const PACKAGE_VERSION = "7.80.0";
69
69
  const logger = createConsola({
70
70
  fancy: true,
71
71
  formatOptions: {
@@ -241,8 +241,20 @@ Missing RPC Overrides: ${Array.from(overridenRPCMethodNames).map((name) => `'${n
241
241
  addServerPlugin(
242
242
  resolve("./runtime/nitro/plugins/nitroRuntimeStorageConfig")
243
243
  );
244
- addServerPlugin(resolve("./runtime/nitro/plugins/nitroSetXPoweredByHeader"));
245
- addServerPlugin(resolve("./runtime/nitro/plugins/configValidation"));
244
+ if (yn(process.env.SFC_PLUGIN_CONFIG_VALIDATION_ENABLED, { default: true })) {
245
+ logger.debug("Installing config validation plugin");
246
+ addServerPlugin(resolve("./runtime/nitro/plugins/configValidation"));
247
+ }
248
+ if (yn(process.env.SFC_PLUGIN_POWERED_BY_ENABLED, { default: true })) {
249
+ logger.debug("Installing X-Powered-By plugin");
250
+ addServerPlugin(
251
+ resolve("./runtime/nitro/plugins/nitroSetXPoweredByHeader")
252
+ );
253
+ }
254
+ if (yn(process.env.SFC_PLUGIN_RUNTIME_PERFORMANCE_ENABLED, { default: true })) {
255
+ logger.debug("Installing runtime performance plugin");
256
+ addServerPlugin(resolve("./runtime/nitro/plugins/cacheRuntimeConfig"));
257
+ }
246
258
  nuxt.hooks.hook("nitro:config", (nitroConfig) => {
247
259
  nitroConfig.externals = nitroConfig.externals || {};
248
260
  nitroConfig.externals.inline = nitroConfig.externals.inline || [];
@@ -261,6 +273,7 @@ Missing RPC Overrides: ${Array.from(overridenRPCMethodNames).map((name) => `'${n
261
273
  "server/middleware/cache",
262
274
  "server/utils/cacheStorage",
263
275
  "utils/zodSchema",
276
+ "nitro/plugins/cacheRuntimeConfig",
264
277
  "nitro/plugins/nitroLogger",
265
278
  "nitro/plugins/nitroRuntimeStorageConfig",
266
279
  "nitro/plugins/nitroSetXPoweredByHeader",
package/dist/rpc.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RpcMethodName, RpcMethodParameters, RpcMethodReturnType, RpcContext } from '@scayle/storefront-core';
2
2
  import { NuxtApp } from 'nuxt/app';
3
- import { P as PublicShopConfig } from './shared/storefront-nuxt.282cc1d9.mjs';
3
+ import { P as PublicShopConfig } from './shared/storefront-nuxt.ed010583.mjs';
4
4
  import '@scayle/unstorage-compression-driver';
5
5
  import 'unstorage';
6
6
  import 'zod';
package/dist/rpc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RpcMethodName, RpcMethodParameters, RpcMethodReturnType, RpcContext } from '@scayle/storefront-core';
2
2
  import { NuxtApp } from 'nuxt/app';
3
- import { P as PublicShopConfig } from './shared/storefront-nuxt.282cc1d9.js';
3
+ import { P as PublicShopConfig } from './shared/storefront-nuxt.ed010583.js';
4
4
  import '@scayle/unstorage-compression-driver';
5
5
  import 'unstorage';
6
6
  import 'zod';
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { defineNitroPlugin, useRuntimeConfig } from "#imports";
2
+ export default defineNitroPlugin((nitroApp) => {
3
+ const runtimeConfig = useRuntimeConfig();
4
+ nitroApp.hooks.hook("request", (event) => {
5
+ event.context.nitro = event.context.nitro ?? {};
6
+ event.context.nitro.runtimeConfig = runtimeConfig;
7
+ });
8
+ });
@@ -810,7 +810,7 @@ declare const StorefrontConfigSchema: z.ZodObject<{
810
810
  };
811
811
  enabled?: boolean | undefined;
812
812
  }>>;
813
- publicShopData: z.ZodOptional<z.ZodArray<z.ZodType<("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders", z.ZodTypeDef, ("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders">, "many">>;
813
+ publicShopData: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
814
814
  idp: z.ZodOptional<z.ZodObject<{
815
815
  enabled: z.ZodBoolean;
816
816
  idpKeys: z.ZodArray<z.ZodString, "many">;
@@ -936,7 +936,7 @@ declare const StorefrontConfigSchema: z.ZodObject<{
936
936
  tls?: boolean | undefined;
937
937
  } | undefined;
938
938
  } | undefined;
939
- publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
939
+ publicShopData?: string[] | undefined;
940
940
  }, {
941
941
  oauth: {
942
942
  apiHost: string;
@@ -1011,7 +1011,7 @@ declare const StorefrontConfigSchema: z.ZodObject<{
1011
1011
  tls?: boolean | undefined;
1012
1012
  } | undefined;
1013
1013
  } | undefined;
1014
- publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
1014
+ publicShopData?: string[] | undefined;
1015
1015
  }>;
1016
1016
  declare const PublicRuntimeConfigSchema: z.ZodObject<{
1017
1017
  log: z.ZodObject<{
@@ -1254,7 +1254,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
1254
1254
  };
1255
1255
  enabled?: boolean | undefined;
1256
1256
  }>>;
1257
- publicShopData: z.ZodOptional<z.ZodArray<z.ZodType<("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders", z.ZodTypeDef, ("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders">, "many">>;
1257
+ publicShopData: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1258
1258
  idp: z.ZodOptional<z.ZodObject<{
1259
1259
  enabled: z.ZodBoolean;
1260
1260
  idpKeys: z.ZodArray<z.ZodString, "many">;
@@ -1380,7 +1380,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
1380
1380
  tls?: boolean | undefined;
1381
1381
  } | undefined;
1382
1382
  } | undefined;
1383
- publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
1383
+ publicShopData?: string[] | undefined;
1384
1384
  }, {
1385
1385
  oauth: {
1386
1386
  apiHost: string;
@@ -1455,7 +1455,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
1455
1455
  tls?: boolean | undefined;
1456
1456
  } | undefined;
1457
1457
  } | undefined;
1458
- publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
1458
+ publicShopData?: string[] | undefined;
1459
1459
  }>, z.ZodObject<{
1460
1460
  shopSelector: z.ZodEnum<["path", "domain", "path_or_default"]>;
1461
1461
  stores: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2187,7 +2187,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
2187
2187
  tls?: boolean | undefined;
2188
2188
  } | undefined;
2189
2189
  } | undefined;
2190
- publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
2190
+ publicShopData?: string[] | undefined;
2191
2191
  } | {
2192
2192
  shopSelector: "domain" | "path" | "path_or_default";
2193
2193
  stores: Record<string, {
@@ -2360,7 +2360,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
2360
2360
  tls?: boolean | undefined;
2361
2361
  } | undefined;
2362
2362
  } | undefined;
2363
- publicShopData?: (("locale" | "checkout" | "shopId" | "auth" | "currency") | ("domain" | "storeCampaignKeyword" | "idp" | "path" | "redis" | "apiBasePath" | "appKeys" | "currencyFractionDigits" | "isEnabled" | "sessionConfig" | "bapi" | "storage" | "isDefault") | "paymentProviders")[] | undefined;
2363
+ publicShopData?: string[] | undefined;
2364
2364
  } | {
2365
2365
  shopSelector: "domain" | "path" | "path_or_default";
2366
2366
  stores: Record<string, {
@@ -131,9 +131,7 @@ const StorefrontConfigSchema = z.object({
131
131
  appKeys: AppKeysSchema,
132
132
  apiBasePath: z.string().optional(),
133
133
  cache: CacheSchema.optional(),
134
- publicShopData: z.array(
135
- z.custom()
136
- ).optional(),
134
+ publicShopData: z.array(z.string()).optional(),
137
135
  idp: IdpSchema.optional(),
138
136
  /** @deprecated Global storefront.redis config is being removed in favor of `storefront.storage` config */
139
137
  redis: RedisConfigSchema.optional()