@netlify/config 17.0.20 → 18.0.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/package.json +1 -1
- package/src/case.js +3 -3
- package/src/context.js +6 -6
- package/src/files.js +4 -4
- package/src/log/cleanup.js +2 -2
- package/src/mutations/apply.js +2 -2
- package/src/options/base.js +1 -1
- package/src/validate/validations.js +2 -2
package/package.json
CHANGED
package/src/case.js
CHANGED
|
@@ -9,8 +9,8 @@ const normalizeBuildCase = function ({
|
|
|
9
9
|
base = Base,
|
|
10
10
|
Command,
|
|
11
11
|
command = Command,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
Edge_functions: EdgeFunctions,
|
|
13
|
+
edge_functions: edgeFunctions = EdgeFunctions,
|
|
14
14
|
Environment,
|
|
15
15
|
environment = Environment,
|
|
16
16
|
Functions,
|
|
@@ -27,7 +27,7 @@ const normalizeBuildCase = function ({
|
|
|
27
27
|
...build,
|
|
28
28
|
base,
|
|
29
29
|
command,
|
|
30
|
-
|
|
30
|
+
edge_functions: edgeFunctions,
|
|
31
31
|
environment,
|
|
32
32
|
functions,
|
|
33
33
|
ignore,
|
package/src/context.js
CHANGED
|
@@ -54,14 +54,14 @@ const addNamespacedProperty = function (contextConfig, [key, value]) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const isBuildProperty = function (key, value) {
|
|
57
|
-
return BUILD_PROPERTIES.has(key) && !isFunctionsConfig(key, value) && !
|
|
57
|
+
return BUILD_PROPERTIES.has(key) && !isFunctionsConfig(key, value) && !isEdgeFunctionsConfig(key, value)
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// All properties in `config.build.*`
|
|
61
61
|
const BUILD_PROPERTIES = new Set([
|
|
62
62
|
'base',
|
|
63
63
|
'command',
|
|
64
|
-
'
|
|
64
|
+
'edge_functions',
|
|
65
65
|
'environment',
|
|
66
66
|
'functions',
|
|
67
67
|
'ignore',
|
|
@@ -75,10 +75,10 @@ const isFunctionsConfig = function (key, value) {
|
|
|
75
75
|
return key === 'functions' && isPlainObj(value)
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
// `config.
|
|
79
|
-
// `config.build.
|
|
80
|
-
const
|
|
81
|
-
return key === '
|
|
78
|
+
// `config.edge_functions` is an array of objects while
|
|
79
|
+
// `config.build.edge_functions` is a string.
|
|
80
|
+
const isEdgeFunctionsConfig = function (key, value) {
|
|
81
|
+
return key === 'edge_functions' && Array.isArray(value)
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
// Ensure that `inlineConfig` has higher priority than context properties by
|
package/src/files.js
CHANGED
|
@@ -18,7 +18,7 @@ export const resolveConfigPaths = async function ({ config, repositoryRoot, buil
|
|
|
18
18
|
|
|
19
19
|
// All file paths in the configuration file are are relative to `buildDir`
|
|
20
20
|
// (if `baseRelDir` is `true`).
|
|
21
|
-
const FILE_PATH_CONFIG_PROPS = ['functionsDirectory', 'build.publish', 'build.
|
|
21
|
+
const FILE_PATH_CONFIG_PROPS = ['functionsDirectory', 'build.publish', 'build.edge_functions']
|
|
22
22
|
|
|
23
23
|
const resolvePaths = function (config, propNames, baseRel, repositoryRoot) {
|
|
24
24
|
return propNames.reduce((configA, propName) => resolvePathProp(configA, propName, baseRel, repositoryRoot), config)
|
|
@@ -90,9 +90,9 @@ const DEFAULT_PATHS = [
|
|
|
90
90
|
propName: 'functions.directory',
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
|
-
getConfig: (directory) => ({ build: {
|
|
94
|
-
defaultPath: 'netlify/edge-
|
|
95
|
-
propName: 'build.
|
|
93
|
+
getConfig: (directory) => ({ build: { edge_functions: directory } }),
|
|
94
|
+
defaultPath: 'netlify/edge-functions',
|
|
95
|
+
propName: 'build.edge_functions',
|
|
96
96
|
},
|
|
97
97
|
]
|
|
98
98
|
|
package/src/log/cleanup.js
CHANGED
|
@@ -9,7 +9,7 @@ export const cleanupConfig = function ({
|
|
|
9
9
|
command,
|
|
10
10
|
commandOrigin,
|
|
11
11
|
environment = {},
|
|
12
|
-
|
|
12
|
+
edge_functions: edgeFunctions,
|
|
13
13
|
ignore,
|
|
14
14
|
processing,
|
|
15
15
|
publish,
|
|
@@ -30,7 +30,7 @@ export const cleanupConfig = function ({
|
|
|
30
30
|
command,
|
|
31
31
|
commandOrigin,
|
|
32
32
|
environment: environmentA,
|
|
33
|
-
|
|
33
|
+
edge_functions: edgeFunctions,
|
|
34
34
|
ignore,
|
|
35
35
|
processing,
|
|
36
36
|
publish,
|
package/src/mutations/apply.js
CHANGED
|
@@ -51,7 +51,7 @@ const denormalizeFunctionsTopProps = function (
|
|
|
51
51
|
// List of properties that are not read-only.
|
|
52
52
|
const MUTABLE_PROPS = {
|
|
53
53
|
'build.command': { lastEvent: 'onPreBuild' },
|
|
54
|
-
'build.
|
|
54
|
+
'build.edge_functions': { lastEvent: 'onPostBuild' },
|
|
55
55
|
'build.environment': { lastEvent: 'onPostBuild' },
|
|
56
56
|
'build.environment.*': { lastEvent: 'onPostBuild' },
|
|
57
57
|
'build.functions': { lastEvent: 'onBuild' },
|
|
@@ -70,7 +70,7 @@ const MUTABLE_PROPS = {
|
|
|
70
70
|
'build.publish': { lastEvent: 'onPostBuild' },
|
|
71
71
|
'build.services': { lastEvent: 'onPostBuild' },
|
|
72
72
|
'build.services.*': { lastEvent: 'onPostBuild' },
|
|
73
|
-
|
|
73
|
+
edge_functions: { lastEvent: 'onPostBuild' },
|
|
74
74
|
'functions.*': { lastEvent: 'onBuild', denormalize: denormalizeFunctionsTopProps },
|
|
75
75
|
'functions.*.*': { lastEvent: 'onBuild' },
|
|
76
76
|
headers: { lastEvent: 'onPostBuild' },
|
package/src/options/base.js
CHANGED
|
@@ -26,7 +26,7 @@ export const getBaseOverride = async function ({ repositoryRoot, cwd }) {
|
|
|
26
26
|
// return an absolute path
|
|
27
27
|
const base = relative(repositoryRoot, dirname(basePath))
|
|
28
28
|
// When `base` is explicitely overridden, `baseRelDir: true` makes more sense
|
|
29
|
-
// since we want `publish`, `functions` and `
|
|
29
|
+
// since we want `publish`, `functions` and `edge_functions` to be relative to it.
|
|
30
30
|
return { base, baseRelDir: true }
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -172,10 +172,10 @@ export const POST_NORMALIZE_VALIDATIONS = [
|
|
|
172
172
|
example: () => ({ build: { functions: 'functions' } }),
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
|
-
property: 'build.
|
|
175
|
+
property: 'build.edge_functions',
|
|
176
176
|
check: isString,
|
|
177
177
|
message: 'must be a string.',
|
|
178
|
-
example: () => ({ build: {
|
|
178
|
+
example: () => ({ build: { edge_functions: 'edge-functions' } }),
|
|
179
179
|
},
|
|
180
180
|
{
|
|
181
181
|
property: 'functions.*',
|