@netlify/config 18.0.0 → 18.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.
- package/package.json +1 -1
- package/src/validate/validations.js +46 -0
package/package.json
CHANGED
|
@@ -102,6 +102,17 @@ export const PRE_NORMALIZE_VALIDATIONS = [
|
|
|
102
102
|
functions: { ignored_node_modules: ['module-one', 'module-two'] },
|
|
103
103
|
}),
|
|
104
104
|
},
|
|
105
|
+
{
|
|
106
|
+
property: 'edge_functions',
|
|
107
|
+
check: isArrayOfObjects,
|
|
108
|
+
message: 'must be an array of objects.',
|
|
109
|
+
example: () => ({
|
|
110
|
+
edge_functions: [
|
|
111
|
+
{ path: '/hello', function: 'hello' },
|
|
112
|
+
{ path: '/auth', function: 'auth' },
|
|
113
|
+
],
|
|
114
|
+
}),
|
|
115
|
+
},
|
|
105
116
|
]
|
|
106
117
|
|
|
107
118
|
const EXAMPLE_PORT = 80
|
|
@@ -242,5 +253,40 @@ export const POST_NORMALIZE_VALIDATIONS = [
|
|
|
242
253
|
functions: { directory: 'my-functions' },
|
|
243
254
|
}),
|
|
244
255
|
},
|
|
256
|
+
{
|
|
257
|
+
property: 'edge_functions.*',
|
|
258
|
+
...validProperties(['path', 'function'], []),
|
|
259
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
property: 'edge_functions.*',
|
|
263
|
+
check: (edgeFunction) => edgeFunction.path !== undefined,
|
|
264
|
+
message: '"path" property is required.',
|
|
265
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
property: 'edge_functions.*',
|
|
269
|
+
check: (edgeFunction) => edgeFunction.function !== undefined,
|
|
270
|
+
message: '"function" property is required.',
|
|
271
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
property: 'edge_functions.*.path',
|
|
275
|
+
check: isString,
|
|
276
|
+
message: 'must be a string.',
|
|
277
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
property: 'edge_functions.*.function',
|
|
281
|
+
check: isString,
|
|
282
|
+
message: 'must be a string.',
|
|
283
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
property: 'edge_functions.*.path',
|
|
287
|
+
check: (pathName) => pathName.startsWith('/'),
|
|
288
|
+
message: 'must be a valid path.',
|
|
289
|
+
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
290
|
+
},
|
|
245
291
|
]
|
|
246
292
|
/* eslint-enable max-lines */
|