netlify-cli 14.0.0 → 14.1.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.
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "14.0.0",
3
+ "version": "14.1.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "14.0.0",
9
+ "version": "14.1.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
+ "@bugsnag/js": "^7.20.0",
13
14
  "@fastify/static": "^6.6.0",
14
15
  "@netlify/build": "^29.9.2",
15
16
  "@netlify/config": "^20.3.7",
@@ -220,17 +221,17 @@
220
221
  }
221
222
  },
222
223
  "node_modules/@bugsnag/browser": {
223
- "version": "7.16.2",
224
- "resolved": "https://registry.npmjs.org/@bugsnag/browser/-/browser-7.16.2.tgz",
225
- "integrity": "sha512-iBbAmjTDe0I6WPTHi3wIcmKu3ykydtT6fc8atJA65rzgDLMlTM1Wnwz4Ny1cn0bVouLGa48BRiOJ27Rwy7QRYA==",
224
+ "version": "7.20.0",
225
+ "resolved": "https://registry.npmjs.org/@bugsnag/browser/-/browser-7.20.0.tgz",
226
+ "integrity": "sha512-LzZWI6q5cWYQSXvfJDcSl287d2xXESVn0L20lK+K5nwo/jXcK9IVZr9L+CYZ40HVXaC9jOmQbqZ18hsbO2QNIw==",
226
227
  "dependencies": {
227
- "@bugsnag/core": "^7.16.1"
228
+ "@bugsnag/core": "^7.19.0"
228
229
  }
229
230
  },
230
231
  "node_modules/@bugsnag/core": {
231
- "version": "7.16.1",
232
- "resolved": "https://registry.npmjs.org/@bugsnag/core/-/core-7.16.1.tgz",
233
- "integrity": "sha512-zuBnL7B329VldItRqhXYrp1hjmjZnltJwNXMysi9WtY4t29WKk5LVwgWb1mPM9clJ0FoObZ7kvvQMUTKh3ezFQ==",
232
+ "version": "7.19.0",
233
+ "resolved": "https://registry.npmjs.org/@bugsnag/core/-/core-7.19.0.tgz",
234
+ "integrity": "sha512-2KGwdaLD9PhR7Wk7xPi3jGuGsKTatc/28U4TOZIDU3CgC2QhGjubwiXSECel5gwxhZ3jACKcMKSV2ovHhv1NrA==",
234
235
  "dependencies": {
235
236
  "@bugsnag/cuid": "^3.0.0",
236
237
  "@bugsnag/safe-json-stringify": "^6.0.0",
@@ -240,25 +241,25 @@
240
241
  }
241
242
  },
242
243
  "node_modules/@bugsnag/cuid": {
243
- "version": "3.0.0",
244
- "resolved": "https://registry.npmjs.org/@bugsnag/cuid/-/cuid-3.0.0.tgz",
245
- "integrity": "sha512-LOt8aaBI+KvOQGneBtpuCz3YqzyEAehd1f3nC5yr9TIYW1+IzYKa2xWS4EiMz5pPOnRPHkyyS5t/wmSmN51Gjg=="
244
+ "version": "3.0.2",
245
+ "resolved": "https://registry.npmjs.org/@bugsnag/cuid/-/cuid-3.0.2.tgz",
246
+ "integrity": "sha512-cIwzC93r3PQ/INeuwtZwkZIG2K8WWN0rRLZQhu+mr48Ay+i6sEki4GYfTsflse7hZ1BeDWrNb/Q9vgY3B31xHQ=="
246
247
  },
247
248
  "node_modules/@bugsnag/js": {
248
- "version": "7.16.2",
249
- "resolved": "https://registry.npmjs.org/@bugsnag/js/-/js-7.16.2.tgz",
250
- "integrity": "sha512-AzV0PtG3SZt+HnA2JmRJeI60aDNZsIJbEEAZIWZeATvWBt5RdVdsWKllM1SkTvURfxfdAVd4Xry3BgVrh8nEbg==",
249
+ "version": "7.20.0",
250
+ "resolved": "https://registry.npmjs.org/@bugsnag/js/-/js-7.20.0.tgz",
251
+ "integrity": "sha512-lhUUSOveE8fP10RagAINqBmuH+eoOpyUOiTN1WRkjHUevWG0LZjRRUWEGN3AA+ZyTphmC6ljd2qE3/64qfOSGQ==",
251
252
  "dependencies": {
252
- "@bugsnag/browser": "^7.16.2",
253
- "@bugsnag/node": "^7.16.2"
253
+ "@bugsnag/browser": "^7.20.0",
254
+ "@bugsnag/node": "^7.19.0"
254
255
  }
255
256
  },
