@netlify/build 27.20.3 → 27.20.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 (133) hide show
  1. package/lib/core/bin.js +42 -59
  2. package/lib/core/build.js +333 -536
  3. package/lib/core/config.js +94 -159
  4. package/lib/core/constants.js +95 -135
  5. package/lib/core/dev.js +26 -30
  6. package/lib/core/dry.js +18 -36
  7. package/lib/core/feature_flags.js +13 -16
  8. package/lib/core/flags.js +168 -169
  9. package/lib/core/lingering.js +44 -61
  10. package/lib/core/main.js +94 -136
  11. package/lib/core/missing_side_file.js +12 -24
  12. package/lib/core/normalize_flags.js +52 -63
  13. package/lib/core/severity.js +13 -15
  14. package/lib/core/user_node_version.js +26 -35
  15. package/lib/env/changes.js +29 -37
  16. package/lib/env/main.js +10 -15
  17. package/lib/env/metadata.js +63 -76
  18. package/lib/error/api.js +31 -40
  19. package/lib/error/build.js +27 -38
  20. package/lib/error/cancel.js +5 -6
  21. package/lib/error/colors.js +7 -9
  22. package/lib/error/handle.js +38 -49
  23. package/lib/error/info.js +26 -35
  24. package/lib/error/monitor/location.js +12 -17
  25. package/lib/error/monitor/normalize.js +75 -85
  26. package/lib/error/monitor/print.js +19 -41
  27. package/lib/error/monitor/report.js +102 -121
  28. package/lib/error/monitor/start.js +43 -56
  29. package/lib/error/parse/clean_stack.js +52 -69
  30. package/lib/error/parse/location.js +40 -52
  31. package/lib/error/parse/normalize.js +18 -23
  32. package/lib/error/parse/parse.js +59 -93
  33. package/lib/error/parse/plugin.js +42 -57
  34. package/lib/error/parse/properties.js +13 -20
  35. package/lib/error/parse/serialize_log.js +29 -37
  36. package/lib/error/parse/serialize_status.js +15 -23
  37. package/lib/error/parse/stack.js +29 -38
  38. package/lib/error/type.js +132 -150
  39. package/lib/install/functions.js +16 -24
  40. package/lib/install/local.js +31 -48
  41. package/lib/install/main.js +52 -66
  42. package/lib/install/missing.js +40 -53
  43. package/lib/log/colors.js +15 -22
  44. package/lib/log/description.js +16 -21
  45. package/lib/log/header.js +11 -13
  46. package/lib/log/header_func.js +11 -15
  47. package/lib/log/logger.js +88 -119
  48. package/lib/log/messages/compatibility.js +100 -158
  49. package/lib/log/messages/config.js +76 -92
  50. package/lib/log/messages/core.js +40 -60
  51. package/lib/log/messages/core_steps.js +63 -92
  52. package/lib/log/messages/dry.js +31 -53
  53. package/lib/log/messages/install.js +21 -28
  54. package/lib/log/messages/ipc.js +21 -30
  55. package/lib/log/messages/mutations.js +51 -71
  56. package/lib/log/messages/plugins.js +18 -31
  57. package/lib/log/messages/status.js +12 -14
  58. package/lib/log/messages/steps.js +14 -18
  59. package/lib/log/old_version.js +23 -32
  60. package/lib/log/serialize.js +7 -10
  61. package/lib/log/stream.js +48 -65
  62. package/lib/log/theme.js +22 -23
  63. package/lib/plugins/child/diff.js +31 -40
  64. package/lib/plugins/child/error.js +20 -26
  65. package/lib/plugins/child/lazy.js +11 -14
  66. package/lib/plugins/child/load.js +15 -22
  67. package/lib/plugins/child/logic.js +51 -58
  68. package/lib/plugins/child/main.js +32 -46
  69. package/lib/plugins/child/run.js +18 -27
  70. package/lib/plugins/child/status.js +52 -63
  71. package/lib/plugins/child/typescript.js +19 -36
  72. package/lib/plugins/child/utils.js +36 -49
  73. package/lib/plugins/child/validate.js +25 -28
  74. package/lib/plugins/compatibility.js +64 -92
  75. package/lib/plugins/error.js +29 -35
  76. package/lib/plugins/events.js +7 -12
  77. package/lib/plugins/expected_version.js +61 -99
  78. package/lib/plugins/ipc.js +79 -102
  79. package/lib/plugins/list.js +49 -62
  80. package/lib/plugins/load.js +44 -64
  81. package/lib/plugins/manifest/check.js +64 -85
  82. package/lib/plugins/manifest/load.js +34 -37
  83. package/lib/plugins/manifest/main.js +16 -21
  84. package/lib/plugins/manifest/path.js +18 -25
  85. package/lib/plugins/manifest/validate.js +77 -94
  86. package/lib/plugins/node_version.js +22 -42
  87. package/lib/plugins/options.js +45 -78
  88. package/lib/plugins/pinned_version.js +58 -106
  89. package/lib/plugins/resolve.js +91 -133
  90. package/lib/plugins/spawn.js +43 -61
  91. package/lib/plugins_core/add.js +26 -40
  92. package/lib/plugins_core/build_command.js +47 -72
  93. package/lib/plugins_core/deploy/buildbot_client.js +61 -87
  94. package/lib/plugins_core/deploy/index.js +47 -71
  95. package/lib/plugins_core/edge_functions/index.js +73 -116
  96. package/lib/plugins_core/edge_functions/lib/error.js +13 -17
  97. package/lib/plugins_core/edge_functions/lib/internal_manifest.js +45 -55
  98. package/lib/plugins_core/edge_functions/validate_manifest/validate_edge_functions_manifest.js +65 -80
  99. package/lib/plugins_core/functions/error.js +88 -128
  100. package/lib/plugins_core/functions/feature_flags.js +5 -5
  101. package/lib/plugins_core/functions/index.js +98 -145
  102. package/lib/plugins_core/functions/utils.js +36 -57
  103. package/lib/plugins_core/functions/zisi.js +35 -52
  104. package/lib/plugins_core/functions_install/index.js +8 -11
  105. package/lib/plugins_core/list.js +15 -22
  106. package/lib/status/add.js +26 -32
  107. package/lib/status/colors.js +14 -19
  108. package/lib/status/load_error.js +8 -9
  109. package/lib/status/report.js +72 -126
  110. package/lib/status/success.js +10 -14
  111. package/lib/steps/core_step.js +54 -89
  112. package/lib/steps/error.js +50 -87
  113. package/lib/steps/get.js +33 -41
  114. package/lib/steps/plugin.js +53 -83
  115. package/lib/steps/return.js +24 -51
  116. package/lib/steps/run_core_steps.js +119 -171
  117. package/lib/steps/run_step.js +154 -270
  118. package/lib/steps/run_steps.js +91 -174
  119. package/lib/steps/update_config.js +45 -72
  120. package/lib/telemetry/main.js +89 -128
  121. package/lib/time/aggregate.js +84 -110
  122. package/lib/time/main.js +23 -34
  123. package/lib/time/measure.js +11 -15
  124. package/lib/time/report.js +32 -44
  125. package/lib/utils/errors.js +10 -9
  126. package/lib/utils/json.js +11 -15
  127. package/lib/utils/omit.js +3 -4
  128. package/lib/utils/package.js +19 -22
  129. package/lib/utils/remove_falsy.js +5 -7
  130. package/lib/utils/resolve.js +30 -34
  131. package/lib/utils/runtime.js +4 -4
  132. package/lib/utils/semver.js +19 -25
  133. package/package.json +15 -8
