@netlify/config 17.0.13 → 17.0.16
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 +2 -2
- package/src/headers.js +7 -1
- package/src/main.js +8 -2
- package/src/mutations/update.js +3 -3
- package/src/redirects.js +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.16",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./src/main.js",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"map-obj": "^5.0.0",
|
|
67
67
|
"netlify": "^11.0.0",
|
|
68
68
|
"netlify-headers-parser": "^6.0.2",
|
|
69
|
-
"netlify-redirect-parser": "13.0.
|
|
69
|
+
"netlify-redirect-parser": "13.0.5",
|
|
70
70
|
"omit.js": "^2.0.2",
|
|
71
71
|
"p-locate": "^6.0.0",
|
|
72
72
|
"path-exists": "^5.0.0",
|
package/src/headers.js
CHANGED
|
@@ -12,11 +12,17 @@ export const getHeadersPath = function ({ build: { publish } }) {
|
|
|
12
12
|
const HEADERS_FILENAME = '_headers'
|
|
13
13
|
|
|
14
14
|
// Add `config.headers`
|
|
15
|
-
export const addHeaders = async function ({
|
|
15
|
+
export const addHeaders = async function ({
|
|
16
|
+
config: { headers: configHeaders, ...config },
|
|
17
|
+
headersPath,
|
|
18
|
+
logs,
|
|
19
|
+
featureFlags,
|
|
20
|
+
}) {
|
|
16
21
|
const { headers, errors } = await parseAllHeaders({
|
|
17
22
|
headersFiles: [headersPath],
|
|
18
23
|
configHeaders,
|
|
19
24
|
minimal: true,
|
|
25
|
+
featureFlags,
|
|
20
26
|
})
|
|
21
27
|
warnHeadersParsing(logs, errors)
|
|
22
28
|
warnHeadersCaseSensitivity(logs, headers)
|
package/src/main.js
CHANGED
|
@@ -55,6 +55,7 @@ export const resolveConfig = async function (opts) {
|
|
|
55
55
|
mode,
|
|
56
56
|
debug,
|
|
57
57
|
logs,
|
|
58
|
+
featureFlags,
|
|
58
59
|
} = await normalizeOpts(optsA)
|
|
59
60
|
|
|
60
61
|
const { siteInfo, accounts, addons } = await getSiteInfo({ api, siteId, mode, testOpts })
|
|
@@ -79,6 +80,7 @@ export const resolveConfig = async function (opts) {
|
|
|
79
80
|
inlineConfig: inlineConfigA,
|
|
80
81
|
baseRelDir: baseRelDirA,
|
|
81
82
|
logs,
|
|
83
|
+
featureFlags,
|
|
82
84
|
})
|
|
83
85
|
|
|
84
86
|
const env = await getEnv({
|
|
@@ -147,6 +149,7 @@ const loadConfig = async function ({
|
|
|
147
149
|
inlineConfig,
|
|
148
150
|
baseRelDir,
|
|
149
151
|
logs,
|
|
152
|
+
featureFlags,
|
|
150
153
|
}) {
|
|
151
154
|
const initialBase = getInitialBase({ repositoryRoot, defaultConfig, inlineConfig })
|
|
152
155
|
const { configPath, config, buildDir, base, redirectsPath, headersPath } = await getFullConfig({
|
|
@@ -160,6 +163,7 @@ const loadConfig = async function ({
|
|
|
160
163
|
baseRelDir,
|
|
161
164
|
configBase: initialBase,
|
|
162
165
|
logs,
|
|
166
|
+
featureFlags,
|
|
163
167
|
})
|
|
164
168
|
|
|
165
169
|
// No second pass needed if:
|
|
@@ -190,6 +194,7 @@ const loadConfig = async function ({
|
|
|
190
194
|
configBase: base,
|
|
191
195
|
base,
|
|
192
196
|
logs,
|
|
197
|
+
featureFlags,
|
|
193
198
|
})
|
|
194
199
|
return {
|
|
195
200
|
configPath: configPathA,
|
|
@@ -213,6 +218,7 @@ const getFullConfig = async function ({
|
|
|
213
218
|
configBase,
|
|
214
219
|
base,
|
|
215
220
|
logs,
|
|
221
|
+
featureFlags,
|
|
216
222
|
}) {
|
|
217
223
|
const configPath = await getConfigPath({ configOpt, cwd, repositoryRoot, configBase })
|
|
218
224
|
|
|
@@ -232,9 +238,9 @@ const getFullConfig = async function ({
|
|
|
232
238
|
base: baseA,
|
|
233
239
|
} = await resolveFiles({ config: configA, repositoryRoot, base, baseRelDir })
|
|
234
240
|
const headersPath = getHeadersPath(configB)
|
|
235
|
-
const configC = await addHeaders(configB, headersPath, logs)
|
|
241
|
+
const configC = await addHeaders({ config: configB, headersPath, logs, featureFlags })
|
|
236
242
|
const redirectsPath = getRedirectsPath(configC)
|
|
237
|
-
const configD = await addRedirects(configC, redirectsPath, logs)
|
|
243
|
+
const configD = await addRedirects({ config: configC, redirectsPath, logs, featureFlags })
|
|
238
244
|
return { configPath, config: configD, buildDir, base: baseA, redirectsPath, headersPath }
|
|
239
245
|
} catch (error) {
|
|
240
246
|
const configName = configPath === undefined ? '' : ` file ${configPath}`
|
package/src/mutations/update.js
CHANGED
|
@@ -16,7 +16,7 @@ import { applyMutations } from './apply.js'
|
|
|
16
16
|
// If `netlify.toml` does not exist, creates it. Otherwise, merges the changes.
|
|
17
17
|
export const updateConfig = async function (
|
|
18
18
|
configMutations,
|
|
19
|
-
{ buildDir, configPath, headersPath, redirectsPath, context, branch, logs },
|
|
19
|
+
{ buildDir, configPath, headersPath, redirectsPath, context, branch, logs, featureFlags },
|
|
20
20
|
) {
|
|
21
21
|
if (configMutations.length === 0) {
|
|
22
22
|
return
|
|
@@ -25,8 +25,8 @@ export const updateConfig = async function (
|
|
|
25
25
|
const inlineConfig = applyMutations({}, configMutations)
|
|
26
26
|
const normalizedInlineConfig = ensureConfigPriority(inlineConfig, context, branch)
|
|
27
27
|
const updatedConfig = await mergeWithConfig(normalizedInlineConfig, configPath)
|
|
28
|
-
const configWithHeaders = await addHeaders(updatedConfig, headersPath, logs)
|
|
29
|
-
const finalConfig = await addRedirects(configWithHeaders, redirectsPath, logs)
|
|
28
|
+
const configWithHeaders = await addHeaders({ config: updatedConfig, headersPath, logs, featureFlags })
|
|
29
|
+
const finalConfig = await addRedirects({ config: configWithHeaders, redirectsPath, logs, featureFlags })
|
|
30
30
|
const simplifiedConfig = simplifyConfig(finalConfig)
|
|
31
31
|
await backupConfig({ buildDir, configPath, headersPath, redirectsPath })
|
|
32
32
|
await Promise.all([
|
package/src/redirects.js
CHANGED
|
@@ -12,11 +12,17 @@ export const getRedirectsPath = function ({ build: { publish } }) {
|
|
|
12
12
|
const REDIRECTS_FILENAME = '_redirects'
|
|
13
13
|
|
|
14
14
|
// Add `config.redirects`
|
|
15
|
-
export const addRedirects = async function ({
|
|
15
|
+
export const addRedirects = async function ({
|
|
16
|
+
config: { redirects: configRedirects, ...config },
|
|
17
|
+
redirectsPath,
|
|
18
|
+
logs,
|
|
19
|
+
featureFlags,
|
|
20
|
+
}) {
|
|
16
21
|
const { redirects, errors } = await parseAllRedirects({
|
|
17
22
|
redirectsFiles: [redirectsPath],
|
|
18
23
|
configRedirects,
|
|
19
24
|
minimal: true,
|
|
25
|
+
featureFlags,
|
|
20
26
|
})
|
|
21
27
|
warnRedirectsParsing(logs, errors)
|
|
22
28
|
return { ...config, redirects }
|