@netlify/config 20.11.0 → 20.12.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/lib/index.js +1 -0
- package/lib/merge.js +9 -3
- package/lib/utils/toml.js +1 -1
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { DEV_EVENTS, EVENTS } from './events.js';
|
|
2
2
|
export { cleanupConfig } from './log/cleanup.js';
|
|
3
3
|
export { resolveConfig } from './main.js';
|
|
4
|
+
export { mergeConfigs } from './merge.js';
|
|
4
5
|
export { applyMutations } from './mutations/apply.js';
|
|
5
6
|
export { restoreConfig, updateConfig } from './mutations/update.js';
|
package/lib/merge.js
CHANGED
|
@@ -5,10 +5,11 @@ import { removeUndefined } from './utils/remove_falsy.js';
|
|
|
5
5
|
// Merge an array of configuration objects.
|
|
6
6
|
// Last items have higher priority.
|
|
7
7
|
// Configuration objects are deeply merged.
|
|
8
|
-
// - Arrays are overridden, not concatenated.
|
|
9
|
-
|
|
8
|
+
// - By default, Arrays are overridden, not concatenated. This behavior can
|
|
9
|
+
// be changed by setting the `concatenateArrays` property to `true`.
|
|
10
|
+
export const mergeConfigs = function (configs, { concatenateArrays } = {}) {
|
|
10
11
|
const cleanedConfigs = configs.map(removeUndefinedProps);
|
|
11
|
-
return deepmerge.all(cleanedConfigs, { arrayMerge });
|
|
12
|
+
return deepmerge.all(cleanedConfigs, { arrayMerge: concatenateArrays ? arrayConcatenate : arrayMerge });
|
|
12
13
|
};
|
|
13
14
|
const removeUndefinedProps = function ({ build = {}, ...config }) {
|
|
14
15
|
return removeUndefined({ ...config, build: removeUndefined(build) });
|
|
@@ -22,6 +23,11 @@ const arrayMerge = function (arrayA, arrayB) {
|
|
|
22
23
|
}
|
|
23
24
|
return arrayB;
|
|
24
25
|
};
|
|
26
|
+
// Concatenate two arrays such that elements from array A come after elements
|
|
27
|
+
// from array B.
|
|
28
|
+
const arrayConcatenate = function (arrayA, arrayB) {
|
|
29
|
+
return [...arrayB, ...arrayA];
|
|
30
|
+
};
|
|
25
31
|
// `deepmerge` does not allow retrieving the name of the array property being
|
|
26
32
|
// merged, so we need to do some heuristics.
|
|
27
33
|
const isPluginsProperty = function (array) {
|
package/lib/utils/toml.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.12.0",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"license": "MIT",
|
|
59
59
|
"dependencies": {
|
|
60
|
+
"@iarna/toml": "^2.2.5",
|
|
60
61
|
"chalk": "^5.0.0",
|
|
61
62
|
"cron-parser": "^4.1.0",
|
|
62
63
|
"deepmerge": "^4.2.2",
|
|
@@ -71,13 +72,12 @@
|
|
|
71
72
|
"js-yaml": "^4.0.0",
|
|
72
73
|
"map-obj": "^5.0.0",
|
|
73
74
|
"netlify": "^13.1.14",
|
|
74
|
-
"netlify-headers-parser": "^7.1.
|
|
75
|
-
"netlify-redirect-parser": "^14.2.
|
|
75
|
+
"netlify-headers-parser": "^7.1.4",
|
|
76
|
+
"netlify-redirect-parser": "^14.2.2",
|
|
76
77
|
"node-fetch": "^3.3.1",
|
|
77
78
|
"omit.js": "^2.0.2",
|
|
78
79
|
"p-locate": "^6.0.0",
|
|
79
80
|
"path-type": "^5.0.0",
|
|
80
|
-
"toml": "^3.0.0",
|
|
81
81
|
"tomlify-j0.4": "^3.0.0",
|
|
82
82
|
"validate-npm-package-name": "^4.0.0",
|
|
83
83
|
"yargs": "^17.6.0"
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"engines": {
|
|
95
95
|
"node": "^14.16.0 || >=16.0.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "24f130e0d2e27091cd5998cb23f19718e3785824"
|
|
98
98
|
}
|