@@ -1,178 +1,120 @@
1
- import semver from 'semver'
2
-
3
- import { isRuntime } from '../../utils/runtime.js'
4
- import { isPreviousMajor } from '../../utils/semver.js'
5
- import { getPluginOrigin } from '../description.js'
6
- import { logArray, logSubHeader, logWarningArray, logWarningSubHeader } from '../logger.js'
7
- import { THEME } from '../theme.js'
8
-
1
+ import semver from 'semver';
2
+ import { isRuntime } from '../../utils/runtime.js';
3
+ import { isPreviousMajor } from '../../utils/semver.js';
4
+ import { getPluginOrigin } from '../description.js';
5
+ import { logArray, logSubHeader, logWarningArray, logWarningSubHeader } from '../logger.js';
6
+ import { THEME } from '../theme.js';
9
7
  export const logRuntime = (logs, pluginOptions) => {
10
- const runtimes = pluginOptions.filter(isRuntime)
11
-
12
- // Once we have more runtimes, this hardcoded check should be removed
13
- if (runtimes.length !== 0) {
14
- const [nextRuntime] = runtimes
15
-
16
- logSubHeader(logs, `Using Next.js Runtime - v${nextRuntime.pluginPackageJson.version}`)
17
- }
18
- }
19
-
8
+ const runtimes = pluginOptions.filter(isRuntime);
9
+ // Once we have more runtimes, this hardcoded check should be removed
10
+ if (runtimes.length !== 0) {
11
+ const [nextRuntime] = runtimes;
12
+ logSubHeader(logs, `Using Next.js Runtime - v${nextRuntime.pluginPackageJson.version}`);
13
+ }
14
+ };
20
15
  export const logLoadingPlugins = function (logs, pluginsOptions, debug) {
21
- const loadingPlugins = pluginsOptions
22
- .filter(isNotCorePlugin)
23
- // We don't want to show runtimes as plugins
24
- .filter((plugin) => !isRuntime(plugin))
25
- .map((pluginOptions) => getPluginDescription(pluginOptions, debug))
26
-
27
- if (loadingPlugins.length === 0) {
28
- return
29
- }
30
-
31
- logSubHeader(logs, 'Loading plugins')
32
- logArray(logs, loadingPlugins)
33
- }
34
-
16
+ const loadingPlugins = pluginsOptions
17
+ .filter(isNotCorePlugin)
18
+ // We don't want to show runtimes as plugins
19
+ .filter((plugin) => !isRuntime(plugin))
20
+ .map((pluginOptions) => getPluginDescription(pluginOptions, debug));
21
+ if (loadingPlugins.length === 0) {
22
+ return;
23
+ }
24
+ logSubHeader(logs, 'Loading plugins');
25
+ logArray(logs, loadingPlugins);
26
+ };
35
27
  // We only logs plugins explicitly enabled by users