256
257
  "node_modules/@bugsnag/node": {
257
- "version": "7.16.2",
258
- "resolved": "https://registry.npmjs.org/@bugsnag/node/-/node-7.16.2.tgz",
259
- "integrity": "sha512-V5pND701cIYGzjjTwt0tuvAU1YyPB9h7vo5F/DzrDHRPmCINA/oVbc0Twco87knc2VPe8ntGFqTicTY65iOWzg==",
258
+ "version": "7.19.0",
259
+ "resolved": "https://registry.npmjs.org/@bugsnag/node/-/node-7.19.0.tgz",
260
+ "integrity": "sha512-c4snyxx5d/fsMogmgehFBGc//daH6+4XCplia4zrEQYltjaQ+l8ud0dPx623DgJl/2j1+2zlRc7y7IHSd7Gm5w==",
260
261
  "dependencies": {
261
- "@bugsnag/core": "^7.16.1",
262
+ "@bugsnag/core": "^7.19.0",
262
263
  "byline": "^5.0.0",
263
264
  "error-stack-parser": "^2.0.2",
264
265
  "iserror": "^0.0.2",
@@ -5144,7 +5145,7 @@
5144
5145
  "node_modules/byline": {
5145
5146
  "version": "5.0.0",
5146
5147
  "resolved": "https://registry.npmjs.org/byline/-/byline-5.0.0.tgz",
5147
- "integrity": "sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE=",
5148
+ "integrity": "sha512-s6webAy+R4SR8XVuJWt2V2rGvhnrhxN+9S15GNuTK3wKPOXFF6RNc+8ug2XhH+2s4f+uudG4kUVYmYOQWL2g0Q==",
5148
5149
  "engines": {
5149
5150
  "node": ">=0.10.0"
5150
5151
  }
@@ -7053,11 +7054,11 @@
7053
7054
  }
7054
7055
  },
7055
7056
  "node_modules/error-stack-parser": {
7056
- "version": "2.0.7",
7057
- "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.0.7.tgz",
7058
- "integrity": "sha512-chLOW0ZGRf4s8raLrDxa5sdkvPec5YdvwbFnqJme4rk0rFajP8mPtrDL1+I+CwrQDCjswDA5sREX7jYQDQs9vA==",
7057
+ "version": "2.1.4",
7058
+ "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz",
7059
+ "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==",
7059
7060
  "dependencies": {
7060
- "stackframe": "^1.1.1"
7061
+ "stackframe": "^1.3.4"
7061
7062
  }
7062
7063
  },
7063
7064
  "node_modules/es-module-lexer": {
@@ -9599,7 +9600,7 @@
9599
9600
  "node_modules/iserror": {
9600
9601
  "version": "0.0.2",
9601
9602
  "resolved": "https://registry.npmjs.org/iserror/-/iserror-0.0.2.tgz",
9602
- "integrity": "sha1-vVNFH+L2aLnyQCwZZnh6qix8C/U="
9603
+ "integrity": "sha512-oKGGrFVaWwETimP3SiWwjDeY27ovZoyZPHtxblC4hCq9fXxed/jasx+ATWFFjCVSRZng8VTMsN1nDnGo6zMBSw=="
9603
9604
  },
9604
9605
  "node_modules/isexe": {
9605
9606
  "version": "2.0.0",
@@ -13551,11 +13552,11 @@
13551
13552
  }
13552
13553
  },
13553
13554
  "node_modules/stack-generator": {
13554
- "version": "2.0.5",
13555
- "resolved": "https://registry.npmjs.org/stack-generator/-/stack-generator-2.0.5.tgz",
13556
- "integrity": "sha512-/t1ebrbHkrLrDuNMdeAcsvynWgoH/i4o8EGGfX7dEYDoTXOYVAkEpFdtshlvabzc6JlJ8Kf9YdFEoz7JkzGN9Q==",
13555
+ "version": "2.0.10",
13556
+ "resolved": "https://registry.npmjs.org/stack-generator/-/stack-generator-2.0.10.tgz",
13557
+ "integrity": "sha512-mwnua/hkqM6pF4k8SnmZ2zfETsRUpWXREfA/goT8SLCV4iOFa4bzOX2nDipWAZFPTjLvQB82f5yaodMVhK0yJQ==",
13557
13558
  "dependencies": {
13558
- "stackframe": "^1.1.1"
13559
+ "stackframe": "^1.3.4"
13559
13560
  }
13560
13561
  },
13561
13562
  "node_modules/stack-trace": {
@@ -13567,9 +13568,9 @@
13567
13568
  }
13568
13569
  },
