@netlify/config 16.0.2 → 16.0.6
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 +4 -6
- package/src/api/client.js +4 -2
- package/src/bin/main.js +0 -2
- package/src/env/main.js +1 -2
- package/src/main.js +1 -3
- package/src/redirects.js +3 -1
- package/src/utils/polyfills.js +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.6",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"bin": {
|
|
@@ -49,8 +49,6 @@
|
|
|
49
49
|
},
|
|
50
50
|
"license": "MIT",
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@ungap/from-entries": "^0.2.1",
|
|
53
|
-
"array-flat-polyfill": "^1.0.1",
|
|
54
52
|
"chalk": "^4.1.2",
|
|
55
53
|
"cron-parser": "^4.1.0",
|
|
56
54
|
"deepmerge": "^4.2.2",
|
|
@@ -65,9 +63,9 @@
|
|
|
65
63
|
"js-yaml": "^4.0.0",
|
|
66
64
|
"make-dir": "^3.1.0",
|
|
67
65
|
"map-obj": "^4.0.0",
|
|
68
|
-
"netlify": "^
|
|
69
|
-
"netlify-headers-parser": "^
|
|
70
|
-
"netlify-redirect-parser": "^
|
|
66
|
+
"netlify": "^10.0.0",
|
|
67
|
+
"netlify-headers-parser": "^5.0.0",
|
|
68
|
+
"netlify-redirect-parser": "^13.0.0",
|
|
71
69
|
"omit.js": "^2.0.2",
|
|
72
70
|
"p-locate": "^5.0.0",
|
|
73
71
|
"path-exists": "^4.0.0",
|
package/src/api/client.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
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/bin/main.js
CHANGED
|
@@ -10,8 +10,6 @@ const { stableStringify } = require('fast-safe-stringify')
|
|
|
10
10
|
const makeDir = require('make-dir')
|
|
11
11
|
const omit = require('omit.js').default
|
|
12
12
|
|
|
13
|
-
require('../utils/polyfills')
|
|
14
|
-
|
|
15
13
|
const { isUserError } = require('../error')
|
|
16
14
|
const resolveConfig = require('../main')
|
|
17
15
|
|
package/src/env/main.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const fromEntries = require('@ungap/from-entries')
|
|
4
3
|
const omit = require('omit.js').default
|
|
5
4
|
|
|
6
5
|
const { removeFalsy } = require('../utils/remove_falsy')
|
|
@@ -65,7 +64,7 @@ const getEnv = async function ({
|
|
|
65
64
|
})
|
|
66
65
|
})
|
|
67
66
|
|
|
68
|
-
return fromEntries(env)
|
|
67
|
+
return Object.fromEntries(env)
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
// Environment variables not set by users, but meant to mimic the production
|
package/src/main.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
'use strict'
|
|
3
3
|
|
|
4
|
-
require('./utils/polyfills')
|
|
5
|
-
|
|
6
4
|
const { getApiClient } = require('./api/client')
|
|
7
5
|
const { getSiteInfo } = require('./api/site_info')
|
|
8
6
|
const { getInitialBase, getBase, addBase } = require('./base')
|
|
@@ -34,7 +32,7 @@ const resolveConfig = async function (opts) {
|
|
|
34
32
|
const { cachedConfig, cachedConfigPath, host, scheme, pathPrefix, testOpts, token, offline, ...optsA } =
|
|
35
33
|
addDefaultOpts(opts)
|
|
36
34
|
// `api` is not JSON-serializable, so we cannot cache it inside `cachedConfig`
|
|
37
|
-
const api = getApiClient({ token, offline, host, scheme, pathPrefix, testOpts })
|
|
35
|
+
const api = await getApiClient({ token, offline, host, scheme, pathPrefix, testOpts })
|
|
38
36
|
|
|
39
37
|
const parsedCachedConfig = await getCachedConfig({ cachedConfig, cachedConfigPath, token, api })
|
|
40
38
|
if (parsedCachedConfig !== undefined) {
|
package/src/redirects.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const { resolve } = require('path')
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// TODO: use static `import` after migrating this repository to pure ES modules
|
|
6
|
+
const netlifyRedirectParser = import('netlify-redirect-parser')
|
|
6
7
|
|
|
7
8
|
const { warnRedirectsParsing } = require('./log/messages')
|
|
8
9
|
|
|
@@ -15,6 +16,7 @@ const REDIRECTS_FILENAME = '_redirects'
|
|
|
15
16
|
|
|
16
17
|
// Add `config.redirects`
|
|
17
18
|
const addRedirects = async function ({ redirects: configRedirects, ...config }, redirectsPath, logs) {
|
|
19
|
+
const { parseAllRedirects } = await netlifyRedirectParser
|
|
18
20
|
const { redirects, errors } = await parseAllRedirects({
|
|
19
21
|
redirectsFiles: [redirectsPath],
|
|
20
22
|
configRedirects,
|