36
28
  const isNotCorePlugin = function ({ origin }) {
37
- return origin !== 'core'
38
- }
39
-
40
- const getPluginDescription = function (
41
- {
42
- packageName,
43
- pluginPackageJson: { version },
44
- loadedFrom,
45
- origin,
46
- pinnedVersion,
47
- latestVersion,
48
- expectedVersion,
49
- compatibleVersion,
50
- },
51
- debug,
52
- ) {
53
- const versionedPackage = getVersionedPackage(packageName, version)
54
- const pluginOrigin = getPluginOrigin(loadedFrom, origin)
55
- const description = `${THEME.highlightWords(packageName)}${versionedPackage} ${pluginOrigin}`
56
- if (!debug) {
57
- return description
58
- }
59
-
60
- const versions = Object.entries({
61
- pinned: pinnedVersion,
62
- latest: latestVersion,
63
- expected: expectedVersion,
64
- compatible: compatibleVersion,
65
- })
66
- .filter(hasVersion)
67
- .map(getVersionField)
68
-
69
- if (versions.length === 0) {
70
- return description
71
- }
72
-
73
- return `${description} (${versions.join(', ')})`
74
- }
75
-
29
+ return origin !== 'core';
30
+ };
31
+ const getPluginDescription = function ({ packageName, pluginPackageJson: { version }, loadedFrom, origin, pinnedVersion, latestVersion, expectedVersion, compatibleVersion, }, debug) {
32
+ const versionedPackage = getVersionedPackage(packageName, version);
33
+ const pluginOrigin = getPluginOrigin(loadedFrom, origin);
34
+ const description = `${THEME.highlightWords(packageName)}${versionedPackage} ${pluginOrigin}`;
35
+ if (!debug) {
36
+ return description;
37
+ }
38
+ const versions = Object.entries({
39
+ pinned: pinnedVersion,
40
+ latest: latestVersion,
41
+ expected: expectedVersion,
42
+ compatible: compatibleVersion,
43
+ })
44
+ .filter(hasVersion)
45
+ .map(getVersionField);
46
+ if (versions.length === 0) {
47
+ return description;
48
+ }
49
+ return `${description} (${versions.join(', ')})`;
50
+ };
76
51
  const hasVersion = function ([, version]) {
77
- return version !== undefined
78
- }
79
-
52
+ return version !== undefined;
53
+ };
80
54
  const getVersionField = function ([versionFieldName, version]) {
81
- return `${versionFieldName} ${version}`
82
- }
83
-
55
+ return `${versionFieldName} ${version}`;
56
+ };
84
57
  // Print a warning message when old versions plugins are used.
