@netlify/config 20.3.3 → 20.3.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/lib/bin/flags.js CHANGED
@@ -27,7 +27,7 @@ Defaults to any netlify.toml in the git repository root directory or the base di
27
27
  defaultConfig: {
28
28
  string: true,
29
29
  describe: `JSON configuration object containing default values.
30
- Each configuration default value is used unless overriden through the main configuration file.
30
+ Each configuration default value is used unless overridden through the main configuration file.
31
31
  Default: none.`,
32
32
  coerce: jsonParse,
33
33
  hidden: true,
@@ -60,7 +60,7 @@ Default: none.`,
60
60
  array: true,
61
61
  describe: `Array of changes to apply to the configuration.
62
62
  Each change must be an object with three properties:
63
- - "keys": array of keys targetting the property to change
63
+ - "keys": array of keys targeting the property to change
64
64
  - "value": new value of that property
65
65
  - "event": build event when this change was applied, e.g. "onPreBuild"
66
66
  Default: empty array.`,
package/lib/build_dir.js CHANGED
@@ -11,7 +11,7 @@ export const getBuildDir = async function (repositoryRoot, base) {
11
11
  return buildDir;
12
12
  };
13
13
  // The build directory is used as the current directory of build commands and
14
- // build plugins. Therefore it must exist.
14
+ // build plugins. Therefore, it must exist.
15
15
  // We already check `repositoryRoot` earlier in the code, so only need to check
16
16
  // `buildDir` when it is the base directory instead.
17
17
  const checkBuildDir = async function (buildDir, repositoryRoot) {
package/lib/context.js CHANGED
@@ -63,7 +63,7 @@ const isEdgeFunctionsConfig = function (key, value) {
63
63
  return key === 'edge_functions' && Array.isArray(value);
64
64
  };
65
65
  // Ensure that `inlineConfig` has higher priority than context properties by
66
- // assigining it to `context.*`. Still keep it at the top-level as well since
66
+ // assigning it to `context.*`. Still keep it at the top-level as well since
67
67
  // some properties are not handled context-sensitively by the API.
68
68
  // Takes into account that `context.{context}.build.*` is the same as
69
69
  // `context.{context}.*`
package/lib/default.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { addBuildSettings } from './api/build_settings.js';
2
2
  import { logDefaultConfig } from './log/main.js';
3
- // Retrieve default configuration file. It has less priority and it also does
3
+ // Retrieve default configuration file. It has less priority, and it also does
4
4
  // not get normalized, merged with contexts, etc.
5
5
  export const parseDefaultConfig = function ({ defaultConfig, base, baseRelDir, siteInfo, logs, debug }) {
6
6
  const defaultConfigB = addDefaultConfigBase(defaultConfig, base);
@@ -21,7 +21,7 @@ const addDefaultConfigBase = function (defaultConfig, base) {
21
21
  const { build = {} } = defaultConfig;
22
22
  return { ...defaultConfig, build: { ...build, base } };
23
23
  };
24
- // `baseRelDir` should default to `true` only if the option was not passed and
24
+ // `baseRelDir` should default to `true` only if the option was not passed, and
25
25
  // it could be retrieved from the `siteInfo`, which is why the default value
26
26
  // is assigned later than other properties.
27
27
  const DEFAULT_BASE_REL_DIR = true;
package/lib/files.js CHANGED
@@ -12,7 +12,7 @@ export const resolveConfigPaths = function ({ config, repositoryRoot, buildDir,
12
12
  const configB = addDefaultPaths(configA, repositoryRoot, baseRel);
13
13
  return configB;
14
14
  };
15
- // All file paths in the configuration file are are relative to `buildDir`
15
+ // All file paths in the configuration file are relative to `buildDir`
16
16
  // (if `baseRelDir` is `true`).
17
17
  const FILE_PATH_CONFIG_PROPS = [
18
18
  'functionsDirectory',
@@ -44,7 +44,7 @@ export const resolvePath = function (repositoryRoot, baseRel, originalPath, prop
44
44
  // In that case, those are actually relative paths not absolute.
45
45
  const LEADING_SLASH_REGEXP = /^\/+/;
46
46
  // We ensure all file paths are within the repository root directory.
47
- // However we allow file paths to be outside of the build directory, since this
47
+ // However, we allow file paths to be outside the build directory, since this
48
48
  // can be convenient in monorepo setups.
49
49
  const validateInsideRoot = function (originalPath, path, repositoryRoot, propName) {
50
50
  if (relative(repositoryRoot, path).startsWith('..') || getWindowsDrive(repositoryRoot) !== getWindowsDrive(path)) {
package/lib/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { DEV_EVENTS, EVENTS } from './events.js';
2
+ export { cleanupConfig } from './log/cleanup.js';
3
+ export { resolveConfig } from './main.js';
4
+ export { applyMutations } from './mutations/apply.js';
5
+ export { restoreConfig, updateConfig } from './mutations/update.js';
package/lib/log/logger.js CHANGED
@@ -21,7 +21,7 @@ export const log = function (logs, string, { color } = {}) {
21
21
  }
22
22
  console.warn(stringB);
23
23
  };
24
- // We need to add a zero width space character in empty lines. Otherwise the
24
+ // We need to add a zero width space character in empty lines. Otherwise, the
25
25
  // buildbot removes those due to a bug: https://github.com/netlify/buildbot/issues/595
26
26
  const EMPTY_LINES_REGEXP = /^\s*$/gm;
27
27
  const EMPTY_LINE = '\u{200B}';
package/lib/main.js CHANGED
@@ -17,9 +17,6 @@ import { UI_ORIGIN, CONFIG_ORIGIN, INLINE_ORIGIN } from './origin.js';
17
17
  import { parseConfig } from './parse.js';
18
18
  import { getConfigPath } from './path.js';
19
19
  import { getRedirectsPath, addRedirects } from './redirects.js';
20
- export { DEV_EVENTS, EVENTS } from './events.js';
21
- export { cleanupConfig } from './log/cleanup.js';
22
- export { updateConfig, restoreConfig } from './mutations/update.js';
23
20
  // Load the configuration file.
24
21
  // Takes an optional configuration file path as input and return the resolved
25
22
  // `config` together with related properties such as the `configPath`.
package/lib/merge.js CHANGED
@@ -13,7 +13,7 @@ export const mergeConfigs = function (configs) {
13
13
  const removeUndefinedProps = function ({ build = {}, ...config }) {
14
14
  return removeUndefined({ ...config, build: removeUndefined(build) });
15
15
  };
16
- // By default `deepmerge` concatenates arrays. We use the `arrayMerge` option
16
+ // By default, `deepmerge` concatenates arrays. We use the `arrayMerge` option
17
17
  // to remove this behavior. Also, we merge some array properties differently,
18
18
  // such as `plugins`.
19
19
  const arrayMerge = function (arrayA, arrayB) {
@@ -1,14 +1,13 @@
1
- // Retrieve normalized property name
1
+ /** Properties with dynamic children */
2
+ const DYNAMIC_OBJECT_PROPS = new Set(['build.services', 'build.environment', 'functions', 'functions.*']);
3
+ /** Retrieve normalized property name */
2
4
  export const getPropName = function (keys) {
3
- return keys.reduce(normalizeDynamicProp, '');
4
- };
5
- // Some properties are user-defined, i.e. we need to replace them with a "*" token
6
- // Check if a property name is dynamic, such as `functions.{functionName}`, or
7
- // is an array index.
8
- // In those cases, we replace it by "*".
9
- const normalizeDynamicProp = function (propName, key) {
10
- const normalizedKey = Number.isInteger(key) || DYNAMIC_OBJECT_PROPS.has(propName) ? '*' : String(key);
11
- return propName === '' ? normalizedKey : `${propName}.${normalizedKey}`;
5
+ // Some properties are user-defined, i.e. we need to replace them with a "*" token
6
+ // Check if a property name is dynamic, such as `functions.{functionName}`, or
7
+ // is an array index.
8
+ // In those cases, we replace it by "*".
9
+ return keys.reduce((propName, key) => {
10
+ const normalizedKey = Number.isInteger(key) || DYNAMIC_OBJECT_PROPS.has(propName) ? '*' : String(key);
11
+ return propName === '' ? normalizedKey : `${propName}.${normalizedKey}`;
12
+ }, '');
12
13
  };
13
- // Properties with dynamic children
14
- const DYNAMIC_OBJECT_PROPS = new Set(['build.services', 'build.environment', 'functions', 'functions.*']);
@@ -46,7 +46,7 @@ const deleteSideFile = async function (filePath) {
46
46
  await fs.unlink(filePath);
47
47
  };
48
48
  // Modifications to `netlify.toml` and `_headers/_redirects` are only meant for
49
- // the deploy API call. After it's been performed, we restore their former
49
+ // the deployment API call. After it's been performed, we restore their former
50
50
  // state.
51
51
  // We do this by backing them up inside some sibling directory.
52
52
  const backupConfig = async function ({ buildDir, configPath, headersPath, redirectsPath }) {
package/lib/normalize.js CHANGED
@@ -12,7 +12,7 @@ export const normalizeConfig = function (config) {
12
12
  };
13
13
  // Remove empty strings.
14
14
  // This notably ensures that empty strings in the build command are removed.
15
- // Otherwise those would be run during builds, making the build fail.
15
+ // Otherwise, those would be run during builds, making the build fail.
16
16
  const removeEmpty = function ({ build, ...config }) {
17
17
  return removeFalsy({ ...config, build: removeFalsy(build) });
18
18
  };
@@ -19,7 +19,7 @@ export const getBaseOverride = async function ({ repositoryRoot, cwd }) {
19
19
  // `base` starting with a `/` are relative to `repositoryRoot`, so we cannot
20
20
  // return an absolute path
21
21
  const base = relative(repositoryRoot, dirname(basePath));
22
- // When `base` is explicitely overridden, `baseRelDir: true` makes more sense
22
+ // When `base` is explicitly overridden, `baseRelDir: true` makes more sense
23
23
  // since we want `publish`, `functions` and `edge_functions` to be relative to it.
24
24
  return { base, baseRelDir: true };
25
25
  };
package/lib/utils/toml.js CHANGED
@@ -3,7 +3,7 @@ import tomlify from 'tomlify-j0.4';
3
3
  // Parse from TOML to JavaScript
4
4
  export const parseToml = function (configString) {
5
5
  const config = loadToml(configString);
6
- // `toml.parse()` returns a object with `null` prototype deeply, which can
6
+ // `toml.parse()` returns an object with `null` prototype deeply, which can
7
7
  // sometimes create problems with some utilities. We convert it.
8
8
  // TOML can return Date instances, but JSON will stringify those, and we
9
9
  // don't use Date in netlify.toml, so this should be ok.
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@netlify/config",
3
- "version": "20.3.3",
3
+ "version": "20.3.5",
4
4
  "description": "Netlify config module",
5
5
  "type": "module",
6
- "exports": "./lib/main.js",
7
- "main": "./lib/main.js",
8
- "types": "./lib/main.d.ts",
6
+ "exports": "./lib/index.js",
7
+ "main": "./lib/index.js",
8
+ "types": "./lib/index.d.ts",
9
9
  "bin": {
10
10
  "netlify-config": "./bin.js"
11
11
  },
@@ -71,8 +71,8 @@
71
71
  "js-yaml": "^4.0.0",
72
72
  "map-obj": "^5.0.0",
73
73
  "netlify": "^13.1.2",
74
- "netlify-headers-parser": "^7.1.1",
75
- "netlify-redirect-parser": "^14.1.1",
74
+ "netlify-headers-parser": "^7.1.2",
75
+ "netlify-redirect-parser": "^14.1.2",
76
76
  "omit.js": "^2.0.2",
77
77
  "p-locate": "^6.0.0",
78
78
  "path-type": "^5.0.0",
@@ -82,7 +82,7 @@
82
82
  "yargs": "^17.6.0"
83
83
  },
84
84
  "devDependencies": {
85
- "@types/node": "^14.18.31",
85
+ "@types/node": "^18.14.2",
86
86
  "ava": "^4.0.0",
87
87
  "c8": "^7.12.0",
88
88
  "del": "^6.0.0",
@@ -94,5 +94,5 @@
94
94
  "engines": {
95
95
  "node": "^14.16.0 || >=16.0.0"
96
96
  },
97
- "gitHead": "d78a65c209ed987d3475cd1f37cf357693b99e3c"
97
+ "gitHead": "35d6533c324d061b9e8e4165d369880a25bab707"
98
98
  }