netlify-cli 12.14.0 → 13.0.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 +16 -2
- package/package.json +2 -1
- package/src/lib/edge-functions/headers.mjs +0 -1
- package/src/lib/edge-functions/proxy.mjs +0 -2
- package/src/utils/headers.mjs +2 -0
- package/src/utils/proxy.mjs +15 -1
- package/src/utils/request-id.mjs +4 -0
- package/src/utils/static-server.mjs +2 -1
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "netlify-cli",
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "13.0.0",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
"through2-map": "^3.0.0",
|
|
110
110
|
"to-readable-stream": "^2.1.0",
|
|
111
111
|
"toml": "^3.0.0",
|
|
112
|
+
"ulid": "^2.3.0",
|
|
112
113
|
"unixify": "^1.0.0",
|
|
113
114
|
"update-notifier": "^6.0.0",
|
|
114
115
|
"uuid": "^9.0.0",
|
|
@@ -22636,6 +22637,14 @@
|
|
|
22636
22637
|
"node": ">= 0.8"
|
|
22637
22638
|
}
|
|
22638
22639
|
},
|
|
22640
|
+
"node_modules/ulid": {
|
|
22641
|
+
"version": "2.3.0",
|
|
22642
|
+
"resolved": "https://registry.npmjs.org/ulid/-/ulid-2.3.0.tgz",
|
|
22643
|
+
"integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==",
|
|
22644
|
+
"bin": {
|
|
22645
|
+
"ulid": "bin/cli.js"
|
|
22646
|
+
}
|
|
22647
|
+
},
|
|
22639
22648
|
"node_modules/unbox-primitive": {
|
|
22640
22649
|
"version": "1.0.1",
|
|
22641
22650
|
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz",
|
|
@@ -40848,6 +40857,11 @@
|
|
|
40848
40857
|
"random-bytes": "~1.0.0"
|
|
40849
40858
|
}
|
|
40850
40859
|
},
|
|
40860
|
+
"ulid": {
|
|
40861
|
+
"version": "2.3.0",
|
|
40862
|
+
"resolved": "https://registry.npmjs.org/ulid/-/ulid-2.3.0.tgz",
|
|
40863
|
+
"integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw=="
|
|
40864
|
+
},
|
|
40851
40865
|
"unbox-primitive": {
|
|
40852
40866
|
"version": "1.0.1",
|
|
40853
40867
|
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "13.0.0",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -174,6 +174,7 @@
|
|
|
174
174
|
"through2-map": "^3.0.0",
|
|
175
175
|
"to-readable-stream": "^2.1.0",
|
|
176
176
|
"toml": "^3.0.0",
|
|
177
|
+
"ulid": "^2.3.0",
|
|
177
178
|
"unixify": "^1.0.0",
|
|
178
179
|
"update-notifier": "^6.0.0",
|
|
179
180
|
"uuid": "^9.0.0",
|
|
@@ -4,7 +4,6 @@ import { relative } from 'path'
|
|
|
4
4
|
import { cwd, env } from 'process'
|
|
5
5
|
|
|
6
6
|
import getAvailablePort from 'get-port'
|
|
7
|
-
import { v4 as generateUUID } from 'uuid'
|
|
8
7
|
|
|
9
8
|
import { NETLIFYDEVERR, NETLIFYDEVWARN, chalk, error as printError, log } from '../../utils/command-helpers.mjs'
|
|
10
9
|
import { getGeoLocation } from '../geo-location.mjs'
|
|
@@ -133,7 +132,6 @@ export const initializeProxy = async ({
|
|
|
133
132
|
[headers.Functions]: functionNames.join(','),
|
|
134
133
|
[headers.ForwardedHost]: `localhost:${passthroughPort}`,
|
|
135
134
|
[headers.Passthrough]: 'passthrough',
|
|
136
|
-
[headers.RequestID]: generateUUID(),
|
|
137
135
|
[headers.IP]: LOCAL_HOST,
|
|
138
136
|
}
|
|
139
137
|
|
package/src/utils/headers.mjs
CHANGED
package/src/utils/proxy.mjs
CHANGED
|
@@ -31,7 +31,8 @@ import renderErrorTemplate from '../lib/render-error-template.mjs'
|
|
|
31
31
|
|
|
32
32
|
import { NETLIFYDEVLOG, NETLIFYDEVWARN, log, chalk } from './command-helpers.mjs'
|
|
33
33
|
import createStreamPromise from './create-stream-promise.mjs'
|
|
34
|
-
import { headersForPath, parseHeaders } from './headers.mjs'
|
|
34
|
+
import { headersForPath, parseHeaders, NFRequestID } from './headers.mjs'
|
|
35
|
+
import { generateRequestID } from './request-id.mjs'
|
|
35
36
|
import { createRewriter, onChanges } from './rules-proxy.mjs'
|
|
36
37
|
import { signRedirect } from './sign-redirect.mjs'
|
|
37
38
|
|
|
@@ -369,6 +370,11 @@ const initializeProxy = async function ({ configPath, distDir, env, host, port,
|
|
|
369
370
|
res.end(message)
|
|
370
371
|
})
|
|
371
372
|
proxy.on('proxyReq', (proxyReq, req) => {
|
|
373
|
+
const requestID = generateRequestID()
|
|
374
|
+
|
|
375
|
+
proxyReq.setHeader(NFRequestID, requestID)
|
|
376
|
+
req.headers[NFRequestID] = requestID
|
|
377
|
+
|
|
372
378
|
if (isEdgeFunctionsRequest(req)) {
|
|
373
379
|
handleProxyRequest(req, proxyReq)
|
|
374
380
|
}
|
|
@@ -383,6 +389,14 @@ const initializeProxy = async function ({ configPath, distDir, env, host, port,
|
|
|
383
389
|
}
|
|
384
390
|
})
|
|
385
391
|
proxy.on('proxyRes', (proxyRes, req, res) => {
|
|
392
|
+
res.setHeader('server', 'Netlify')
|
|
393
|
+
|
|
394
|
+
const requestID = req.headers[NFRequestID]
|
|
395
|
+
|
|
396
|
+
if (requestID) {
|
|
397
|
+
res.setHeader(NFRequestID, requestID)
|
|
398
|
+
}
|
|
399
|
+
|
|
386
400
|
if (proxyRes.statusCode === 404 || proxyRes.statusCode === 403) {
|
|
387
401
|
if (req.alternativePaths && req.alternativePaths.length !== 0) {
|
|
388
402
|
req.url = req.alternativePaths.shift()
|
|
@@ -21,7 +21,8 @@ export const startStaticServer = async ({ settings }) => {
|
|
|
21
21
|
})
|
|
22
22
|
|
|
23
23
|
server.addHook('onRequest', (req, reply, done) => {
|
|
24
|
-
reply.header('
|
|
24
|
+
reply.header('age', '0')
|
|
25
|
+
reply.header('cache-control', 'public, max-age=0, must-revalidate')
|
|
25
26
|
const validMethods = ['GET', 'HEAD']
|
|
26
27
|
if (!validMethods.includes(req.method)) {
|
|
27
28
|
reply.code(405).send('Method Not Allowed')
|