@netlify/config 18.2.4 → 18.2.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.
Files changed (56) hide show
  1. package/bin.js +5 -0
  2. package/lib/api/build_settings.js +20 -33
  3. package/lib/api/client.js +10 -13
  4. package/lib/api/site_info.js +48 -56
  5. package/lib/base.js +10 -18
  6. package/lib/bin/flags.js +134 -142
  7. package/lib/bin/main.js +49 -63
  8. package/lib/build_dir.js +11 -15
  9. package/lib/cached_config.js +14 -17
  10. package/lib/case.js +16 -35
  11. package/lib/context.js +62 -84
  12. package/lib/default.js +18 -22
  13. package/lib/env/envelope.js +23 -23
  14. package/lib/env/git.js +18 -18
  15. package/lib/env/main.js +127 -179
  16. package/lib/error.js +19 -27
  17. package/lib/events.js +18 -19
  18. package/lib/files.js +63 -87
  19. package/lib/functions_config.js +36 -52
  20. package/lib/headers.js +17 -27
  21. package/lib/inline_config.js +6 -7
  22. package/lib/log/cleanup.js +54 -82
  23. package/lib/log/logger.js +25 -36
  24. package/lib/log/main.js +31 -40
  25. package/lib/log/messages.js +56 -95
  26. package/lib/log/options.js +24 -38
  27. package/lib/log/serialize.js +3 -4
  28. package/lib/log/theme.js +10 -11
  29. package/lib/main.js +188 -263
  30. package/lib/merge.js +25 -35
  31. package/lib/merge_normalize.js +17 -24
  32. package/lib/mutations/apply.js +53 -65
  33. package/lib/mutations/config_prop_name.js +6 -8
  34. package/lib/mutations/update.js +79 -98
  35. package/lib/normalize.js +24 -28
  36. package/lib/options/base.js +39 -51
  37. package/lib/options/branch.js +23 -26
  38. package/lib/options/feature_flags.js +7 -10
  39. package/lib/options/main.js +76 -96
  40. package/lib/options/repository_root.js +11 -16
  41. package/lib/origin.js +22 -29
  42. package/lib/parse.js +42 -55
  43. package/lib/path.js +29 -40
  44. package/lib/redirects.js +16 -26
  45. package/lib/simplify.js +66 -92
  46. package/lib/utils/group.js +5 -6
  47. package/lib/utils/remove_falsy.js +9 -13
  48. package/lib/utils/set.js +19 -25
  49. package/lib/utils/toml.js +13 -16
  50. package/lib/validate/context.js +24 -43
  51. package/lib/validate/example.js +20 -27
  52. package/lib/validate/helpers.js +17 -23
  53. package/lib/validate/identical.js +8 -12
  54. package/lib/validate/main.js +83 -127
  55. package/lib/validate/validations.js +243 -257
  56. package/package.json +13 -8
@@ -1,15 +1,12 @@
1
1
  // From CLI `--featureFlags=a,b,c` to programmatic `{ a: true, b: true, c: true }`
2
2
  export const normalizeCliFeatureFlags = function (cliFeatureFlags) {
3
- return Object.assign({}, ...cliFeatureFlags.split(',').filter(isNotEmpty).map(getFeatureFlag))
4
- }
5
-
3
+ return Object.assign({}, ...cliFeatureFlags.split(',').filter(isNotEmpty).map(getFeatureFlag));
4
+ };
6
5
  const isNotEmpty = function (name) {
7
- return name.trim() !== ''
8
- }
9
-
6
+ return name.trim() !== '';
7
+ };
10
8
  const getFeatureFlag = function (name) {
11
- return { [name]: true }
12
- }
13
-
9
+ return { [name]: true };
10
+ };
14
11
  // Default values for feature flags
15
- export const DEFAULT_FEATURE_FLAGS = {}
12
+ export const DEFAULT_FEATURE_FLAGS = {};
@@ -1,111 +1,91 @@
1
- import { resolve } from 'path'
2
- import process from 'process'
3
-
4
- import { isDirectory } from 'path-type'
5
-
6
- import { throwUserError } from '../error.js'
7
- import { getBufferLogs } from '../log/logger.js'
8
- import { logOpts } from '../log/main.js'
9
- import { removeFalsy } from '../utils/remove_falsy.js'
10
-
11
- import { getBaseOverride } from './base.js'
12
- import { getBranch } from './branch.js'
13
- import { DEFAULT_FEATURE_FLAGS } from './feature_flags.js'
14
- import { getRepositoryRoot } from './repository_root.js'
15
-
1
+ import { resolve } from 'path';
2
+ import process from 'process';
3
+ import { isDirectory } from 'path-type';
4
+ import { throwUserError } from '../error.js';
5
+ import { getBufferLogs } from '../log/logger.js';
6
+ import { logOpts } from '../log/main.js';
7
+ import { removeFalsy } from '../utils/remove_falsy.js';
8
+ import { getBaseOverride } from './base.js';
9
+ import { getBranch } from './branch.js';
10
+ import { DEFAULT_FEATURE_FLAGS } from './feature_flags.js';
11
+ import { getRepositoryRoot } from './repository_root.js';
16
12
  // Assign default options
