netlify-cli 9.6.0 → 9.6.4
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 +20 -20
- package/package.json +3 -3
- package/src/commands/dev/dev.js +44 -2
- package/src/functions-templates/javascript/scheduled-function/package.json +1 -1
- package/src/functions-templates/typescript/hello-world/package-lock.json +8 -8
- package/src/functions-templates/typescript/hello-world/package.json +1 -1
- package/src/functions-templates/typescript/scheduled-function/package.json +1 -1
- package/src/lib/functions/server.js +1 -45
- package/src/lib/one-graph/cli-netlify-graph.js +1 -2
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.4",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "netlify-cli",
|
|
9
|
-
"version": "9.6.
|
|
9
|
+
"version": "9.6.4",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@netlify/build": "^26.3.
|
|
13
|
+
"@netlify/build": "^26.3.3",
|
|
14
14
|
"@netlify/config": "^17.0.9",
|
|
15
15
|
"@netlify/framework-info": "^9.0.0",
|
|
16
16
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
17
17
|
"@netlify/plugin-edge-handlers": "^3.0.6",
|
|
18
18
|
"@netlify/plugins-list": "^6.11.0",
|
|
19
19
|
"@netlify/routing-local-proxy": "^0.34.1",
|
|
20
|
-
"@netlify/zip-it-and-ship-it": "^5.
|
|
20
|
+
"@netlify/zip-it-and-ship-it": "^5.8.0",
|
|
21
21
|
"@octokit/rest": "^18.0.0",
|
|
22
22
|
"@sindresorhus/slugify": "^1.1.0",
|
|
23
23
|
"ansi-escapes": "^5.0.0",
|
|
@@ -2358,9 +2358,9 @@
|
|
|
2358
2358
|
}
|
|
2359
2359
|
},
|
|
2360
2360
|
"node_modules/@netlify/build": {
|
|
2361
|
-
"version": "26.3.
|
|
2362
|
-
"resolved": "https://registry.npmjs.org/@netlify/build/-/build-26.3.
|
|
2363
|
-
"integrity": "sha512-
|
|
2361
|
+
"version": "26.3.3",
|
|
2362
|
+
"resolved": "https://registry.npmjs.org/@netlify/build/-/build-26.3.3.tgz",
|
|
2363
|
+
"integrity": "sha512-ktZ6my38EisaUecAfV8ihNitYrgTzpoL1Y+0QzdWhZGw3HoBMMnuyc3DfQ9cNo4SWeg2mG4ISGgApnqg3ah8sA==",
|
|
2364
2364
|
"dependencies": {
|
|
2365
2365
|
"@bugsnag/js": "^7.0.0",
|
|
2366
2366
|
"@netlify/cache-utils": "^4.0.0",
|
|
@@ -2368,9 +2368,9 @@
|
|
|
2368
2368
|
"@netlify/functions-utils": "^4.0.0",
|
|
2369
2369
|
"@netlify/git-utils": "^4.0.0",
|
|
2370
2370
|
"@netlify/plugin-edge-handlers": "^3.0.6",
|
|
2371
|
-
"@netlify/plugins-list": "^6.
|
|
2371
|
+
"@netlify/plugins-list": "^6.11.0",
|
|
2372
2372
|
"@netlify/run-utils": "^4.0.0",
|
|
2373
|
-
"@netlify/zip-it-and-ship-it": "5.
|
|
2373
|
+
"@netlify/zip-it-and-ship-it": "5.8.0",
|
|
2374
2374
|
"@sindresorhus/slugify": "^2.0.0",
|
|
2375
2375
|
"@types/node": "^16.0.0",
|
|
2376
2376
|
"ansi-escapes": "^5.0.0",
|
|
@@ -4301,9 +4301,9 @@
|
|
|
4301
4301
|
}
|
|
4302
4302
|
},
|
|
4303
4303
|
"node_modules/@netlify/zip-it-and-ship-it": {
|
|
4304
|
-
"version": "5.
|
|
4305
|
-
"resolved": "https://registry.npmjs.org/@netlify/zip-it-and-ship-it/-/zip-it-and-ship-it-5.
|
|
4306
|
-
"integrity": "sha512-
|
|
4304
|
+
"version": "5.8.0",
|
|
4305
|
+
"resolved": "https://registry.npmjs.org/@netlify/zip-it-and-ship-it/-/zip-it-and-ship-it-5.8.0.tgz",
|
|
4306
|
+
"integrity": "sha512-Tr6/x19us7xCuHHHdZxKzAyR2jPLBCgHwmNvRsv1WWyptElm+srd0Xku5RzK1P/FdOySkub2d5iy+NHeSrbLLQ==",
|
|
4307
4307
|
"dependencies": {
|
|
4308
4308
|
"@babel/parser": "7.16.8",
|
|
4309
4309
|
"@netlify/esbuild": "^0.13.6",
|
|
@@ -25496,9 +25496,9 @@
|
|
|
25496
25496
|
}
|
|
25497
25497
|
},
|
|
25498
25498
|
"@netlify/build": {
|
|
25499
|
-
"version": "26.3.
|
|
25500
|
-
"resolved": "https://registry.npmjs.org/@netlify/build/-/build-26.3.
|
|
25501
|
-
"integrity": "sha512-
|
|
25499
|
+
"version": "26.3.3",
|
|
25500
|
+
"resolved": "https://registry.npmjs.org/@netlify/build/-/build-26.3.3.tgz",
|
|
25501
|
+
"integrity": "sha512-ktZ6my38EisaUecAfV8ihNitYrgTzpoL1Y+0QzdWhZGw3HoBMMnuyc3DfQ9cNo4SWeg2mG4ISGgApnqg3ah8sA==",
|
|
25502
25502
|
"requires": {
|
|
25503
25503
|
"@bugsnag/js": "^7.0.0",
|
|
25504
25504
|
"@netlify/cache-utils": "^4.0.0",
|
|
@@ -25506,9 +25506,9 @@
|
|
|
25506
25506
|
"@netlify/functions-utils": "^4.0.0",
|
|
25507
25507
|
"@netlify/git-utils": "^4.0.0",
|
|
25508
25508
|
"@netlify/plugin-edge-handlers": "^3.0.6",
|
|
25509
|
-
"@netlify/plugins-list": "^6.
|
|
25509
|
+
"@netlify/plugins-list": "^6.11.0",
|
|
25510
25510
|
"@netlify/run-utils": "^4.0.0",
|
|
25511
|
-
"@netlify/zip-it-and-ship-it": "5.
|
|
25511
|
+
"@netlify/zip-it-and-ship-it": "5.8.0",
|
|
25512
25512
|
"@sindresorhus/slugify": "^2.0.0",
|
|
25513
25513
|
"@types/node": "^16.0.0",
|
|
25514
25514
|
"ansi-escapes": "^5.0.0",
|
|
@@ -26688,9 +26688,9 @@
|
|
|
26688
26688
|
}
|
|
26689
26689
|
},
|
|
26690
26690
|
"@netlify/zip-it-and-ship-it": {
|
|
26691
|
-
"version": "5.
|
|
26692
|
-
"resolved": "https://registry.npmjs.org/@netlify/zip-it-and-ship-it/-/zip-it-and-ship-it-5.
|
|
26693
|
-
"integrity": "sha512-
|
|
26691
|
+
"version": "5.8.0",
|
|
26692
|
+
"resolved": "https://registry.npmjs.org/@netlify/zip-it-and-ship-it/-/zip-it-and-ship-it-5.8.0.tgz",
|
|
26693
|
+
"integrity": "sha512-Tr6/x19us7xCuHHHdZxKzAyR2jPLBCgHwmNvRsv1WWyptElm+srd0Xku5RzK1P/FdOySkub2d5iy+NHeSrbLLQ==",
|
|
26694
26694
|
"requires": {
|
|
26695
26695
|
"@babel/parser": "7.16.8",
|
|
26696
26696
|
"@netlify/esbuild": "^0.13.6",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "9.6.
|
|
4
|
+
"version": "9.6.4",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Abraham Schilling <AbrahamSchilling@gmail.com> (https://gitlab.com/n4bb12)",
|
|
@@ -199,14 +199,14 @@
|
|
|
199
199
|
"prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!site/package-lock.json\" \"!.github/**/*.md\""
|
|
200
200
|
},
|
|
201
201
|
"dependencies": {
|
|
202
|
-
"@netlify/build": "^26.3.
|
|
202
|
+
"@netlify/build": "^26.3.3",
|
|
203
203
|
"@netlify/config": "^17.0.9",
|
|
204
204
|
"@netlify/framework-info": "^9.0.0",
|
|
205
205
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
206
206
|
"@netlify/plugin-edge-handlers": "^3.0.6",
|
|
207
207
|
"@netlify/plugins-list": "^6.11.0",
|
|
208
208
|
"@netlify/routing-local-proxy": "^0.34.1",
|
|
209
|
-
"@netlify/zip-it-and-ship-it": "^5.
|
|
209
|
+
"@netlify/zip-it-and-ship-it": "^5.8.0",
|
|
210
210
|
"@octokit/rest": "^18.0.0",
|
|
211
211
|
"@sindresorhus/slugify": "^1.1.0",
|
|
212
212
|
"ansi-escapes": "^5.0.0",
|
package/src/commands/dev/dev.js
CHANGED
|
@@ -33,6 +33,7 @@ const {
|
|
|
33
33
|
detectServerSettings,
|
|
34
34
|
error,
|
|
35
35
|
exit,
|
|
36
|
+
generateNetlifyGraphJWT,
|
|
36
37
|
getSiteInformation,
|
|
37
38
|
injectEnvVariables,
|
|
38
39
|
log,
|
|
@@ -262,6 +263,44 @@ const printBanner = ({ url }) => {
|
|
|
262
263
|
)
|
|
263
264
|
}
|
|
264
265
|
|
|
266
|
+
const startPollingForAPIAuthentication = async function (options) {
|
|
267
|
+
const { api, command, config, site, siteInfo } = options
|
|
268
|
+
const frequency = 5000
|
|
269
|
+
|
|
270
|
+
const helper = async (maybeSiteData) => {
|
|
271
|
+
const siteData = await (maybeSiteData || api.getSite({ siteId: site.id }))
|
|
272
|
+
const authlifyTokenId = siteData && siteData.authlify_token_id
|
|
273
|
+
|
|
274
|
+
const existingAuthlifyTokenId = config && config.netlifyGraphConfig && config.netlifyGraphConfig.authlifyTokenId
|
|
275
|
+
if (authlifyTokenId && authlifyTokenId !== existingAuthlifyTokenId) {
|
|
276
|
+
const netlifyToken = await command.authenticate()
|
|
277
|
+
// Only inject the authlify config if a token ID exists. This prevents
|
|
278
|
+
// calling command.authenticate() (which opens a browser window) if the
|
|
279
|
+
// user hasn't enabled API Authentication
|
|
280
|
+
const netlifyGraphConfig = {
|
|
281
|
+
netlifyToken,
|
|
282
|
+
authlifyTokenId: siteData.authlify_token_id,
|
|
283
|
+
siteId: site.id,
|
|
284
|
+
}
|
|
285
|
+
config.netlifyGraphConfig = netlifyGraphConfig
|
|
286
|
+
|
|
287
|
+
const netlifyGraphJWT = generateNetlifyGraphJWT(netlifyGraphConfig)
|
|
288
|
+
|
|
289
|
+
if (netlifyGraphJWT != null) {
|
|
290
|
+
// XXX(anmonteiro): this name is deprecated. Delete after 3/31/2022
|
|
291
|
+
process.env.ONEGRAPH_AUTHLIFY_TOKEN = netlifyGraphJWT
|
|
292
|
+
process.env.NETLIFY_GRAPH_TOKEN = netlifyGraphJWT
|
|
293
|
+
}
|
|
294
|
+
} else {
|
|
295
|
+
delete config.netlifyGraphConfig
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
setTimeout(helper, frequency)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
await helper(siteInfo)
|
|
302
|
+
}
|
|
303
|
+
|
|
265
304
|
/**
|
|
266
305
|
* The dev command
|
|
267
306
|
* @param {import('commander').OptionValues} options
|
|
@@ -287,7 +326,6 @@ const dev = async (options, command) => {
|
|
|
287
326
|
)
|
|
288
327
|
}
|
|
289
328
|
|
|
290
|
-
const startNetlifyGraphWatcher = Boolean(options.graph)
|
|
291
329
|
await injectEnvVariables({ env: command.netlify.cachedConfig.env, site })
|
|
292
330
|
|
|
293
331
|
const { addonsUrls, capabilities, siteUrl, timeouts } = await getSiteInformation({
|
|
@@ -309,11 +347,15 @@ const dev = async (options, command) => {
|
|
|
309
347
|
|
|
310
348
|
command.setAnalyticsPayload({ projectType: settings.framework || 'custom', live: options.live })
|
|
311
349
|
|
|
350
|
+
const startNetlifyGraphWatcher = Boolean(options.graph)
|
|
351
|
+
if (startNetlifyGraphWatcher) {
|
|
352
|
+
startPollingForAPIAuthentication({ api, command, config, site, siteInfo })
|
|
353
|
+
}
|
|
354
|
+
|
|
312
355
|
await startFunctionsServer({
|
|
313
356
|
api,
|
|
314
357
|
command,
|
|
315
358
|
config,
|
|
316
|
-
isGraphEnabled: startNetlifyGraphWatcher,
|
|
317
359
|
settings,
|
|
318
360
|
site,
|
|
319
361
|
siteInfo,
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@netlify/functions": "^0.
|
|
13
|
-
"@types/node": "^14.
|
|
12
|
+
"@netlify/functions": "^1.0.0",
|
|
13
|
+
"@types/node": "^14.0.0",
|
|
14
14
|
"typescript": "^4.0.0"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"node_modules/@netlify/functions": {
|
|
18
|
-
"version": "0.
|
|
19
|
-
"resolved": "https://registry.npmjs.org/@netlify/functions/-/functions-0.
|
|
20
|
-
"integrity": "sha512
|
|
18
|
+
"version": "1.0.0",
|
|
19
|
+
"resolved": "https://registry.npmjs.org/@netlify/functions/-/functions-1.0.0.tgz",
|
|
20
|
+
"integrity": "sha512-7fnJv3vr8uyyyOYPChwoec6MjzsCw1CoRUO2DhQ1BD6bOyJRlD4DUaOOGlMILB2LCT8P24p5LexEGx8AJb7xdA==",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"is-promise": "^4.0.0"
|
|
23
23
|
},
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@netlify/functions": {
|
|
53
|
-
"version": "0.
|
|
54
|
-
"resolved": "https://registry.npmjs.org/@netlify/functions/-/functions-0.
|
|
55
|
-
"integrity": "sha512
|
|
53
|
+
"version": "1.0.0",
|
|
54
|
+
"resolved": "https://registry.npmjs.org/@netlify/functions/-/functions-1.0.0.tgz",
|
|
55
|
+
"integrity": "sha512-7fnJv3vr8uyyyOYPChwoec6MjzsCw1CoRUO2DhQ1BD6bOyJRlD4DUaOOGlMILB2LCT8P24p5LexEGx8AJb7xdA==",
|
|
56
56
|
"requires": {
|
|
57
57
|
"is-promise": "^4.0.0"
|
|
58
58
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
const process = require('process')
|
|
3
|
-
|
|
4
2
|
const jwtDecode = require('jwt-decode')
|
|
5
3
|
|
|
6
4
|
const {
|
|
@@ -47,51 +45,9 @@ const buildClientContext = function (headers) {
|
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
const startPollingForAPIAuthentication = async function (options) {
|
|
51
|
-
const { api, command, config, site, siteInfo } = options
|
|
52
|
-
const frequency = 5000
|
|
53
|
-
|
|
54
|
-
const helper = async (maybeSiteData) => {
|
|
55
|
-
const siteData = await (maybeSiteData || api.getSite({ siteId: site.id }))
|
|
56
|
-
const authlifyTokenId = siteData && siteData.authlify_token_id
|
|
57
|
-
|
|
58
|
-
const existingAuthlifyTokenId = config && config.netlifyGraphConfig && config.netlifyGraphConfig.authlifyTokenId
|
|
59
|
-
if (authlifyTokenId && authlifyTokenId !== existingAuthlifyTokenId) {
|
|
60
|
-
const netlifyToken = await command.authenticate()
|
|
61
|
-
// Only inject the authlify config if a token ID exists. This prevents
|
|
62
|
-
// calling command.authenticate() (which opens a browser window) if the
|
|
63
|
-
// user hasn't enabled API Authentication
|
|
64
|
-
const netlifyGraphConfig = {
|
|
65
|
-
netlifyToken,
|
|
66
|
-
authlifyTokenId: siteData.authlify_token_id,
|
|
67
|
-
siteId: site.id,
|
|
68
|
-
}
|
|
69
|
-
config.netlifyGraphConfig = netlifyGraphConfig
|
|
70
|
-
|
|
71
|
-
const netlifyGraphJWT = generateNetlifyGraphJWT(netlifyGraphConfig)
|
|
72
|
-
|
|
73
|
-
if (netlifyGraphJWT != null) {
|
|
74
|
-
// XXX(anmonteiro): this name is deprecated. Delete after 3/31/2022
|
|
75
|
-
process.env.ONEGRAPH_AUTHLIFY_TOKEN = netlifyGraphJWT
|
|
76
|
-
process.env.NETLIFY_GRAPH_TOKEN = netlifyGraphJWT
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
79
|
-
delete config.authlify
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
setTimeout(helper, frequency)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
await helper(siteInfo)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
48
|
const createHandler = function (options) {
|
|
89
49
|
const { config, functionsRegistry } = options
|
|
90
50
|
|
|
91
|
-
if (options.isGraphEnabled) {
|
|
92
|
-
startPollingForAPIAuthentication(options)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
51
|
return async function handler(request, response) {
|
|
96
52
|
// handle proxies without path re-writes (http-servr)
|
|
97
53
|
const cleanPath = request.path.replace(/^\/.netlify\/(functions|builders)/, '')
|
|
@@ -152,7 +108,7 @@ const createHandler = function (options) {
|
|
|
152
108
|
rawQuery,
|
|
153
109
|
}
|
|
154
110
|
|
|
155
|
-
if (config && config.
|
|
111
|
+
if (config && config.netlifyGraphConfig && config.netlifyGraphConfig.authlifyTokenId != null) {
|
|
156
112
|
// XXX(anmonteiro): this name is deprecated. Delete after 3/31/2022
|
|
157
113
|
const jwt = generateNetlifyGraphJWT(config.netlifyGraphConfig)
|
|
158
114
|
event.authlifyToken = jwt
|
|
@@ -217,8 +217,7 @@ const getNetlifyGraphConfig = async ({ command, options, settings }) => {
|
|
|
217
217
|
const moduleType =
|
|
218
218
|
(userSpecifiedConfig.moduleType && userSpecifiedConfig.moduleType.split(path.sep)) ||
|
|
219
219
|
defaultFrameworkConfig.moduleType
|
|
220
|
-
const language =
|
|
221
|
-
(userSpecifiedConfig.language && userSpecifiedConfig.language.split(path.sep)) || autodetectedLanguage
|
|
220
|
+
const language = userSpecifiedConfig.language || autodetectedLanguage
|
|
222
221
|
const webhookBasePath =
|
|
223
222
|
(userSpecifiedConfig.webhookBasePath && userSpecifiedConfig.webhookBasePath.split(path.sep)) ||
|
|
224
223
|
defaultFrameworkConfig.webhookBasePath
|