netlify-cli 10.1.0 → 10.3.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": "10.1.0",
4
+ "version": "10.3.1",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Abraham Schilling <AbrahamSchilling@gmail.com> (https://gitlab.com/n4bb12)",
@@ -184,7 +184,7 @@
184
184
  "format:check-fix:prettier": "run-e format:check:prettier format:fix:prettier",
185
185
  "format:check:prettier": "cross-env-shell prettier --check $npm_package_config_prettier",
186
186
  "format:fix:prettier": "cross-env-shell prettier --write $npm_package_config_prettier",
187
- "test:dev": "run-s test:init:* test:dev:*",
187
+ "test:dev": "run-s certs test:init:* test:dev:*",
188
188
  "test:init": "run-s test:init:*",
189
189
  "test:init:cli-version": "npm run start -- --version",
190
190
  "test:init:cli-help": "npm run start -- --help",
@@ -200,16 +200,17 @@
200
200
  "site:build": "run-s site:build:*",
201
201
  "site:build:install": "cd site && npm ci --no-audit",
202
202
  "site:build:assets": "cd site && npm run build",
203
- "postinstall": "node ./scripts/postinstall.js"
203
+ "postinstall": "node ./scripts/postinstall.js",
204
+ "certs": "openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 -subj \"/CN=localhost\" -extensions EXT -config certconf"
204
205
  },
205
206
  "config": {
206
207
  "eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,html}\" \"*.{mjs,cjs,js,md,html}\" \".*.{mjs,cjs,js,md,html}\"",
207
208
  "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\" \"!**/*/package-lock.json\" \"!.github/**/*.md\""
208
209
  },
209
210
  "dependencies": {
210
- "@netlify/build": "^27.0.1",
211
+ "@netlify/build": "^27.1.1",
211
212
  "@netlify/config": "^18.0.0",
212
- "@netlify/edge-bundler": "^0.12.0",
213
+ "@netlify/edge-bundler": "^1.1.0",
213
214
  "@netlify/framework-info": "^9.0.2",
214
215
  "@netlify/local-functions-proxy": "^1.1.1",
215
216
  "@netlify/plugins-list": "^6.19.0",
@@ -8,6 +8,7 @@ const inquirer = require('inquirer')
8
8
  const isObject = require('lodash/isObject')
9
9
  const prettyjson = require('prettyjson')
10
10
 
11
+ const runCoreStepPromise = import('@netlify/build')
11
12
  const netlifyConfigPromise = import('@netlify/config')
12
13
 
13
14
  const { cancelDeploy } = require('../../lib/api')
@@ -274,6 +275,10 @@ const deployProgressCb = function () {
274
275
  }
275
276
  return
276
277
  }
278
+ case 'error':
279
+ stopSpinner({ error: true, spinner: events[event.type], text: event.msg })
280
+ delete events[event.type]
281
+ return
277
282
  case 'stop':
