netlify-cli 15.8.1 → 15.9.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/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.1",
4
+ "version": "15.9.0",
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.15.2",
48
- "@netlify/build-info": "7.3.4",
49
- "@netlify/config": "20.5.2",
50
- "@netlify/edge-bundler": "8.16.2",
47
+ "@netlify/build": "29.16.1",
48
+ "@netlify/build-info": "7.4.1",
49
+ "@netlify/config": "20.6.0",
50
+ "@netlify/edge-bundler": "8.16.4",
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.12.1",
54
+ "@netlify/zip-it-and-ship-it": "9.13.0",
55
55
  "@octokit/rest": "19.0.13",
56
56
  "@skn0tt/lambda-local": "2.0.3",
57
57
  "ansi-escapes": "6.2.0",
@@ -115,7 +115,7 @@
115
115
  "log-update": "5.0.1",
116
116
  "minimist": "1.2.8",
117
117
  "multiparty": "4.2.3",
118
- "netlify": "13.1.9",
118
+ "netlify": "13.1.10",
119
119
  "netlify-headers-parser": "7.1.2",
120
120
  "netlify-redirect-parser": "14.1.3",
121
121
  "netlify-redirector": "0.4.0",
@@ -133,7 +133,7 @@
133
133
  "pump": "3.0.0",
134
134
  "raw-body": "2.5.2",
135
135
  "read-pkg-up": "9.1.0",
136
- "semver": "7.5.3",
136
+ "semver": "7.5.4",
137
137
  "source-map-support": "0.5.21",
138
138
  "strip-ansi-control-characters": "2.0.0",
139
139
  "tabtab": "3.0.2",
