netlify-cli 15.8.1 → 15.9.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/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.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.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",
@@ -1,5 +1,11 @@
1
1
  import process from 'process'
2
2
 
3
+ import chalk from 'chalk'
4
+
5
+ import { createMainCommand } from '../src/commands/index.mjs'
6
+ // TODO: use destructuring again once the imported file is esm
7
+ import { generateAutocompletion } from '../src/lib/completion/index.mjs'
8
+
3
9
  const id = (message) => message
4
10
 
5
11
  /**
@@ -8,12 +14,10 @@ const id = (message) => message
8
14
  * @param {Array<chalk['Color'] | chalk['Modifiers']>} styles
9
15
  * @returns
10
16
  */
11
- const format = async (message, styles) => {
17
+ const format = (message, styles) => {
12
18
  let func = id
13
19
  try {
14
- // this fails sometimes on outdated npm versions
15
- const chalk = await import('chalk')
16
- func = chalk.default
20
+ func = chalk
17
21
  styles.forEach((style) => {
18
22
  func = func[style]
19
23
  })
@@ -26,10 +30,6 @@ const postInstall = async () => {
26
30
  // as yarn pnp analyzes everything inside the postinstall
27
31
  // yarn pnp executes it out of a .yarn folder .yarn/unplugged/netlify-cli-file-fb026a3a6d/node_modules/netlify-cli/scripts/postinstall.mjs
28
32
  if (!process.argv[1].includes('.yarn')) {
29
- const { createMainCommand } = await import('../src/commands/index.mjs')
30
- // TODO: use destructuring again once the imported file is esm
31
- const { generateAutocompletion } = await import('../src/lib/completion/index.mjs')
32
-
33
33
  // create or update the autocompletion definition
34
34
  const program = createMainCommand()
35
35
  generateAutocompletion(program)
@@ -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) {
@@ -1,6 +1,8 @@
1
1
  // @ts-check
2
2
  import { mkdir } from 'fs/promises'
3
3
 
4
+ import { zipFunctions } from '@netlify/zip-it-and-ship-it'
5
+
4
6
  import { NETLIFYDEVERR, NETLIFYDEVLOG, exit, log } from '../../utils/command-helpers.mjs'
5
7
  import { getFunctionsDir } from '../../utils/functions/index.mjs'
6
8
 
@@ -36,8 +38,6 @@ const functionsBuild = async (options, command) => {
36
38
 
37
39
  log(`${NETLIFYDEVLOG} Building functions`)
38
40
 
39
- const { zipFunctions } = await import('@netlify/zip-it-and-ship-it')
40
-
41
41
  zipFunctions(src, dst, { skipGo: true })
42
42
  log(`${NETLIFYDEVLOG} Functions built to `, dst)
43
43
  }
@@ -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
 
@@ -2,6 +2,7 @@
2
2
  import process from 'process'
3
3
 
4
4
  import { Option } from 'commander'
5
+ import envinfo from 'envinfo'
5
6
  import { closest } from 'fastest-levenshtein'
6
7
  import inquirer from 'inquirer'
7
8
 
@@ -39,7 +40,6 @@ const SUGGESTION_TIMEOUT = 1e4
39
40
  const getVersionPage = async () => {
40
41
  // performance optimization - load envinfo on demand
41
42
 
42
- const envinfo = await import('envinfo')
43
43
  const data = await envinfo.run({
44
44
  System: ['OS', 'CPU'],
45
45
  Binaries: ['Node', 'Yarn', 'npm'],
@@ -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);
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- import { existsSync, mkdirSync, writeFileSync } from 'fs'
2
+ import fs from 'fs'
3
3
  import { dirname } from 'path'
4
4
 
5
5
  import { sortOptions, warn } from '../../utils/command-helpers.mjs'
@@ -28,10 +28,10 @@ const generateAutocompletion = (program) => {
28
28
  {},
29
29
  )
30
30
 
31
- if (!existsSync(dirname(AUTOCOMPLETION_FILE))) {
32
- mkdirSync(dirname(AUTOCOMPLETION_FILE), { recursive: true })
31
+ if (!fs.existsSync(dirname(AUTOCOMPLETION_FILE))) {
32
+ fs.mkdirSync(dirname(AUTOCOMPLETION_FILE), { recursive: true })
33
33
  }
34
- writeFileSync(AUTOCOMPLETION_FILE, JSON.stringify(autocomplete), 'utf-8')
34
+ fs.writeFileSync(AUTOCOMPLETION_FILE, JSON.stringify(autocomplete), 'utf-8')
35
35
  } catch (error_) {
36
36
  // Sometimes it can happen that the autocomplete generation in the postinstall script lacks permissions
37
37
  // to write files to the home directory of the user. Therefore just warn with the error and don't break install.
@@ -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
  /**
@@ -3,6 +3,8 @@ import { Buffer } from 'buffer'
3
3
  import { relative } from 'path'
4
4
  import { cwd, env } from 'process'
5
5
 
6
+ // eslint-disable-next-line import/no-namespace
7
+ import * as bundler from '@netlify/edge-bundler'
6
8
  import getAvailablePort from 'get-port'
7
9
 
8
10
  import { NETLIFYDEVERR, NETLIFYDEVWARN, chalk, error as printError, log } from '../../utils/command-helpers.mjs'
@@ -53,7 +55,15 @@ export const createSiteInfoHeader = (siteInfo = {}) => {
53
55
  return Buffer.from(siteString).toString('base64')
54
56
  }
55
57
 
58
+ export const createAccountInfoHeader = (accountInfo = {}) => {
59
+ const { id } = accountInfo
60
+ const account = { id }
61
+ const accountString = JSON.stringify(account)
62
+ return Buffer.from(accountString).toString('base64')
63
+ }
64
+
56
65
  export const initializeProxy = async ({
66
+ accountId,
57
67
  config,
58
68
  configPath,
59
69
  debug,
@@ -106,6 +116,7 @@ export const initializeProxy = async ({
106
116
  // Setting header with geolocation and site info.
107
117
  req.headers[headers.Geo] = JSON.stringify(geoLocation)
108
118
  req.headers[headers.Site] = createSiteInfoHeader(siteInfo)
119
+ req.headers[headers.Account] = createAccountInfoHeader({ id: accountId })
109
120
 
110
121
  await registry.initialize()
111
122
 
@@ -176,7 +187,6 @@ const prepareServer = async ({
176
187
  const importMapPaths = [...importMaps, config.functions['*'].deno_import_map]
177
188
 
178
189
  try {
179
- const bundler = await import('@netlify/edge-bundler')
180
190
  const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH])
181
191
  const runIsolate = await bundler.serve({
182
192
  ...getDownloadUpdateFunctions(),
@@ -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
@@ -3,6 +3,7 @@ import { mkdir } from 'fs/promises'
3
3
  import { extname, isAbsolute, join, resolve } from 'path'
4
4
  import { env } from 'process'
5
5
 
6
+ import { listFunctions } from '@netlify/zip-it-and-ship-it'
6
7
  import extractZip from 'extract-zip'
7
8
 
8
9
  import {
@@ -175,9 +176,6 @@ export class FunctionsRegistry {
175
176
  // This function is here so we can mock it in tests
176
177
  // eslint-disable-next-line class-methods-use-this
177
178
  async listFunctions(...args) {
178
- // Performance optimization: load '@netlify/zip-it-and-ship-it' on demand.
179
- const { listFunctions } = await import('@netlify/zip-it-and-ship-it')
180
-
181
179
  return await listFunctions(...args)
182
180
  }
183
181
 
@@ -2,6 +2,7 @@ import { mkdir, writeFile } from 'fs/promises'
2
2
  import { createRequire } from 'module'
3
3
  import path from 'path'
4
4
 
5
+ import { zipFunction, listFunction } from '@netlify/zip-it-and-ship-it'
5
6
  import decache from 'decache'
6
7
  import { readPackageUp } from 'read-pkg-up'
7
8
  import sourceMapSupport from 'source-map-support'
@@ -44,9 +45,6 @@ const buildFunction = async ({
44
45
  }
45
46
  const functionDirectory = path.dirname(func.mainFile)
46
47
 
47
- // performance
48
- const { zipFunction } = await import('@netlify/zip-it-and-ship-it')
49
-
50
48
  // If we have a function at `functions/my-func/index.js` and we pass
51
49
  // that path to `zipFunction`, it will lack the context of the whole
52
50
  // functions directory and will infer the name of the function to be
@@ -92,15 +90,12 @@ const buildFunction = async ({
92
90
  * @param {string} params.mainFile
93
91
  * @param {string} params.projectRoot
94
92
  */
95
- export const parseFunctionForMetadata = async ({ config, mainFile, projectRoot }) => {
96
- const { listFunction } = await import('@netlify/zip-it-and-ship-it')
97
-
98
- return await listFunction(mainFile, {
93
+ export const parseFunctionForMetadata = async ({ config, mainFile, projectRoot }) =>
94
+ await listFunction(mainFile, {
99
95
  config: netlifyConfigToZisiConfig({ config, projectRoot }),
100
96
  featureFlags: { zisi_functions_api_v2: true },
101
97
  parseISC: true,
102
98
  })
103
- }
104
99
 
105
100
  // Clears the cache for any files inside the directory from which functions are
106
101
  // served.
@@ -1,4 +1,6 @@
1
1
  // @ts-check
2
+ import express from 'express'
3
+ import expressLogging from 'express-logging'
2
4
  import jwtDecode from 'jwt-decode'
3
5
 
4
6
  import { NETLIFYDEVERR, NETLIFYDEVLOG, error as errorExit, log } from '../../utils/command-helpers.mjs'
@@ -111,6 +113,7 @@ export const createHandler = function (options) {
111
113
  ...request.headers,
112
114
  'client-ip': [remoteAddress],
113
115
  'x-nf-client-connection-ip': [remoteAddress],
116
+ 'x-nf-account-id': [options.accountId],
114
117
  [efHeaders.Geo]: JSON.stringify(geoLocation),
115
118
  }).reduce((prev, [key, value]) => ({ ...prev, [key]: Array.isArray(value) ? value : [value] }), {})
116
119
  const rawQuery = new URLSearchParams(requestQuery).toString()
@@ -184,11 +187,8 @@ export const createHandler = function (options) {
184
187
  }
185
188
  }
186
189
 
187
- const getFunctionsServer = async function (options) {
190
+ const getFunctionsServer = (options) => {
188
191
  const { buildersPrefix = '', functionsPrefix = '', functionsRegistry, siteUrl } = options
189
- // performance optimization, load express on demand
190
- const { default: express } = await import('express')
191
- const { default: expressLogging } = await import('express-logging')
192
192
  const app = express()
193
193
  const functionHandler = createHandler(options)
194
194
 
@@ -1,5 +1,6 @@
1
1
  import { join } from 'path'
2
2
 
3
+ import { DenoBridge } from '@netlify/edge-bundler'
3
4
  import execa from 'execa'
4
5
  import inquirer from 'inquirer'
5
6
 
@@ -49,7 +50,6 @@ const getDenoExtPrompt = () => {
49
50
  }
50
51
 
51
52
  export const run = async ({ config, repositoryRoot }) => {
52
- const { DenoBridge } = await import('@netlify/edge-bundler')
53
53
  const deno = new DenoBridge({
54
54
  onBeforeDownload: () =>
55
55
  log(`${NETLIFYDEVWARN} Setting up the Edge Functions environment. This may take a couple of minutes.`),
@@ -2,6 +2,7 @@ import { readFile } from 'fs/promises'
2
2
  import path from 'path'
3
3
  import { promisify } from 'util'
4
4
 
5
+ import { zipFunctions } from '@netlify/zip-it-and-ship-it'
5
6
  import fromArray from 'from2-array'
6
7
  import pumpModule from 'pump'
7
8
 
@@ -66,8 +67,6 @@ const getFunctionZips = async ({
66
67
  })
67
68
  }
68
69
 
69
- const { zipFunctions } = await import('@netlify/zip-it-and-ship-it')
70
-
71
70
  return await zipFunctions(directories, tmpDir, {
72
71
  basePath: rootDir,
73
72
  configFileDirectories: [getPathInProject([INTERNAL_FUNCTIONS_FOLDER])],
@@ -10,6 +10,8 @@ import { NodeFS } from '@netlify/build-info/node'
10
10
  import { getFramework, listFrameworks } from '@netlify/framework-info'
11
11
  import fuzzy from 'fuzzy'
12
12
  import getPort from 'get-port'
13
+ import inquirer from 'inquirer'
14
+ import inquirerAutocompletePrompt from 'inquirer-autocomplete-prompt'
13
15
 
14
16
  import { NETLIFYDEVWARN, chalk, log } from './command-helpers.mjs'
15
17
  import { acquirePort } from './dev.mjs'
@@ -207,11 +209,11 @@ const detectChangesInNewSettings = (frameworkSettings, newSettings, metadata) =>
207
209
  const message = ['']
208
210
  const [setting] = newSettings
209
211
 
210
- if (frameworkSettings?.framework !== setting?.framework) {
212
+ if (frameworkSettings?.framework !== setting?.framework.name) {
211
213
  message.push(
212
214
  `- Framework does not match:`,
213
215
  ` [old]: ${frameworkSettings?.framework}`,
214
- ` [new]: ${setting?.framework}`,
216
+ ` [new]: ${setting?.framework.name}`,
215
217
  '',
216
218
  )
217
219
  }
@@ -259,9 +261,6 @@ const detectFrameworkSettings = async ({ projectDir }) => {
259
261
  }
260
262
 
261
263
  if (frameworks.length > 1) {
262
- // performance optimization, load inquirer on demand
263
- const { default: inquirer } = await import('inquirer')
264
- const { default: inquirerAutocompletePrompt } = await import('inquirer-autocomplete-prompt')
265
264
  /** multiple matching detectors, make the user choose */
266
265
  inquirer.registerPrompt('autocomplete', inquirerAutocompletePrompt)
267
266
  const scriptInquirerOptions = formatSettingsArrForInquirer(frameworks)
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
  },
@@ -1,4 +1,7 @@
1
1
  import { env } from 'process'
2
+
3
+ import execaLib from 'execa'
4
+
2
5
  // This is a thin layer on top of `execa` that allows consumers to provide an
3
6
  // alternative path to the module location, making it easier to mock its logic
4
7
  // in tests (see `tests/utils/mock-execa.js`).
@@ -13,8 +16,7 @@ if (env.NETLIFY_CLI_EXECA_PATH) {
13
16
  const execaMock = await import(env.NETLIFY_CLI_EXECA_PATH)
14
17
  execa = execaMock.default
15
18
  } else {
16
- const execaLib = await import('execa')
17
- execa = execaLib.default
19
+ execa = execaLib
18
20
  }
19
21
 
20
22
  export default execa
@@ -1,4 +1,6 @@
1
1
  // @ts-check
2
+ import { listFunctions } from '@netlify/zip-it-and-ship-it'
3
+
2
4
  import { fileExistsAsync } from '../../lib/fs.mjs'
3
5
 
4
6
  const getUrlPath = (functionName) => `/.netlify/functions/${functionName}`
@@ -24,8 +26,6 @@ export const getFunctions = async (functionsSrcDir, config = {}) => {
24
26
  return []
25
27
  }
26
28
 
27
- // performance optimization, load '@netlify/zip-it-and-ship-it' on demand
28
- const { listFunctions } = await import('@netlify/zip-it-and-ship-it')
29
29
  const functions = await listFunctions(functionsSrcDir, {
30
30
  config: config.functions ? extractSchedule(config.functions) : undefined,
31
31
  parseISC: true,
@@ -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({