17
13
  export const addDefaultOpts = function (opts = {}) {
18
- const rawOpts = removeFalsy(opts)
19
-
20
- const defaultOpts = getDefaultOpts(rawOpts)
21
- const mergedOpts = {
22
- ...defaultOpts,
23
- ...rawOpts,
24
- featureFlags: { ...defaultOpts.featureFlags, ...rawOpts.featureFlags },
25
- }
26
- const normalizedOpts = removeFalsy(mergedOpts)
27
-
28
- const logs = getBufferLogs(normalizedOpts)
29
- const normalizedOptsA = { ...normalizedOpts, logs }
30
-
31
- logOpts(rawOpts, normalizedOptsA)
32
-
33
- return normalizedOptsA
34
- }
35
-
14
+ const rawOpts = removeFalsy(opts);
15
+ const defaultOpts = getDefaultOpts(rawOpts);
16
+ const mergedOpts = {
17
+ ...defaultOpts,
18
+ ...rawOpts,
19
+ featureFlags: { ...defaultOpts.featureFlags, ...rawOpts.featureFlags },
20
+ };
21
+ const normalizedOpts = removeFalsy(mergedOpts);
22
+ const logs = getBufferLogs(normalizedOpts);
23
+ const normalizedOptsA = { ...normalizedOpts, logs };
24
+ logOpts(rawOpts, normalizedOptsA);
25
+ return normalizedOptsA;
26
+ };
36
27
  const getDefaultOpts = function ({ env: envOpt = {}, cwd: cwdOpt, defaultConfig = {} }) {
37
- const combinedEnv = { ...process.env, ...envOpt }
38
- return {
39
- defaultConfig,
40
- ...getDefaultCwd(cwdOpt),
41
- env: envOpt,
42
- context: combinedEnv.CONTEXT || 'production',
43
- branch: combinedEnv.BRANCH,
44
- host: combinedEnv.NETLIFY_API_HOST,
45
- token: combinedEnv.NETLIFY_AUTH_TOKEN,
46
- siteId: combinedEnv.NETLIFY_SITE_ID,
47
- deployId: combinedEnv.DEPLOY_ID || DEFAULT_DEPLOY_ID,
48
- buildId: combinedEnv.BUILD_ID || DEFAULT_BUILD_ID,
49
- mode: 'require',
50
- offline: false,
51
- debug: getDefaultDebug(combinedEnv, defaultConfig),
52
- buffer: false,
53
- featureFlags: DEFAULT_FEATURE_FLAGS,
54
- inlineConfig: {},
55
- configMutations: [],
56
- }
57
- }
58
-
28
+ const combinedEnv = { ...process.env, ...envOpt };
29
+ return {
30
+ defaultConfig,
31
+ ...getDefaultCwd(cwdOpt),
32
+ env: envOpt,
33
+ context: combinedEnv.CONTEXT || 'production',
34
+ branch: combinedEnv.BRANCH,
35
+ host: combinedEnv.NETLIFY_API_HOST,
36
+ token: combinedEnv.NETLIFY_AUTH_TOKEN,
37
+ siteId: combinedEnv.NETLIFY_SITE_ID,
38
+ deployId: combinedEnv.DEPLOY_ID || DEFAULT_DEPLOY_ID,
39
+ buildId: combinedEnv.BUILD_ID || DEFAULT_BUILD_ID,
40
+ mode: 'require',
41
+ offline: false,
42
+ debug: getDefaultDebug(combinedEnv, defaultConfig),
43
+ buffer: false,
44
+ featureFlags: DEFAULT_FEATURE_FLAGS,
45
+ inlineConfig: {},
46
+ configMutations: [],
47
+ };
48
+ };
59
49
  // Local builds do not have any deploys, so some dummy ids are used instead
