@graphcommerce/next-config 11.0.0-canary.66 → 11.0.0-canary.69

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,15 @@
1
1
  # Change Log
2
2
 
3
+ ## 11.0.0-canary.69
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2732](https://github.com/graphcommerce-org/graphcommerce/pull/2732) [`cba75a0`](https://github.com/graphcommerce-org/graphcommerce/commit/cba75a006d4efface5d1149e9cc6ebe3a9b5b9f8) - Added `imageQuality` to `graphcommerce.config.ts`. Choose the kind (`content` or `product`) with `quality` on `<Image>` or `imageUrl()`. `quality='content'` is for content images, such as CMS images, and is the default when no quality is given, with quality 75 in place of the previous 52. `quality='product'` is for product images from the Magento catalog, with quality 52. ([@bramvanderholst](https://github.com/bramvanderholst))
8
+
9
+ ## 11.0.0-canary.68
10
+
11
+ ## 11.0.0-canary.67
12
+
3
13
  ## 11.0.0-canary.66
4
14
 
5
15
  ## 11.0.0-canary.65
@@ -49,6 +49,7 @@ function GraphCommerceConfigSchema() {
49
49
  hygraphManagementApi: z.string().nullish(),
50
50
  hygraphProjectId: z.string().nullish(),
51
51
  hygraphWriteAccessToken: z.string().nullish(),
52
+ imageQuality: z.lazy(() => ImageQualityConfigSchema().default({ content: 75, product: 52 })),
52
53
  limitSsg: z.boolean().nullish(),
53
54
  magentoEndpoint: z.string().min(1),
54
55
  magentoVersion: z.number(),
@@ -107,6 +108,12 @@ function GraphCommerceStorefrontConfigSchema() {
107
108
  robotsAllow: z.boolean().nullish()
108
109
  });
109
110
  }
