@graphcommerce/next-config 9.1.0-canary.44 → 9.1.0-canary.46

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,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.1.0-canary.46
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f6b9c0d`](https://github.com/graphcommerce-org/graphcommerce/commit/f6b9c0d2bc5f678fc6cde279f1590b30ef631f8a) - Temporarily pin prettier to 3.5.3 to fix the GraphCommerce build: https://github.com/hosseinmd/prettier-plugin-jsdoc/pull/246/files ([@paales](https://github.com/paales))
8
+
9
+ ## 9.1.0-canary.45
10
+
11
+ ### Patch Changes
12
+
13
+ - [`f508396`](https://github.com/graphcommerce-org/graphcommerce/commit/f50839619c75c8f7b1782c079f1c25998cb9217b) - Solve issue where optional chaining for import.meta.graphCommmerce configuration paths didn't work. ([@paales](https://github.com/paales))
14
+
3
15
  ## 9.1.0-canary.44
4
16
 
5
17
  ## 9.1.0-canary.43
@@ -342,7 +354,6 @@
342
354
  - NextLink makes all relative href absolute. `href="my-page"` will be rendered as `href="/my-page"`. ([@paales](https://github.com/paales))
343
355
 
344
356
  - [#1786](https://github.com/graphcommerce-org/graphcommerce/pull/1786) [`b76679204`](https://github.com/graphcommerce-org/graphcommerce/commit/b766792049e1e6ebe45671c0b36e78746ef159e2) - Created a completely new [GraphCommerce config system](https://www.graphcommerce.org/docs/framework/config) to allow for greater confiugration options and rely less on a .env file to configuration.
345
-
346
357
  - GraphCommerce can be configured in the graphcommerce.config.js
347
358
  - The configuration is automatically validated on startup.
348
359
  - All configuration values can be overwritten by environment variables. ([@paales](https://github.com/paales))
@@ -1,36 +1,49 @@
1
1
  import { configToImportMeta } from '../../../src/config/utils/configToImportMeta'
2
-
3
2
  const configFile = {
4
3
  storefront: [{ locale: 'en', hygraphLocales: ['en'], magentoStoreCode: 'en_us' }],
5
4
  demoMode: true,
6
5
  googleTagmanagerKey: 'GTM-XXXXXXX',
7
6
  productFiltersPro: false,
8
- deeper: {
9
- arrayvalue: ['test'],
10
- nested: {
11
- value: 'test',
12
- },
13
- },
7
+ deeper: { arrayvalue: ['test'], nested: { value: 'test' } },
14
8
  }
15
-
16
9
  it('flattens a config object', () => {
17
- expect(configToImportMeta(configFile)).toMatchInlineSnapshot(`
10
+ expect(configToImportMeta(configFile)).toMatchInlineSnapshot(
11
+ `
18
12
  {
19
13
  "import.meta.graphCommerce": "{ __debug: "'import.meta.graphCommerce' can not be destructured, please access deeper properties directly" }",
20
14
  "import.meta.graphCommerce.deeper": "{ __debug: "'import.meta.graphCommerce.deeper' can not be destructured, please access deeper properties directly" }",
21
15
  "import.meta.graphCommerce.deeper.arrayvalue": "["test"]",
22
16
  "import.meta.graphCommerce.deeper.nested": "{ __debug: "'import.meta.graphCommerce.deeper.nested' can not be destructured, please access deeper properties directly" }",
23
17
  "import.meta.graphCommerce.deeper.nested.value": ""test"",
18
+ "import.meta.graphCommerce.deeper.nested?.value": ""test"",
19
+ "import.meta.graphCommerce.deeper?.arrayvalue": "["test"]",
20
+ "import.meta.graphCommerce.deeper?.nested": "{ __debug: "'import.meta.graphCommerce.deeper?.nested' can not be destructured, please access deeper properties directly" }",
21
+ "import.meta.graphCommerce.deeper?.nested.value": ""test"",
22
+ "import.meta.graphCommerce.deeper?.nested?.value": ""test"",
24
23
  "import.meta.graphCommerce.demoMode": "true",
25
24
  "import.meta.graphCommerce.googleTagmanagerKey": ""GTM-XXXXXXX"",
26
25
  "import.meta.graphCommerce.productFiltersPro": "false",
27
26
  "import.meta.graphCommerce.storefront": "[{"locale":"en","hygraphLocales":["en"],"magentoStoreCode":"en_us"}]",
27
+ "import.meta.graphCommerce?.deeper": "{ __debug: "'import.meta.graphCommerce?.deeper' can not be destructured, please access deeper properties directly" }",
28
+ "import.meta.graphCommerce?.deeper.arrayvalue": "["test"]",
29
+ "import.meta.graphCommerce?.deeper.nested": "{ __debug: "'import.meta.graphCommerce?.deeper.nested' can not be destructured, please access deeper properties directly" }",
30
+ "import.meta.graphCommerce?.deeper.nested.value": ""test"",
31
+ "import.meta.graphCommerce?.deeper.nested?.value": ""test"",
32
+ "import.meta.graphCommerce?.deeper?.arrayvalue": "["test"]",
33
+ "import.meta.graphCommerce?.deeper?.nested": "{ __debug: "'import.meta.graphCommerce?.deeper?.nested' can not be destructured, please access deeper properties directly" }",
34
+ "import.meta.graphCommerce?.deeper?.nested.value": ""test"",
35
+ "import.meta.graphCommerce?.deeper?.nested?.value": ""test"",
36
+ "import.meta.graphCommerce?.demoMode": "true",
37
+ "import.meta.graphCommerce?.googleTagmanagerKey": ""GTM-XXXXXXX"",
38
+ "import.meta.graphCommerce?.productFiltersPro": "false",
39
+ "import.meta.graphCommerce?.storefront": "[{"locale":"en","hygraphLocales":["en"],"magentoStoreCode":"en_us"}]",
28
40
  }
29
- `)
41
+ `,
42
+ )
30
43
  })
31
-
32
44
  it('creates keys but does not stringify values', () => {
33
- expect(configToImportMeta(configFile, 'graphCommerce', false)).toMatchInlineSnapshot(`
45
+ expect(configToImportMeta(configFile, 'graphCommerce', false)).toMatchInlineSnapshot(
46
+ `
34
47
  {
35
48
  "graphCommerce": {
36
49
  "deeper": {
@@ -67,10 +80,42 @@ it('creates keys but does not stringify values', () => {
67
80
  "value": "test",
68
81
  },
69
82
  "graphCommerce.deeper.nested.value": "test",
83
+ "graphCommerce.deeper.nested?.value": "test",
84
+ "graphCommerce.deeper?.arrayvalue": "["test"]",
85
+ "graphCommerce.deeper?.nested": {
86
+ "value": "test",
87
+ },
88
+ "graphCommerce.deeper?.nested.value": "test",
89
+ "graphCommerce.deeper?.nested?.value": "test",
70
90
  "graphCommerce.demoMode": true,
71
91
  "graphCommerce.googleTagmanagerKey": "GTM-XXXXXXX",
72
92
  "graphCommerce.productFiltersPro": false,
73
93
  "graphCommerce.storefront": "[{"locale":"en","hygraphLocales":["en"],"magentoStoreCode":"en_us"}]",
94
+ "graphCommerce?.deeper": {
95
+ "arrayvalue": [
96
+ "test",
97
+ ],
98
+ "nested": {
99
+ "value": "test",
100
+ },
101
+ },
102
+ "graphCommerce?.deeper.arrayvalue": "["test"]",
103
+ "graphCommerce?.deeper.nested": {
104
+ "value": "test",
105
+ },
106
+ "graphCommerce?.deeper.nested.value": "test",
107
+ "graphCommerce?.deeper.nested?.value": "test",
108
+ "graphCommerce?.deeper?.arrayvalue": "["test"]",
109
+ "graphCommerce?.deeper?.nested": {
110
+ "value": "test",
111
+ },
112
+ "graphCommerce?.deeper?.nested.value": "test",
113
+ "graphCommerce?.deeper?.nested?.value": "test",
114
+ "graphCommerce?.demoMode": true,
115
+ "graphCommerce?.googleTagmanagerKey": "GTM-XXXXXXX",
116
+ "graphCommerce?.productFiltersPro": false,
117
+ "graphCommerce?.storefront": "[{"locale":"en","hygraphLocales":["en"],"magentoStoreCode":"en_us"}]",
74
118
  }
75
- `)
119
+ `,
120
+ )
76
121
  })
package/dist/index.js CHANGED
@@ -650,7 +650,10 @@ function flattenKeys(value, initialPathPrefix, stringify) {
650
650
  [initialPathPrefix]: outputValue,
651
651
  ...Object.keys(value).map((key) => {
652
652
  const deep = value[key];
653
- return flattenKeys(deep, `${initialPathPrefix}.${key}`, stringify);
653
+ return {
654
+ ...flattenKeys(deep, `${initialPathPrefix}.${key}`, stringify),
655
+ ...flattenKeys(deep, `${initialPathPrefix}?.${key}`, stringify)
656
+ };
654
657
  }).reduce((acc, path) => ({ ...acc, ...path }), {})
655
658
  };
656
659
  }
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": "9.1.0-canary.44",
5
+ "version": "9.1.0-canary.46",
6
6
  "type": "module",
7
7
  "types": "./src/index.ts",
8
8
  "exports": {
@@ -43,7 +43,7 @@
43
43
  "zod": "^3.24.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.44",
46
+ "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.46",
47
47
  "@lingui/loader": "*",
48
48
  "@lingui/macro": "*",
49
49
  "@lingui/react": "*",
@@ -32,7 +32,10 @@ function flattenKeys(
32
32
  ...Object.keys(value)
33
33
  .map((key) => {
34
34
  const deep = (value as Record<string, unknown>)[key]
35
- return flattenKeys(deep, `${initialPathPrefix}.${key}`, stringify)
35
+ return {
36
+ ...flattenKeys(deep, `${initialPathPrefix}.${key}`, stringify),
37
+ ...flattenKeys(deep, `${initialPathPrefix}?.${key}`, stringify),
38
+ }
36
39
  })
37
40
  .reduce((acc, path) => ({ ...acc, ...path }), {}),
38
41
  }