@netlify/config 17.0.0 → 17.0.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 +1 -1
- package/src/api/client.js +3 -5
- package/src/headers.js +2 -4
- package/src/main.js +1 -1
- package/src/redirects.js +2 -4
package/package.json
CHANGED
package/src/api/client.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NetlifyAPI } from 'netlify'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const jsClient = import('netlify')
|
|
3
|
+
import { removeUndefined } from '../utils/remove_falsy.js'
|
|
5
4
|
|
|
6
5
|
// Retrieve Netlify API client, if an access token was passed
|
|
7
|
-
export const getApiClient =
|
|
6
|
+
export const getApiClient = function ({ token, offline, testOpts = {}, host, scheme, pathPrefix }) {
|
|
8
7
|
if (!token || offline) {
|
|
9
8
|
return
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
// TODO: find less intrusive way to mock HTTP requests
|
|
13
12
|
const parameters = removeUndefined({ scheme: testOpts.scheme || scheme, host: testOpts.host || host, pathPrefix })
|
|
14
|
-
const { NetlifyAPI } = await jsClient
|
|
15
13
|
const api = new NetlifyAPI(token, parameters)
|
|
16
14
|
return api
|
|
17
15
|
}
|
package/src/headers.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { resolve } from 'path'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { parseAllHeaders } from 'netlify-headers-parser'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const netlifyHeadersParser = import('netlify-headers-parser')
|
|
5
|
+
import { warnHeadersParsing, warnHeadersCaseSensitivity } from './log/messages.js'
|
|
7
6
|
|
|
8
7
|
// Retrieve path to `_headers` file (even if it does not exist yet)
|
|
9
8
|
export const getHeadersPath = function ({ build: { publish } }) {
|
|
@@ -14,7 +13,6 @@ const HEADERS_FILENAME = '_headers'
|
|
|
14
13
|
|
|
15
14
|
// Add `config.headers`
|
|
16
15
|
export const addHeaders = async function ({ headers: configHeaders, ...config }, headersPath, logs) {
|
|
17
|
-
const { parseAllHeaders } = await netlifyHeadersParser
|
|
18
16
|
const { headers, errors } = await parseAllHeaders({
|
|
19
17
|
headersFiles: [headersPath],
|
|
20
18
|
configHeaders,
|
package/src/main.js
CHANGED
|
@@ -31,7 +31,7 @@ export const resolveConfig = async function (opts) {
|
|
|
31
31
|
const { cachedConfig, cachedConfigPath, host, scheme, pathPrefix, testOpts, token, offline, ...optsA } =
|
|
32
32
|
addDefaultOpts(opts)
|
|
33
33
|
// `api` is not JSON-serializable, so we cannot cache it inside `cachedConfig`
|
|
34
|
-
const api =
|
|
34
|
+
const api = getApiClient({ token, offline, host, scheme, pathPrefix, testOpts })
|
|
35
35
|
|
|
36
36
|
const parsedCachedConfig = await getCachedConfig({ cachedConfig, cachedConfigPath, token, api })
|
|
37
37
|
if (parsedCachedConfig !== undefined) {
|
package/src/redirects.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { resolve } from 'path'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { parseAllRedirects } from 'netlify-redirect-parser'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const netlifyRedirectParser = import('netlify-redirect-parser')
|
|
5
|
+
import { warnRedirectsParsing } from './log/messages.js'
|
|
7
6
|
|
|
8
7
|
// Retrieve path to `_redirects` file (even if it does not exist yet)
|
|
9
8
|
export const getRedirectsPath = function ({ build: { publish } }) {
|
|
@@ -14,7 +13,6 @@ const REDIRECTS_FILENAME = '_redirects'
|
|
|
14
13
|
|
|
15
14
|
// Add `config.redirects`
|
|
16
15
|
export const addRedirects = async function ({ redirects: configRedirects, ...config }, redirectsPath, logs) {
|
|
17
|
-
const { parseAllRedirects } = await netlifyRedirectParser
|
|
18
16
|
const { redirects, errors } = await parseAllRedirects({
|
|
19
17
|
redirectsFiles: [redirectsPath],
|
|
20
18
|
configRedirects,
|