netlify-cli 10.7.0 → 10.7.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.
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "10.7.0",
3
+ "version": "10.7.1",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "10.7.0",
9
+ "version": "10.7.1",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
13
  "@netlify/build": "^27.3.2",
14
14
  "@netlify/config": "^18.1.1",
15
- "@netlify/edge-bundler": "^1.4.2",
15
+ "@netlify/edge-bundler": "^1.4.3",
16
16
  "@netlify/framework-info": "^9.1.0",
17
17
  "@netlify/local-functions-proxy": "^1.1.1",
18
18
  "@netlify/plugins-list": "^6.30.0",
@@ -2301,9 +2301,9 @@
2301
2301
  }
2302
2302
  },
2303
2303
  "node_modules/@netlify/edge-bundler": {
2304
- "version": "1.4.2",
2305
- "resolved": "https://registry.npmjs.org/@netlify/edge-bundler/-/edge-bundler-1.4.2.tgz",
2306
- "integrity": "sha512-grllAfoFzZu6m63pkcm8GqoG8wng6AIKNjY/Ay6UTMn+E2lBgB6pw2fF7xT8mGYWSB2TLdRlQ4RyPE/DUoyoIQ==",
2304
+ "version": "1.4.3",
2305
+ "resolved": "https://registry.npmjs.org/@netlify/edge-bundler/-/edge-bundler-1.4.3.tgz",
2306
+ "integrity": "sha512-6brBHMq8cM6110H8Dtp7csPMhHeF8dtH6eqz+M+PVzsPEua4PY2KlSf+7CFxnviiXivm/k7bC/Hq4+VQvp8o3A==",
2307
2307
  "dependencies": {
2308
2308
  "common-path-prefix": "^3.0.0",
2309
2309
  "del": "^6.0.0",
@@ -24382,9 +24382,9 @@
24382
24382
  }
24383
24383
  },
