@graphcommerce/next-config 9.1.0-canary.43 → 9.1.0-canary.45

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,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.1.0-canary.45
4
+
5
+ ### Patch Changes
6
+
7
+ - [`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))
8
+
9
+ ## 9.1.0-canary.44
10
+
3
11
  ## 9.1.0-canary.43
4
12
 
5
13
  ## 9.1.0-canary.42
@@ -123,7 +131,6 @@
123
131
  - [#2305](https://github.com/graphcommerce-org/graphcommerce/pull/2305) [`77e8297`](https://github.com/graphcommerce-org/graphcommerce/commit/77e82976816994336c616208a651cb18ce9ea270) - Added `<CompanyFields/>` with `<CompanyName />` and `<CompanyVAT />` to shipping and billing forms. ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
124
132
 
125
133
  - [#2226](https://github.com/graphcommerce-org/graphcommerce/pull/2226) [`8939df2`](https://github.com/graphcommerce-org/graphcommerce/commit/8939df22eda57e681f83076707e856700f8b2e21) - Big improvements to the plugin system: Typescript validated, deeper resolution, new configuration object, replace plugins, and more ifConfig options.
126
-
127
134
  1. Plugins now use TypeScript's `"moduleSuffixes": [".interceptor", ""]` [functionality](https://www.typescriptlang.org/tsconfig#moduleSuffixes) which means that plugins now correctly resolve via TypeScript. So if you _go to reference_ in VSCode (or any other editor), you go to the interceptor directly and see which plugins are applied there. This also means that plugins are automatically checked during build (and will fail if there are errors).
128
135
  2. The exported type of an _intercepted component_ now has the types of all plugins applied. This means that plugins can modify the props of components (and is still validated with TypeScript). To make this work a plugin must always forward props to the `<Prev>` to ensure that values are correctly passed on.
129
136
  3. Plugins will now always be applied to deepest resolved path. This means that a plugin automatically applies to internal usages as well. This thus means that plugins do not need to be written with an internal path, but can keep the parent path. Istead of writing `@graphcommerce/magento-cart-items/components/RemoveItemFromCart/RemoveItemFromCartFab` you can now write `@graphcommerce/magento-cart-items`.
@@ -193,9 +200,7 @@
193
200
  ### Patch Changes
194
201
 
195
202
  - [#2380](https://github.com/graphcommerce-org/graphcommerce/pull/2380) [`3710d8b`](https://github.com/graphcommerce-org/graphcommerce/commit/3710d8bf1cceb5a991e5cfdfc15d42e462704c6d) - Solves the issue `TypeError: url?.startsWith is not a function`. The generated `.mesh/index.ts` would be generated as a requirejs module while next.js expects an esm module. In the end we properly generated the mesh correctly and now there is an `import.meta.url` instead of using `require('node:url')`. To solve this we needed to solve a chain of issues:
196
-
197
203
  1. The generation of the mesh is based on the version of the mesh that is imported (esm or commonjs). See [source](https://github.com/ardatan/graphql-mesh/blob/bf588d372c0078378aaa24beea2da794af7949e6/scripts/replace-import-meta-url-in-cjs.ts#L9-L10) for the lines that need to be different. This meant that we needed to change the @graphcommerce/cli package to be of type:module instead of a commonjs module.
198
-
199
204
  2) To properly convert the module to an esm module we've migrated the build of the cli package to use 'pkgroll' instead of tsc, because tsc is limited in what it outputs and can't really convert classic imports to esm.
200
205
  3) To load possible mesh plugins we require additional .ts files to be loaded with [tsx](https://tsx.is/). To get the tsx loader to work properly in combination with esm modules, we need at least [node 18.19.0](https://nodejs.org/en/blog/release/v18.19.0#new-nodemodule-api-register-for-module-customization-hooks-new-initialize-hook). Minimal Node version upped to 18.19.0 and add support for node 22. ([@paales](https://github.com/paales))
201
206
 
@@ -334,13 +339,11 @@
334
339
  ### Major Changes
335
340
 
336
341
  - [#1766](https://github.com/graphcommerce-org/graphcommerce/pull/1766) [`e34169ee2`](https://github.com/graphcommerce-org/graphcommerce/commit/e34169ee2e0fdc052ff589ceca0bc67557584c1f) - Upgraded to Next.js 13
337
-
338
342
  - NextLink integrates the next/link functionality with @mui/material's Link and ButtonBase (and all it's derivatives) components.
339
343
  - NextLink automatically adds `target="_blank"` when the href is external.
340
344
  - NextLink makes all relative href absolute. `href="my-page"` will be rendered as `href="/my-page"`. ([@paales](https://github.com/paales))
341
345
 
342
346
  - [#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.
343
-
344
347
  - GraphCommerce can be configured in the graphcommerce.config.js
345
348
  - The configuration is automatically validated on startup.
346
349
  - All configuration values can be overwritten by environment variables. ([@paales](https://github.com/paales))
@@ -370,7 +373,6 @@
370
373
  - [#1760](https://github.com/graphcommerce-org/graphcommerce/pull/1760) [`8badc8550`](https://github.com/graphcommerce-org/graphcommerce/commit/8badc8550c402ac7b80c8d3238d313550c28a055) - Updated dependencies ([@paales](https://github.com/paales))
371
374
 
372
375
  - [#1752](https://github.com/graphcommerce-org/graphcommerce/pull/1752) [`2a6a4d9ec`](https://github.com/graphcommerce-org/graphcommerce/commit/2a6a4d9ecfa1b58a66ba9b9d00016d6feda9aa95) - Updated dependencies to latest versions, except for nextjs; Solve tons of peer dependency issues.
373
-
374
376
  - Updated the @mui/material package
375
377
  - Removed dependencies on react-hook-form-mui and @playwright/test
376
378
  - Upgraded dependencies including type-fest and graphql-mesh
@@ -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.43",
5
+ "version": "9.1.0-canary.45",
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.43",
46
+ "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.45",
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
  }