85
58
  // This can only happen when they are installed to `package.json`.
86
59
  export const logOutdatedPlugins = function (logs, pluginsOptions) {
87
- const outdatedPlugins = pluginsOptions.filter(hasOutdatedVersion).map(getOutdatedPlugin)
88
-
89
- if (outdatedPlugins.length === 0) {
90
- return
91
- }
92
-
93
- logWarningSubHeader(logs, 'Outdated plugins')
94
- logWarningArray(logs, outdatedPlugins)
95
- }
96
-
60
+ const outdatedPlugins = pluginsOptions.filter(hasOutdatedVersion).map(getOutdatedPlugin);
61
+ if (outdatedPlugins.length === 0) {
62
+ return;
63
+ }
64
+ logWarningSubHeader(logs, 'Outdated plugins');
65
+ logWarningArray(logs, outdatedPlugins);
66
+ };
97
67
  const hasOutdatedVersion = function ({ pluginPackageJson: { version }, latestVersion }) {
98
- return version !== undefined && latestVersion !== undefined && semver.lt(version, latestVersion)
99
- }
100
-
101
- const getOutdatedPlugin = function ({
102
- packageName,
103
- pluginPackageJson: { version },
104
- latestVersion,
105
- migrationGuide,
106
- loadedFrom,
107
- origin,
108
- }) {
109
- const versionedPackage = getVersionedPackage(packageName, version)
110
- const outdatedDescription = getOutdatedDescription({ latestVersion, migrationGuide, loadedFrom, origin })
111
- return `${THEME.warningHighlightWords(packageName)}${versionedPackage}: ${outdatedDescription}`
112
- }
113
-
68
+ return version !== undefined && latestVersion !== undefined && semver.lt(version, latestVersion);
69
+ };
70
+ const getOutdatedPlugin = function ({ packageName, pluginPackageJson: { version }, latestVersion, migrationGuide, loadedFrom, origin, }) {
71
+ const versionedPackage = getVersionedPackage(packageName, version);
72
+ const outdatedDescription = getOutdatedDescription({ latestVersion, migrationGuide, loadedFrom, origin });
73
+ return `${THEME.warningHighlightWords(packageName)}${versionedPackage}: ${outdatedDescription}`;
74
+ };
114
75
  const getOutdatedDescription = function ({ latestVersion, migrationGuide, loadedFrom, origin }) {
115
- const upgradeInstruction = getUpgradeInstruction(loadedFrom, origin)
116
- if (migrationGuide === undefined) {
117
- return `latest version is ${latestVersion}\n${upgradeInstruction}`
118
- }
119
-
120
- return `latest version is ${latestVersion}\nMigration guide: ${migrationGuide}\n${upgradeInstruction}`
121
- }
122
-
76
+ const upgradeInstruction = getUpgradeInstruction(loadedFrom, origin);
77
+ if (migrationGuide === undefined) {
78
+ return `latest version is ${latestVersion}\n${upgradeInstruction}`;
79
+ }
80
+ return `latest version is ${latestVersion}\nMigration guide: ${migrationGuide}\n${upgradeInstruction}`;
81
+ };
123
82
  const getUpgradeInstruction = function (loadedFrom, origin) {
124
- if (loadedFrom === 'package.json') {
125
- return 'To upgrade this plugin, please update its version in "package.json"'
126
- }
127
-
128
- if (origin === 'ui') {
129
- return 'To upgrade this plugin, please uninstall and re-install it from the Netlify plugins directory (https://app.netlify.com/plugins)'
130
- }
131
-
132
- return 'To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)'
133
- }
134
-
83
+ if (loadedFrom === 'package.json') {
84
+ return 'To upgrade this plugin, please update its version in "package.json"';
85
+ }
86
+ if (origin === 'ui') {
87
+ return 'To upgrade this plugin, please uninstall and re-install it from the Netlify plugins directory (https://app.netlify.com/plugins)';
88
+ }
89
+ return 'To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)';
90
+ };
135
91
  // Print a warning message when plugins are using a version that is too recent
