@scayle/storefront-nuxt 7.42.3 → 7.43.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,19 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.43.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Extend `StorageEntity` with optional `compression: 'none' | 'deflate' | 'gzip' | 'brotli'` option.
8
+ Modify [unstorage](https://unstorage.unjs.io/) driver creation during server startup to configure`@scayle/unstorage-compression-driver` if value of `compression` is set to a supported compression algorithm.
9
+
10
+ ### Patch Changes
11
+
12
+ - Ensure correct unstorage drivers are bundled
13
+ - Updated dependencies
14
+ - @scayle/unstorage-compression-driver@0.1.1
15
+ - @scayle/storefront-core@7.29.0
16
+
3
17
  ## 7.42.3
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,7 +1,8 @@
1
- export { g as AdditionalShopConfig, A as AppKeys, f as AuthenticationConfig, B as BapiConfig, b as CacheConfig, k as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, h as ShopConfig, i as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, j as StorefrontConfig } from './shared/storefront-nuxt.180408c8.mjs';
1
+ export { g as AdditionalShopConfig, A as AppKeys, f as AuthenticationConfig, B as BapiConfig, b as CacheConfig, k as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, h as ShopConfig, i as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, j as StorefrontConfig } from './shared/storefront-nuxt.5af220a0.mjs';
2
2
  export { rpcCall } from './rpc.mjs';
3
3
  export * from '@scayle/storefront-core';
4
4
  export { LogLevel } from '@scayle/storefront-core';
5
+ import '@scayle/unstorage-compression-driver';
5
6
  import 'unstorage';
6
7
  import 'nuxt/app';
7
8
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- export { g as AdditionalShopConfig, A as AppKeys, f as AuthenticationConfig, B as BapiConfig, b as CacheConfig, k as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, h as ShopConfig, i as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, j as StorefrontConfig } from './shared/storefront-nuxt.180408c8.js';
1
+ export { g as AdditionalShopConfig, A as AppKeys, f as AuthenticationConfig, B as BapiConfig, b as CacheConfig, k as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, h as ShopConfig, i as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, j as StorefrontConfig } from './shared/storefront-nuxt.5af220a0.js';
2
2
  export { rpcCall } from './rpc.js';
3
3
  export * from '@scayle/storefront-core';
4
4
  export { LogLevel } from '@scayle/storefront-core';
5
+ import '@scayle/unstorage-compression-driver';
5
6
  import 'unstorage';
6
7
  import 'nuxt/app';
7
8
 
package/dist/module.d.mts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { M as ModuleOptions } from './shared/storefront-nuxt.180408c8.mjs';
3
- export { g as AdditionalShopConfig, A as AppKeys, f as AuthenticationConfig, B as BapiConfig, b as CacheConfig, k as CheckoutEvent, C as CheckoutShopConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, h as ShopConfig, i as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, j as StorefrontConfig } from './shared/storefront-nuxt.180408c8.mjs';
2
+ import { M as ModuleOptions } from './shared/storefront-nuxt.5af220a0.mjs';
3
+ export { g as AdditionalShopConfig, A as AppKeys, f as AuthenticationConfig, B as BapiConfig, b as CacheConfig, k as CheckoutEvent, C as CheckoutShopConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, h as ShopConfig, i as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, j as StorefrontConfig } from './shared/storefront-nuxt.5af220a0.mjs';
4
4
  export { LogLevel } from '@scayle/storefront-core';
5
+ import '@scayle/unstorage-compression-driver';
5
6
  import 'unstorage';
6
7
 
7
8
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
package/dist/module.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { M as ModuleOptions } from './shared/storefront-nuxt.180408c8.js';
3
- export { g as AdditionalShopConfig, A as AppKeys, f as AuthenticationConfig, B as BapiConfig, b as CacheConfig, k as CheckoutEvent, C as CheckoutShopConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, h as ShopConfig, i as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, j as StorefrontConfig } from './shared/storefront-nuxt.180408c8.js';
2
+ import { M as ModuleOptions } from './shared/storefront-nuxt.5af220a0.js';
3
+ export { g as AdditionalShopConfig, A as AppKeys, f as AuthenticationConfig, B as BapiConfig, b as CacheConfig, k as CheckoutEvent, C as CheckoutShopConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, h as ShopConfig, i as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, j as StorefrontConfig } from './shared/storefront-nuxt.5af220a0.js';
4
4
  export { LogLevel } from '@scayle/storefront-core';
5
+ import '@scayle/unstorage-compression-driver';
5
6
  import 'unstorage';
6
7
 
7
8
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.7.0"
6
6
  },
7
- "version": "7.42.2"
7
+ "version": "7.42.3"
8
8
  }
package/dist/module.mjs CHANGED
@@ -25,6 +25,20 @@ function getUsedDrivers(options) {
25
25
  });
26
26
  return Array.from(drivers);
27
27
  }
