@graphcommerce/next-config 9.0.0-canary.101 → 9.0.0-canary.103

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +86 -1207
  2. package/__tests__/config/utils/mergeEnvIntoConfig.ts +5 -3
  3. package/__tests__/config/utils/rewriteLegancyEnv.ts +2 -1
  4. package/__tests__/interceptors/findPlugins.ts +14 -6
  5. package/__tests__/interceptors/generateInterceptors.ts +29 -29
  6. package/__tests__/interceptors/parseStructure.ts +2 -2
  7. package/__tests__/utils/resolveDependenciesSync.ts +1 -1
  8. package/dist/config/commands/exportConfig.js +1 -1
  9. package/dist/config/utils/mergeEnvIntoConfig.js +6 -6
  10. package/dist/config/utils/rewriteLegacyEnv.js +2 -2
  11. package/dist/interceptors/InterceptorPlugin.js +3 -3
  12. package/dist/interceptors/commands/codegenInterceptors.js +2 -2
  13. package/dist/interceptors/findOriginalSource.js +2 -1
  14. package/dist/interceptors/findPlugins.js +5 -8
  15. package/dist/interceptors/generateInterceptor.js +5 -5
  16. package/dist/interceptors/generateInterceptors.js +2 -2
  17. package/dist/interceptors/parseStructure.js +1 -1
  18. package/dist/utils/resolveDependenciesSync.js +3 -1
  19. package/package.json +12 -10
  20. package/src/config/commands/exportConfig.ts +1 -1
  21. package/src/config/demoConfig.ts +2 -2
  22. package/src/config/index.ts +1 -1
  23. package/src/config/utils/exportConfigToEnv.ts +1 -1
  24. package/src/config/utils/mergeEnvIntoConfig.ts +7 -9
  25. package/src/config/utils/replaceConfigInString.ts +1 -1
  26. package/src/config/utils/rewriteLegacyEnv.ts +5 -4
  27. package/src/index.ts +2 -1
  28. package/src/interceptors/InterceptorPlugin.ts +9 -7
  29. package/src/interceptors/RenameVisitor.ts +1 -1
  30. package/src/interceptors/Visitor.ts +1 -1
  31. package/src/interceptors/commands/codegenInterceptors.ts +2 -2
  32. package/src/interceptors/extractExports.ts +1 -0
  33. package/src/interceptors/findOriginalSource.ts +5 -4
  34. package/src/interceptors/findPlugins.ts +8 -9
  35. package/src/interceptors/generateInterceptor.ts +8 -7
  36. package/src/interceptors/generateInterceptors.ts +6 -12
  37. package/src/interceptors/parseStructure.ts +4 -4
  38. package/src/interceptors/swc.ts +2 -1
  39. package/src/interceptors/writeInterceptors.ts +1 -1
  40. package/src/utils/packageRoots.ts +1 -1
  41. package/src/utils/resolveDependenciesSync.ts +4 -1
  42. package/src/withGraphCommerce.ts +4 -3
@@ -1,6 +1,6 @@
1
+ import dotenv from 'dotenv'
1
2
  import { loadConfig } from '../loadConfig'
2
3
  import { exportConfigToEnv } from '../utils/exportConfigToEnv'
3
- import dotenv from 'dotenv'
4
4
 
5
5
  dotenv.config()
6
6
 
@@ -1,6 +1,6 @@
1
1
  // eslint-disable-next-line import/no-extraneous-dependencies
2
- import { PartialDeep } from 'type-fest'
3
- import { GraphCommerceConfig } from '../generated/config'
2
+ import type { PartialDeep } from 'type-fest'
3
+ import type { GraphCommerceConfig } from '../generated/config'
4
4
 
5
5
  export const demoConfig: PartialDeep<GraphCommerceConfig, { recurseIntoArrays: true }> &
