@netlify/config 17.0.10 → 17.0.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/config",
3
- "version": "17.0.10",
3
+ "version": "17.0.13",
4
4
  "description": "Netlify config module",
5
5
  "type": "module",
6
6
  "exports": "./src/main.js",
@@ -19,8 +19,8 @@
19
19
  "prepublishOnly": "cd ../../ && npm run prepublishOnly"
20
20
  },
21
21
  "keywords": [
22
- "nodejs",
23
22
  "javascript",
23
+ "nodejs",
24
24
  "windows",
25
25
  "macos",
26
26
  "linux",
@@ -66,7 +66,7 @@
66
66
  "map-obj": "^5.0.0",
67
67
  "netlify": "^11.0.0",
68
68
  "netlify-headers-parser": "^6.0.2",
69
- "netlify-redirect-parser": "^13.0.2",
69
+ "netlify-redirect-parser": "13.0.2",
70
70
  "omit.js": "^2.0.2",
71
71
  "p-locate": "^6.0.0",
72
72
  "path-exists": "^5.0.0",
@@ -48,7 +48,9 @@ export const cleanupConfig = function ({
48
48
  functions,
49
49
  functionsDirectory,
50
50
  })
51
- return netlifyConfig
51
+ const netlifyConfigA = truncateArray(netlifyConfig, 'headers')
52
+ const netlifyConfigB = truncateArray(netlifyConfigA, 'redirects')
53
+ return netlifyConfigB
52
54
  }
53
55
 
54
56
  export const cleanupEnvironment = function (environment) {
@@ -77,3 +79,14 @@ const cleanupPlugin = function ({ package: packageName, origin, inputs = {} }) {
77
79
  const isPublicInput = function (key, input) {
78
80
  return typeof input === 'boolean'
79
81
  }
82
+
83
+ // `headers` and `redirects` can be very long, which can take several minutes
84
+ // to print in the build logs. We truncate them before logging.
85
+ const truncateArray = function (netlifyConfig, propName) {
86
+ const array = netlifyConfig[propName]
87
+ return Array.isArray(array) && array.length > MAX_ARRAY_LENGTH
88
+ ? { ...netlifyConfig, [propName]: array.slice(0, MAX_ARRAY_LENGTH) }
89
+ : netlifyConfig
90
+ }
91
+
92
+ const MAX_ARRAY_LENGTH = 100
package/src/simplify.js CHANGED
@@ -33,8 +33,8 @@ export const simplifyConfig = function ({
33
33
  ...removeEmptyObject(simplifyFunctions(functions), 'functions'),
34
34
  ...removeEmptyObject(buildA, 'build'),
35
35
  ...removeEmptyArray(plugins, 'plugins'),
36
- ...removeEmptyArray(truncateArray(headers), 'headers'),
37
- ...removeEmptyArray(simplifyRedirects(truncateArray(redirects)), 'redirects'),
36
+ ...removeEmptyArray(headers, 'headers'),
37
+ ...removeEmptyArray(simplifyRedirects(redirects), 'redirects'),
38
38
  ...removeEmptyObject(simplifyContexts(context), 'context'),
39
39
  })
40
40
  }
@@ -85,14 +85,6 @@ const removeDefaultValue = function (value, propName, defaultValue) {
85
85
  return value === defaultValue ? {} : { [propName]: value }
86
86
  }
87
87
 
88
- // `headers` and `redirects` can be very long, which can take several minutes
89
- // to print in the build logs. We truncate them before logging.
90
- const truncateArray = function (array) {
91
- return !Array.isArray(array) || array.length < MAX_ARRAY_LENGTH ? array : array.slice(0, MAX_ARRAY_LENGTH)
92
- }
93
-
94
- const MAX_ARRAY_LENGTH = 100
95
-
96
88
  export const removeEmptyObject = function (object, propName) {
97
89
  if (!isPlainObj(object)) {
98
90
  return {}