111
+ function ImageQualityConfigSchema() {
112
+ return z.object({
113
+ content: z.number().default(75),
114
+ product: z.number().default(52)
115
+ });
116
+ }
110
117
  function MagentoConfigurableVariantValuesSchema() {
111
118
  return z.object({
112
119
  content: z.boolean().nullish(),
@@ -126,4 +133,4 @@ function SidebarGalleryConfigSchema() {
126
133
  });
127
134
  }
128
135
 
129
- export { BillingAddressPermissionsSchema, CartPermissionsSchema, CompareVariantSchema, ContainerSizingSchema, CustomerAccountPermissionsSchema, DatalayerConfigSchema, GraphCommerceConfigSchema, GraphCommerceDebugConfigSchema, GraphCommerceGooglePlaystoreConfigSchema, GraphCommercePermissionsSchema, GraphCommerceStorefrontConfigSchema, MagentoConfigurableVariantValuesSchema, PaginationVariantSchema, ProductFiltersLayoutSchema, RecentlyViewedProductsConfigSchema, SidebarGalleryConfigSchema, SidebarGalleryPaginationVariantSchema, WebsitePermissionsSchema, definedNonNullAnySchema, isDefinedNonNullAny };
136
+ export { BillingAddressPermissionsSchema, CartPermissionsSchema, CompareVariantSchema, ContainerSizingSchema, CustomerAccountPermissionsSchema, DatalayerConfigSchema, GraphCommerceConfigSchema, GraphCommerceDebugConfigSchema, GraphCommerceGooglePlaystoreConfigSchema, GraphCommercePermissionsSchema, GraphCommerceStorefrontConfigSchema, ImageQualityConfigSchema, MagentoConfigurableVariantValuesSchema, PaginationVariantSchema, ProductFiltersLayoutSchema, RecentlyViewedProductsConfigSchema, SidebarGalleryConfigSchema, SidebarGalleryPaginationVariantSchema, WebsitePermissionsSchema, definedNonNullAnySchema, isDefinedNonNullAny };
package/dist/index.js CHANGED
@@ -1666,8 +1666,10 @@ function withGraphCommerce(nextConfig, cwd = process.cwd()) {
1666
1666
  },
1667
1667
  images: {
1668
1668
  ...nextConfig.images,
1669
- // GraphCommerce uses quality 52 by default for optimized image delivery
1670
- qualities: [52, 75, ...nextConfig.images?.qualities ?? []],
1669
+ qualities: [
1670
+ ...Object.values(graphcommerceConfig.imageQuality ?? {}),
1671
+ ...nextConfig.images?.qualities ?? []
1672
+ ],
1671
1673
  remotePatterns: [
1672
1674
  "magentoEndpoint" in graphcommerceConfig ? {
1673
1675
  hostname: new URL(graphcommerceConfig.magentoEndpoint).hostname
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/next-config",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "11.0.0-canary.66",
5
+ "version": "11.0.0-canary.69",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@apollo/client": "*",
67
- "@graphcommerce/prettier-config-pwa": "^11.0.0-canary.66",
67
+ "@graphcommerce/prettier-config-pwa": "^11.0.0-canary.69",
68
68
  "@lingui/loader": "*",
69
69
  "@lingui/react": "*",
70
70
  "dotenv": "^18",
@@ -319,6 +319,8 @@ export type GraphCommerceConfig = {
319
319
  * ```
320
320
  */
321
321
  hygraphWriteAccessToken?: InputMaybe<Scalars['String']['input']>
322
+ /** Sets the quality of the images of `<Image>` and `imageUrl()`. */
323
+ imageQuality?: ImageQualityConfig
322
324
  /**
323
325
  * Limit the static generation of SSG when building.
324
326
  *
@@ -516,6 +518,20 @@ export type GraphCommerceStorefrontConfig = {
516
518
  robotsAllow?: InputMaybe<Scalars['Boolean']['input']>
517
519
  }
518
520
 
521
+ /**
522
+ * The quality of each kind of image. Choose the kind with `quality` on `<Image>` or `imageUrl()`,
523
+ * for example `quality='product'`.
524
+ */
525
+ export type ImageQualityConfig = {
526
+ /**
527
+ * The quality of a content image, such as a banner or another CMS image. `quality='content'` is
528
+ * the default for `<Image>` without the quality prop.
529
+ */
530
+ content?: Scalars['Int']['input']
531
+ /** The quality of a product image from the Magento catalog. */
532
+ product?: Scalars['Int']['input']
533
+ }
534
+
519
535
  /**
520
536
  * Options to configure which values will be replaced when a variant is selected on the product
521
537
  * page.
@@ -640,6 +656,7 @@ export function GraphCommerceConfigSchema() {
640
656
  hygraphManagementApi: z.string().nullish(),
641
657
  hygraphProjectId: z.string().nullish(),
642
658
  hygraphWriteAccessToken: z.string().nullish(),
659
+ imageQuality: z.lazy(() => ImageQualityConfigSchema().default({ content: 75, product: 52 })),
643
660
  limitSsg: z.boolean().nullish(),
644
661
  magentoEndpoint: z.string().min(1),
645
662
  magentoVersion: z.number(),
@@ -703,6 +720,13 @@ export function GraphCommerceStorefrontConfigSchema() {
703
720
  })
704
721
  }
705
722
 
723
+ export function ImageQualityConfigSchema() {
724
+ return z.object({
725
+ content: z.number().default(75),
726
+ product: z.number().default(52),
727
+ })
728
+ }
729
+
706
730
  export function MagentoConfigurableVariantValuesSchema() {
707
731
  return z.object({
708
732
  content: z.boolean().nullish(),
@@ -89,8 +89,10 @@ export function withGraphCommerce(nextConfig: NextConfig, cwd: string = process.
89
89
  },
90
90
  images: {
91
91
  ...nextConfig.images,
92
- // GraphCommerce uses quality 52 by default for optimized image delivery
93
- qualities: [52, 75, ...(nextConfig.images?.qualities ?? [])],
92
+ qualities: [
93
+ ...Object.values(graphcommerceConfig.imageQuality ?? {}),
94
+ ...(nextConfig.images?.qualities ?? []),
95
+ ],
94
96
  remotePatterns: [
95
97
  'magentoEndpoint' in graphcommerceConfig
96
98
  ? {