@netlify/config 16.0.4 → 16.0.5

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/config",
3
- "version": "16.0.4",
3
+ "version": "16.0.5",
4
4
  "description": "Netlify config module",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -63,7 +63,7 @@
63
63
  "js-yaml": "^4.0.0",
64
64
  "make-dir": "^3.1.0",
65
65
  "map-obj": "^4.0.0",
66
- "netlify": "^9.0.0",
66
+ "netlify": "^10.0.0",
67
67
  "netlify-headers-parser": "^5.0.0",
68
68
  "netlify-redirect-parser": "^12.0.0",
69
69
  "omit.js": "^2.0.2",
package/src/api/client.js CHANGED
@@ -1,17 +1,19 @@
1
1
  'use strict'
2
2
 
3
- const NetlifyAPI = require('netlify')
3
+ // TODO: use static `import` after migrating `@netlify/config` to pure ES modules
4
+ const jsClient = import('netlify')
4
5
 
5
6
  const { removeUndefined } = require('../utils/remove_falsy')
6
7
 
7
8
  // Retrieve Netlify API client, if an access token was passed
8
- const getApiClient = function ({ token, offline, testOpts = {}, host, scheme, pathPrefix }) {
9
+ const getApiClient = async function ({ token, offline, testOpts = {}, host, scheme, pathPrefix }) {
9
10
  if (!token || offline) {
10
11
  return
11
12
  }
12
13
 
13
14
  // TODO: find less intrusive way to mock HTTP requests
14
15
  const parameters = removeUndefined({ scheme: testOpts.scheme || scheme, host: testOpts.host || host, pathPrefix })
16
+ const { NetlifyAPI } = await jsClient
15
17
  const api = new NetlifyAPI(token, parameters)
16
18
  return api
17
19
  }
package/src/main.js CHANGED
@@ -32,7 +32,7 @@ const resolveConfig = async function (opts) {
32
32
  const { cachedConfig, cachedConfigPath, host, scheme, pathPrefix, testOpts, token, offline, ...optsA } =
33
33
  addDefaultOpts(opts)
34
34
  // `api` is not JSON-serializable, so we cannot cache it inside `cachedConfig`
35
- const api = getApiClient({ token, offline, host, scheme, pathPrefix, testOpts })
35
+ const api = await getApiClient({ token, offline, host, scheme, pathPrefix, testOpts })
36
36
 
37
37
  const parsedCachedConfig = await getCachedConfig({ cachedConfig, cachedConfigPath, token, api })
38
38
  if (parsedCachedConfig !== undefined) {