60
- const DEFAULT_DEPLOY_ID = '0'
61
- const DEFAULT_BUILD_ID = '0'
62
-
50
+ const DEFAULT_DEPLOY_ID = '0';
51
+ const DEFAULT_BUILD_ID = '0';
63
52
  // --debug can be set using an environment variable `NETLIFY_BUILD_DEBUG` either
64
53
  // locally or in the UI build settings
65
54
  const getDefaultDebug = function (combinedEnv, { build: { environment = {} } = {} }) {
66
- return Boolean(combinedEnv.NETLIFY_BUILD_DEBUG || environment.NETLIFY_BUILD_DEBUG)
67
- }
68
-
55
+ return Boolean(combinedEnv.NETLIFY_BUILD_DEBUG || environment.NETLIFY_BUILD_DEBUG);
56
+ };
69
57
  // `process.cwd()` can throw, so only call it when needed
70
58
  const getDefaultCwd = function (cwdOpt) {
71
- if (cwdOpt !== undefined) {
72
- return {}
73
- }
74
-
75
- const cwd = process.cwd()
76
- return { cwd }
77
- }
78
-
59
+ if (cwdOpt !== undefined) {
60
+ return {};
61
+ }
62
+ const cwd = process.cwd();
63
+ return { cwd };
64
+ };
79
65
  // Normalize options
80
66
  export const normalizeOpts = async function (opts) {
81
- const repositoryRoot = await getRepositoryRoot(opts)
82
- const optsA = { ...opts, repositoryRoot }
83
-
84
- const branch = await getBranch(optsA)
85
- const optsB = { ...optsA, branch }
86
-
87
- const optsC = removeFalsy(optsB)
88
- const optsD = await normalizeDirs(optsC)
89
-
90
- const baseOverride = await getBaseOverride(optsD)
91
- const optsE = { ...baseOverride, ...optsD }
92
- return optsE
93
- }
94
-
67
+ const repositoryRoot = await getRepositoryRoot(opts);
68
+ const optsA = { ...opts, repositoryRoot };
69
+ const branch = await getBranch(optsA);
70
+ const optsB = { ...optsA, branch };
71
+ const optsC = removeFalsy(optsB);
72
+ const optsD = await normalizeDirs(optsC);
73
+ const baseOverride = await getBaseOverride(optsD);
74
+ const optsE = { ...baseOverride, ...optsD };
75
+ return optsE;
76
+ };
95
77
  // Verify that options point to existing directories.
96
78
  // Also resolve them to absolute file paths.
97
79
  const normalizeDirs = async function (opts) {
98
- const dirOpts = await Promise.all(DIR_OPTIONS.map((optName) => normalizeDir(opts, optName)))
99
- return Object.assign({}, opts, ...dirOpts)
100
- }
101
-
102
- const DIR_OPTIONS = ['cwd', 'repositoryRoot']
103
-
80
+ const dirOpts = await Promise.all(DIR_OPTIONS.map((optName) => normalizeDir(opts, optName)));
81
+ return Object.assign({}, opts, ...dirOpts);
82
+ };
83
+ const DIR_OPTIONS = ['cwd', 'repositoryRoot'];
104
84
  const normalizeDir = async function (opts, optName) {
105
- const path = opts[optName]
106
- const resolvedPath = resolve(path)
107
- if (!(await isDirectory(path))) {
108
- throwUserError(`Option '${optName}' points to a non-existing directory: ${resolvedPath}`)
109
- }
110
- return { [optName]: resolvedPath }
111
- }
85
+ const path = opts[optName];
86
+ const resolvedPath = resolve(path);
87
+ if (!(await isDirectory(path))) {
88
+ throwUserError(`Option '${optName}' points to a non-existing directory: ${resolvedPath}`);
89
+ }
90
+ return { [optName]: resolvedPath };
91
+ };
@@ -1,21 +1,16 @@
1
- import { dirname } from 'path'
2
-
3
- import { findUp } from 'find-up'
4
-
1
+ import { dirname } from 'path';
2
+ import { findUp } from 'find-up';
5
3
  // Find out repository root among (in priority order):
6
4
  // - `repositoryRoot` option
7
5
  // - find a `.git` directory up from `cwd`
8
6
  // - `cwd` (fallback)