13569
13570
  "node_modules/stackframe": {
13570
- "version": "1.2.1",
13571
- "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.2.1.tgz",
13572
- "integrity": "sha512-h88QkzREN/hy8eRdyNhhsO7RSJ5oyTqxxmmn0dzBIMUclZsjpfmrsg81vp8mjjAs2vAZ72nyWxRUwSwmh0e4xg=="
13571
+ "version": "1.3.4",
13572
+ "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz",
13573
+ "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw=="
13573
13574
  },
13574
13575
  "node_modules/static-extend": {
13575
13576
  "version": "0.1.2",
@@ -15523,17 +15524,17 @@
15523
15524
  "integrity": "sha512-9JKn5vN+hDt0Hdqn1PiJ2guflwP+B6Ga8qbDuoF0PzzVhrzsKIJo8yGqVk6CmMHiMei9w1C1Bp9IMJSIK+HPIQ=="
15524
15525
  },
15525
15526
  "@bugsnag/browser": {
15526
- "version": "7.16.2",
15527
- "resolved": "https://registry.npmjs.org/@bugsnag/browser/-/browser-7.16.2.tgz",
15528
- "integrity": "sha512-iBbAmjTDe0I6WPTHi3wIcmKu3ykydtT6fc8atJA65rzgDLMlTM1Wnwz4Ny1cn0bVouLGa48BRiOJ27Rwy7QRYA==",
15527
+ "version": "7.20.0",
15528
+ "resolved": "https://registry.npmjs.org/@bugsnag/browser/-/browser-7.20.0.tgz",
15529
+ "integrity": "sha512-LzZWI6q5cWYQSXvfJDcSl287d2xXESVn0L20lK+K5nwo/jXcK9IVZr9L+CYZ40HVXaC9jOmQbqZ18hsbO2QNIw==",
15529
15530
  "requires": {
15530
- "@bugsnag/core": "^7.16.1"
15531
+ "@bugsnag/core": "^7.19.0"
15531
15532
  }
15532
15533
  },
15533
15534
  "@bugsnag/core": {
15534
- "version": "7.16.1",
15535
- "resolved": "https://registry.npmjs.org/@bugsnag/core/-/core-7.16.1.tgz",
15536
- "integrity": "sha512-zuBnL7B329VldItRqhXYrp1hjmjZnltJwNXMysi9WtY4t29WKk5LVwgWb1mPM9clJ0FoObZ7kvvQMUTKh3ezFQ==",
15535
+ "version": "7.19.0",
15536
+ "resolved": "https://registry.npmjs.org/@bugsnag/core/-/core-7.19.0.tgz",
15537
+ "integrity": "sha512-2KGwdaLD9PhR7Wk7xPi3jGuGsKTatc/28U4TOZIDU3CgC2QhGjubwiXSECel5gwxhZ3jACKcMKSV2ovHhv1NrA==",
15537
15538
  "requires": {
15538
15539
  "@bugsnag/cuid": "^3.0.0",
15539
15540
  "@bugsnag/safe-json-stringify": "^6.0.0",
@@ -15543,25 +15544,25 @@
15543
15544
  }
15544
15545
  },