28
+ function createVirtualDriverImport(options) {
29
+ const usedDrivers = getUsedDrivers(options);
30
+ const usesCompression = !yn(process.env.SFC_OMIT_COMPRESSION);
31
+ return `${usedDrivers.map(
32
+ (driver) => genImport(builtinDrivers[driver], genSafeVariableName(driver))
33
+ ).join("\n")}
34
+
35
+ ${usesCompression ? genImport("@scayle/unstorage-compression-driver", "compression") : ""}
36
+
37
+ export default {
38
+ ${usedDrivers.map((driver) => '"' + driver + '":' + genSafeVariableName(driver) + ",").join("\n")}
39
+ ${usesCompression ? "compression" : ""}
40
+ }`;
41
+ }
28
42
  const module = defineNuxtModule({
29
43
  meta: {
30
44
  name: "@scayle/storefront-nuxt",
@@ -195,18 +209,11 @@ const module = defineNuxtModule({
195
209
  nitroConfig.replace["process.env.SFC_OMIT_MD5"] = yn(
196
210
  process.env.SFC_OMIT_MD5
197
211
  );
198
- const usedDrivers = getUsedDrivers(options);
199
212
  nitroConfig.virtual = {
200
213
  ...nitroConfig.virtual,
201
- "#virtual/storage-drivers": `
202
- ${usedDrivers.map(
203
- (driver) => genImport(builtinDrivers[driver], genSafeVariableName(driver))
204
- ).join("\n")}
205
-
206
- export default {
207
- ${usedDrivers.map((driver) => '"' + driver + '":' + genSafeVariableName(driver) + ",").join("\n")}
208
- }
209
- `
214
+ "#virtual/storage-drivers": createVirtualDriverImport(
215
+ nuxt.options.runtimeConfig.storefront
216
+ )
210
217
  };
211
218
  });
212
219
  nuxt.options.alias["#rpcMethods"] = appResolve(
package/dist/rpc.d.mts CHANGED
@@ -1,6 +1,7 @@
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.180408c8.mjs';
3
+ import { P as PublicShopConfig } from './shared/storefront-nuxt.5af220a0.mjs';
4
+ import '@scayle/unstorage-compression-driver';
4
5
  import 'unstorage';
5
6
 
6
7
  /**
package/dist/rpc.d.ts CHANGED
@@ -1,6 +1,7 @@
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.180408c8.js';
3
+ import { P as PublicShopConfig } from './shared/storefront-nuxt.5af220a0.js';
4
+ import '@scayle/unstorage-compression-driver';
4
5
  import 'unstorage';
5
6
 
6
7
  /**
@@ -1,4 +1,3 @@
1
- import memoryDriver from "unstorage/drivers/memory";
2
1
  import { createConsola } from "consola";
3
2
  import {
4
3
  STORAGE_MOUNT_CACHE,
@@ -9,10 +8,17 @@ import drivers from "#virtual/storage-drivers";
9
8
  import { defineNitroPlugin, useRuntimeConfig, useStorage } from "#imports";
10
9
  function createMountDriver(options) {
11
10
  if (options?.driver) {
11
+ const compression = options?.compression;
12
+ const isCompressionEnabled = !!compression && compression !== "none";
12
13
  const driver = drivers[options.driver ?? "memory"];
13
- return driver(options ?? {});
14
+ const createdDriver = driver(options);
15
+ return isCompressionEnabled ? drivers.compression({
16
+ ...options,
17
+ encoding: compression,
18
+ passthroughDriver: createdDriver
19
+ }) : createdDriver;
14
20
  }
15
- return memoryDriver();
21
+ return drivers.memory();
16
22
  }
17
23
  function mountStorage(storage, options) {
18
24
  const { config, base } = options;
@@ -1,4 +1,5 @@
1
1
  import { LogLevel, HashAlgorithm, WithParams, ShopUser } from '@scayle/storefront-core';
2
+ import { CompressionEncodings } from '@scayle/unstorage-compression-driver';
2
3
  import { BuiltinDriverName, BuiltinDriverOptions } from 'unstorage';
3
4
 
4
5
  type StorageProvider = 'memory' | 'redis';
@@ -73,6 +74,7 @@ type CustomDriverName = string & {
73
74
  };
74
75
  type StorageEntity<Driver extends BuiltinDriverName | CustomDriverName = any, DriverOptions = Driver extends keyof BuiltinDriverOptions ? BuiltinDriverOptions[Driver] : any> = {
75
76
  driver: Driver;
77
+ compression?: CompressionEncodings;
76
78
  } & DriverOptions;
77
79
  interface StorageConfig {
78
80
  cache?: StorageEntity;
@@ -1,4 +1,5 @@
1
1
  import { LogLevel, HashAlgorithm, WithParams, ShopUser } from '@scayle/storefront-core';
2
+ import { CompressionEncodings } from '@scayle/unstorage-compression-driver';
2
3
  import { BuiltinDriverName, BuiltinDriverOptions } from 'unstorage';
3
4
 
4
5
  type StorageProvider = 'memory' | 'redis';
@@ -73,6 +74,7 @@ type CustomDriverName = string & {
73
74
  };
74
75
  type StorageEntity<Driver extends BuiltinDriverName | CustomDriverName = any, DriverOptions = Driver extends keyof BuiltinDriverOptions ? BuiltinDriverOptions[Driver] : any> = {
75
76
  driver: Driver;
77
+ compression?: CompressionEncodings;
76
78
  } & DriverOptions;
77
79
  interface StorageConfig {
78
80
  cache?: StorageEntity;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.42.3",
4
+ "version": "7.43.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -62,7 +62,8 @@
62
62
  "dependencies": {
63
63
  "@nuxt/kit": "3.8.2",
64
64
  "@scayle/h3-session": "0.3.4",
65
- "@scayle/storefront-core": "7.28.2",
65
+ "@scayle/storefront-core": "7.29.0",
66
+ "@scayle/unstorage-compression-driver": "0.1.1",
66
67
  "@vueuse/core": "10.7.0",
67
68
  "consola": "3.2.3",
68
69
  "core-js": "3.34.0",
@@ -91,7 +92,7 @@
91
92
  "nuxt": "3.8.2",
92
93
  "prettier": "3.0.0",
93
94
  "publint": "0.2.6",
94
- "vitest": "1.0.1",
95
+ "vitest": "1.0.2",
95
96
  "vue-tsc": "1.8.25"
96
97
  },
97
98
  "peerDependencies": {