netlify-cli 22.2.1 → 22.2.3-rc.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/bin/run.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { argv } from 'process'
3
3
  import EventEmitter from 'events'
4
+ import nf, { Request, Response, Headers } from 'node-fetch'
4
5
 
5
6
  import { maybeEnableCompileCache } from '../dist/utils/nodejs-compile-cache.js'
6
7
 
@@ -12,7 +13,7 @@ const UPDATE_BOXEN_OPTIONS = {
12
13
  padding: 1,
13
14
  margin: 1,
14
15
  textAlignment: 'center',
15
- borderStyle: 'round',
16
+ borderStyle: 'round',
16
17
  borderColor: NETLIFY_CYAN_HEX,
17
18
  float: 'center',
18
19
  // This is an intentional half-width space to work around a unicode padding math bug in boxen
@@ -20,6 +21,15 @@ const UPDATE_BOXEN_OPTIONS = {
20
21
  titleAlignment: 'center',
21
22
  }
22
23
 
24
+ // patch fetch for node < 18
25
+ if (!globalThis.fetch) {
26
+ globalThis.fetch = nf;
27
+ globalThis.Request = Request;
28
+ globalThis.Response = Response;
29
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
30
+ globalThis.Headers = Headers;
31
+ }
32
+
23
33
  const main = async () => {
24
34
  // TODO(serhalp) Investigate and fix this at the root instead.
25
35
  // This avoids `MaxListenersExceededWarning` warnings during Edge Functions bundling,