15545
15546
  "@bugsnag/cuid": {
15546
- "version": "3.0.0",
15547
- "resolved": "https://registry.npmjs.org/@bugsnag/cuid/-/cuid-3.0.0.tgz",
15548
- "integrity": "sha512-LOt8aaBI+KvOQGneBtpuCz3YqzyEAehd1f3nC5yr9TIYW1+IzYKa2xWS4EiMz5pPOnRPHkyyS5t/wmSmN51Gjg=="
15547
+ "version": "3.0.2",
15548
+ "resolved": "https://registry.npmjs.org/@bugsnag/cuid/-/cuid-3.0.2.tgz",
15549
+ "integrity": "sha512-cIwzC93r3PQ/INeuwtZwkZIG2K8WWN0rRLZQhu+mr48Ay+i6sEki4GYfTsflse7hZ1BeDWrNb/Q9vgY3B31xHQ=="
15549
15550
  },
15550
15551
  "@bugsnag/js": {
15551
- "version": "7.16.2",
15552
- "resolved": "https://registry.npmjs.org/@bugsnag/js/-/js-7.16.2.tgz",
15553
- "integrity": "sha512-AzV0PtG3SZt+HnA2JmRJeI60aDNZsIJbEEAZIWZeATvWBt5RdVdsWKllM1SkTvURfxfdAVd4Xry3BgVrh8nEbg==",
15552
+ "version": "7.20.0",
15553
+ "resolved": "https://registry.npmjs.org/@bugsnag/js/-/js-7.20.0.tgz",
15554
+ "integrity": "sha512-lhUUSOveE8fP10RagAINqBmuH+eoOpyUOiTN1WRkjHUevWG0LZjRRUWEGN3AA+ZyTphmC6ljd2qE3/64qfOSGQ==",
15554
15555
  "requires": {
15555
- "@bugsnag/browser": "^7.16.2",
15556
- "@bugsnag/node": "^7.16.2"
15556
+ "@bugsnag/browser": "^7.20.0",
15557
+ "@bugsnag/node": "^7.19.0"
15557
15558
  }
15558
15559
  },
