@graphcommerce/cli 9.1.0-canary.55 → 10.0.0-canary.57

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,87 @@
1
1
  # @graphcommerce/cli
2
2
 
3
+ ## 10.0.0-canary.57
4
+
5
+ ## 10.0.0-canary.56
6
+
7
+ ### Major Changes
8
+
9
+ - [#2546](https://github.com/graphcommerce-org/graphcommerce/pull/2546) [`ed9332a`](https://github.com/graphcommerce-org/graphcommerce/commit/ed9332a7f78966d932041d9a7725641edc92b28d) - ## GraphCommerce 10 - Turbopack Support
10
+
11
+ This major release brings full Turbopack compatibility, dramatically improving development speed.
12
+
13
+ ### 🚀 Turbopack-Compatible Interceptor System
14
+
15
+ The entire plugin/interceptor system has been rewritten to work with Turbopack:
16
+
17
+ - **No more Webpack plugins** - Removed `InterceptorPlugin` webpack plugin entirely
18
+ - **File-based interception** - Original files are moved to `.original.tsx` and replaced with interceptor content
19
+ - **Direct imports** - Interceptors import from `.original` files instead of embedding source
20
+ - **New CLI commands**:
21
+ - `graphcommerce codegen-interceptors` - Generate interceptor files
22
+ - `graphcommerce cleanup-interceptors` - Reset interceptor system, restore original files
23
+ - **Stable file hashing** - Deterministic interceptor generation for better caching
24
+
25
+ ### ⚙️ Treeshakable Configuration System
26
+
27
+ Replaced Webpack `DefinePlugin`-based `import.meta.graphCommerce` with a new generated configuration system:
28
+
29
+ - **New `codegen-config-values` command** - Generates TypeScript files with precise typing
30
+ - **Schema-driven** - Dynamically introspects Zod schemas to determine all available properties
31
+ - **Fully treeshakable** - Unused config values are eliminated from the bundle
32
+ - **Type-safe** - Uses `Get<GraphCommerceConfig, 'path'>` for nested property access
33
+ - **Separate files for nested objects** - Optimal treeshaking for complex configurations
34
+
35
+ ### 🔧 withGraphCommerce Changes
36
+
37
+ - **Removed** `InterceptorPlugin` - No longer needed with file-based interception
38
+ - **Removed** `DefinePlugin` for `import.meta.graphCommerce` - Replaced with generated config
39
+ - **Removed** `@mui/*` alias rewrites - No longer required
40
+ - **Added** Turbopack loader rules for `.yaml`, `.yml`, and `.po` files
41
+ - **Added** `serverExternalPackages` for all `@whatwg-node/*` packages
42
+ - **Added** `optimizePackageImports` for better bundle optimization
43
+ - **Added** `images.qualities: [52, 75]` for Next.js image optimization
44
+
45
+ ### 📦 Lingui Configuration
46
+
47
+ - **Renamed** `lingui.config.js` → `lingui.config.ts` with TypeScript support
48
+ - **Updated** `@graphcommerce/lingui-next/config` to TypeScript with proper exports
49
+ - **Simplified** formatter options
50
+
51
+ ### ⚛️ React 19 & Next.js 16 Compatibility
52
+
53
+ - Updated `RefObject<T>` types for React 19 (now includes `null` by default)
54
+ - Replaced deprecated `React.VFC` with `React.FC`
55
+ - Fixed `useRef` calls to require explicit initial values
56
+ - Updated `MutableRefObject` usage in `framer-scroller`
57
+
58
+ ### 📋 ESLint 9 Flat Config
59
+
60
+ - Migrated from legacy `.eslintrc` to new flat config format (`eslint.config.mjs`)
61
+ - Updated `@typescript-eslint/*` packages to v8
62
+ - Fixed AST selector for `SxProps` rule (`typeParameters` → `typeArguments`)
63
+
64
+ ### 🔄 Apollo Client
65
+
66
+ - Fixed deprecated `name` option → `clientAwareness: { name: 'ssr' }`
67
+ - Updated error handling types to accept `ApolloError | null | undefined`
68
+
69
+ ### ⚠️ Breaking Changes
70
+
71
+ - **Node.js 24.x not supported** - Restricted to `>=20 <24.0.0` due to [nodejs/undici#4290](https://github.com/nodejs/undici/issues/4290)
72
+ - **Interceptor files changed** - Original components now at `.original.tsx`
73
+ - **Config access changed** - Use generated config values instead of `import.meta.graphCommerce`
74
+ - **ESLint config format** - Must use flat config (`eslint.config.mjs`)
75
+ - **Lingui config** - Rename `lingui.config.js` to `lingui.config.ts`
76
+
77
+ ### 🗑️ Removed
78
+
79
+ - `InterceptorPlugin` webpack plugin
80
+ - `configToImportMeta` utility
81
+ - Webpack `DefinePlugin` usage for config
82
+ - `@mui/*` modern alias rewrites
83
+ - Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
84
+
3
85
  ## 9.1.0-canary.55
4
86
 
5
87
  ## 9.1.0-canary.54
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import fs from 'node:fs/promises';
3
- import path from 'node:path';
2
+ import fs from 'fs/promises';
3
+ import path from 'path';
4
4
  import { resolveDependenciesSync, packageRoots } from '@graphcommerce/next-config';
5
5
  import { cliError, loadCodegenConfig, runCli } from '@graphql-codegen/cli';
6
6
  import dotenv from 'dotenv';
7
+ import glob from 'fast-glob';
7
8
  import { rimraf } from 'rimraf';
8
9
  import yaml from 'yaml';
9
10
 
10
11
  const [, , cmd] = process.argv;
11
- dotenv.config();
12
+ dotenv.config({ quiet: true });
12
13
  const root = process.cwd();
13
14
  const configLocation = path.join(root, "._tmp_codegen.yml");
14
15
  async function cleanup() {
@@ -23,7 +24,12 @@ async function cleanup() {
23
24
  }
24
25
  function appendDocumentLocations(conf, packages) {
25
26
  const documents = Array.isArray(conf.documents) ? conf.documents : [conf.documents];
26
- documents.push(...packages.map((p) => `${p}/**/*.graphql`));
27
+ const packagePatterns = packages.map((p) => `${p}/**/*.graphql`);
28
+ const resolvedFiles = glob.sync(packagePatterns, {
29
+ ignore: ["**/node_modules/**"],
30
+ followSymbolicLinks: false
31
+ });
32
+ documents.push(...resolvedFiles);
27
33
  return conf;
28
34
  }
29
35
  async function main() {
@@ -2,8 +2,10 @@
2
2
  const commands = {
3
3
  codegen: () => import('@graphcommerce/next-config').then((m) => m.codegen),
4
4
  "codegen-config": () => import('@graphcommerce/next-config').then((m) => m.generateConfig),
5
+ "codegen-config-values": () => import('@graphcommerce/next-config').then((m) => m.generateConfigValues),
5
6
  "copy-files": () => import('@graphcommerce/next-config').then((m) => m.copyFiles),
6
7
  "codegen-interceptors": () => import('@graphcommerce/next-config').then((m) => m.codegenInterceptors),
8
+ "cleanup-interceptors": () => import('@graphcommerce/next-config').then((m) => m.cleanupInterceptors),
7
9
  "export-config": () => import('@graphcommerce/next-config').then((m) => m.exportConfig),
8
10
  "hygraph-migrate": () => import('@graphcommerce/hygraph-cli').then((m) => m.migrateHygraph)
9
11
  };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { spawn } from 'node:child_process';
3
- import path from 'node:path';
2
+ import { spawn } from 'child_process';
3
+ import path from 'path';
4
4
  import { findParentPath } from '@graphcommerce/next-config';
5
5
  import { detect } from 'detect-package-manager';
6
6
 
package/dist/bin/mesh.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { promises } from 'node:fs';
3
- import path$1 from 'node:path';
4
- import { exit } from 'node:process';
2
+ import { promises } from 'fs';
3
+ import path from 'path';
4
+ import { exit } from 'process';
5
5
  import { loadConfig, resolveDependenciesSync, sig, packageRoots, replaceConfigInString } from '@graphcommerce/next-config';
6
6
  import { DEFAULT_CLI_PARAMS, graphqlMesh } from '@graphql-mesh/cli';
7
7
  import { defaultImportFn, DefaultLogger, loadYaml, fileURLToPath } from '@graphql-mesh/utils';
@@ -9,7 +9,6 @@ import dotenv from 'dotenv';
9
9
  import 'tsx/cjs';
10
10
  import 'tsx/esm';
11
11
  import yaml from 'yaml';
12
- import path from 'path';
13
12
  import { cosmiconfig, defaultLoaders } from 'cosmiconfig';
14
13
 
15
14
  function customLoader(ext, importFn = defaultImportFn, initialLoggerPrefix = "\u{1F578}\uFE0F Mesh") {
@@ -72,7 +71,7 @@ async function findConfig(options) {
72
71
  return config;
73
72
  }
74
73
 
75
- dotenv.config();
74
+ dotenv.config({ quiet: true });
76
75
  function resolvePath(pathStr) {
77
76
  return fileURLToPath(import.meta.resolve(pathStr));
78
77
  }
@@ -82,14 +81,14 @@ function handleFatalError(e, logger = new DefaultLogger("\u25C8")) {
82
81
  if (process.env.JEST == null) exit(1);
83
82
  }
84
83
  const root = process.cwd();
85
- const meshDir = path$1.dirname(resolvePath("@graphcommerce/graphql-mesh"));
86
- const relativePath = path$1.join(path$1.relative(meshDir, root), "/");
84
+ const meshDir = path.dirname(resolvePath("@graphcommerce/graphql-mesh"));
85
+ const relativePath = path.join(path.relative(meshDir, root), "/");
87
86
  const cliParams = {
88
87
  ...DEFAULT_CLI_PARAMS,
89
88
  playgroundTitle: "GraphCommerce\xAE Mesh"
90
89
  };
91
90
  const tmpMesh = "_tmp_mesh";
92
- const tmpMeshLocation = path$1.join(root, `.${tmpMesh}rc.yml`);
91
+ const tmpMeshLocation = path.join(root, `.${tmpMesh}rc.yml`);
93
92
  async function cleanup() {
94
93
  try {
95
94
  await promises.stat(tmpMeshLocation).then((r) => {
@@ -103,7 +102,7 @@ async function cleanup() {
103
102
  const main = async () => {
104
103
  const baseConf = await findConfig({});
105
104
  const graphCommerce = loadConfig(root);
106
- const meshConfigf = await import('@graphcommerce/graphql-mesh/meshConfig.interceptor');
105
+ const meshConfigf = await import('@graphcommerce/graphql-mesh/meshConfig');
107
106
  const conf = meshConfigf.default.meshConfig(baseConf, graphCommerce);
108
107
  conf.customFetch = "@graphcommerce/graphql-mesh/customFetch";
109
108
  conf.serve = { ...conf.serve, endpoint: "/api/graphql" };
@@ -111,7 +110,7 @@ const main = async () => {
111
110
  conf.additionalResolvers = conf.additionalResolvers?.map((additionalResolver) => {
112
111
  if (typeof additionalResolver !== "string") return additionalResolver;
113
112
  if (additionalResolver.startsWith("@"))
114
- return path$1.relative(root, resolvePath(additionalResolver));
113
+ return path.relative(root, resolvePath(additionalResolver));
115
114
  return additionalResolver;
116
115
  });
117
116
  conf.sources = conf.sources.map((source) => {
@@ -123,7 +122,7 @@ const main = async () => {
123
122
  if (key === "openapi" && value) {
124
123
  const openapi = value;
125
124
  if (openapi.source.startsWith("@")) {
126
- return [key, { ...openapi, source: path$1.relative(root, resolvePath(openapi.source)) }];
125
+ return [key, { ...openapi, source: path.relative(root, resolvePath(openapi.source)) }];
127
126
  }
128
127
  }
129
128
  return [key, value];
@@ -134,7 +133,7 @@ const main = async () => {
134
133
  if (!conf.additionalTypeDefs) conf.additionalTypeDefs = [];
135
134
  conf.additionalTypeDefs = (Array.isArray(conf.additionalTypeDefs) ? conf.additionalTypeDefs : [conf.additionalTypeDefs]).map((additionalTypeDef) => {
136
135
  if (typeof additionalTypeDef === "string" && additionalTypeDef.startsWith("@"))
137
- return path$1.relative(root, resolvePath(additionalTypeDef));
136
+ return path.relative(root, resolvePath(additionalTypeDef));
138
137
  return additionalTypeDef;
139
138
  });
140
139
  conf.additionalTypeDefs.push("graphql/**/*.graphqls");
@@ -169,14 +168,14 @@ const main = async () => {
169
168
  await promises.writeFile(tmpMeshLocation, yamlString);
170
169
  await promises.writeFile(
171
170
  `${meshDir}/.mesh.ts`,
172
- `export type * from '${relativePath.split(path$1.sep).join("/")}.mesh'
171
+ `export type * from '${relativePath.split(path.sep).join("/")}.mesh'
173
172
  export {
174
173
  getBuiltMesh as getBuiltMeshBase,
175
174
  execute,
176
175
  subscribe,
177
176
  createBuiltMeshHTTPHandler as createBuiltMeshHTTPHandlerBase,
178
177
  rawServeConfig,
179
- } from '${relativePath.split(path$1.sep).join("/")}.mesh'`,
178
+ } from '${relativePath.split(path.sep).join("/")}.mesh'`,
180
179
  { encoding: "utf8" }
181
180
  );
182
181
  await graphqlMesh({ ...cliParams, configName: tmpMesh });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/cli",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "9.1.0-canary.55",
5
+ "version": "10.0.0-canary.57",
6
6
  "scripts": {
7
7
  "dev": "pkgroll --clean-dist --watch",
8
8
  "build": "pkgroll --clean-dist",
@@ -22,29 +22,31 @@
22
22
  "is-monorepo": "dist/bin/is-monorepo.js"
23
23
  },
24
24
  "dependencies": {
25
- "@graphql-codegen/cli": "5.0.5",
25
+ "@graphql-codegen/cli": "6.1.0",
26
26
  "cosmiconfig": "^8.3.6",
27
27
  "detect-package-manager": "^3.0.2",
28
- "dotenv": "16.4.7",
29
- "graphql": "^16.10.0",
30
- "graphql-codegen-typescript-validation-schema": "^0.17.0",
28
+ "dotenv": "16.6.1",
29
+ "fast-glob": "^3.3.3",
30
+ "graphql": "^16.12.0",
31
+ "graphql-codegen-typescript-validation-schema": "^0.18.1",
31
32
  "graphql-tag": "^2.12.6",
32
33
  "rimraf": "^5.0.10",
33
34
  "tslib": "^2.8.1",
34
- "tsx": "^4.19.2",
35
- "yaml": "2.6.1"
35
+ "tsx": "^4.21.0",
36
+ "yaml": "2.8.2",
37
+ "zod": "^3.25.76"
36
38
  },
37
39
  "peerDependencies": {
38
- "@graphcommerce/eslint-config-pwa": "^9.1.0-canary.55",
39
- "@graphcommerce/graphql-mesh": "^9.1.0-canary.55",
40
- "@graphcommerce/hygraph-cli": "^9.1.0-canary.55",
41
- "@graphcommerce/next-config": "^9.1.0-canary.55",
42
- "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.55",
43
- "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.55",
40
+ "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.57",
41
+ "@graphcommerce/graphql-mesh": "^10.0.0-canary.57",
42
+ "@graphcommerce/hygraph-cli": "^10.0.0-canary.57",
43
+ "@graphcommerce/next-config": "^10.0.0-canary.57",
44
+ "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.57",
45
+ "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.57",
44
46
  "@graphql-mesh/cli": "*",
45
47
  "@graphql-mesh/types": "*",
46
48
  "@graphql-mesh/utils": "*",
47
- "react": "^18.2.0"
49
+ "react": "^19.2.0"
48
50
  },
49
51
  "peerDependenciesMeta": {
50
52
  "@graphcommerce/hygraph-cli": {
@@ -63,6 +65,6 @@
63
65
  }
64
66
  },
65
67
  "devDependencies": {
66
- "pkgroll": "^2.5.1"
68
+ "pkgroll": "^2.21.4"
67
69
  }
68
70
  }
@@ -1,18 +1,17 @@
1
1
  #!/usr/bin/env node
2
-
3
- /* eslint-disable import/no-extraneous-dependencies */
4
- import fs from 'node:fs/promises'
5
- import path from 'node:path'
2
+ import fs from 'fs/promises'
3
+ import path from 'path'
6
4
  import { packageRoots, resolveDependenciesSync } from '@graphcommerce/next-config'
7
5
  import { cliError, loadCodegenConfig, runCli } from '@graphql-codegen/cli'
8
6
  import type { Types } from '@graphql-codegen/plugin-helpers'
9
7
  import dotenv from 'dotenv'
8
+ import glob from 'fast-glob'
10
9
  import { rimraf } from 'rimraf'
11
10
  import yaml from 'yaml'
12
11
 
13
12
  const [, , cmd] = process.argv
14
13
 
15
- dotenv.config()
14
+ dotenv.config({ quiet: true })
16
15
 
17
16
  const root = process.cwd()
18
17
  const configLocation = path.join(root, '._tmp_codegen.yml')
@@ -34,7 +33,14 @@ function appendDocumentLocations(
34
33
  packages: string[],
35
34
  ): Types.ConfiguredOutput {
36
35
  const documents = Array.isArray(conf.documents) ? conf.documents : [conf.documents]
37
- documents.push(...packages.map((p) => `${p}/**/*.graphql`))
36
+
37
+ // Pre-resolve GraphQL files to avoid graphql-codegen following symlinks into node_modules
38
+ const packagePatterns = packages.map((p) => `${p}/**/*.graphql`)
39
+ const resolvedFiles = glob.sync(packagePatterns, {
40
+ ignore: ['**/node_modules/**'],
41
+ followSymbolicLinks: false,
42
+ })
43
+ documents.push(...resolvedFiles)
38
44
 
39
45
  return conf
40
46
  }
@@ -3,9 +3,13 @@
3
3
  const commands = {
4
4
  codegen: () => import('@graphcommerce/next-config').then((m) => m.codegen),
5
5
  'codegen-config': () => import('@graphcommerce/next-config').then((m) => m.generateConfig),
6
+ 'codegen-config-values': () =>
7
+ import('@graphcommerce/next-config').then((m) => m.generateConfigValues),
6
8
  'copy-files': () => import('@graphcommerce/next-config').then((m) => m.copyFiles),
7
9
  'codegen-interceptors': () =>
8
10
  import('@graphcommerce/next-config').then((m) => m.codegenInterceptors),
11
+ 'cleanup-interceptors': () =>
12
+ import('@graphcommerce/next-config').then((m) => m.cleanupInterceptors),
9
13
  'export-config': () => import('@graphcommerce/next-config').then((m) => m.exportConfig),
10
14
  'hygraph-migrate': () => import('@graphcommerce/hygraph-cli').then((m) => m.migrateHygraph),
11
15
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import type { ChildProcess } from 'node:child_process'
3
- import { spawn } from 'node:child_process'
4
- import path from 'node:path'
2
+ import { spawn } from 'child_process'
3
+ import type { ChildProcess } from 'child_process'
4
+ import path from 'path'
5
5
  import { findParentPath } from '@graphcommerce/next-config'
6
6
  import { detect } from 'detect-package-manager'
7
7
 
package/src/bin/mesh.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable import/no-extraneous-dependencies */
2
- import { promises as fs } from 'node:fs'
3
- import path from 'node:path'
4
- import { exit } from 'node:process'
2
+ import { promises as fs } from 'fs'
3
+ import path from 'path'
4
+ import { exit } from 'process'
5
5
  import type { meshConfig as meshConfigBase } from '@graphcommerce/graphql-mesh/meshConfig'
6
6
  import {
7
7
  loadConfig,
@@ -21,7 +21,7 @@ import type { Entries, OmitIndexSignature } from 'type-fest'
21
21
  import yaml from 'yaml'
22
22
  import { findConfig } from '../utils/findConfig'
23
23
 
24
- dotenv.config()
24
+ dotenv.config({ quiet: true })
25
25
 
26
26
  function resolvePath(pathStr: string) {
27
27
  return fileURLToPath(import.meta.resolve(pathStr))
@@ -62,9 +62,7 @@ const main = async () => {
62
62
  const baseConf = (await findConfig({})) as YamlConfig.Config
63
63
  const graphCommerce = loadConfig(root)
64
64
 
65
- const meshConfigf = (await import(
66
- '@graphcommerce/graphql-mesh/meshConfig.interceptor'
67
- )) as unknown as {
65
+ const meshConfigf = (await import('@graphcommerce/graphql-mesh/meshConfig')) as unknown as {
68
66
  default: {
69
67
  meshConfig: typeof meshConfigBase
70
68
  }