@graphcommerce/next-config 3.1.6 → 3.2.0

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/dist/index.js CHANGED
@@ -9,7 +9,7 @@ const crypto_1 = require("crypto");
9
9
  const fs_1 = require("fs");
10
10
  const next_transpile_modules_1 = __importDefault(require("next-transpile-modules"));
11
11
  const webpack_1 = require("webpack");
12
- function extendConfig(nextConfig) {
12
+ function extendConfig(nextConfig, modules) {
13
13
  return {
14
14
  ...nextConfig,
15
15
  webpack: (config, options) => {
@@ -27,13 +27,12 @@ function extendConfig(nextConfig) {
27
27
  };
28
28
  config.snapshot = {
29
29
  ...(config.snapshot ?? {}),
30
- managedPaths: [/^(.+?[\\/]node_modules[\\/])(?!@graphcommerce)/],
30
+ managedPaths: [new RegExp(`^(.+?[\\/]node_modules[\\/])(?!${modules.join('|')})`)],
31
31
  };
32
32
  // `config.watchOptions.ignored = ['**/.git/**', '**/node_modules/**', '**/.next/**']
33
- // Replace the '**/node_modules/**' with a regex that excludes node_modules except @graphcommerce
34
33
  config.watchOptions = {
35
34
  ...(config.watchOptions ?? {}),
36
- ignored: ['**/.git/**', '**/node_modules/!(@graphcommerce)**', '**/.next/**'],
35
+ ignored: ['**/.git/**', `**/node_modules/!(${modules.join('|')})**`, '**/.next/**'],
37
36
  };
38
37
  if (!config.resolve)
39
38
  config.resolve = {};
@@ -82,7 +81,7 @@ function withYarn1Scopes(scopes = ['@graphcommerce']) {
82
81
  (0, fs_1.mkdirSync)('.next/cache/', { recursive: true });
83
82
  (0, fs_1.writeFileSync)(cacheKey, JSON.stringify(modules));
84
83
  }
85
- return (config) => extendConfig((0, next_transpile_modules_1.default)(modules)(config));
84
+ return (config) => extendConfig((0, next_transpile_modules_1.default)(modules)(config), modules);
86
85
  }
87
86
  exports.withYarn1Scopes = withYarn1Scopes;
88
87
  function withYarn1Workspaces(modules = []) {
@@ -118,6 +117,6 @@ function withYarn1Workspaces(modules = []) {
118
117
  b.workspaceDependencies.forEach((wp) => m.add(wp));
119
118
  }
120
119
  });
121
- return (config) => extendConfig((0, next_transpile_modules_1.default)([...m.values()])(config));
120
+ return (config) => extendConfig((0, next_transpile_modules_1.default)([...m.values()])(config), [...m.values()]);
122
121
  }
123
122
  exports.withYarn1Workspaces = withYarn1Workspaces;
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": "3.1.6",
5
+ "version": "3.2.0",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "typings": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -31,7 +31,7 @@ export type ListInfo = {
31
31
  }
32
32
  }
33
33
 
34
- function extendConfig(nextConfig: NextConfig): NextConfig {
34
+ function extendConfig(nextConfig: NextConfig, modules: string[]): NextConfig {
35
35
  return {
36
36
  ...nextConfig,
37
37
  webpack: (config: Configuration, options) => {
@@ -53,14 +53,13 @@ function extendConfig(nextConfig: NextConfig): NextConfig {
53
53
 
54
54
  config.snapshot = {
55
55
  ...(config.snapshot ?? {}),
56
- managedPaths: [/^(.+?[\\/]node_modules[\\/])(?!@graphcommerce)/],
56
+ managedPaths: [new RegExp(`^(.+?[\\/]node_modules[\\/])(?!${modules.join('|')})`)],
57
57
  }
58
58
 
59
59
  // `config.watchOptions.ignored = ['**/.git/**', '**/node_modules/**', '**/.next/**']
60
- // Replace the '**/node_modules/**' with a regex that excludes node_modules except @graphcommerce
61
60
  config.watchOptions = {
62
61
  ...(config.watchOptions ?? {}),
63
- ignored: ['**/.git/**', '**/node_modules/!(@graphcommerce)**', '**/.next/**'],
62
+ ignored: ['**/.git/**', `**/node_modules/!(${modules.join('|')})**`, '**/.next/**'],
64
63
  }
65
64
 
66
65
  if (!config.resolve) config.resolve = {}
@@ -119,7 +118,7 @@ export function withYarn1Scopes(
119
118
  writeFileSync(cacheKey, JSON.stringify(modules))
120
119
  }
121
120
 
122
- return (config) => extendConfig(withTranspileModules(modules)(config))
121
+ return (config) => extendConfig(withTranspileModules(modules)(config), modules)
123
122
  }
124
123
 
125
124
  export function withYarn1Workspaces(modules: string[] = []): (config: NextConfig) => NextConfig {
@@ -160,5 +159,5 @@ export function withYarn1Workspaces(modules: string[] = []): (config: NextConfig
160
159
  }
161
160
  })
162
161
 
163
- return (config) => extendConfig(withTranspileModules([...m.values()])(config))
162
+ return (config) => extendConfig(withTranspileModules([...m.values()])(config), [...m.values()])
164
163
  }