136
92
  // and does not meet some `compatibility` expectations.
137
93
  // This can only happen when they are installed to `package.json`.
138
94
  export const logIncompatiblePlugins = function (logs, pluginsOptions) {
139
- const incompatiblePlugins = pluginsOptions.filter(hasIncompatibleVersion).map(getIncompatiblePlugin)
140
-
141
- if (incompatiblePlugins.length === 0) {
142
- return
143
- }
144
-
145
- logWarningSubHeader(logs, 'Incompatible plugins')
146
- logWarningArray(logs, incompatiblePlugins)
147
- }
148
-
95
+ const incompatiblePlugins = pluginsOptions.filter(hasIncompatibleVersion).map(getIncompatiblePlugin);
96
+ if (incompatiblePlugins.length === 0) {
97
+ return;
98
+ }
99
+ logWarningSubHeader(logs, 'Incompatible plugins');
100
+ logWarningArray(logs, incompatiblePlugins);
101
+ };
149
102
  const hasIncompatibleVersion = function ({ pluginPackageJson: { version }, compatibleVersion, compatWarning }) {
150
- return (
151
- compatWarning !== '' &&
152
- version !== undefined &&
153
- compatibleVersion !== undefined &&
154
- // Using only the major version prevents printing this warning message when
155
- // a site is using the right `compatibility` version, but is using the most
156
- // recent version due to the time gap between `npm publish` and the
157
- // `plugins.json` update
158
- isPreviousMajor(compatibleVersion, version)
159
- )
160
- }
161
-
162
- const getIncompatiblePlugin = function ({
163
- packageName,
164
- pluginPackageJson: { version },
165
- compatibleVersion,
166
- compatWarning,
167
- }) {
168
- const versionedPackage = getVersionedPackage(packageName, version)
169
- return `${THEME.warningHighlightWords(
170
- packageName,
171
- )}${versionedPackage}: version ${compatibleVersion} is the most recent version compatible with ${compatWarning}`
172
- }
173
-
103
+ return (compatWarning !== '' &&
104
+ version !== undefined &&
105
+ compatibleVersion !== undefined &&
106
+ // Using only the major version prevents printing this warning message when
107
+ // a site is using the right `compatibility` version, but is using the most
108
+ // recent version due to the time gap between `npm publish` and the
109
+ // `plugins.json` update
110
+ isPreviousMajor(compatibleVersion, version));
111
+ };
112
+ const getIncompatiblePlugin = function ({ packageName, pluginPackageJson: { version }, compatibleVersion, compatWarning, }) {
113
+ const versionedPackage = getVersionedPackage(packageName, version);
114
+ return `${THEME.warningHighlightWords(packageName)}${versionedPackage}: version ${compatibleVersion} is the most recent version compatible with ${compatWarning}`;
115
+ };
174
116
  // Make sure we handle `package.json` with `version` being either `undefined`
175
117
  // or an empty string
176
118
  const getVersionedPackage = function (packageName, version = '') {
177
- return version === '' ? '' : `@${version}`
178
- }
119
+ return version === '' ? '' : `@${version}`;
120
+ };
@@ -1,107 +1,91 @@
1
- import { cleanupConfig } from '@netlify/config'
2
-
3
- import { DEFAULT_FEATURE_FLAGS } from '../../core/feature_flags.js'
4
- import { omit } from '../../utils/omit.js'
5
- import { logMessage, logObject, logSubHeader } from '../logger.js'
6
- import { THEME } from '../theme.js'
7
-
1
+ import { cleanupConfig } from '@netlify/config';
2
+ import { DEFAULT_FEATURE_FLAGS } from '../../core/feature_flags.js';
3
+ import { omit } from '../../utils/omit.js';
4
+ import { logMessage, logObject, logSubHeader } from '../logger.js';
5
+ import { THEME } from '../theme.js';
8
6
  export const logFlags = function (logs, flags, { debug }) {
9
- const flagsA = cleanFeatureFlags(flags)
10
- const hiddenFlags = debug ? HIDDEN_DEBUG_FLAGS : HIDDEN_FLAGS
11
- const flagsB = omit(flagsA, hiddenFlags)
12
- logSubHeader(logs, 'Flags')
13
- logObject(logs, flagsB)
14
- }
15
-
7
+ const flagsA = cleanFeatureFlags(flags);
8
+ const hiddenFlags = debug ? HIDDEN_DEBUG_FLAGS : HIDDEN_FLAGS;
9
+ const flagsB = omit(flagsA, hiddenFlags);
10
+ logSubHeader(logs, 'Flags');
11
+ logObject(logs, flagsB);
12
+ };
16
13
  // We only show feature flags related to `@netlify/build`.