15559
15560
  "@bugsnag/node": {
15560
- "version": "7.16.2",
15561
- "resolved": "https://registry.npmjs.org/@bugsnag/node/-/node-7.16.2.tgz",
15562
- "integrity": "sha512-V5pND701cIYGzjjTwt0tuvAU1YyPB9h7vo5F/DzrDHRPmCINA/oVbc0Twco87knc2VPe8ntGFqTicTY65iOWzg==",
15561
+ "version": "7.19.0",
15562
+ "resolved": "https://registry.npmjs.org/@bugsnag/node/-/node-7.19.0.tgz",
15563
+ "integrity": "sha512-c4snyxx5d/fsMogmgehFBGc//daH6+4XCplia4zrEQYltjaQ+l8ud0dPx623DgJl/2j1+2zlRc7y7IHSd7Gm5w==",
15563
15564
  "requires": {
15564
- "@bugsnag/core": "^7.16.1",
15565
+ "@bugsnag/core": "^7.19.0",
15565
15566
  "byline": "^5.0.0",
15566
15567
  "error-stack-parser": "^2.0.2",
15567
15568
  "iserror": "^0.0.2",
@@ -18956,7 +18957,7 @@
18956
18957
  "byline": {
18957
18958
  "version": "5.0.0",
18958
18959
  "resolved": "https://registry.npmjs.org/byline/-/byline-5.0.0.tgz",
18959
- "integrity": "sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE="
18960
+ "integrity": "sha512-s6webAy+R4SR8XVuJWt2V2rGvhnrhxN+9S15GNuTK3wKPOXFF6RNc+8ug2XhH+2s4f+uudG4kUVYmYOQWL2g0Q=="
18960
18961
  },
18961
18962
  "bytes": {
18962
18963
  "version": "3.1.2",
@@ -20425,11 +20426,11 @@
20425
20426
  }
20426
20427
  },
20427
20428
  "error-stack-parser": {
20428
- "version": "2.0.7",
20429
- "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.0.7.tgz",
20430
- "integrity": "sha512-chLOW0ZGRf4s8raLrDxa5sdkvPec5YdvwbFnqJme4rk0rFajP8mPtrDL1+I+CwrQDCjswDA5sREX7jYQDQs9vA==",
20429
+ "version": "2.1.4",
20430
+ "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz",
20431
+ "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==",
20431
20432
  "requires": {
20432
- "stackframe": "^1.1.1"
20433
+ "stackframe": "^1.3.4"
20433
20434
  }
20434
20435
  },
20435
20436
  "es-module-lexer": {
@@ -22292,7 +22293,7 @@
22292
22293
  "iserror": {
22293
22294
  "version": "0.0.2",
22294
22295
  "resolved": "https://registry.npmjs.org/iserror/-/iserror-0.0.2.tgz",
22295
- "integrity": "sha1-vVNFH+L2aLnyQCwZZnh6qix8C/U="
22296
+ "integrity": "sha512-oKGGrFVaWwETimP3SiWwjDeY27ovZoyZPHtxblC4hCq9fXxed/jasx+ATWFFjCVSRZng8VTMsN1nDnGo6zMBSw=="
22296
22297
  },
22297
22298
  "isexe": {
22298
22299
  "version": "2.0.0",
@@ -25198,11 +25199,11 @@
25198
25199
  }
25199
25200
  },
25200
25201
  "stack-generator": {
25201
- "version": "2.0.5",
25202
- "resolved": "https://registry.npmjs.org/stack-generator/-/stack-generator-2.0.5.tgz",
25203
- "integrity": "sha512-/t1ebrbHkrLrDuNMdeAcsvynWgoH/i4o8EGGfX7dEYDoTXOYVAkEpFdtshlvabzc6JlJ8Kf9YdFEoz7JkzGN9Q==",
25202
+ "version": "2.0.10",
25203
+ "resolved": "https://registry.npmjs.org/stack-generator/-/stack-generator-2.0.10.tgz",
25204
+ "integrity": "sha512-mwnua/hkqM6pF4k8SnmZ2zfETsRUpWXREfA/goT8SLCV4iOFa4bzOX2nDipWAZFPTjLvQB82f5yaodMVhK0yJQ==",
25204
25205
  "requires": {
25205
- "stackframe": "^1.1.1"
25206
+ "stackframe": "^1.3.4"
25206
25207
  }
25207
25208
  },
25208
25209
  "stack-trace": {
@@ -25211,9 +25212,9 @@
25211
25212
  "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
25212
25213
  },
25213
25214
  "stackframe": {
25214
- "version": "1.2.1",
25215
- "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.2.1.tgz",
25216
- "integrity": "sha512-h88QkzREN/hy8eRdyNhhsO7RSJ5oyTqxxmmn0dzBIMUclZsjpfmrsg81vp8mjjAs2vAZ72nyWxRUwSwmh0e4xg=="
25215
+ "version": "1.3.4",
25216
+ "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz",
25217
+ "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw=="
25217
25218
  },
25218
25219
  "static-extend": {
25219
25220
  "version": "0.1.2",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "14.0.0",
4
+ "version": "14.1.0",
5
5
  "author": "Netlify Inc.",
6
6
  "type": "module",
7
7
  "engines": {
@@ -42,6 +42,7 @@
42
42
  "prepublishOnly": "node ./scripts/prepare-for-publish.mjs"
43
43
  },
44
44
  "dependencies": {
45
+ "@bugsnag/js": "^7.20.0",
45
46
  "@fastify/static": "^6.6.0",
46
47
  "@netlify/build": "^29.9.2",
47
48
  "@netlify/config": "^20.3.7",
@@ -122,12 +122,7 @@ export class EdgeFunctionsRegistry {
122
122
  * @returns {Promise<void>}
123
123
  */
124
124
  async #doInitialScan() {
125
- const [internalFunctions, userFunctions] = await Promise.all([
126
- this.#scanForFunctions(this.#internalDirectories),
127
- this.#scanForFunctions(this.#directories),
128
- ])
129
- this.#internalFunctions = internalFunctions.all
130
- this.#userFunctions = userFunctions.all
125
+ await this.#scanForFunctions()
131
126
 
132
127
  this.#functions.forEach((func) => {
133
128
  this.#logAddedFunction(func)
@@ -190,16 +185,7 @@ export class EdgeFunctionsRegistry {
190
185
  * @returns {Promise<void>}
191
186
  */
192
187
  async #checkForAddedOrDeletedFunctions() {
193
- const [internalFunctions, userFunctions] = await Promise.all([
194
- this.#scanForFunctions(this.#internalDirectories),
195
- this.#scanForFunctions(this.#directories),
196
- ])
197
-
198
- this.#internalFunctions = internalFunctions.all
199
- this.#userFunctions = userFunctions.all
200
-
201
- const newFunctions = [...internalFunctions.new, ...userFunctions.new]
202
- const deletedFunctions = [...internalFunctions.deleted, ...userFunctions.deleted]
188
+ const { deleted: deletedFunctions, new: newFunctions } = await this.#scanForFunctions()
203
189
 
204
190
  if (newFunctions.length === 0 && deletedFunctions.length === 0) {
205
191
  return
@@ -446,12 +432,16 @@ export class EdgeFunctionsRegistry {
446
432
  }
447
433
 
448
434
  /**
449
- *
450
- * @param {string[]} directories
451
435
  * @returns {Promise<{all: EdgeFunction[], new: EdgeFunction[], deleted: EdgeFunction[]}>}
452
436
  */
453
- async #scanForFunctions(directories) {
454
- const functions = await this.#bundler.find(directories)
437
+ async #scanForFunctions() {
438
+ const [internalFunctions, userFunctions] = await Promise.all([
439
+ this.#bundler.find(this.#internalDirectories),
440
+ this.#bundler.find(this.#directories),
441
+ ])
442
+
443
+ const functions = [...internalFunctions, ...userFunctions]
444
+
455
445
  const newFunctions = functions.filter((func) => {
456
446
  const functionExists = this.#functions.some(
457
447
  (existingFunc) => func.name === existingFunc.name && func.path === existingFunc.path,
@@ -467,6 +457,9 @@ export class EdgeFunctionsRegistry {
467
457
  return !functionExists
468
458
  })
469
459
 
460
+ this.#internalFunctions = internalFunctions
461
+ this.#userFunctions = userFunctions
462
+
470
463
  return { all: functions, new: newFunctions, deleted: deletedFunctions }
471
464
  }
472
465
 
@@ -16,6 +16,7 @@ import { clearSpinner, startSpinner } from '../lib/spinner.mjs'
16
16
 
17
17
  import getGlobalConfig from './get-global-config.mjs'
18
18
  import getPackageJson from './get-package-json.mjs'
19
+ import { reportError } from './telemetry/report-error.mjs'
19
20
 
20
21
  /** The parsed process argv without the binary only arguments and flags */
21
22
  const argv = process.argv.slice(2)
@@ -179,14 +180,16 @@ export const warn = (message = '') => {
179
180
  */
180
181
  export const error = (message = '', options = {}) => {
181
182
  const err = message instanceof Error ? message : new Error(message)
183
+
182
184
  if (options.exit === false) {
183
185
  const bang = chalk.red(BANG)
184
186
  if (process.env.DEBUG) {
185
- process.stderr.write(` ${bang} Warning: ${err.stack.split('\n').join(`\n ${bang} `)}\n`)
187
+ process.stderr.write(` ${bang} Warning: ${err.stack?.split('\n').join(`\n ${bang} `)}\n`)
186
188
  } else {
187
189
  process.stderr.write(` ${bang} ${chalk.red(`${err.name}:`)} ${err.message}\n`)
188
190
  }
189
191
  } else {
192
+ reportError(err, { severity: 'error' })
190
193
  throw err
191
194
  }
192
195
  }
@@ -2,6 +2,10 @@ import { env } from 'process'
2
2
  // This is a thin layer on top of `execa` that allows consumers to provide an
3
3
  // alternative path to the module location, making it easier to mock its logic
4
4
  // in tests (see `tests/utils/mock-execa.js`).
5
+
6
+ /**
7
+ * @type {import('execa')}
8
+ */
5
9
  // eslint-disable-next-line import/no-mutable-exports
6
10
  let execa
7
11
 
@@ -1 +1,2 @@
1
1
  export { track, identify } from './telemetry.mjs'
2
+ export { reportError } from './report-error.mjs'
@@ -0,0 +1,44 @@
1
+ import { dirname, join } from 'path'
2
+ import process, { version as nodejsVersion } from 'process'
3
+ import { fileURLToPath } from 'url'
4
+
5
+ import execa from '../execa.mjs'
6
+ import getGlobalConfig from '../get-global-config.mjs'
7
+
8
+ import { cliVersion } from './utils.mjs'
9
+
10
+ const dirPath = dirname(fileURLToPath(import.meta.url))
11
+
12
+ /**
13
+ *
14
+ * @param {import('@bugsnag/js').NotifiableError} error
15
+ * @param {object} config
16
+ * @param {import('@bugsnag/js').Event['severity']} config.severity
17
+ * @returns {Promise<void>}
18
+ */
19
+ export const reportError = async function (error, config = {}) {
20
+ const globalConfig = await getGlobalConfig()
21
+
22
+ const options = JSON.stringify({
23
+ type: 'error',
24
+ data: {
25
+ message: error.message,
26
+ name: error.name,
27
+ stack: error.stack,
28
+ cause: error.cause,
29
+ severity: config.severity,
30
+ user: {
31
+ id: globalConfig.get('userId'),
32
+ },
33
+ osName: process.platform,
34
+ cliVersion,
35
+ nodejsVersion,
36
+ },
37
+ })
38
+
39
+ // spawn detached child process to handle send
40
+ execa(process.execPath, [join(dirPath, 'request.mjs'), options], {
41
+ detached: true,
42
+ stdio: 'ignore',
43
+ }).unref()
44
+ }
@@ -14,13 +14,23 @@ const options = JSON.parse(process.argv[2])
14
14
  const CLIENT_ID = 'NETLIFY_CLI'
15
15
  const TRACK_URL = process.env.NETLIFY_TEST_TRACK_URL || 'https://cli.netlify.com/telemetry/track'
16
16
  const IDENTIFY_URL = process.env.NETLIFY_TEST_IDENTIFY_URL || 'https://cli.netlify.com/telemetry/identify'
17
-
18
- const API_URL = options.type && options.type === 'track' ? TRACK_URL : IDENTIFY_URL
17
+ const REPORT_ERROR_URL = process.env.NETLIFY_TEST_ERROR_REPORT_URL || 'https://cli.netlify.com/report-error'
18
+
19
+ const getApiUrl = () => {
20
+ switch (options.type) {
21
+ case 'track':
22
+ return TRACK_URL
23
+ case 'error':
24
+ return REPORT_ERROR_URL
25
+ default:
26
+ return IDENTIFY_URL
27
+ }
28
+ }
19
29
 
20
30
  // Make telemetry call
21
31
  const makeRequest = async function () {
22
32
  try {
23
- await fetch(API_URL, {
33
+ await fetch(getApiUrl(), {
24
34
  method: 'POST',
25
35
  headers: {
26
36
  'Content-Type': 'application/json',
@@ -7,16 +7,10 @@ import { isCI } from 'ci-info'
7
7
 
8
8
  import execa from '../execa.mjs'
9
9
  import getGlobalConfig from '../get-global-config.mjs'
10
- import getPackageJson from '../get-package-json.mjs'
11
10
 
11
+ import { isTelemetryDisabled, cliVersion } from './utils.mjs'
12
12
  import isValidEventName from './validation.mjs'
13
13
 
14
- const { version: cliVersion } = await getPackageJson()
15
-
16
- const isTelemetryDisabled = function (config) {
17
- return config.get('telemetryDisabled')
18
- }
19
-
20
14
  const dirPath = dirname(fileURLToPath(import.meta.url))
21
15
 
22
16
  const send = function (type, payload) {
@@ -0,0 +1,7 @@
1
+ import getPackageJson from '../get-package-json.mjs'
2
+
3
+ export const { version: cliVersion } = await getPackageJson()
4
+
5
+ export const isTelemetryDisabled = function (config) {
6
+ return config.get('telemetryDisabled')
7
+ }