netlify-cli 13.1.6 → 13.2.0
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 +217 -472
- package/package.json +6 -6
- package/src/functions-templates/typescript/hello-world/package-lock.json +6 -6
- package/src/lib/edge-functions/bootstrap.mjs +1 -1
- package/src/lib/edge-functions/headers.mjs +27 -2
- package/src/lib/edge-functions/proxy.mjs +8 -4
- package/src/lib/edge-functions/registry.mjs +5 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.2.0",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@fastify/static": "^6.6.0",
|
|
79
|
-
"@netlify/build": "^29.
|
|
80
|
-
"@netlify/config": "^20.3.
|
|
81
|
-
"@netlify/edge-bundler": "^8.12.
|
|
79
|
+
"@netlify/build": "^29.7.1",
|
|
80
|
+
"@netlify/config": "^20.3.6",
|
|
81
|
+
"@netlify/edge-bundler": "^8.12.3",
|
|
82
82
|
"@netlify/framework-info": "^9.8.5",
|
|
83
83
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
84
84
|
"@netlify/zip-it-and-ship-it": "^8.9.0",
|
|
85
85
|
"@octokit/rest": "^19.0.0",
|
|
86
|
-
"ansi-escapes": "^
|
|
86
|
+
"ansi-escapes": "^6.0.0",
|
|
87
87
|
"ansi-styles": "^5.0.0",
|
|
88
88
|
"ansi-to-html": "^0.7.2",
|
|
89
89
|
"ascii-table": "0.0.9",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"log-update": "^5.0.0",
|
|
145
145
|
"minimist": "^1.2.5",
|
|
146
146
|
"multiparty": "^4.2.1",
|
|
147
|
-
"netlify": "^13.1.
|
|
147
|
+
"netlify": "^13.1.3",
|
|
148
148
|
"netlify-headers-parser": "^7.1.2",
|
|
149
149
|
"netlify-onegraph-internal": "0.10.1",
|
|
150
150
|
"netlify-redirect-parser": "^14.1.2",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"node_modules/@types/node": {
|
|
29
|
-
"version": "14.18.
|
|
30
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.
|
|
31
|
-
"integrity": "sha512-
|
|
29
|
+
"version": "14.18.38",
|
|
30
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.38.tgz",
|
|
31
|
+
"integrity": "sha512-zMRIidN2Huikv/+/U7gRPFYsXDR/7IGqFZzTLnCEj5+gkrQjsowfamaxEnyvArct5hxGA3bTxMXlYhH78V6Cew=="
|
|
32
32
|
},
|
|
33
33
|
"node_modules/is-promise": {
|
|
34
34
|
"version": "4.0.0",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"@types/node": {
|
|
61
|
-
"version": "14.18.
|
|
62
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.
|
|
63
|
-
"integrity": "sha512-
|
|
61
|
+
"version": "14.18.38",
|
|
62
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.38.tgz",
|
|
63
|
+
"integrity": "sha512-zMRIidN2Huikv/+/U7gRPFYsXDR/7IGqFZzTLnCEj5+gkrQjsowfamaxEnyvArct5hxGA3bTxMXlYhH78V6Cew=="
|
|
64
64
|
},
|
|
65
65
|
"is-promise": {
|
|
66
66
|
"version": "4.0.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { env } from 'process'
|
|
2
2
|
|
|
3
|
-
const latestBootstrapURL = 'https://
|
|
3
|
+
const latestBootstrapURL = 'https://6419767d9dc968000848742a--edge.netlify.com/bootstrap/index-combined.ts'
|
|
4
4
|
|
|
5
5
|
export const getBootstrapURL = () => env.NETLIFY_EDGE_BOOTSTRAP || latestBootstrapURL
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { Buffer } from 'buffer'
|
|
3
|
+
|
|
4
|
+
export const headers = {
|
|
5
|
+
FeatureFlags: 'x-nf-feature-flags',
|
|
2
6
|
ForwardedHost: 'x-forwarded-host',
|
|
3
7
|
Functions: 'x-nf-edge-functions',
|
|
8
|
+
InvocationMetadata: 'x-nf-edge-functions-metadata',
|
|
4
9
|
Geo: 'x-nf-geo',
|
|
5
10
|
Passthrough: 'x-nf-passthrough',
|
|
6
11
|
IP: 'x-nf-client-connection-ip',
|
|
@@ -8,4 +13,24 @@ const headers = {
|
|
|
8
13
|
DebugLogging: 'x-nf-debug-logging',
|
|
9
14
|
}
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Takes an array of feature flags and produces a Base64-encoded JSON object
|
|
18
|
+
* that the bootstrap layer can understand.
|
|
19
|
+
*
|
|
20
|
+
* @param {Array<string>} featureFlags
|
|
21
|
+
* @returns {string}
|
|
22
|
+
*/
|
|
23
|
+
export const getFeatureFlagsHeader = (featureFlags) => {
|
|
24
|
+
const featureFlagsObject = featureFlags.reduce((acc, flagName) => ({ ...acc, [flagName]: true }), {})
|
|
25
|
+
|
|
26
|
+
return Buffer.from(JSON.stringify(featureFlagsObject)).toString('base64')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Takes the invocation metadata object and produces a Base64-encoded JSON
|
|
31
|
+
* object that the bootstrap layer can understand.
|
|
32
|
+
*
|
|
33
|
+
* @param {object} metadata
|
|
34
|
+
* @returns {string}
|
|
35
|
+
*/
|
|
36
|
+
export const getInvocationMetadataHeader = (metadata) => Buffer.from(JSON.stringify(metadata)).toString('base64')
|
|
@@ -12,7 +12,7 @@ import { startSpinner, stopSpinner } from '../spinner.mjs'
|
|
|
12
12
|
|
|
13
13
|
import { getBootstrapURL } from './bootstrap.mjs'
|
|
14
14
|
import { DIST_IMPORT_MAP_PATH } from './consts.mjs'
|
|
15
|
-
import headers from './headers.mjs'
|
|
15
|
+
import { headers, getFeatureFlagsHeader, getInvocationMetadataHeader } from './headers.mjs'
|
|
16
16
|
import { getInternalFunctions } from './internal.mjs'
|
|
17
17
|
import { EdgeFunctionsRegistry } from './registry.mjs'
|
|
18
18
|
|
|
@@ -109,7 +109,7 @@ export const initializeProxy = async ({
|
|
|
109
109
|
await registry.initialize()
|
|
110
110
|
|
|
111
111
|
const url = new URL(req.url, `http://${LOCAL_HOST}:${mainPort}`)
|
|
112
|
-
const { functionNames, orphanedDeclarations } = registry.matchURLPath(url.pathname)
|
|
112
|
+
const { functionNames, invocationMetadata, orphanedDeclarations } = registry.matchURLPath(url.pathname)
|
|
113
113
|
|
|
114
114
|
// If the request matches a config declaration for an Edge Function without
|
|
115
115
|
// a matching function file, we warn the user.
|
|
@@ -129,11 +129,15 @@ export const initializeProxy = async ({
|
|
|
129
129
|
return
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
const featureFlags = ['edge_functions_bootstrap_failure_mode']
|
|
133
|
+
|
|
132
134
|
req[headersSymbol] = {
|
|
133
|
-
[headers.
|
|
135
|
+
[headers.FeatureFlags]: getFeatureFlagsHeader(featureFlags),
|
|
134
136
|
[headers.ForwardedHost]: `localhost:${passthroughPort}`,
|
|
135
|
-
[headers.
|
|
137
|
+
[headers.Functions]: functionNames.join(','),
|
|
138
|
+
[headers.InvocationMetadata]: getInvocationMetadataHeader(invocationMetadata),
|
|
136
139
|
[headers.IP]: LOCAL_HOST,
|
|
140
|
+
[headers.Passthrough]: 'passthrough',
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
if (debug) {
|
|
@@ -268,6 +268,10 @@ export class EdgeFunctionsRegistry {
|
|
|
268
268
|
functionConfig: this.declarationsFromSource,
|
|
269
269
|
functions: this.functions,
|
|
270
270
|
})
|
|
271
|
+
const invocationMetadata = {
|
|
272
|
+
function_config: manifest.function_config,
|
|
273
|
+
routes: manifest.routes.map((route) => ({ function: route.function, pattern: route.pattern })),
|
|
274
|
+
}
|
|
271
275
|
const routes = [...manifest.routes, ...manifest.post_cache_routes].map((route) => ({
|
|
272
276
|
...route,
|
|
273
277
|
pattern: new RegExp(route.pattern),
|
|
@@ -283,7 +287,7 @@ export class EdgeFunctionsRegistry {
|
|
|
283
287
|
.map((route) => route.function)
|
|
284
288
|
const orphanedDeclarations = this.matchURLPathAgainstOrphanedDeclarations(urlPath)
|
|
285
289
|
|
|
286
|
-
return { functionNames, orphanedDeclarations }
|
|
290
|
+
return { functionNames, invocationMetadata, orphanedDeclarations }
|
|
287
291
|
}
|
|
288
292
|
|
|
289
293
|
matchURLPathAgainstOrphanedDeclarations(urlPath) {
|