9
7
  export const getRepositoryRoot = async function ({ repositoryRoot, cwd }) {
10
- if (repositoryRoot !== undefined) {
11
- return repositoryRoot
12
- }
13
-
14
- const repositoryRootA = await findUp('.git', { cwd, type: 'directory' })
15
-
16
- if (repositoryRootA === undefined) {
17
- return cwd
18
- }
19
-
20
- return dirname(repositoryRootA)
21
- }
8
+ if (repositoryRoot !== undefined) {
9
+ return repositoryRoot;
10
+ }
11
+ const repositoryRootA = await findUp('.git', { cwd, type: 'directory' });
12
+ if (repositoryRootA === undefined) {
13
+ return cwd;
14
+ }
15
+ return dirname(repositoryRootA);
16
+ };
package/lib/origin.js CHANGED
@@ -1,38 +1,31 @@
1
- import { isTruthy } from './utils/remove_falsy.js'
2
-
1
+ import { isTruthy } from './utils/remove_falsy.js';
3
2
  // `build.commandOrigin`, `build.publishOrigin` and `plugins[*].origin` constants
4
- export const UI_ORIGIN = 'ui'
5
- export const CONFIG_ORIGIN = 'config'
6
- export const DEFAULT_ORIGIN = 'default'
7
- export const INLINE_ORIGIN = 'inline'
8
-
3
+ export const UI_ORIGIN = 'ui';
4
+ export const CONFIG_ORIGIN = 'config';
5
+ export const DEFAULT_ORIGIN = 'default';
6
+ export const INLINE_ORIGIN = 'inline';
9
7
  // Add `build.commandOrigin`, `build.publishOrigin` and `plugins[*].origin`.
10
8
  // This shows whether those properties came from the `ui` or from the `config`.
11
9
  export const addOrigins = function (config, origin) {
12
- const configA = addBuildCommandOrigin({ config, origin })
13
- const configB = addBuildPublishOrigin({ config: configA, origin })
14
- const configC = addConfigPluginOrigin({ config: configB, origin })
15
- const configD = addHeadersOrigin({ config: configC, origin })
16
- const configE = addRedirectsOrigin({ config: configD, origin })
17
- return configE
18
- }
19
-
10
+ const configA = addBuildCommandOrigin({ config, origin });
11
+ const configB = addBuildPublishOrigin({ config: configA, origin });
12
+ const configC = addConfigPluginOrigin({ config: configB, origin });
13
+ const configD = addHeadersOrigin({ config: configC, origin });
14
+ const configE = addRedirectsOrigin({ config: configD, origin });
15
+ return configE;
16
+ };
20
17
  const addBuildCommandOrigin = function ({ config, config: { build = {} }, origin }) {
21
- return isTruthy(build.command) ? { ...config, build: { ...build, commandOrigin: origin } } : config
22
- }
23
-
18
+ return isTruthy(build.command) ? { ...config, build: { ...build, commandOrigin: origin } } : config;
19
+ };
24
20
  const addBuildPublishOrigin = function ({ config, config: { build = {} }, origin }) {
25
- return isTruthy(build.publish) ? { ...config, build: { ...build, publishOrigin: origin } } : config
26
- }
27
-
21
+ return isTruthy(build.publish) ? { ...config, build: { ...build, publishOrigin: origin } } : config;
22
+ };
28
23
  const addConfigPluginOrigin = function ({ config, config: { plugins }, origin }) {
29
- return Array.isArray(plugins) ? { ...config, plugins: plugins.map((plugin) => ({ ...plugin, origin })) } : config
30
- }
31
-
24
+ return Array.isArray(plugins) ? { ...config, plugins: plugins.map((plugin) => ({ ...plugin, origin })) } : config;
25
+ };
32
26
  const addHeadersOrigin = function ({ config, config: { headers }, origin }) {
33
- return isTruthy(headers) ? { ...config, headersOrigin: origin } : config
34
- }
35
-
27
+ return isTruthy(headers) ? { ...config, headersOrigin: origin } : config;
28
+ };
36
29
  const addRedirectsOrigin = function ({ config, config: { redirects }, origin }) {
37
- return isTruthy(redirects) ? { ...config, redirectsOrigin: origin } : config
38
- }
30
+ return isTruthy(redirects) ? { ...config, redirectsOrigin: origin } : config;
31
+ };
package/lib/parse.js CHANGED
@@ -1,69 +1,56 @@
1
- import { promises as fs } from 'fs'
2
-
3
- import { pathExists } from 'path-exists'
4
-
5
- import { throwUserError } from './error.js'
6
- import { throwOnInvalidTomlSequence } from './log/messages.js'
7
- import { parseToml } from './utils/toml.js'
8
-
1
+ import { promises as fs } from 'fs';
2
+ import { pathExists } from 'path-exists';
3
+ import { throwUserError } from './error.js';
4
+ import { throwOnInvalidTomlSequence } from './log/messages.js';
5
+ import { parseToml } from './utils/toml.js';
9
6
  // Load the configuration file and parse it (TOML)