17
14
  // Also, we only print enabled feature flags.
18
15
  const cleanFeatureFlags = function ({ featureFlags = {}, ...flags }) {
19
- const cleanedFeatureFlags = Object.entries(featureFlags)
20
- .filter(shouldPrintFeatureFlag)
21
- .map(([featureFlagName]) => featureFlagName)
22
- return cleanedFeatureFlags.length === 0 ? flags : { ...flags, featureFlags: cleanedFeatureFlags }
23
- }
24
-
16
+ const cleanedFeatureFlags = Object.entries(featureFlags)
17
+ .filter(shouldPrintFeatureFlag)
18
+ .map(([featureFlagName]) => featureFlagName);
19
+ return cleanedFeatureFlags.length === 0 ? flags : { ...flags, featureFlags: cleanedFeatureFlags };
20
+ };
25
21
  const shouldPrintFeatureFlag = function ([featureFlagName, enabled]) {
26
- return enabled && featureFlagName in DEFAULT_FEATURE_FLAGS
27
- }
28
-
22
+ return enabled && featureFlagName in DEFAULT_FEATURE_FLAGS;
23
+ };
29
24
  // Hidden because the value is security-sensitive
30
- const SECURE_FLAGS = ['token', 'bugsnagKey', 'env', 'cachedConfig', 'defaultConfig']
25
+ const SECURE_FLAGS = ['token', 'bugsnagKey', 'env', 'cachedConfig', 'defaultConfig'];
31
26
  // Hidden because those are used in tests
32
- const TEST_FLAGS = ['buffer', 'telemetry']
27
+ const TEST_FLAGS = ['buffer', 'telemetry'];
33
28
  // Hidden because those are only used internally
