@graphcommerce/next-config 8.1.0-canary.5 → 8.1.0-canary.52

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 (47) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/Config.graphqls +5 -5
  3. package/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap +48 -2
  4. package/__tests__/config/utils/configToImportMeta.ts +0 -4
  5. package/__tests__/config/utils/mergeEnvIntoConfig.ts +15 -2
  6. package/__tests__/config/utils/rewriteLegancyEnv.ts +1 -1
  7. package/__tests__/interceptors/findPlugins.ts +144 -194
  8. package/__tests__/interceptors/generateInterceptors.ts +174 -91
  9. package/__tests__/interceptors/parseStructure.ts +50 -0
  10. package/__tests__/utils/resolveDependenciesSync.ts +4 -0
  11. package/dist/config/commands/exportConfig.js +5 -0
  12. package/dist/config/commands/generateConfig.js +5 -0
  13. package/dist/config/commands/generateIntercetors.js +9 -0
  14. package/dist/config/demoConfig.js +5 -0
  15. package/dist/config/utils/mergeEnvIntoConfig.js +8 -1
  16. package/dist/generated/config.js +17 -9
  17. package/dist/index.js +1 -0
  18. package/dist/interceptors/commands/codegenInterceptors.js +23 -0
  19. package/dist/interceptors/commands/generateIntercetors.js +9 -0
  20. package/dist/interceptors/extractExports.js +21 -18
  21. package/dist/interceptors/findOriginalSource.js +17 -1
  22. package/dist/interceptors/findPlugins.js +7 -3
  23. package/dist/interceptors/generateInterceptor.js +32 -15
  24. package/dist/interceptors/generateInterceptors.js +6 -5
  25. package/dist/interceptors/parseStructure.js +9 -1
  26. package/dist/interceptors/writeInterceptors.js +7 -7
  27. package/dist/utils/resolveDependenciesSync.js +5 -4
  28. package/dist/utils/resolveDependency.js +5 -0
  29. package/dist/withGraphCommerce.js +14 -5
  30. package/package.json +1 -1
  31. package/src/config/commands/exportConfig.ts +3 -0
  32. package/src/config/commands/generateConfig.ts +3 -0
  33. package/src/config/demoConfig.ts +5 -0
  34. package/src/config/utils/mergeEnvIntoConfig.ts +9 -1
  35. package/src/generated/config.ts +57 -19
  36. package/src/index.ts +1 -0
  37. package/src/interceptors/commands/codegenInterceptors.ts +27 -0
  38. package/src/interceptors/extractExports.ts +21 -21
  39. package/src/interceptors/findOriginalSource.ts +16 -1
  40. package/src/interceptors/findPlugins.ts +7 -3
  41. package/src/interceptors/generateInterceptor.ts +39 -15
  42. package/src/interceptors/generateInterceptors.ts +9 -6
  43. package/src/interceptors/parseStructure.ts +14 -1
  44. package/src/interceptors/writeInterceptors.ts +7 -7
  45. package/src/utils/resolveDependenciesSync.ts +11 -3
  46. package/src/utils/resolveDependency.ts +7 -0
  47. package/src/withGraphCommerce.ts +15 -6
@@ -112,8 +112,19 @@ export function withGraphCommerce(nextConfig: NextConfig, cwd: string): NextConf
112
112
  },
113
113
  transpilePackages,
114
114
  webpack: (config: Configuration, options) => {
115
- // Allow importing yml/yaml files for graphql-mesh
116
- config.module?.rules?.push({ test: /\.ya?ml$/, use: 'js-yaml-loader' })
115
+ if (!config.module) config.module = { rules: [] }
116
+
117
+ config.module = {
118
+ ...config.module,
119
+ rules: [
120
+ ...(config.module.rules ?? []),
121
+ // Allow importing yml/yaml files for graphql-mesh
122
+ { test: /\.ya?ml$/, use: 'js-yaml-loader' },
123
+ // @lingui .po file support
124
+ { test: /\.po/, use: '@lingui/loader' },
125
+ ],
126
+ exprContextCritical: false,
127
+ }
117
128
 
118
129
  if (!config.plugins) config.plugins = []
119
130
 
@@ -121,8 +132,9 @@ export function withGraphCommerce(nextConfig: NextConfig, cwd: string): NextConf
121
132
  config.plugins.push(new DefinePlugin(importMetaPaths))
122
133
 
123
134
  // To properly properly treeshake @apollo/client we need to define the __DEV__ property
135
+ config.plugins.push(new DefinePlugin({ 'globalThis.__DEV__': options.dev }))
136
+
124
137
  if (!options.isServer) {
125
- config.plugins.push(new DefinePlugin({ __DEV__: options.dev }))
126
138
  if (graphcommerceConfig.debug?.webpackCircularDependencyPlugin) {
127
139
  config.plugins.push(
128
140
  new CircularDependencyPlugin({
@@ -147,9 +159,6 @@ export function withGraphCommerce(nextConfig: NextConfig, cwd: string): NextConf
147
159
  }
148
160
  }
149
161
 
150
- // @lingui .po file support
151
- config.module?.rules?.push({ test: /\.po/, use: '@lingui/loader' })
152
-
153
162
  config.snapshot = {
154
163
  ...(config.snapshot ?? {}),
155
164
  managedPaths: [