netlify-cli 15.8.0 → 15.8.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 +483 -404
- package/package.json +9 -9
- package/src/commands/base-command.mjs +2 -1
- package/src/lib/functions/synchronous.mjs +10 -10
- package/src/utils/proxy.mjs +23 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "15.8.
|
|
4
|
+
"version": "15.8.1",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@bugsnag/js": "7.20.2",
|
|
46
46
|
"@fastify/static": "6.10.2",
|
|
47
|
-
"@netlify/build": "29.
|
|
48
|
-
"@netlify/build-info": "7.
|
|
49
|
-
"@netlify/config": "20.5.
|
|
47
|
+
"@netlify/build": "29.15.2",
|
|
48
|
+
"@netlify/build-info": "7.3.4",
|
|
49
|
+
"@netlify/config": "20.5.2",
|
|
50
50
|
"@netlify/edge-bundler": "8.16.2",
|
|
51
51
|
"@netlify/framework-info": "9.8.10",
|
|
52
52
|
"@netlify/local-functions-proxy": "1.1.1",
|
|
53
53
|
"@netlify/serverless-functions-api": "1.5.1",
|
|
54
|
-
"@netlify/zip-it-and-ship-it": "9.
|
|
54
|
+
"@netlify/zip-it-and-ship-it": "9.12.1",
|
|
55
55
|
"@octokit/rest": "19.0.13",
|
|
56
56
|
"@skn0tt/lambda-local": "2.0.3",
|
|
57
57
|
"ansi-escapes": "6.2.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"ascii-table": "0.0.9",
|
|
61
61
|
"backoff": "2.5.0",
|
|
62
62
|
"better-opn": "3.0.2",
|
|
63
|
-
"boxen": "7.1.
|
|
63
|
+
"boxen": "7.1.1",
|
|
64
64
|
"chalk": "5.2.0",
|
|
65
65
|
"chokidar": "3.5.3",
|
|
66
66
|
"ci-info": "3.8.0",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"from2-array": "0.0.4",
|
|
93
93
|
"fuzzy": "0.1.3",
|
|
94
94
|
"get-port": "5.1.1",
|
|
95
|
-
"gh-release-fetch": "4.0.
|
|
95
|
+
"gh-release-fetch": "4.0.3",
|
|
96
96
|
"git-repo-info": "2.1.1",
|
|
97
97
|
"gitconfiglocal": "2.1.0",
|
|
98
98
|
"hasbin": "1.2.3",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"is-stream": "3.0.0",
|
|
107
107
|
"is-wsl": "2.2.0",
|
|
108
108
|
"isexe": "2.0.0",
|
|
109
|
-
"jsonwebtoken": "9.0.
|
|
109
|
+
"jsonwebtoken": "9.0.1",
|
|
110
110
|
"jwt-decode": "3.1.2",
|
|
111
111
|
"listr": "0.14.3",
|
|
112
112
|
"locate-path": "7.2.0",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"netlify-headers-parser": "7.1.2",
|
|
120
120
|
"netlify-redirect-parser": "14.1.3",
|
|
121
121
|
"netlify-redirector": "0.4.0",
|
|
122
|
-
"node-fetch": "2.6.
|
|
122
|
+
"node-fetch": "2.6.12",
|
|
123
123
|
"node-version-alias": "3.4.1",
|
|
124
124
|
"ora": "6.3.1",
|
|
125
125
|
"p-filter": "3.0.0",
|
|
@@ -407,7 +407,8 @@ export default class BaseCommand extends Command {
|
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
setAnalyticsPayload(payload) {
|
|
410
|
-
|
|
410
|
+
const newPayload = { ...this.analytics.payload, ...payload }
|
|
411
|
+
this.analytics = { ...this.analytics, payload: newPayload }
|
|
411
412
|
}
|
|
412
413
|
|
|
413
414
|
/**
|
|
@@ -75,20 +75,20 @@ const formatLambdaLocalError = (err, acceptsHtml) =>
|
|
|
75
75
|
})
|
|
76
76
|
: `${err.errorType}: ${err.errorMessage}\n ${err.stackTrace?.join('\n ')}`
|
|
77
77
|
|
|
78
|
-
const processRenderedResponse = async (err, request) => {
|
|
79
|
-
const acceptsHtml = request.headers && request.headers.accept && request.headers.accept.includes('text/html')
|
|
80
|
-
const errorString = typeof err === 'string' ? err : formatLambdaLocalError(err, acceptsHtml)
|
|
81
|
-
|
|
82
|
-
return acceptsHtml
|
|
83
|
-
? await renderErrorTemplate(errorString, './templates/function-error.html', 'function')
|
|
84
|
-
: errorString
|
|
85
|
-
}
|
|
86
|
-
|
|
87
78
|
const handleErr = async (err, request, response) => {
|
|
88
79
|
detectAwsSdkError({ err })
|
|
89
80
|
|
|
81
|
+
const acceptsHtml = request.headers && request.headers.accept && request.headers.accept.includes('text/html')
|
|
82
|
+
const errorString = typeof err === 'string' ? err : formatLambdaLocalError(err, acceptsHtml)
|
|
83
|
+
|
|
90
84
|
response.statusCode = 500
|
|
91
|
-
|
|
85
|
+
|
|
86
|
+
if (acceptsHtml) {
|
|
87
|
+
response.setHeader('Content-Type', 'text/html')
|
|
88
|
+
response.end(await renderErrorTemplate(errorString, './templates/function-error.html', 'function'))
|
|
89
|
+
} else {
|
|
90
|
+
response.end(errorString)
|
|
91
|
+
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
const validateLambdaResponse = (lambdaResponse) => {
|
package/src/utils/proxy.mjs
CHANGED
|
@@ -36,9 +36,29 @@ import { generateRequestID } from './request-id.mjs'
|
|
|
36
36
|
import { createRewriter, onChanges } from './rules-proxy.mjs'
|
|
37
37
|
import { signRedirect } from './sign-redirect.mjs'
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const gunzip = util.promisify(zlib.gunzip)
|
|
40
|
+
const brotliDecompress = util.promisify(zlib.brotliDecompress)
|
|
41
|
+
const deflate = util.promisify(zlib.deflate)
|
|
40
42
|
const shouldGenerateETag = Symbol('Internal: response should generate ETag')
|
|
41
43
|
|
|
44
|
+
/**
|
|
45
|
+
* @param {Buffer} body
|
|
46
|
+
* @param {string | undefined} contentEncoding
|
|
47
|
+
* @returns {Promise<Buffer>}
|
|
48
|
+
*/
|
|
49
|
+
const decompressResponseBody = async function (body, contentEncoding = '') {
|
|
50
|
+
switch (contentEncoding) {
|
|
51
|
+
case 'gzip':
|
|
52
|
+
return await gunzip(body)
|
|
53
|
+
case 'br':
|
|
54
|
+
return await brotliDecompress(body)
|
|
55
|
+
case 'deflate':
|
|
56
|
+
return await deflate(body)
|
|
57
|
+
default:
|
|
58
|
+
return body
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
42
62
|
const formatEdgeFunctionError = (errorBuffer, acceptsHtml) => {
|
|
43
63
|
const {
|
|
44
64
|
error: { message, name, stack },
|
|
@@ -479,7 +499,7 @@ const initializeProxy = async function ({ configPath, distDir, env, host, port,
|
|
|
479
499
|
|
|
480
500
|
if (isEdgeFunctionsRequest(req) && isUncaughtError) {
|
|
481
501
|
const acceptsHtml = req.headers && req.headers.accept && req.headers.accept.includes('text/html')
|
|
482
|
-
const decompressedBody = await
|
|
502
|
+
const decompressedBody = await decompressResponseBody(responseBody, req.headers['content-encoding'])
|
|
483
503
|
const formattedBody = formatEdgeFunctionError(decompressedBody, acceptsHtml)
|
|
484
504
|
const errorResponse = acceptsHtml
|
|
485
505
|
? await renderErrorTemplate(formattedBody, './templates/function-error.html', 'edge function')
|
|
@@ -487,6 +507,7 @@ const initializeProxy = async function ({ configPath, distDir, env, host, port,
|
|
|
487
507
|
const contentLength = Buffer.from(errorResponse, 'utf8').byteLength
|
|
488
508
|
|
|
489
509
|
res.setHeader('content-length', contentLength)
|
|
510
|
+
res.statusCode = 500
|
|
490
511
|
res.write(errorResponse)
|
|
491
512
|
return res.end()
|
|
492
513
|
}
|