@netlify/config 25.2.5 → 25.2.7
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.d.ts
CHANGED
|
@@ -61,5 +61,5 @@ type GetExtensionsOptions = {
|
|
|
61
61
|
extensionApiBaseUrl: string;
|
|
62
62
|
mode: ModeOption;
|
|
63
63
|
};
|
|
64
|
-
export declare const getExtensions: ({ siteId, accountId, testOpts, offline, token,
|
|
64
|
+
export declare const getExtensions: ({ siteId, accountId, testOpts, offline, token, extensionApiBaseUrl, mode, }: GetExtensionsOptions) => Promise<Extension[]>;
|
|
65
65
|
export {};
|
package/lib/api/site_info.js
CHANGED
|
@@ -99,11 +99,10 @@ const ExtensionResponseSchema = z.array(z.object({
|
|
|
99
99
|
// Returned by API, but unused. Leaving this here for the sake of documentation.
|
|
100
100
|
// has_connector: z.boolean(),
|
|
101
101
|
}));
|
|
102
|
-
export const getExtensions = async function ({ siteId, accountId, testOpts, offline, token,
|
|
102
|
+
export const getExtensions = async function ({ siteId, accountId, testOpts, offline, token, extensionApiBaseUrl, mode, }) {
|
|
103
103
|
if (!siteId || offline) {
|
|
104
104
|
return [];
|
|
105
105
|
}
|
|
106
|
-
const sendBuildBotTokenToJigsaw = featureFlags?.send_build_bot_token_to_jigsaw;
|
|
107
106
|
const { host: originalHost, setBaseUrl } = testOpts;
|
|
108
107
|
// TODO(kh): I am adding this purely for local staging development.
|
|
109
108
|
// We should remove this once we have fixed https://github.com/netlify/cli/blob/b5a5c7525edd28925c5c2e3e5f0f00c4261eaba5/src/lib/build.ts#L125
|
|
@@ -135,7 +134,7 @@ export const getExtensions = async function ({ siteId, accountId, testOpts, offl
|
|
|
135
134
|
'Netlify-Config-Mode': mode,
|
|
136
135
|
'User-Agent': `Netlify Config (mode:${mode}) / ${ROOT_PACKAGE_JSON.version}`,
|
|
137
136
|
});
|
|
138
|
-
if (
|
|
137
|
+
if (token) {
|
|
139
138
|
headers.set('Netlify-SDK-Build-Bot-Token', token);
|
|
140
139
|
}
|
|
141
140
|
try {
|
|
@@ -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.7",
|
|
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": "288d53ba807d13535afdb605f49034e0a9a4082e"
|
|
98
98
|
}
|