24384
24384
  "@netlify/edge-bundler": {
24385
- "version": "1.4.2",
24386
- "resolved": "https://registry.npmjs.org/@netlify/edge-bundler/-/edge-bundler-1.4.2.tgz",
24387
- "integrity": "sha512-grllAfoFzZu6m63pkcm8GqoG8wng6AIKNjY/Ay6UTMn+E2lBgB6pw2fF7xT8mGYWSB2TLdRlQ4RyPE/DUoyoIQ==",
24385
+ "version": "1.4.3",
24386
+ "resolved": "https://registry.npmjs.org/@netlify/edge-bundler/-/edge-bundler-1.4.3.tgz",
24387
+ "integrity": "sha512-6brBHMq8cM6110H8Dtp7csPMhHeF8dtH6eqz+M+PVzsPEua4PY2KlSf+7CFxnviiXivm/k7bC/Hq4+VQvp8o3A==",
24388
24388
  "requires": {
24389
24389
  "common-path-prefix": "^3.0.0",
24390
24390
  "del": "^6.0.0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "10.7.0",
4
+ "version": "10.7.1",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Abraham Schilling <AbrahamSchilling@gmail.com> (https://gitlab.com/n4bb12)",
@@ -215,7 +215,7 @@
215
215
  "dependencies": {
216
216
  "@netlify/build": "^27.3.2",
217
217
  "@netlify/config": "^18.1.1",
218
- "@netlify/edge-bundler": "^1.4.2",
218
+ "@netlify/edge-bundler": "^1.4.3",
219
219
  "@netlify/framework-info": "^9.1.0",
220
220
  "@netlify/local-functions-proxy": "^1.1.1",
221
221
  "@netlify/plugins-list": "^6.30.0",
@@ -1,6 +1,5 @@
1
1
  // @ts-check
2
2
  const { stat } = require('fs').promises
3
- const path = require('path')
4
3
 
5
4
  const { getPathInProject } = require('../settings')
6
5
 
@@ -10,7 +9,7 @@ const distPath = getPathInProject([EDGE_FUNCTIONS_FOLDER])
10
9
 
11
10
  const deployFileNormalizer = (file) => {
12
11
  const isEdgeFunction = file.root === distPath
13
- const normalizedPath = isEdgeFunction ? path.join(PUBLIC_URL_PATH, file.normalizedPath) : file.normalizedPath
12
+ const normalizedPath = isEdgeFunction ? `${PUBLIC_URL_PATH}/${file.normalizedPath}` : file.normalizedPath
14
13
 
15
14
  return {
16
15
  ...file,
@@ -32,7 +31,7 @@ const getDistPathIfExists = async () => {
32
31
  }
33
32
  }
34
33
 
35
- const isEdgeFunctionFile = (filePath) => filePath.startsWith(`${PUBLIC_URL_PATH}${path.sep}`)
34
+ const isEdgeFunctionFile = (filePath) => filePath.startsWith(`${PUBLIC_URL_PATH}/`)
36
35
 
37
36
  module.exports = {
38
37
  deployFileNormalizer,
@@ -5,7 +5,7 @@ const { cwd, env } = require('process')
5
5
  const getAvailablePort = require('get-port')
6
6
  const { v4: generateUUID } = require('uuid')
7
7
 
8
- const { NETLIFYDEVERR, NETLIFYDEVWARN, chalk, error, log } = require('../../utils/command-helpers')
8
+ const { NETLIFYDEVERR, NETLIFYDEVWARN, chalk, error: printError, log } = require('../../utils/command-helpers')
9
9
  const { getGeoLocation } = require('../geo-location')
10
10
  const { getPathInProject } = require('../settings')
11
11
  const { startSpinner, stopSpinner } = require('../spinner')
@@ -77,24 +77,18 @@ const initializeProxy = async ({
77
77
  projectDir,
78
78
  })
79
79
  const hasEdgeFunctions = userFunctionsPath !== undefined || internalFunctions.length !== 0
80
- let hasServerError = false
81
80
 
82
81
  return async (req) => {
83
- if (req.headers[headers.Passthrough] !== undefined || !hasEdgeFunctions || hasServerError) {
82
+ if (req.headers[headers.Passthrough] !== undefined || !hasEdgeFunctions) {
84
83
  return
85
84
  }
86
85
 
87
- let promiseResult
86
+ const [geoLocation, registry] = await Promise.all([
87
+ getGeoLocation({ mode: geolocationMode, offline, state }),
88
+ server,
89
+ ])
88
90
 
89
- try {
90
- promiseResult = await Promise.all([getGeoLocation({ mode: geolocationMode, offline, state }), server])
91
- } catch (error_) {
92
- error(error_.message, { exit: false })
93
- hasServerError = true
94
- return
95
- }
96
-
97
- const [geoLocation, { registry }] = promiseResult
91
+ if (!registry) return
98
92
 
99
93
  // Setting header with geolocation.
100
94
  req.headers[headers.Geo] = JSON.stringify(geoLocation)
@@ -152,34 +146,39 @@ const prepareServer = async ({
152
146
  port,
153
147
  projectDir,
154
148
  }) => {
155
- const bundler = await import('@netlify/edge-bundler')
156
- const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH])
157
- const runIsolate = await bundler.serve({
158
- ...getDownloadUpdateFunctions(),
159
- certificatePath,
160
- debug: env.NETLIFY_DENO_DEBUG === 'true',
161
- distImportMapPath,
162
- formatExportTypeError: (name) =>
163
- `${NETLIFYDEVERR} ${chalk.red('Failed')} to load Edge Function ${chalk.yellow(
164
- name,
165
- )}. The file does not seem to have a function as the default export.`,
166
- formatImportError: (name) => `${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`,
167
- importMaps,
168
- inspectSettings,
169
- port,
170
- })
171
- const registry = new EdgeFunctionsRegistry({
172
- bundler,
173
- config,
174
- configPath,
175
- directories,
176
- getUpdatedConfig,
177
- internalFunctions,
178
- projectDir,
179
- runIsolate,
180
- })
149
+ try {
150
+ const bundler = await import('@netlify/edge-bundler')
151
+ const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH])
152
+ const runIsolate = await bundler.serve({
153
+ ...getDownloadUpdateFunctions(),
154
+ certificatePath,
155
+ debug: env.NETLIFY_DENO_DEBUG === 'true',
156
+ distImportMapPath,
157
+ formatExportTypeError: (name) =>
158
+ `${NETLIFYDEVERR} ${chalk.red('Failed')} to load Edge Function ${chalk.yellow(
159
+ name,
160
+ )}. The file does not seem to have a function as the default export.`,
161
+ formatImportError: (name) =>
162
+ `${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`,
163
+ importMaps,
164
+ inspectSettings,
165
+ port,
166
+ })
167
+ const registry = new EdgeFunctionsRegistry({
168
+ bundler,
169
+ config,
170
+ configPath,
171
+ directories,
172
+ getUpdatedConfig,
173
+ internalFunctions,
174
+ projectDir,
175
+ runIsolate,
176
+ })
181
177
 
182
- return { registry, runIsolate }
178
+ return registry
179
+ } catch (error) {
180
+ printError(error.message, { exit: false })
181
+ }
183
182
  }
184
183
 
185
184
  module.exports = { handleProxyRequest, initializeProxy, isEdgeFunctionsRequest }