@netlify/config 20.5.0 → 20.5.2
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/api/site_info.js +1 -1
- package/lib/edge_functions.js +47 -3
- package/package.json +2 -2
package/lib/api/site_info.js
CHANGED
|
@@ -29,7 +29,7 @@ const getSite = async function (api, siteId, siteFeatureFlagPrefix = null) {
|
|
|
29
29
|
return {};
|
|
30
30
|
}
|
|
31
31
|
try {
|
|
32
|
-
const site = await api.getSite({ siteId,
|
|
32
|
+
const site = await api.getSite({ siteId, feature_flags: siteFeatureFlagPrefix });
|
|
33
33
|
return { ...site, id: siteId };
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
package/lib/edge_functions.js
CHANGED
|
@@ -3,13 +3,19 @@ const cacheValues = ['manual', 'off'];
|
|
|
3
3
|
export const validations = [
|
|
4
4
|
{
|
|
5
5
|
property: 'edge_functions.*',
|
|
6
|
-
...validProperties(['path', 'function', 'cache'], []),
|
|
6
|
+
...validProperties(['path', 'excludedPath', 'pattern', 'excludedPattern', 'function', 'cache'], []),
|
|
7
7
|
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
property: 'edge_functions.*',
|
|
11
|
-
check: (edgeFunction) => edgeFunction.path !== undefined,
|
|
12
|
-
message: '"path"
|
|
11
|
+
check: (edgeFunction) => edgeFunction.path !== undefined || edgeFunction.pattern !== undefined,
|
|
12
|
+
message: 'either "path" or "pattern" is required.',
|
|
13
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
property: 'edge_functions.*',
|
|
17
|
+
check: (edgeFunction) => !(edgeFunction.path !== undefined && edgeFunction.pattern !== undefined),
|
|
18
|
+
message: '"path" and "pattern" are mutually exclusive.',
|
|
13
19
|
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
14
20
|
},
|
|
15
21
|
{
|
|
@@ -24,6 +30,44 @@ export const validations = [
|
|
|
24
30
|
message: 'must be a string.',
|
|
25
31
|
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
26
32
|
},
|
|
33
|
+
{
|
|
34
|
+
property: 'edge_functions.*.excludedPath',
|
|
35
|
+
check: (value) => isString(value) || (Array.isArray(value) && value.every(isString)),
|
|
36
|
+
message: 'must be a string or array of strings.',
|
|
37
|
+
example: () => ({
|
|
38
|
+
edge_functions: [{ path: '/products/*', excludedPath: ['/products/*.jpg'], function: 'customise' }],
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
property: 'edge_functions.*',
|
|
43
|
+
check: (value) => value.excludedPath === undefined || value.path !== undefined,
|
|
44
|
+
message: '"excludedPath" can only be specified together with "path".',
|
|
45
|
+
example: () => ({
|
|
46
|
+
edge_functions: [{ path: '/products/*', excludedPath: ['/products/*.jpg'], function: 'customise' }],
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
property: 'edge_functions.*.pattern',
|
|
51
|
+
check: isString,
|
|
52
|
+
message: 'must be a string.',
|
|
53
|
+
example: () => ({ edge_functions: [{ pattern: '/hello/(.*)', function: 'hello' }] }),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
property: 'edge_functions.*.excludedPattern',
|
|
57
|
+
check: (value) => isString(value) || (Array.isArray(value) && value.every(isString)),
|
|
58
|
+
message: 'must be a string or array of strings.',
|
|
59
|
+
example: () => ({
|
|
60
|
+
edge_functions: [{ path: '/products/(.*)', excludedPath: ['/products/(.*)\\.jpg'], function: 'customise' }],
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
property: 'edge_functions.*.excludedPattern',
|
|
65
|
+
check: (value) => value.excludedPattern === undefined || value.pattern !== undefined,
|
|
66
|
+
message: '"excludedPattern" can only be specified together with "pattern".',
|
|
67
|
+
example: () => ({
|
|
68
|
+
edge_functions: [{ path: '/products/(.*)', excludedPath: ['/products/(.*)\\.jpg'], function: 'customise' }],
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
27
71
|
{
|
|
28
72
|
property: 'edge_functions.*.function',
|
|
29
73
|
check: isString,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "20.5.
|
|
3
|
+
"version": "20.5.2",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"engines": {
|
|
94
94
|
"node": "^14.16.0 || >=16.0.0"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "2bb08a1fb4ad1bca50cee1131b70cbd94a9f08a3"
|
|
97
97
|
}
|