10
7
  export const parseConfig = async function (configPath) {
11
- if (configPath === undefined) {
12
- return {}
13
- }
14
-
15
- if (!(await pathExists(configPath))) {
16
- throwUserError('Configuration file does not exist')
17
- }
18
-
19
- return await readConfigPath(configPath)
20
- }
21
-
8
+ if (configPath === undefined) {
9
+ return {};
10
+ }
11
+ if (!(await pathExists(configPath))) {
12
+ throwUserError('Configuration file does not exist');
13
+ }
14
+ return await readConfigPath(configPath);
15
+ };
22
16
  // Same but `configPath` is required and `configPath` might point to a
23
17
  // non-existing file.
24
18
  export const parseOptionalConfig = async function (configPath) {
25
- if (!(await pathExists(configPath))) {
26
- return {}
27
- }
28
-
29
- return await readConfigPath(configPath)
30
- }
31
-
19
+ if (!(await pathExists(configPath))) {
20
+ return {};
21
+ }
22
+ return await readConfigPath(configPath);
23
+ };
32
24
  const readConfigPath = async function (configPath) {
33
- const configString = await readConfig(configPath)
34
-
35
- validateTomlBlackslashes(configString)
36
-
37
- try {
38
- return parseToml(configString)
39
- } catch (error) {
40
- throwUserError('Could not parse configuration file', error)
41
- }
42
- }
43
-
25
+ const configString = await readConfig(configPath);
26
+ validateTomlBlackslashes(configString);
27
+ try {
28
+ return parseToml(configString);
29
+ }
30
+ catch (error) {
31
+ throwUserError('Could not parse configuration file', error);
32
+ }
33
+ };
44
34
  // Reach the configuration file's raw content
45
35
  const readConfig = async function (configPath) {
46
- try {
47
- return await fs.readFile(configPath, 'utf8')
48
- } catch (error) {
49
- throwUserError('Could not read configuration file', error)
50
- }
51
- }
52
-
36
+ try {
37
+ return await fs.readFile(configPath, 'utf8');
38
+ }
39
+ catch (error) {
40
+ throwUserError('Could not read configuration file', error);
41
+ }
42
+ };
53
43
  const validateTomlBlackslashes = function (configString) {
54
- const result = INVALID_TOML_BLACKSLASH.exec(configString)
55
- if (result === null) {
56
- return
57
- }
58
-
59
- const [, invalidTripleSequence, invalidSequence = invalidTripleSequence] = result
60
- throwOnInvalidTomlSequence(invalidSequence)
61
- }
62
-
44
+ const result = INVALID_TOML_BLACKSLASH.exec(configString);
45
+ if (result === null) {
46
+ return;
47
+ }
48
+ const [, invalidTripleSequence, invalidSequence = invalidTripleSequence] = result;
49
+ throwOnInvalidTomlSequence(invalidSequence);
50
+ };
63
51
  // The TOML specification forbids unrecognized backslash sequences. However,
64
52
  // `toml-node` does not respect the specification and do not fail on those.
65
53
  // Therefore, we print a warning message.
66
54
  // This only applies to " and """ strings, not ' nor '''
67
55
  // Also, """ strings can use trailing backslashes.