@@ -116,7 +116,7 @@ const dev = async (options, command) => {
116
116
  injectEnvVariables(env)
117
117
  await promptEditorHelper({ chalk, config, log, NETLIFYDEVLOG, repositoryRoot, state })
118
118
 
119
- const { addonsUrls, capabilities, siteUrl, timeouts } = await getSiteInformation({
119
+ const { accountId, addonsUrls, capabilities, siteUrl, timeouts } = await getSiteInformation({
120
120
  // inherited from base command --offline
121
121
  offline: options.offline,
122
122
  api,
@@ -176,6 +176,7 @@ const dev = async (options, command) => {
176
176
  geoCountry: options.country,
177
177
  offline: options.offline,
178
178
  state,
179
+ accountId,
179
180
  })
180
181
 
181
182
  // Try to add `.netlify` to `.gitignore`.
@@ -211,6 +212,7 @@ const dev = async (options, command) => {
211
212
  state,
212
213
  geolocationMode: options.geo,
213
214
  geoCountry: options.country,
215
+ accountId,
214
216
  })
215
217
 
216
218
  if (devConfig.autoLaunch !== false) {
@@ -23,7 +23,7 @@ const functionsServe = async (options, command) => {
23
23
  env = await getDotEnvVariables({ devConfig: { ...config.dev }, env, site })
24
24
  injectEnvVariables(env)
25
25
 
26
- const { capabilities, siteUrl, timeouts } = await getSiteInformation({
26
+ const { accountId, capabilities, siteUrl, timeouts } = await getSiteInformation({
27
27
  offline: options.offline,
28
28
  api,
29
29
  site,
@@ -52,6 +52,7 @@ const functionsServe = async (options, command) => {
52
52
  geoCountry: options.country,
53
53
  offline: options.offline,
54
54
  state,
55
+ accountId,
55
56
  })
56
57
  }
57
58
 
@@ -56,7 +56,7 @@ const serve = async (options, command) => {
56
56
  injectEnvVariables(env)
57
57
  await promptEditorHelper({ chalk, config, log, NETLIFYDEVLOG, repositoryRoot, state })
58
58
 
59
- const { addonsUrls, capabilities, siteUrl, timeouts } = await getSiteInformation({
59
+ const { accountId, addonsUrls, capabilities, siteUrl, timeouts } = await getSiteInformation({
60
60
  // inherited from base command --offline
61
61
  offline: options.offline,
62
62
  api,
@@ -105,6 +105,7 @@ const serve = async (options, command) => {
105
105
  geoCountry: options.country,
106
106
  offline: options.offline,
107
107
  state,
108
+ accountId,
108
109
  })
109
110
 
110
111
  // Try to add `.netlify` to `.gitignore`.
@@ -138,6 +139,7 @@ const serve = async (options, command) => {
138
139
  site,
139
140
  siteInfo,
140
141
  state,
142
+ accountId,
141
143
  })
142
144
 
143
145
  if (devConfig.autoLaunch !== false) {
@@ -13,9 +13,9 @@
13
13
  }
14
14
  },
15
15
  "node_modules/node-fetch": {
16
- "version": "2.6.11",
17
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz",
18
- "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==",
16
+ "version": "2.6.12",
17
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz",
18
+ "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==",
19
19
  "dependencies": {
20
20
  "whatwg-url": "^5.0.0"
21
21
  },
@@ -53,9 +53,9 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "node-fetch": {
56
- "version": "2.6.11",
57
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz",
58
- "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==",
56
+ "version": "2.6.12",
57
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz",
58
+ "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==",
59
59
  "requires": {
60
60
  "whatwg-url": "^5.0.0"
61
61
  }
@@ -17,9 +17,9 @@
17
17
  }
18
18
  },
19
19
  "node_modules/node-fetch": {
20
- "version": "2.6.11",
21
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz",
22
- "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==",
20
+ "version": "2.6.12",
21
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz",
22
+ "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==",
23
23
  "dependencies": {
24
24
  "whatwg-url": "^5.0.0"
25
25
  },
@@ -65,9 +65,9 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "node-fetch": {
68
- "version": "2.6.11",
69
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz",
70
- "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==",
68
+ "version": "2.6.12",
69
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz",
70
+ "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==",
71
71
  "requires": {
72
72
  "whatwg-url": "^5.0.0"
73
73
  }
@@ -26,9 +26,9 @@
26
26
  }
27
27
  },
28
28
  "node_modules/@types/node": {
29
- "version": "14.18.48",
30
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.48.tgz",
31
- "integrity": "sha512-iL0PIMwejpmuVHgfibHpfDwOdsbmB50wr21X71VnF5d7SsBF7WK+ZvP/SCcFm7Iwb9iiYSap9rlrdhToNAWdxg=="
29
+ "version": "14.18.53",
30
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.53.tgz",
31
+ "integrity": "sha512-soGmOpVBUq+gaBMwom1M+krC/NNbWlosh4AtGA03SyWNDiqSKtwp7OulO1M6+mg8YkHMvJ/y0AkCeO8d1hNb7A=="
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.48",
62
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.48.tgz",
63
- "integrity": "sha512-iL0PIMwejpmuVHgfibHpfDwOdsbmB50wr21X71VnF5d7SsBF7WK+ZvP/SCcFm7Iwb9iiYSap9rlrdhToNAWdxg=="
61
+ "version": "14.18.53",
62
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.53.tgz",
63
+ "integrity": "sha512-soGmOpVBUq+gaBMwom1M+krC/NNbWlosh4AtGA03SyWNDiqSKtwp7OulO1M6+mg8YkHMvJ/y0AkCeO8d1hNb7A=="
64
64
  },
65
65
  "is-promise": {
66
66
  "version": "4.0.0",
@@ -7,7 +7,6 @@ export default async (request: Request, context: Context) => {
7
7
  if (url.searchParams.get("method") !== "transform") {
8
8
  return;
9
9
  }
10
-
11
10
  const response = await context.next();
12
11
  const text = await response.text();
13
12
  return new Response(text.toUpperCase(), response);
@@ -11,6 +11,7 @@ export const headers = {
11
11
  IP: 'x-nf-client-connection-ip',
12
12
  Site: 'X-NF-Site-Info',
13
13
  DebugLogging: 'x-nf-debug-logging',
14
+ Account: 'x-nf-account-info',
14
15
  }
15
16
 
16
17
  /**
@@ -53,7 +53,15 @@ export const createSiteInfoHeader = (siteInfo = {}) => {
53
53
  return Buffer.from(siteString).toString('base64')
54
54
  }
55
55
 
56
+ export const createAccountInfoHeader = (accountInfo = {}) => {
57
+ const { id } = accountInfo
58
+ const account = { id }
59
+ const accountString = JSON.stringify(account)
60
+ return Buffer.from(accountString).toString('base64')
61
+ }
62
+
56
63
  export const initializeProxy = async ({
64
+ accountId,
57
65
  config,
58
66
  configPath,
59
67
  debug,
@@ -106,6 +114,7 @@ export const initializeProxy = async ({
106
114
  // Setting header with geolocation and site info.
107
115
  req.headers[headers.Geo] = JSON.stringify(geoLocation)
108
116
  req.headers[headers.Site] = createSiteInfoHeader(siteInfo)
117
+ req.headers[headers.Account] = createAccountInfoHeader({ id: accountId })
109
118
 
110
119
  await registry.initialize()
111
120
 
@@ -467,17 +467,19 @@ export class EdgeFunctionsRegistry {
467
467
  * @param {string} projectDir
468
468
  */
469
469
  async #setupWatchers(projectDir) {
470
- // Creating a watcher for the config file. When it changes, we update the
471
- // declarations and see if we need to register or unregister any functions.
472
- this.#configWatcher = await watchDebounced(this.#configPath, {
473
- onChange: async () => {
474
- const newConfig = await this.#getUpdatedConfig()
470
+ if (this.#configPath) {
471
+ // Creating a watcher for the config file. When it changes, we update the
472
+ // declarations and see if we need to register or unregister any functions.
473
+ this.#configWatcher = await watchDebounced(this.#configPath, {
474
+ onChange: async () => {
475
+ const newConfig = await this.#getUpdatedConfig()
475
476
 
476
- this.#declarationsFromTOML = EdgeFunctionsRegistry.#getDeclarationsFromTOML(newConfig)
477
+ this.#declarationsFromTOML = EdgeFunctionsRegistry.#getDeclarationsFromTOML(newConfig)
477
478
 
478
- await this.#checkForAddedOrDeletedFunctions()
479
- },
480
- })
479
+ await this.#checkForAddedOrDeletedFunctions()
480
+ },
481
+ })
482
+ }
481
483
 
482
484
  // While functions are guaranteed to be inside one of the configured
483
485
  // directories, they might be importing files that are located in
@@ -111,6 +111,7 @@ export const createHandler = function (options) {
111
111
  ...request.headers,
112
112
  'client-ip': [remoteAddress],
113
113
  'x-nf-client-connection-ip': [remoteAddress],
114
+ 'x-nf-account-id': [options.accountId],
114
115
  [efHeaders.Geo]: JSON.stringify(geoLocation),
115
116
  }).reduce((prev, [key, value]) => ({ ...prev, [key]: Array.isArray(value) ? value : [value] }), {})
116
117
  const rawQuery = new URLSearchParams(requestQuery).toString()
package/src/utils/dev.mjs CHANGED
@@ -107,6 +107,7 @@ export const getSiteInformation = async ({ api, offline, site, siteInfo }) => {
107
107
  return {
108
108
  addonsUrls,
109
109
  siteUrl: siteInfo.ssl_url,
110
+ accountId: account.id,
110
111
  capabilities: {
111
112
  backgroundFunctions: supportsBackgroundFunctions(account),
112
113
  },
@@ -53,6 +53,7 @@ export const generateInspectSettings = (edgeInspect, edgeInspectBrk) => {
53
53
  * @returns
54
54
  */
55
55
  export const startProxyServer = async ({
56
+ accountId,
56
57
  addonsUrls,
57
58
  config,
58
59
  configPath,
@@ -83,6 +84,7 @@ export const startProxyServer = async ({
83
84
  settings,
84
85
  state,
85
86
  siteInfo,
87
+ accountId,
86
88
  })
87
89
  if (!url) {
88
90
  log(NETLIFYDEVERR, `Unable to start proxy server on port '${settings.port}'`)
@@ -605,6 +605,7 @@ export const getProxyUrl = function (settings) {
605
605
  }
606
606
 
607
607
  export const startProxy = async function ({
608
+ accountId,
608
609
  addonsUrls,
609
610
  config,
610
611
  configPath,
@@ -636,6 +637,7 @@ export const startProxy = async function ({
636
637
  passthroughPort: secondaryServerPort || settings.port,
637
638
  projectDir,
638
639
  siteInfo,
640
+ accountId,
639
641
  state,
640
642
  })
641
643
  const proxy = await initializeProxy({