6
6
  Record<string, unknown> = {
@@ -1,5 +1,5 @@
1
1
  import type { Path, PathValue } from 'react-hook-form'
2
- import { GraphCommerceConfig } from '../generated/config'
2
+ import type { GraphCommerceConfig } from '../generated/config'
3
3
 
4
4
  export * from './commands/generateConfig'
5
5
  export * from './commands/exportConfig'
@@ -1,4 +1,4 @@
1
- import { GraphCommerceConfig } from '../../generated/config'
1
+ import type { GraphCommerceConfig } from '../../generated/config'
2
2
  import { toEnvStr } from './mergeEnvIntoConfig'
3
3
 
4
4
  const fmt = (value: string | number | boolean | object | null) => {
@@ -3,6 +3,7 @@ import { mergeDeep, cloneDeep } from '@apollo/client/utilities'
3
3
  import chalk from 'chalk'
4
4
  import { get, set } from 'lodash'
5
5
  import snakeCase from 'lodash/snakeCase'
6
+ import type { ZodRawShape, ZodTypeAny, ZodAny } from 'zod'
6
7
  import {
7
8
  z,
8
9
  ZodObject,
@@ -13,10 +14,7 @@ import {
13
14
  ZodNullable,
14
15
  ZodOptional,
15
16
  ZodEffects,
16
- ZodRawShape,
17
17
  ZodEnum,
18
- ZodTypeAny,
19
- ZodAny,
20
18
  ZodDefault,
21
19
  } from 'zod'
22
20
  import diff from './diff'
@@ -69,7 +67,7 @@ export function configToEnvSchema(schema: ZodNode) {
69
67
  envSchema[toEnvStr(path)] = z
70
68
  .string()
71
69
  .optional()
72
- .refine(isJSON, { message: `Invalid JSON` })
70
+ .refine(isJSON, { message: 'Invalid JSON' })
73
71
  .transform((val) => (val ? JSON.parse(val) : val))
74
72
  envToDot[toEnvStr(path)] = dotNotation(path)
75
73
  }
@@ -89,7 +87,7 @@ export function configToEnvSchema(schema: ZodNode) {
89
87
  envSchema[toEnvStr(path)] = z
90
88
  .string()
91
89
  .optional()
92
- .refine(isJSON, { message: `Invalid JSON` })
90
+ .refine(isJSON, { message: 'Invalid JSON' })
93
91
  .transform((val) => (val ? JSON.parse(val) : val))
94
92
  envToDot[toEnvStr(path)] = dotNotation(path)
95
93
  }
@@ -232,11 +230,11 @@ export function formatAppliedEnv(applyResult: ApplyResult) {
232
230
  return ` ${chalk.yellowBright('~')} ${baseLog}: ${fromFmt} => ${toFmt}`
233
231
  })
234
232
 
235
- let header = chalk.blueBright(`info`)
236
- if (hasWarning) header = chalk.yellowBright(`warning`)
237
- if (hasError) header = chalk.yellowBright(`error`)
233
+ let header = chalk.blueBright('info')
234
+ if (hasWarning) header = chalk.yellowBright('warning')
235
+ if (hasError) header = chalk.yellowBright('error')
238
236
 
239
- header += ` - Loaded GraphCommerce env variables`
237
+ header += ' - Loaded GraphCommerce env variables'
240
238
 
241
239
  return [header, ...lines].join('\n')
242
240
  }
@@ -1,4 +1,4 @@
1
- import { GraphCommerceConfig } from '../../generated/config'
1
+ import type { GraphCommerceConfig } from '../../generated/config'
2
2
  import { configToImportMeta } from './configToImportMeta'
3
3
 
4
4
  export function replaceConfigInString(str: string, config: Partial<GraphCommerceConfig>) {
@@ -1,6 +1,7 @@
1
1
  import cloneDeep from 'lodash/cloneDeep'
2
- import { GraphCommerceConfig } from '../../generated/config'
3
- import { ApplyResult, mergeEnvIntoConfig, ZodNode } from './mergeEnvIntoConfig'
2
+ import type { GraphCommerceConfig } from '../../generated/config'
3
+ import type { ApplyResult, ZodNode } from './mergeEnvIntoConfig'
4
+ import { mergeEnvIntoConfig } from './mergeEnvIntoConfig'
4
5
 
5
6
  export function rewriteLegacyEnv(
6
7
  schema: ZodNode,
@@ -24,7 +25,7 @@ export function rewriteLegacyEnv(
24
25
  function notUsed() {
25
26
  return (envVar: string, envValue: string) => {
26
27
  applied.push({
27
- warning: [`should be removed`],
28
+ warning: ['should be removed'],
28
29
  envVar,
29
30
  envValue,
30
31
  })
@@ -38,7 +39,7 @@ export function rewriteLegacyEnv(
38
39
  IMAGE_DOMAINS: (envVar: string, envValue: string) => {
39
40
  applied.push({
40
41
  warning: [
41
- `should be removed: will automatically add the Magento/Hygraph URL. For more advanced configurations, see: https://nextjs.org/docs/api-reference/next/image#configuration-options`,
42
+ 'should be removed: will automatically add the Magento/Hygraph URL. For more advanced configurations, see: https://nextjs.org/docs/api-reference/next/image#configuration-options',
42
43
  ],
43
44
  envVar,
44
45
  envValue,
package/src/index.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import type React from 'react'
3
3
  import type { Path, PathValue } from 'react-hook-form'
4
- import { GraphCommerceConfig } from './generated/config'
4
+ import type { GraphCommerceConfig } from './generated/config'
5
+
5
6
  export * from './utils/isMonorepo'
6
7
  export * from './utils/resolveDependenciesSync'
7
8
  export * from './utils/packageRoots'
@@ -1,9 +1,11 @@
1
1
  import path from 'path'
2
- import { Compiler } from 'webpack'
3
- import { GraphCommerceConfig } from '../generated/config'
4
- import { ResolveDependency, resolveDependency } from '../utils/resolveDependency'
2
+ import type { Compiler } from 'webpack'
3
+ import type { GraphCommerceConfig } from '../generated/config'
4
+ import type { ResolveDependency } from '../utils/resolveDependency'
5
+ import { resolveDependency } from '../utils/resolveDependency'
5
6
  import { findPlugins } from './findPlugins'
6
- import { generateInterceptors, GenerateInterceptorsReturn } from './generateInterceptors'
7
+ import type { GenerateInterceptorsReturn } from './generateInterceptors'
8
+ import { generateInterceptors } from './generateInterceptors'
7
9
  import { writeInterceptors } from './writeInterceptors'
8
10
 
9
11
  let interceptors: GenerateInterceptorsReturn | undefined
@@ -29,11 +31,11 @@ export class InterceptorPlugin {
29
31
  #generateInterceptors = async () => {
30
32
  if (generating) return {}
31
33
  generating = true
32
- const start = Date.now()
34
+ // const start = Date.now()
33
35
 
34
36
  // console.log('Generating interceptors...')
35
37
 
36
- const [plugins, errors] = findPlugins(this.config)
38
+ const [plugins] = findPlugins(this.config)
37
39
 
38
40
  // console.log(errors)
39
41
 
@@ -86,7 +88,7 @@ export class InterceptorPlugin {
86
88
 
87
89
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
88
90
  this.#generateInterceptors().then((i) => {
89
- Object.entries(i).forEach(([key, { sourcePath }]) => {
91
+ Object.entries(i).forEach(([, { sourcePath }]) => {
90
92
  const absoluteFilePath = path.join(process.cwd(), sourcePath)
91
93
  compilation.fileDependencies.add(absoluteFilePath)
92
94
  })
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable max-classes-per-file */
2
- import { Identifier } from '@swc/core'
2
+ import type { Identifier } from '@swc/core'
3
3
  import { Visitor } from './Visitor'
4
4
 
5
5
  export class RenameVisitor extends Visitor {
@@ -11,7 +11,7 @@
11
11
  /* eslint-disable class-methods-use-this */
12
12
  /* eslint-disable consistent-return */
13
13
  // eslint-disable-next-line import/no-extraneous-dependencies
14
- import {
14
+ import type {
15
15
  Accessibility,
16
16
  Argument,
17
17
  ArrayExpression,
@@ -1,9 +1,9 @@
1
+ import dotenv from 'dotenv'
1
2
  import { loadConfig } from '../../config/loadConfig'
2
3
  import { resolveDependency } from '../../utils/resolveDependency'
3
4
  import { findPlugins } from '../findPlugins'
4
5
  import { generateInterceptors } from '../generateInterceptors'
5
6
  import { writeInterceptors } from '../writeInterceptors'
6
- import dotenv from 'dotenv'
7
7
 
8
8
  dotenv.config()
9
9
 
@@ -11,7 +11,7 @@ dotenv.config()
11
11
  export async function codegenInterceptors() {
12
12
  const conf = loadConfig(process.cwd())
13
13
 
14
- const [plugins, errors] = findPlugins(conf)
14
+ const [plugins] = findPlugins(conf)
15
15
 
16
16
  const generatedInterceptors = await generateInterceptors(
17
17
  plugins,
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
2
  /* eslint-disable no-continue */
2
3
  /* eslint-disable max-classes-per-file */
3
4
  import type {
@@ -1,8 +1,8 @@
1
1
  import path from 'path'
2
- import { ResolveDependency, ResolveDependencyReturn } from '../utils/resolveDependency'
3
- import { PluginConfig } from './generateInterceptor'
2
+ import type { ExportAllDeclaration } from '@swc/core'
3
+ import type { ResolveDependency, ResolveDependencyReturn } from '../utils/resolveDependency'
4
+ import type { PluginConfig } from './generateInterceptor'
4
5
  import { parseSync } from './swc'
5
- import { ExportAllDeclaration } from '@swc/core'
6
6
 
7
7
  function parseAndFindExport(
8
8
  resolved: ResolveDependencyReturn,
@@ -25,6 +25,7 @@ function parseAndFindExport(
25
25
  if (declaration.id.type === 'Identifier') {
26
26
  if (declaration.id.value === findExport) return resolved
27
27
  } else {
28
+ // eslint-disable-next-line no-console
28
29
  console.log(declaration)
29
30
  }
30
31
  }
@@ -81,7 +82,7 @@ function parseAndFindExport(
81
82
  return undefined
82
83
  }
83
84
 
84
- const cachedResults = new Map<string, ResolveDependencyReturn>()
85
+ // const cachedResults = new Map<string, ResolveDependencyReturn>()
85
86
 
86
87
  export function findOriginalSource(
87
88
  plug: PluginConfig,
@@ -1,15 +1,16 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies
2
1
  import { parseFileSync } from '@swc/core'
3
- import chalk from 'chalk'
4
- // eslint-disable-next-line import/no-extraneous-dependencies
5
2
  import { sync as globSync } from 'glob'
6
- import { GraphCommerceConfig } from '../generated/config'
3
+ import type { GraphCommerceConfig } from '../generated/config'
7
4
  import { resolveDependenciesSync } from '../utils/resolveDependenciesSync'
8
- import { PluginConfig } from './generateInterceptor'
5
+ import type { PluginConfig } from './generateInterceptor'
9
6
  import { parseStructure } from './parseStructure'
10
7
 
11
8
  const pluginLogs: Record<string, string> = {}
12
9
 
10
+ // ANSI escape codes for console colors
11
+ const GREEN = '\x1b[32m'
12
+ const RESET = '\x1b[0m'
13
+
13
14
  export function findPlugins(config: GraphCommerceConfig, cwd: string = process.cwd()) {
14
15
  const dependencies = resolveDependenciesSync(cwd)
15
16
 
@@ -40,9 +41,7 @@ export function findPlugins(config: GraphCommerceConfig, cwd: string = process.c
40
41
  if (process.env.NODE_ENV === 'development' && debug) {
41
42
  const byExported = plugins.reduce(
42
43
  (acc, plugin) => {
43
- const key = `🔌 ${chalk.greenBright(
44
- `Plugins loaded for ${plugin.targetModule}#${plugin.targetExport}`,
45
- )}`
44
+ const key = `🔌 ${GREEN}Plugins loaded for ${plugin.targetModule}#${plugin.targetExport}${RESET}`
46
45
  if (!acc[key]) acc[key] = []
47
46
  acc[key].push(plugin)
48
47
  return acc
@@ -65,7 +64,7 @@ export function findPlugins(config: GraphCommerceConfig, cwd: string = process.c
65
64
  : `${c.ifConfig}`
66
65
  : ''
67
66
 
68
- return `${c.enabled ? `🟢` : `⚪️`} ${c.sourceModule} ${ifConfigStr}`
67
+ return `${c.enabled ? '🟢' : '⚪️'} ${c.sourceModule} ${ifConfigStr}`
69
68
  })
70
69
  .join('\n')
71
70
 
@@ -2,8 +2,8 @@
2
2
  import prettierConf from '@graphcommerce/prettier-config-pwa'
3
3
  // eslint-disable-next-line import/no-extraneous-dependencies
4
4
  import prettier from 'prettier'
5
- import { GraphCommerceDebugConfig } from '../generated/config'
6
- import { ResolveDependencyReturn } from '../utils/resolveDependency'
5
+ import type { GraphCommerceDebugConfig } from '../generated/config'
6
+ import type { ResolveDependencyReturn } from '../utils/resolveDependency'
7
7
  import { RenameVisitor } from './RenameVisitor'
8
8
  import { parseSync, printSync } from './swc'
9
9
 
@@ -14,6 +14,7 @@ type PluginBaseConfig = {
14
14
  sourceModule: string
15
15
  targetExport: string
16
16
  enabled: boolean
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
18
  ifConfig?: string | [string, any]
18
19
  }
19
20
 
@@ -70,7 +71,6 @@ export const SOURCE_START = '/** Original source starts here (do not modify!): *
70
71
  export const SOURCE_END = '/** Original source ends here (do not modify!) **/'
71
72
 
72
73
  const originalSuffix = 'Original'
73
- const sourceSuffix = 'Plugin'
74
74
  const interceptorSuffix = 'Interceptor'
75
75
  const disabledSuffix = 'Disabled'
76
76
  const name = (plugin: PluginConfig) =>
@@ -193,7 +193,7 @@ export async function generateInterceptor(
193
193
  result = `
194
194
  type ${interceptorPropsName(name(p))} = ${carryProps.join(' & ')} & OmitPrev<React.ComponentProps<typeof ${sourceName(name(p))}>, 'Prev'>
195
195
 
196
- const ${interceptorName(name(p))} = (props: ${interceptorPropsName(name(p))}) => ${withBraces ? `{` : '('}
196
+ const ${interceptorName(name(p))} = (props: ${interceptorPropsName(name(p))}) => ${withBraces ? '{' : '('}
197
197
  ${config.pluginStatus ? `logOnce(\`🔌 Rendering ${base} with plugin(s): ${wrapChain} wrapping <${base}/>\`)` : ''}
198
198
 
199
199
  ${
@@ -202,8 +202,8 @@ export async function generateInterceptor(
202
202
  logOnce('${fileName(p)} does not spread props to prev: <Prev {...props}/>. This will cause issues if multiple plugins are applied to this component.')`
203
203
  : ''
204
204
  }
205
- ${withBraces ? `return` : ''} <${sourceName(name(p))} {...props} Prev={${carry}} />
206
- ${withBraces ? `}` : ')'}`
205
+ ${withBraces ? 'return' : ''} <${sourceName(name(p))} {...props} Prev={${carry}} />
206
+ ${withBraces ? '}' : ')'}`
207
207
 
208
208
  carryProps = [interceptorPropsName(name(p))]
209
209
  pluginSee.push(`@see {${sourceName(name(p))}} for source of applied plugin`)
@@ -270,7 +270,7 @@ export async function generateInterceptor(
270
270
  /* This file is automatically generated for ${dependency} */
271
271
  ${
272
272
  Object.values(targetExports).some((t) => t.some((p) => p.type === 'component'))
273
- ? `import type { DistributedOmit as OmitPrev } from 'type-fest'`
273
+ ? "import type { DistributedOmit as OmitPrev } from 'type-fest'"
274
274
  : ''
275
275
  }
276
276
 
@@ -287,6 +287,7 @@ export async function generateInterceptor(
287
287
  try {
288
288
  templateFormatted = await prettier.format(template, { ...prettierConf, parser: 'typescript' })
289
289
  } catch (e) {
290
+ // eslint-disable-next-line no-console
290
291
  console.log('Error formatting interceptor: ', e, 'using raw template.')
291
292
  templateFormatted = template
292
293
  }
@@ -1,17 +1,11 @@
1
- import path from 'node:path'
2
1
  import fs from 'node:fs/promises'
2
+ import path from 'node:path'
3
3
  // eslint-disable-next-line import/no-extraneous-dependencies
4
- import { GraphCommerceDebugConfig } from '../generated/config'
5
- import { ResolveDependency } from '../utils/resolveDependency'
4
+ import type { GraphCommerceDebugConfig } from '../generated/config'
5
+ import type { ResolveDependency } from '../utils/resolveDependency'
6
6
  import { findOriginalSource } from './findOriginalSource'
7
- import {
8
- Interceptor,
9
- MaterializedPlugin,
10
- PluginConfig,
11
- generateInterceptor,
12
- isPluginConfig,
13
- moveRelativeDown,
14
- } from './generateInterceptor'
7
+ import type { Interceptor, MaterializedPlugin, PluginConfig } from './generateInterceptor'
8
+ import { generateInterceptor, isPluginConfig, moveRelativeDown } from './generateInterceptor'
15
9
 
16
10
  export type GenerateInterceptorsReturn = Record<string, MaterializedPlugin>
17
11
 
@@ -30,7 +24,7 @@ export async function generateInterceptors(
30
24
  const { error, resolved } = findOriginalSource(plug, result, resolve)
31
25
 
32
26
  if (error) {
33
- console.log(error.message)
27
+ console.error(error.message)
34
28
  return acc
35
29
  }
36
30
 
@@ -1,9 +1,9 @@
1
- import { Module } from '@swc/core'
1
+ import type { Module } from '@swc/core'
2
2
  import get from 'lodash/get'
3
3
  import { z } from 'zod'
4
- import { GraphCommerceConfig } from '../generated/config'
4
+ import type { GraphCommerceConfig } from '../generated/config'
5
5
  import { extractExports } from './extractExports'
6
- import { PluginConfig } from './generateInterceptor'
6
+ import type { PluginConfig } from './generateInterceptor'
7
7
 
8
8
  const pluginConfigParsed = z.object({
9
9
  type: z.enum(['component', 'function', 'replace']),
@@ -20,7 +20,7 @@ const isObject = (input: unknown): input is Record<string, unknown> =>
20
20
 
21
21
  export function parseStructure(ast: Module, gcConfig: GraphCommerceConfig, sourceModule: string) {
22
22
  const [exports, errors] = extractExports(ast)
23
- if (errors.length) console.error(`Plugin error for`, errors.join('\n'))
23
+ if (errors.length) console.error('Plugin error for', errors.join('\n'))
24
24
 
25
25
  const {
26
26
  config: moduleConfig,
@@ -1,4 +1,5 @@
1
- import { Output, Program, parseSync as parseSyncCore, printSync as printSyncCode } from '@swc/core'
1
+ import type { Output, Program } from '@swc/core'
2
+ import { parseSync as parseSyncCore, printSync as printSyncCode } from '@swc/core'
2
3
 
3
4
  export function parseSync(src: string) {
4
5
  return parseSyncCore(src, {
@@ -3,7 +3,7 @@ import path from 'path'
3
3
  // eslint-disable-next-line import/no-extraneous-dependencies
4
4
  import { sync as globSync } from 'glob'
5
5
  import { resolveDependenciesSync } from '../utils/resolveDependenciesSync'
6
- import { GenerateInterceptorsReturn } from './generateInterceptors'
6
+ import type { GenerateInterceptorsReturn } from './generateInterceptors'
7
7
 
8
8
  function checkFileExists(file: string) {
9
9
  return fs
@@ -30,6 +30,6 @@ export const packageRoots = (packagePaths: string[]): string[] => {
30
30
 
31
31
  // Filter out the sub-paths which are part of another longer sub-path
32
32
  return roots.filter(
33
- (root, index, self) => self.findIndex((r) => r !== root && r.startsWith(`${root }/`)) === -1,
33
+ (root, index, self) => self.findIndex((r) => r !== root && r.startsWith(`${root}/`)) === -1,
34
34
  )
35
35
  }
@@ -24,7 +24,10 @@ function resolveRecursivePackageJson(
24
24
  // Previously processed
25
25
  if (dependencyStructure[packageJson.name]) return dependencyStructure
26
26
 
27
- if (!isRoot && !packageJson.name.includes('graphcommerce')) return dependencyStructure
27
+ // To have additional namespaces be considered as a graphcommerce package, set PRIVATE_PACKAGE_NAMESPACES
28
+ const namespaces = process.env.PRIVATE_PACKAGE_NAMESPACES?.split(',') ?? ['graphcommerce']
29
+ if (!isRoot && !namespaces.some((namespace) => packageJson.name?.includes(namespace)))
30
+ return dependencyStructure
28
31
 
29
32
  const dependencies = [
30
33
  ...new Set(
@@ -1,11 +1,12 @@
1
1
  // import CircularDependencyPlugin from 'circular-dependency-plugin'
2
2
  import { DuplicatesPlugin } from 'inspectpack/plugin'
3
3
  import type { NextConfig } from 'next'
4
- import { DomainLocale } from 'next/dist/server/config'
5
- import { DefinePlugin, Configuration } from 'webpack'
4
+ import type { DomainLocale } from 'next/dist/server/config'
5
+ import type { Configuration } from 'webpack'
6
+ import { DefinePlugin } from 'webpack'
6
7
  import { loadConfig } from './config/loadConfig'
7
8
  import { configToImportMeta } from './config/utils/configToImportMeta'
8
- import { GraphCommerceConfig } from './generated/config'
9
+ import type { GraphCommerceConfig } from './generated/config'
9
10
  import { InterceptorPlugin } from './interceptors/InterceptorPlugin'
10
11
  import { resolveDependenciesSync } from './utils/resolveDependenciesSync'
11
12