@netlify/config 19.1.2 → 20.0.1
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.
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { isString, validProperties } from './validate/helpers.js';
|
|
2
|
+
const cacheValues = ['manual', 'off'];
|
|
3
|
+
export const validations = [
|
|
4
|
+
{
|
|
5
|
+
property: 'edge_functions.*',
|
|
6
|
+
...validProperties(['path', 'function', 'cache'], []),
|
|
7
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
property: 'edge_functions.*',
|
|
11
|
+
check: (edgeFunction) => edgeFunction.path !== undefined,
|
|
12
|
+
message: '"path" property is required.',
|
|
13
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
property: 'edge_functions.*',
|
|
17
|
+
check: (edgeFunction) => edgeFunction.function !== undefined,
|
|
18
|
+
message: '"function" property is required.',
|
|
19
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
property: 'edge_functions.*.path',
|
|
23
|
+
check: isString,
|
|
24
|
+
message: 'must be a string.',
|
|
25
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
property: 'edge_functions.*.function',
|
|
29
|
+
check: isString,
|
|
30
|
+
message: 'must be a string.',
|
|
31
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
property: 'edge_functions.*.path',
|
|
35
|
+
check: (pathName) => pathName.startsWith('/'),
|
|
36
|
+
message: 'must be a valid path.',
|
|
37
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
property: 'edge_functions.*.cache',
|
|
41
|
+
check: (value) => cacheValues.includes(value),
|
|
42
|
+
message: `must be one of: ${cacheValues.join(', ')}`,
|
|
43
|
+
example: () => ({ edge_functions: [{ cache: cacheValues[0], path: '/hello', function: 'hello' }] }),
|
|
44
|
+
},
|
|
45
|
+
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import CronParser from 'cron-parser';
|
|
2
2
|
import isPlainObj from 'is-plain-obj';
|
|
3
3
|
import validateNpmPackageName from 'validate-npm-package-name';
|
|
4
|
-
import {
|
|
4
|
+
import { validations as edgeFunctionValidations } from '../edge_functions.js';
|
|
5
5
|
import { bundlers, WILDCARD_ALL as FUNCTIONS_CONFIG_WILDCARD_ALL } from '../functions_config.js';
|
|
6
6
|
import { functionsDirectoryCheck, isArrayOfObjects, isArrayOfStrings, isString, validProperties } from './helpers.js';
|
|
7
7
|
/**
|
|
@@ -238,45 +238,5 @@ export const POST_NORMALIZE_VALIDATIONS = [
|
|
|
238
238
|
functions: { directory: 'my-functions' },
|
|
239
239
|
}),
|
|
240
240
|
},
|
|
241
|
-
|
|
242
|
-
property: 'edge_functions.*',
|
|
243
|
-
...validProperties(['path', 'function', 'mode'], []),
|
|
244
|
-
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
property: 'edge_functions.*',
|
|
248
|
-
check: (edgeFunction) => edgeFunction.path !== undefined,
|
|
249
|
-
message: '"path" property is required.',
|
|
250
|
-
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
property: 'edge_functions.*',
|
|
254
|
-
check: (edgeFunction) => edgeFunction.function !== undefined,
|
|
255
|
-
message: '"function" property is required.',
|
|
256
|
-
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
property: 'edge_functions.*.path',
|
|
260
|
-
check: isString,
|
|
261
|
-
message: 'must be a string.',
|
|
262
|
-
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
property: 'edge_functions.*.function',
|
|
266
|
-
check: isString,
|
|
267
|
-
message: 'must be a string.',
|
|
268
|
-
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
property: 'edge_functions.*.path',
|
|
272
|
-
check: (pathName) => pathName.startsWith('/'),
|
|
273
|
-
message: 'must be a valid path.',
|
|
274
|
-
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
property: 'edge_functions.*.mode',
|
|
278
|
-
check: (value) => modes.includes(value),
|
|
279
|
-
message: `must be one of: ${modes.join(', ')}`,
|
|
280
|
-
example: () => ({ edge_functions: [{ mode: modes[0], path: '/hello', function: 'hello' }] }),
|
|
281
|
-
},
|
|
241
|
+
...edgeFunctionValidations,
|
|
282
242
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.1",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/main.js",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"is-plain-obj": "^4.0.0",
|
|
71
71
|
"js-yaml": "^4.0.0",
|
|
72
72
|
"map-obj": "^5.0.0",
|
|
73
|
-
"netlify": "^13.0.
|
|
74
|
-
"netlify-headers-parser": "^7.0.
|
|
75
|
-
"netlify-redirect-parser": "^14.0.
|
|
73
|
+
"netlify": "^13.0.2",
|
|
74
|
+
"netlify-headers-parser": "^7.0.2",
|
|
75
|
+
"netlify-redirect-parser": "^14.0.2",
|
|
76
76
|
"omit.js": "^2.0.2",
|
|
77
77
|
"p-locate": "^6.0.0",
|
|
78
78
|
"path-exists": "^5.0.0",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"engines": {
|
|
96
96
|
"node": "^14.16.0 || >=16.0.0"
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "be9da6e85afa0223bdcd6d228c929f4372515538"
|
|
99
99
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const modes = ['before-cache', 'after-cache'];
|