34
29
  const INTERNAL_FLAGS = [
35
- 'nodePath',
36
- 'functionsDistDir',
37
- 'edgeFunctionsDistDir',
38
- 'defaultConfig',
39
- 'cachedConfigPath',
40
- 'sendStatus',
41
- 'saveConfig',
42
- 'statsd',
43
- 'framework',
44
- 'featureFlags',
45
- 'buildbotServerSocket',
46
- 'testOpts',
47
- 'siteId',
48
- 'context',
49
- 'branch',
50
- 'cwd',
51
- 'repositoryRoot',
52
- 'mode',
53
- 'apiHost',
54
- 'cacheDir',
55
- 'systemLogFile',
56
- 'timeline',
57
- ]
58
- const HIDDEN_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS, ...INTERNAL_FLAGS]
59
- const HIDDEN_DEBUG_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS]
60
-
30
+ 'nodePath',
31
+ 'functionsDistDir',
32
+ 'edgeFunctionsDistDir',
33
+ 'defaultConfig',
34
+ 'cachedConfigPath',
35
+ 'sendStatus',
36
+ 'saveConfig',
37
+ 'statsd',
38
+ 'framework',
39
+ 'featureFlags',
40
+ 'buildbotServerSocket',
41
+ 'testOpts',
42
+ 'siteId',
43
+ 'context',
44
+ 'branch',
45
+ 'cwd',
46
+ 'repositoryRoot',
47
+ 'mode',
48
+ 'apiHost',
49
+ 'cacheDir',
50
+ 'systemLogFile',
51
+ 'timeline',
52
+ ];
53
+ const HIDDEN_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS, ...INTERNAL_FLAGS];
54
+ const HIDDEN_DEBUG_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS];
61
55
  export const logBuildDir = function (logs, buildDir) {
62
- logSubHeader(logs, 'Current directory')
63
- logMessage(logs, buildDir)
64
- }
65
-
56
+ logSubHeader(logs, 'Current directory');
57
+ logMessage(logs, buildDir);
58
+ };
66
59
  export const logConfigPath = function (logs, configPath = NO_CONFIG_MESSAGE) {
67
- logSubHeader(logs, 'Config file')
68
- logMessage(logs, configPath)
69
- }
70
-
71
- const NO_CONFIG_MESSAGE = 'No config file was defined: using default values.'
72
-
60
+ logSubHeader(logs, 'Config file');
61
+ logMessage(logs, configPath);
62
+ };
63
+ const NO_CONFIG_MESSAGE = 'No config file was defined: using default values.';
73
64
  export const logConfig = function ({ logs, netlifyConfig, debug }) {
74
- if (!debug) {
75
- return
76
- }
77
-
78
- logSubHeader(logs, 'Resolved config')
79
- logObject(logs, cleanupConfig(netlifyConfig))
80
- }
81
-
65
+ if (!debug) {
66
+ return;
67
+ }
68
+ logSubHeader(logs, 'Resolved config');
69
+ logObject(logs, cleanupConfig(netlifyConfig));
70
+ };
82
71
  export const logConfigOnUpdate = function ({ logs, netlifyConfig, debug }) {
83
- if (!debug) {
84
- return
85
- }
86
-
87
- logSubHeader(logs, 'Updated config')
88
- logObject(logs, cleanupConfig(netlifyConfig))
89
- }
90
-
72
+ if (!debug) {
73
+ return;
74
+ }
75
+ logSubHeader(logs, 'Updated config');
76
+ logObject(logs, cleanupConfig(netlifyConfig));
77
+ };
91
78
  export const logConfigOnError = function ({ logs, netlifyConfig, severity }) {
92
- if (netlifyConfig === undefined || severity === 'none') {
93
- return
94
- }
95
-
96
- logMessage(logs, THEME.errorSubHeader('Resolved config'))
97
- logObject(logs, cleanupConfig(netlifyConfig))
98
- }
99
-
79
+ if (netlifyConfig === undefined || severity === 'none') {
80
+ return;
81
+ }
82
+ logMessage(logs, THEME.errorSubHeader('Resolved config'));
83
+ logObject(logs, cleanupConfig(netlifyConfig));
84
+ };
100
85
  export const logContext = function (logs, context) {
101
- if (context === undefined) {
102
- return
103
- }
104
-
105
- logSubHeader(logs, 'Context')
106
- logMessage(logs, context)
107
- }
86
+ if (context === undefined) {
87
+ return;
88
+ }
89
+ logSubHeader(logs, 'Context');
90
+ logMessage(logs, context);
91
+ };
@@ -1,70 +1,50 @@
1
- import ansiEscapes from 'ansi-escapes'
2
- import prettyMs from 'pretty-ms'
3
-
4
- import { getFullErrorInfo } from '../../error/parse/parse.js'
5
- import { serializeLogError } from '../../error/parse/serialize_log.js'
6
- import { roundTimerToMillisecs } from '../../time/measure.js'
7
- import { ROOT_PACKAGE_JSON } from '../../utils/json.js'
8
- import { getLogHeaderFunc } from '../header_func.js'
9
- import { log, logMessage, logWarning, logHeader, logSubHeader, logWarningArray } from '../logger.js'
10
- import { logOldCliVersionError } from '../old_version.js'
11
- import { THEME } from '../theme.js'
12
-
13
- import { logConfigOnError } from './config.js'
14
-
1
+ import ansiEscapes from 'ansi-escapes';
2
+ import prettyMs from 'pretty-ms';
3
+ import { getFullErrorInfo } from '../../error/parse/parse.js';
4
+ import { serializeLogError } from '../../error/parse/serialize_log.js';
5
+ import { roundTimerToMillisecs } from '../../time/measure.js';
6
+ import { ROOT_PACKAGE_JSON } from '../../utils/json.js';
7
+ import { getLogHeaderFunc } from '../header_func.js';
8
+ import { log, logMessage, logWarning, logHeader, logSubHeader, logWarningArray } from '../logger.js';
9
+ import { logOldCliVersionError } from '../old_version.js';
10
+ import { THEME } from '../theme.js';
11
+ import { logConfigOnError } from './config.js';
15
12
  export const logBuildStart = function (logs) {
16
- logHeader(logs, 'Netlify Build')
17
- logSubHeader(logs, 'Version')
18
- logMessage(logs, `${ROOT_PACKAGE_JSON.name} ${ROOT_PACKAGE_JSON.version}`)
19
- }
20
-
13
+ logHeader(logs, 'Netlify Build');
14
+ logSubHeader(logs, 'Version');
15
+ logMessage(logs, `${ROOT_PACKAGE_JSON.name} ${ROOT_PACKAGE_JSON.version}`);
16
+ };
21
17
  export const logBuildError = function ({ error, netlifyConfig, mode, logs, debug, testOpts }) {
22
- const fullErrorInfo = getFullErrorInfo({ error, colors: true, debug })
23
- const { severity } = fullErrorInfo
24
- const { title, body } = serializeLogError({ fullErrorInfo })
25
- const logHeaderFunc = getLogHeaderFunc(error)
26
- logHeaderFunc(logs, title)
27
- logMessage(logs, `\n${body}\n`)
28
- logConfigOnError({ logs, netlifyConfig, severity })
29
- logOldCliVersionError({ mode, testOpts })
30
- }
31
-
18
+ const fullErrorInfo = getFullErrorInfo({ error, colors: true, debug });
19
+ const { severity } = fullErrorInfo;
20
+ const { title, body } = serializeLogError({ fullErrorInfo });
21
+ const logHeaderFunc = getLogHeaderFunc(error);
22
+ logHeaderFunc(logs, title);
23
+ logMessage(logs, `\n${body}\n`);
24
+ logConfigOnError({ logs, netlifyConfig, severity });
25
+ logOldCliVersionError({ mode, testOpts });
26
+ };
32
27
  export const logBuildSuccess = function (logs) {
33
- logHeader(logs, 'Netlify Build Complete')
34
- logMessage(logs, '')
35
- }
36
-
28
+ logHeader(logs, 'Netlify Build Complete');
29
+ logMessage(logs, '');
30
+ };
37
31
  export const logTimer = function (logs, durationNs, timerName) {
38
- const durationMs = roundTimerToMillisecs(durationNs)
39
- const duration = prettyMs(durationMs)
40
- log(logs, THEME.dimWords(`(${timerName} completed in ${duration})`))
41
- }
42
-
32
+ const durationMs = roundTimerToMillisecs(durationNs);
33
+ const duration = prettyMs(durationMs);
34
+ log(logs, THEME.dimWords(`(${timerName} completed in ${duration})`));
35
+ };
43
36
  export const logMissingSideFile = function (logs, sideFile, publish) {
44
- logWarning(
45
- logs,
46
- `
47
- A "${sideFile}" file is present in the repository but is missing in the publish directory "${publish}".`,
48
- )
49
- }
50
-
37
+ logWarning(logs, `
38
+ A "${sideFile}" file is present in the repository but is missing in the publish directory "${publish}".`);
39
+ };
51
40
  // @todo use `terminal-link` (https://github.com/sindresorhus/terminal-link)
52
41
  // instead of `ansi-escapes` once
53
42
  // https://github.com/jamestalmage/supports-hyperlinks/pull/12 is fixed
54
43
  export const logLingeringProcesses = function (logs, commands) {
55
- logWarning(
56
- logs,
57
- `
44
+ logWarning(logs, `
58
45
  The build completed successfully, but the following processes were still running:
59
- `,
60
- )
61
- logWarningArray(logs, commands)
62
- logWarning(
63
- logs,
64
- `
65
- These processes have been terminated. In case this creates a problem for your build, refer to this ${ansiEscapes.link(
66
- 'article',
67
- 'https://answers.netlify.com/t/support-guide-how-to-address-the-warning-message-related-to-terminating-processes-in-builds/35277',
68
- )} for details about why this process termination happens and how to fix it.`,
69
- )
70
- }
46
+ `);
47
+ logWarningArray(logs, commands);
48
+ logWarning(logs, `
49
+ These processes have been terminated. In case this creates a problem for your build, refer to this ${ansiEscapes.link('article', 'https://answers.netlify.com/t/support-guide-how-to-address-the-warning-message-related-to-terminating-processes-in-builds/35277')} for details about why this process termination happens and how to fix it.`);
50
+ };