netlify-cli 16.6.0 → 16.6.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/npm-shrinkwrap.json +1790 -3351
- package/package.json +3 -3
- package/src/lib/functions/registry.mjs +6 -3
- package/src/utils/proxy.mjs +11 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "16.6.
|
|
4
|
+
"version": "16.6.1",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@bugsnag/js": "7.20.2",
|
|
46
46
|
"@fastify/static": "6.10.2",
|
|
47
|
-
"@netlify/build": "29.22.
|
|
48
|
-
"@netlify/build-info": "7.10.
|
|
47
|
+
"@netlify/build": "29.22.2",
|
|
48
|
+
"@netlify/build-info": "7.10.1",
|
|
49
49
|
"@netlify/config": "20.9.0",
|
|
50
50
|
"@netlify/edge-bundler": "9.1.0",
|
|
51
51
|
"@netlify/local-functions-proxy": "1.1.1",
|
|
@@ -227,8 +227,11 @@ export class FunctionsRegistry {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
230
|
+
* Looks for the first function that matches a given URL path. If a match is
|
|
231
|
+
* found, returns an object with the function and the route. If the URL path
|
|
232
|
+
* matches the default functions URL (i.e. can only be for a function) but no
|
|
233
|
+
* function with the given name exists, returns an object with the function
|
|
234
|
+
* and the route set to `null`. Otherwise, `undefined` is returned,
|
|
232
235
|
*
|
|
233
236
|
* @param {string} url
|
|
234
237
|
* @param {string} method
|
|
@@ -244,7 +247,7 @@ export class FunctionsRegistry {
|
|
|
244
247
|
const func = this.get(defaultURLMatch[2])
|
|
245
248
|
|
|
246
249
|
if (!func) {
|
|
247
|
-
return
|
|
250
|
+
return { func: null, route: null }
|
|
248
251
|
}
|
|
249
252
|
|
|
250
253
|
const { routes = [] } = await func.getBuildData()
|
package/src/utils/proxy.mjs
CHANGED
|
@@ -343,10 +343,12 @@ const serveRedirect = async function ({ env, functionsRegistry, match, options,
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
if (matchingFunction) {
|
|
346
|
-
const functionHeaders =
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
346
|
+
const functionHeaders = matchingFunction.func
|
|
347
|
+
? {
|
|
348
|
+
[NFFunctionName]: matchingFunction.func?.name,
|
|
349
|
+
[NFFunctionRoute]: matchingFunction.route,
|
|
350
|
+
}
|
|
351
|
+
: {}
|
|
350
352
|
const url = reqToURL(req, originalURL)
|
|
351
353
|
req.headers['x-netlify-original-pathname'] = url.pathname
|
|
352
354
|
req.headers['x-netlify-original-search'] = url.search
|
|
@@ -604,7 +606,11 @@ const onRequest = async (
|
|
|
604
606
|
// Setting an internal header with the function name so that we don't
|
|
605
607
|
// have to match the URL again in the functions server.
|
|
606
608
|
/** @type {Record<string, string>} */
|
|
607
|
-
const headers = {
|
|
609
|
+
const headers = {}
|
|
610
|
+
|
|
611
|
+
if (functionMatch.func) {
|
|
612
|
+
headers[NFFunctionName] = functionMatch.func.name
|
|
613
|
+
}
|
|
608
614
|
|
|
609
615
|
if (functionMatch.route) {
|
|
610
616
|
headers[NFFunctionRoute] = functionMatch.route.pattern
|