278
283
  default: {
279
284
  stopSpinner({ spinner: events[event.type], text: event.msg })
@@ -381,6 +386,40 @@ const handleBuild = async ({ cachedConfig, options }) => {
381
386
  return { newConfig, configMutations }
382
387
  }
383
388
 
389
+ /**
390
+ *
391
+ * @param {object} options Bundling options
392
+ * @returns
393
+ */
394
+ const bundleEdgeFunctions = async (options) => {
395
+ const { runCoreSteps } = await runCoreStepPromise
396
+ const statusCb = options.silent ? () => {} : deployProgressCb()
397
+
398
+ statusCb({
399
+ type: 'edge-functions-bundling',
400
+ msg: 'Bundling edge functions...\n',
401
+ phase: 'start',
402
+ })
403
+
404
+ const { severityCode, success } = await runCoreSteps(['edge_functions_bundling'], { ...options, buffer: true })
405
+
406
+ if (!success) {
407
+ statusCb({
408
+ type: 'edge-functions-bundling',
409
+ msg: 'Deploy aborted due to error while bundling edge functions',
410
+ phase: 'error',
411
+ })
412
+
413
+ exit(severityCode)
414
+ }
415
+
416
+ statusCb({
417
+ type: 'edge-functions-bundling',
418
+ msg: 'Finished bundling edge functions',
419
+ phase: 'stop',
420
+ })
421
+ }
422
+
384
423
  /**
385
424
  *
386
425
  * @param {object} config
@@ -526,6 +565,12 @@ const deploy = async (options, command) => {
526
565
  const deployFolder = await getDeployFolder({ options, config, site, siteData })
527
566
  const functionsFolder = getFunctionsFolder({ options, config, site, siteData })
528
567
  const { configPath } = site
568
+ const edgeFunctionsConfig = command.netlify.config.edge_functions
569
+
570
+ // build flag wasn't used and edge functions exist
571
+ if (!options.build && edgeFunctionsConfig && edgeFunctionsConfig.length !== 0) {
572
+ await bundleEdgeFunctions(options)
573
+ }
529
574
 
530
575
  log(
531
576
  prettyjson.render({
@@ -2,4 +2,4 @@ module github.com/someone/{{name}}
2
2
 
3
3
  go 1.15
4
4
 
5
- require github.com/aws/aws-lambda-go v1.30.0
5
+ require github.com/aws/aws-lambda-go v1.31.1
@@ -2,4 +2,4 @@ module github.com/your-github-handle/{{name}}
2
2
 
3
3
  go 1.17
4
4
 
5
- require github.com/aws/aws-lambda-go v1.30.0
5
+ require github.com/aws/aws-lambda-go v1.31.1
@@ -15,7 +15,7 @@
15
15
  "author": "Netlify",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "axios": "^0.26.0",
18
+ "axios": "^0.27.0",
19
19
  "bad-words": "^3.0.3"
20
20
  }
21
21
  }
@@ -105,9 +105,9 @@
105
105
  }
106
106
  },
107
107
  "node_modules/stripe": {
108
- "version": "8.217.0",
109
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.217.0.tgz",
110
- "integrity": "sha512-CHWazNOrb1EBxTpepv5hCKMxOwF/oW3E4zRi8/LZIy5FC2y7A7NzcuE1aErYXLId3bKPe20HOmWKvjDRU2bXaA==",
108
+ "version": "8.222.0",
109
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.222.0.tgz",
110
+ "integrity": "sha512-hrA79fjmN2Eb6K3kxkDzU4ODeVGGjXQsuVaAPSUro6I9MM3X+BvIsVqdphm3BXWfimAGFvUqWtPtHy25mICY1w==",
111
111
  "dependencies": {
112
112
  "@types/node": ">=8.1.0",
113
113
  "qs": "^6.10.3"
@@ -184,9 +184,9 @@
184
184
  }
185
185
  },
186
186
  "stripe": {
187
- "version": "8.217.0",
188
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.217.0.tgz",
189
- "integrity": "sha512-CHWazNOrb1EBxTpepv5hCKMxOwF/oW3E4zRi8/LZIy5FC2y7A7NzcuE1aErYXLId3bKPe20HOmWKvjDRU2bXaA==",
187
+ "version": "8.222.0",
188
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.222.0.tgz",
189
+ "integrity": "sha512-hrA79fjmN2Eb6K3kxkDzU4ODeVGGjXQsuVaAPSUro6I9MM3X+BvIsVqdphm3BXWfimAGFvUqWtPtHy25mICY1w==",
190
190
  "requires": {
191
191
  "@types/node": ">=8.1.0",
192
192
  "qs": "^6.10.3"
@@ -105,9 +105,9 @@
105
105
  }
106
106
  },
107
107
  "node_modules/stripe": {
108
- "version": "8.217.0",
109
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.217.0.tgz",
110
- "integrity": "sha512-CHWazNOrb1EBxTpepv5hCKMxOwF/oW3E4zRi8/LZIy5FC2y7A7NzcuE1aErYXLId3bKPe20HOmWKvjDRU2bXaA==",
108
+ "version": "8.222.0",
109
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.222.0.tgz",
110
+ "integrity": "sha512-hrA79fjmN2Eb6K3kxkDzU4ODeVGGjXQsuVaAPSUro6I9MM3X+BvIsVqdphm3BXWfimAGFvUqWtPtHy25mICY1w==",
111
111
  "dependencies": {
112
112
  "@types/node": ">=8.1.0",
113
113
  "qs": "^6.10.3"
@@ -184,9 +184,9 @@
184
184
  }
185
185
  },
186
186
  "stripe": {
187
- "version": "8.217.0",
188
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.217.0.tgz",
189
- "integrity": "sha512-CHWazNOrb1EBxTpepv5hCKMxOwF/oW3E4zRi8/LZIy5FC2y7A7NzcuE1aErYXLId3bKPe20HOmWKvjDRU2bXaA==",
187
+ "version": "8.222.0",
188
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.222.0.tgz",
189
+ "integrity": "sha512-hrA79fjmN2Eb6K3kxkDzU4ODeVGGjXQsuVaAPSUro6I9MM3X+BvIsVqdphm3BXWfimAGFvUqWtPtHy25mICY1w==",
190
190
  "requires": {
191
191
  "@types/node": ">=8.1.0",
192
192
  "qs": "^6.10.3"
@@ -9,16 +9,22 @@
9
9
  "version": "1.0.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "axios": "^0.26.1",
12
+ "axios": "^0.27.0",
13
13
  "qs": "^6.7.0"
14
14
  }
15
15
  },
16
+ "node_modules/asynckit": {
17
+ "version": "0.4.0",
18
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
19
+ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
20
+ },
16
21
  "node_modules/axios": {
17
- "version": "0.26.1",
18
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
19
- "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
22
+ "version": "0.27.2",
23
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
24
+ "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
20
25
  "dependencies": {
21
- "follow-redirects": "^1.14.8"
26
+ "follow-redirects": "^1.14.9",
27
+ "form-data": "^4.0.0"
22
28
  }
23
29
  },
24
30
  "node_modules/call-bind": {
@@ -33,10 +39,29 @@
33
39
  "url": "https://github.com/sponsors/ljharb"
34
40
  }
35
41
  },
42
+ "node_modules/combined-stream": {
43
+ "version": "1.0.8",
44
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
45
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
46
+ "dependencies": {
47
+ "delayed-stream": "~1.0.0"
48
+ },
49
+ "engines": {
50
+ "node": ">= 0.8"
51
+ }
52
+ },
53
+ "node_modules/delayed-stream": {
54
+ "version": "1.0.0",
55
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
56
+ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
57
+ "engines": {
58
+ "node": ">=0.4.0"
59
+ }
60
+ },
36
61
  "node_modules/follow-redirects": {
37
- "version": "1.14.8",
38
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz",
39
- "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==",
62
+ "version": "1.15.0",
63
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz",
64
+ "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==",
40
65
  "funding": [
41
66
  {
42
67
  "type": "individual",
@@ -52,6 +77,19 @@
52
77
  }
53
78
  }
54
79
  },
80
+ "node_modules/form-data": {
81
+ "version": "4.0.0",
82
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
83
+ "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
84
+ "dependencies": {
85
+ "asynckit": "^0.4.0",
86
+ "combined-stream": "^1.0.8",
87
+ "mime-types": "^2.1.12"
88
+ },
89
+ "engines": {
90
+ "node": ">= 6"
91
+ }
92
+ },
55
93
  "node_modules/function-bind": {
56
94
  "version": "1.1.1",
57
95
  "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@@ -92,6 +130,25 @@
92
130
  "url": "https://github.com/sponsors/ljharb"
93
131
  }
94
132
  },
133
+ "node_modules/mime-db": {
134
+ "version": "1.52.0",
135
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
136
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
137
+ "engines": {
138
+ "node": ">= 0.6"
139
+ }
140
+ },
141
+ "node_modules/mime-types": {
142
+ "version": "2.1.35",
143
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
144
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
145
+ "dependencies": {
146
+ "mime-db": "1.52.0"
147
+ },
148
+ "engines": {
149
+ "node": ">= 0.6"
150
+ }
151
+ },
95
152
  "node_modules/object-inspect": {
96
153
  "version": "1.12.0",
97
154
  "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz",
@@ -129,12 +186,18 @@
129
186
  }
130
187
  },
131
188
  "dependencies": {
189
+ "asynckit": {
190
+ "version": "0.4.0",
191
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
192
+ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
193
+ },
132
194
  "axios": {
133
- "version": "0.26.1",
134
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
135
- "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
195
+ "version": "0.27.2",
196
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
197
+ "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
136
198
  "requires": {
137
- "follow-redirects": "^1.14.8"
199
+ "follow-redirects": "^1.14.9",
200
+ "form-data": "^4.0.0"
138
201
  }
139
202
  },
140
203
  "call-bind": {
@@ -146,10 +209,33 @@
146
209
  "get-intrinsic": "^1.0.2"
147
210
  }
148
211
  },
212
+ "combined-stream": {
213
+ "version": "1.0.8",
214
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
215
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
216
+ "requires": {
217
+ "delayed-stream": "~1.0.0"
218
+ }
219
+ },
220
+ "delayed-stream": {
221
+ "version": "1.0.0",
222
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
223
+ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
224
+ },
149
225
  "follow-redirects": {
150
- "version": "1.14.8",
151
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz",
152
- "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA=="
226
+ "version": "1.15.0",
227
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.0.tgz",
228
+ "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ=="
229
+ },
230
+ "form-data": {
231
+ "version": "4.0.0",
232
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
233
+ "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
234
+ "requires": {
235
+ "asynckit": "^0.4.0",
236
+ "combined-stream": "^1.0.8",
237
+ "mime-types": "^2.1.12"
238
+ }
153
239
  },
154
240
  "function-bind": {
155
241
  "version": "1.1.1",
@@ -179,6 +265,19 @@
179
265
  "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
180
266
  "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw=="
181
267
  },
268
+ "mime-db": {
269
+ "version": "1.52.0",
270
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
271
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
272
+ },
273
+ "mime-types": {
274
+ "version": "2.1.35",
275
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
276
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
277
+ "requires": {
278
+ "mime-db": "1.52.0"
279
+ }
280
+ },
182
281
  "object-inspect": {
183
282
  "version": "1.12.0",
184
283
  "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz",
@@ -15,7 +15,7 @@
15
15
  "author": "Netlify",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "axios": "^0.26.0",
18
+ "axios": "^0.27.0",
19
19
  "qs": "^6.7.0"
20
20
  }
21
21
  }
@@ -6,9 +6,9 @@ version = "0.1.0"
6
6
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7
7
 
8
8
  [dependencies]
9
- aws_lambda_events = "0.5.0"
10
- http = "0.2.6"
9
+ aws_lambda_events = "0.6.3"
10
+ http = "0.2.7"
11
11
  lambda_runtime = "0.5.1"
12
- log = "0.4.16"
12
+ log = "0.4.17"
13
13
  simple_logger = "1.16.0"
14
- tokio = "1.17.0"
14
+ tokio = "1.18.2"
@@ -26,9 +26,9 @@
26
26
  }
27
27
  },
28
28
  "node_modules/@types/node": {
29
- "version": "14.18.13",
30
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.13.tgz",
31
- "integrity": "sha512-Z6/KzgyWOga3pJNS42A+zayjhPbf2zM3hegRQaOPnLOzEi86VV++6FLDWgR1LGrVCRufP/ph2daa3tEa5br1zA=="
29
+ "version": "14.18.16",
30
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.16.tgz",
31
+ "integrity": "sha512-X3bUMdK/VmvrWdoTkz+VCn6nwKwrKCFTHtqwBIaQJNx4RUIBBUFXM00bqPz/DsDd+Icjmzm6/tyYZzeGVqb6/Q=="
32
32
  },
33
33
  "node_modules/is-promise": {
34
34
  "version": "4.0.0",
@@ -36,9 +36,9 @@
36
36
  "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
37
37
  },
38
38
  "node_modules/typescript": {
39
- "version": "4.6.3",
40
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz",
41
- "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==",
39
+ "version": "4.6.4",
40
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz",
41
+ "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==",
42
42
  "bin": {
43
43
  "tsc": "bin/tsc",
44
44
  "tsserver": "bin/tsserver"
@@ -58,9 +58,9 @@
58
58
  }
59
59
  },
60
60
  "@types/node": {
61
- "version": "14.18.13",
62
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.13.tgz",
63
- "integrity": "sha512-Z6/KzgyWOga3pJNS42A+zayjhPbf2zM3hegRQaOPnLOzEi86VV++6FLDWgR1LGrVCRufP/ph2daa3tEa5br1zA=="
61
+ "version": "14.18.16",
62
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.16.tgz",
63
+ "integrity": "sha512-X3bUMdK/VmvrWdoTkz+VCn6nwKwrKCFTHtqwBIaQJNx4RUIBBUFXM00bqPz/DsDd+Icjmzm6/tyYZzeGVqb6/Q=="
64
64
  },
65
65
  "is-promise": {
66
66
  "version": "4.0.0",
@@ -68,9 +68,9 @@
68
68
  "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
69
69
  },
70
70
  "typescript": {
71
- "version": "4.6.3",
72
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz",
73
- "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw=="
71
+ "version": "4.6.4",
72
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz",
73
+ "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg=="
74
74
  }
75
75
  }
76
76
  }
@@ -1,7 +1,8 @@
1
1
  module.exports = {
2
+ ForwardedHost: 'x-forwarded-host',
3
+ ForwardedProtocol: 'x-forwarded-proto',
2
4
  Functions: 'x-deno-functions',
3
5
  Geo: 'x-nf-geo',
4
- PassHost: 'X-NF-Pass-Host',
5
6
  Passthrough: 'x-deno-pass',
6
7
  RequestID: 'X-NF-Request-ID',
7
8
  }
@@ -42,7 +42,16 @@ const handleProxyRequest = (req, proxyReq) => {
42
42
  })
43
43
  }
44
44
 
45
- const initializeProxy = async ({ config, configPath, geolocationMode, getUpdatedConfig, offline, settings, state }) => {
45
+ const initializeProxy = async ({
46
+ config,
47
+ configPath,
48
+ geolocationMode,
49
+ getUpdatedConfig,
50
+ offline,
51
+ projectDir,
52
+ settings,
53
+ state,
54
+ }) => {
46
55
  const { functions: internalFunctions, importMap, path: internalFunctionsPath } = await getInternalFunctions()
47
56
  const { port: mainPort } = settings
48
57
  const userFunctionsPath = config.build.edge_functions
@@ -52,6 +61,7 @@ const initializeProxy = async ({ config, configPath, geolocationMode, getUpdated
52
61
  // the network if needed. We don't want to wait for that to be completed, or
53
62
  // the command will be left hanging.
54
63
  const server = prepareServer({
64
+ certificatePath: settings.https ? settings.https.certFilePath : undefined,
55
65
  config,
56
66
  configPath,
57
67
  directories: [internalFunctionsPath, userFunctionsPath].filter(Boolean),
@@ -59,6 +69,7 @@ const initializeProxy = async ({ config, configPath, geolocationMode, getUpdated
59
69
  importMaps: [importMap].filter(Boolean),
60
70
  internalFunctions,
61
71
  port: isolatePort,
72
+ projectDir,
62
73
  })
63
74
  const hasEdgeFunctions = userFunctionsPath !== undefined || internalFunctions.length !== 0
64
75
 
@@ -100,11 +111,15 @@ const initializeProxy = async ({ config, configPath, geolocationMode, getUpdated
100
111
 
101
112
  req[headersSymbol] = {
102
113
  [headers.Functions]: functionNames.join(','),
103
- [headers.PassHost]: `${LOCAL_HOST}:${mainPort}`,
114
+ [headers.ForwardedHost]: `localhost:${mainPort}`,
104
115
  [headers.Passthrough]: 'passthrough',
105
116
  [headers.RequestID]: generateUUID(),
106
117
  }
107
118
 
119
+ if (settings.https) {
120
+ req[headersSymbol][headers.ForwardedProtocol] = 'https'
121
+ }
122
+
108
123
  return `http://${LOCAL_HOST}:${isolatePort}`
109
124
  }
110
125
  }
@@ -112,6 +127,7 @@ const initializeProxy = async ({ config, configPath, geolocationMode, getUpdated
112
127
  const isEdgeFunctionsRequest = (req) => req[headersSymbol] !== undefined
113
128
 
114
129
  const prepareServer = async ({
130
+ certificatePath,
115
131
  config,
116
132
  configPath,
117
133
  directories,
@@ -119,11 +135,13 @@ const prepareServer = async ({
119
135
  importMaps,
120
136
  internalFunctions,
121
137
  port,
138
+ projectDir,
122
139
  }) => {
123
140
  const bundler = await import('@netlify/edge-bundler')
124
141
  const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH])
125
142
  const runIsolate = await bundler.serve({
126
143
  ...getDownloadUpdateFunctions(),
144
+ certificatePath,
127
145
  debug: env.NETLIFY_DENO_DEBUG === 'true',
128
146
  distImportMapPath,
129
147
  formatExportTypeError: (name) =>
@@ -141,6 +159,7 @@ const prepareServer = async ({
141
159
  directories,
142
160
  getUpdatedConfig,
143
161
  internalFunctions,
162
+ projectDir,
144
163
  runIsolate,
145
164
  })
146
165
 
@@ -1,4 +1,6 @@
1
1
  // @ts-check
2
+ const { fileURLToPath } = require('url')
3
+
2
4
  const { NETLIFYDEVERR, NETLIFYDEVLOG, chalk, log, warn, watchDebounced } = require('../../utils/command-helpers')
3
5
 
4
6
  /**
@@ -24,9 +26,19 @@ class EdgeFunctionsRegistry {
24
26
  * @param {string[]} opts.directories
25
27
  * @param {() => Promise<object>} opts.getUpdatedConfig
26
28
  * @param {EdgeFunction[]} opts.internalFunctions
29
+ * @param {string} opts.projectDir
27
30
  * @param {(functions: EdgeFunction[]) => Promise<object>} opts.runIsolate
28
31
  */
29
- constructor({ bundler, config, configPath, directories, getUpdatedConfig, internalFunctions, runIsolate }) {
32
+ constructor({
33
+ bundler,
34
+ config,
35
+ configPath,
36
+ directories,
37
+ getUpdatedConfig,
38
+ internalFunctions,
39
+ projectDir,
40
+ runIsolate,
41
+ }) {
30
42
  /**
31
43
  * @type {import('@netlify/edge-bundler')}
32
44
  */
@@ -87,7 +99,7 @@ class EdgeFunctionsRegistry {
87
99
  */
88
100
  this.initialScan = this.scan(directories)
89
101
 
90
- this.setupWatchers()
102
+ this.setupWatchers({ projectDir })
91
103
  }
92
104
 
93
105
  /**
@@ -283,7 +295,12 @@ class EdgeFunctionsRegistry {
283
295
  const dependencyPaths = new Map()
284
296
 
285
297
  graph.modules.forEach(({ dependencies = [], specifier }) => {
286
- const functionMatch = functionPaths.get(specifier)
298
+ if (!specifier.startsWith('file://')) {
299
+ return
300
+ }
301
+
302
+ const path = fileURLToPath(specifier)
303
+ const functionMatch = functionPaths.get(path)
287
304
 
288
305
  if (!functionMatch) {
289
306
  return
@@ -301,9 +318,10 @@ class EdgeFunctionsRegistry {
301
318
  }
302
319
 
303
320
  const { specifier: dependencyURL } = dependency.code
304
- const functions = dependencyPaths.get(dependencyURL) || []
321
+ const dependencyPath = fileURLToPath(dependencyURL)
322
+ const functions = dependencyPaths.get(dependencyPath) || []
305
323
 
306
- dependencyPaths.set(dependencyURL, [...functions, functionMatch])
324
+ dependencyPaths.set(dependencyPath, [...functions, functionMatch])
307
325
  })
308
326
  })
309
327
 
@@ -323,7 +341,7 @@ class EdgeFunctionsRegistry {
323
341
  return functions
324
342
  }
325
343
 
326
- async setupWatchers() {
344
+ async setupWatchers({ projectDir }) {
327
345
  // Creating a watcher for the config file. When it changes, we update the
328
346
  // declarations and see if we need to register or unregister any functions.
329
347
  this.configWatcher = await watchDebounced(this.configPath, {
@@ -336,8 +354,11 @@ class EdgeFunctionsRegistry {
336
354
  },
337
355
  })
338
356
 
339
- // Creating a watcher for each source directory.
340
- await Promise.all(this.directories.map((directory) => this.setupWatcherForDirectory(directory)))
357
+ // While functions are guaranteed to be inside one of the configured
358
+ // directories, they might be importing files that are located in
359
+ // parent directories. So we watch the entire project directory for
360
+ // changes.
361
+ await this.setupWatcherForDirectory(projectDir)
341
362
  }
342
363
 
343
364
  async setupWatcherForDirectory(directory) {
@@ -1,4 +1,5 @@
1
1
  // @ts-check
2
+ const { get } = require('dot-prop')
2
3
  const jwtDecode = require('jwt-decode')
3
4
 
4
5
  const {
@@ -89,7 +90,8 @@ const createHandler = function (options) {
89
90
  {},
90
91
  )
91
92
  const rawQuery = new URLSearchParams(request.query).toString()
92
- const url = new URL(requestPath, `${request.protocol}://${request.get('host') || 'localhost'}`)
93
+ const protocol = get(options, 'config.dev.https') ? 'https' : 'http'
94
+ const url = new URL(requestPath, `${protocol}://${request.get('host') || 'localhost'}`)
93
95
  url.search = rawQuery
94
96
  const rawUrl = url.toString()
95
97
  const event = {
@@ -46,7 +46,7 @@ const readHttpsSettings = async (options) => {
46
46
  throw new Error(`Error reading certificate file: ${certError.message}`)
47
47
  }
48
48
 
49
- return { key, cert }
49
+ return { key, cert, keyFilePath: path.resolve(keyFile), certFilePath: path.resolve(certFile) }
50
50
  }
51
51
 
52
52
  const validateStringProperty = ({ devConfig, property }) => {