@netlify/config 25.2.5 → 25.2.6
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.
|
@@ -299,7 +299,7 @@ export const POST_NORMALIZE_VALIDATIONS: ({
|
|
|
299
299
|
};
|
|
300
300
|
} | {
|
|
301
301
|
property: string;
|
|
302
|
-
check: (value: any) =>
|
|
302
|
+
check: (value: any) => boolean;
|
|
303
303
|
message: string;
|
|
304
304
|
example: (value: any, key: any, prevPath: any) => {
|
|
305
305
|
functions: {
|
|
@@ -17,6 +17,20 @@ const isValidCronExpression = (cron) => {
|
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
+
const FUNCTION_MEMORY_PATTERN = /^(\d+(?:\.\d+)?)\s*(mb|gb)?$/i;
|
|
21
|
+
const FUNCTION_MEMORY_MIN_MB = 1024;
|
|
22
|
+
const FUNCTION_MEMORY_MAX_MB = 4096;
|
|
23
|
+
const isValidFunctionMemory = (value) => {
|
|
24
|
+
let megabytes = value;
|
|
25
|
+
if (isString(value)) {
|
|
26
|
+
const match = FUNCTION_MEMORY_PATTERN.exec(value.trim());
|
|
27
|
+
if (!match) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
megabytes = Number.parseFloat(match[1]) * (match[2]?.toLowerCase() === 'gb' ? 1024 : 1);
|
|
31
|
+
}
|
|
32
|
+
return Number.isInteger(megabytes) && megabytes >= FUNCTION_MEMORY_MIN_MB && megabytes <= FUNCTION_MEMORY_MAX_MB;
|
|
33
|
+
};
|
|
20
34
|
// List of validations performed on the configuration file.
|
|
21
35
|
// Validation are performed in order: parent should be before children.
|
|
22
36
|
// Each validation is an object with the following properties:
|
|
@@ -273,8 +287,8 @@ export const POST_NORMALIZE_VALIDATIONS = [
|
|
|
273
287
|
},
|
|
274
288
|
{
|
|
275
289
|
property: 'functions.*.memory',
|
|
276
|
-
check:
|
|
277
|
-
message: 'must be a number (in MB) or a string with a unit (e.g. "2gb").',
|
|
290
|
+
check: isValidFunctionMemory,
|
|
291
|
+
message: 'must be between 1024 and 4096 MB, as a number (in MB) or a string with a unit (e.g. "2gb").',
|
|
278
292
|
example: (value, key, prevPath) => ({
|
|
279
293
|
functions: { [prevPath[1]]: { memory: '2gb' } },
|
|
280
294
|
}),
|
|
@@ -295,6 +309,14 @@ export const POST_NORMALIZE_VALIDATIONS = [
|
|
|
295
309
|
functions: { [prevPath[1]]: { vcpu: 1.5 } },
|
|
296
310
|
}),
|
|
297
311
|
},
|
|
312
|
+
{
|
|
313
|
+
property: 'functions.*',
|
|
314
|
+
check: (functionConfig) => !(functionConfig.memory !== undefined && functionConfig.vcpu !== undefined),
|
|
315
|
+
message: '"memory" and "vcpu" are mutually exclusive.',
|
|
316
|
+
example: (value, key, prevPath) => ({
|
|
317
|
+
functions: { [prevPath[1]]: { memory: '2gb' } },
|
|
318
|
+
}),
|
|
319
|
+
},
|
|
298
320
|
{
|
|
299
321
|
property: 'functions.*.schedule',
|
|
300
322
|
check: isValidCronExpression,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "25.2.
|
|
3
|
+
"version": "25.2.6",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"engines": {
|
|
95
95
|
"node": ">=22.12.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "227492a17c9821682390f6b7554bd69dfa282d9e"
|
|
98
98
|
}
|