68
- const INVALID_TOML_BLACKSLASH =
69
- /\n[a-zA-Z]+ *= *(?:(?:""".*(?<!\\)(\\[^"\\btnfruU\n]).*""")|(?:"(?!")[^\n]*(?<!\\)(\\[^"\\btnfruU])[^\n]*"))/su
56
+ const INVALID_TOML_BLACKSLASH = /\n[a-zA-Z]+ *= *(?:(?:""".*(?<!\\)(\\[^"\\btnfruU\n]).*""")|(?:"(?!")[^\n]*(?<!\\)(\\[^"\\btnfruU])[^\n]*"))/su;
package/lib/path.js CHANGED
@@ -1,52 +1,41 @@
1
- import { resolve } from 'path'
2
-
3
- import { findUp } from 'find-up'
4
- import pLocate from 'p-locate'
5
- import { pathExists } from 'path-exists'
6
-
1
+ import { resolve } from 'path';
2
+ import { findUp } from 'find-up';
3
+ import pLocate from 'p-locate';
4
+ import { pathExists } from 'path-exists';
7
5
  // Configuration location can be:
8
6
  // - a local path with the --config CLI flag
9
7
  // - a `netlify.*` file in the `repositoryRoot/{base}`
10
8
  // - a `netlify.*` file in the `repositoryRoot`
11
9
  // - a `netlify.*` file in the current directory or any parent
12
10
  export const getConfigPath = async function ({ configOpt, cwd, repositoryRoot, configBase }) {
13
- const configPath = await pLocate(
14
- [
15
- searchConfigOpt(cwd, configOpt),
16
- searchBaseConfigFile(repositoryRoot, configBase),
17
- searchConfigFile(repositoryRoot),
18
- findUp(FILENAME, { cwd }),
19
- ],
20
- Boolean,
21
- )
22
- return configPath
23
- }
24
-
11
+ const configPath = await pLocate([
12
+ searchConfigOpt(cwd, configOpt),
13
+ searchBaseConfigFile(repositoryRoot, configBase),
14
+ searchConfigFile(repositoryRoot),
15
+ findUp(FILENAME, { cwd }),
16
+ ], Boolean);
17
+ return configPath;
18
+ };
25
19
  // --config CLI flag
26
20
  const searchConfigOpt = function (cwd, configOpt) {
27
- if (configOpt === undefined) {
28
- return
29
- }
30
-
31
- return resolve(cwd, configOpt)
32
- }
33
-
21
+ if (configOpt === undefined) {
22
+ return;
23
+ }
24
+ return resolve(cwd, configOpt);
25
+ };
34
26
  // Look for `repositoryRoot/{base}/netlify.*`
35
27
  const searchBaseConfigFile = function (repositoryRoot, configBase) {
36
- if (configBase === undefined) {
37
- return
38
- }
39
-
40
- return searchConfigFile(configBase)
41
- }
42
-
28
+ if (configBase === undefined) {
29
+ return;
30
+ }
31
+ return searchConfigFile(configBase);
32
+ };
43
33
  // Look for several file extensions for `netlify.*`
44
34
  const searchConfigFile = async function (cwd) {
45
- const path = resolve(cwd, FILENAME)
46
- if (!(await pathExists(path))) {
47
- return
48
- }
49
- return path
50
- }
51
-
52
- const FILENAME = 'netlify.toml'
35
+ const path = resolve(cwd, FILENAME);
36
+ if (!(await pathExists(path))) {
37
+ return;
38
+ }
39
+ return path;
40
+ };
41
+ const FILENAME = 'netlify.toml';
package/lib/redirects.js CHANGED
@@ -1,29 +1,19 @@
1
- import { resolve } from 'path'
2
-
3
- import { parseAllRedirects } from 'netlify-redirect-parser'
4
-
5
- import { warnRedirectsParsing } from './log/messages.js'
6
-
1
+ import { resolve } from 'path';
2
+ import { parseAllRedirects } from 'netlify-redirect-parser';
3
+ import { warnRedirectsParsing } from './log/messages.js';
7
4
  // Retrieve path to `_redirects` file (even if it does not exist yet)
8
5
  export const getRedirectsPath = function ({ build: { publish } }) {
9
- return resolve(publish, REDIRECTS_FILENAME)
10
- }
11
-
12
- const REDIRECTS_FILENAME = '_redirects'
13
-
6
+ return resolve(publish, REDIRECTS_FILENAME);
7
+ };
8
+ const REDIRECTS_FILENAME = '_redirects';
14
9
  // Add `config.redirects`
15
- export const addRedirects = async function ({
16
- config: { redirects: configRedirects, ...config },
17
- redirectsPath,
18
- logs,
19
- featureFlags,
20
- }) {
21
- const { redirects, errors } = await parseAllRedirects({
22
- redirectsFiles: [redirectsPath],
23
- configRedirects,
24
- minimal: true,
25
- featureFlags,
26
- })
27
- warnRedirectsParsing(logs, errors)
28
- return { ...config, redirects }
29
- }
10
+ export const addRedirects = async function ({ config: { redirects: configRedirects, ...config }, redirectsPath, logs, featureFlags, }) {
11
+ const { redirects, errors } = await parseAllRedirects({
12
+ redirectsFiles: [redirectsPath],
13
+ configRedirects,
14
+ minimal: true,
15
+ featureFlags,
16
+ });
17
+ warnRedirectsParsing(logs, errors);
18
+ return { ...config, redirects };
19
+ };