@netlify/build 27.20.4 → 27.20.6
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/core/bin.js +42 -59
- package/lib/core/build.js +333 -536
- package/lib/core/config.js +94 -159
- package/lib/core/constants.js +95 -135
- package/lib/core/dev.js +26 -30
- package/lib/core/dry.js +18 -36
- package/lib/core/feature_flags.js +13 -16
- package/lib/core/flags.js +168 -169
- package/lib/core/lingering.js +44 -61
- package/lib/core/main.js +94 -136
- package/lib/core/missing_side_file.js +12 -24
- package/lib/core/normalize_flags.js +52 -63
- package/lib/core/severity.js +13 -15
- package/lib/core/user_node_version.js +26 -35
- package/lib/env/changes.js +29 -37
- package/lib/env/main.js +10 -15
- package/lib/env/metadata.js +63 -76
- package/lib/error/api.js +31 -40
- package/lib/error/build.js +27 -38
- package/lib/error/cancel.js +5 -6
- package/lib/error/colors.js +7 -9
- package/lib/error/handle.js +38 -49
- package/lib/error/info.js +26 -35
- package/lib/error/monitor/location.js +12 -17
- package/lib/error/monitor/normalize.js +75 -85
- package/lib/error/monitor/print.js +19 -41
- package/lib/error/monitor/report.js +102 -121
- package/lib/error/monitor/start.js +43 -56
- package/lib/error/parse/clean_stack.js +52 -69
- package/lib/error/parse/location.js +40 -52
- package/lib/error/parse/normalize.js +18 -23
- package/lib/error/parse/parse.js +59 -93
- package/lib/error/parse/plugin.js +42 -57
- package/lib/error/parse/properties.js +13 -20
- package/lib/error/parse/serialize_log.js +29 -37
- package/lib/error/parse/serialize_status.js +15 -23
- package/lib/error/parse/stack.js +29 -38
- package/lib/error/type.js +132 -150
- package/lib/install/functions.js +16 -24
- package/lib/install/local.js +31 -48
- package/lib/install/main.js +52 -66
- package/lib/install/missing.js +40 -53
- package/lib/log/colors.js +15 -22
- package/lib/log/description.js +16 -21
- package/lib/log/header.js +11 -13
- package/lib/log/header_func.js +11 -15
- package/lib/log/logger.js +88 -119
- package/lib/log/messages/compatibility.js +100 -158
- package/lib/log/messages/config.js +76 -92
- package/lib/log/messages/core.js +40 -60
- package/lib/log/messages/core_steps.js +63 -92
- package/lib/log/messages/dry.js +31 -53
- package/lib/log/messages/install.js +21 -28
- package/lib/log/messages/ipc.js +21 -30
- package/lib/log/messages/mutations.js +51 -71
- package/lib/log/messages/plugins.js +18 -31
- package/lib/log/messages/status.js +12 -14
- package/lib/log/messages/steps.js +14 -18
- package/lib/log/old_version.js +23 -32
- package/lib/log/serialize.js +7 -10
- package/lib/log/stream.js +48 -65
- package/lib/log/theme.js +22 -23
- package/lib/plugins/child/diff.js +31 -40
- package/lib/plugins/child/error.js +20 -26
- package/lib/plugins/child/lazy.js +11 -14
- package/lib/plugins/child/load.js +15 -22
- package/lib/plugins/child/logic.js +51 -58
- package/lib/plugins/child/main.js +32 -46
- package/lib/plugins/child/run.js +18 -27
- package/lib/plugins/child/status.js +52 -63
- package/lib/plugins/child/typescript.js +19 -36
- package/lib/plugins/child/utils.js +36 -49
- package/lib/plugins/child/validate.js +25 -28
- package/lib/plugins/compatibility.js +64 -92
- package/lib/plugins/error.js +29 -35
- package/lib/plugins/events.js +7 -12
- package/lib/plugins/expected_version.js +61 -99
- package/lib/plugins/ipc.js +79 -102
- package/lib/plugins/list.js +49 -62
- package/lib/plugins/load.js +44 -64
- package/lib/plugins/manifest/check.js +64 -85
- package/lib/plugins/manifest/load.js +34 -37
- package/lib/plugins/manifest/main.js +16 -21
- package/lib/plugins/manifest/path.js +18 -25
- package/lib/plugins/manifest/validate.js +77 -94
- package/lib/plugins/node_version.js +22 -42
- package/lib/plugins/options.js +45 -78
- package/lib/plugins/pinned_version.js +58 -106
- package/lib/plugins/resolve.js +91 -133
- package/lib/plugins/spawn.js +43 -61
- package/lib/plugins_core/add.js +26 -40
- package/lib/plugins_core/build_command.js +47 -72
- package/lib/plugins_core/deploy/buildbot_client.js +61 -87
- package/lib/plugins_core/deploy/index.js +47 -71
- package/lib/plugins_core/edge_functions/index.js +73 -116
- package/lib/plugins_core/edge_functions/lib/error.js +13 -17
- package/lib/plugins_core/edge_functions/lib/internal_manifest.js +45 -55
- package/lib/plugins_core/edge_functions/validate_manifest/validate_edge_functions_manifest.js +65 -80
- package/lib/plugins_core/functions/error.js +88 -128
- package/lib/plugins_core/functions/feature_flags.js +5 -5
- package/lib/plugins_core/functions/index.js +98 -145
- package/lib/plugins_core/functions/utils.js +36 -57
- package/lib/plugins_core/functions/zisi.js +35 -52
- package/lib/plugins_core/functions_install/index.js +8 -11
- package/lib/plugins_core/list.js +15 -22
- package/lib/status/add.js +26 -32
- package/lib/status/colors.js +14 -19
- package/lib/status/load_error.js +8 -9
- package/lib/status/report.js +72 -126
- package/lib/status/success.js +10 -14
- package/lib/steps/core_step.js +54 -89
- package/lib/steps/error.js +50 -87
- package/lib/steps/get.js +33 -41
- package/lib/steps/plugin.js +53 -83
- package/lib/steps/return.js +24 -51
- package/lib/steps/run_core_steps.js +119 -171
- package/lib/steps/run_step.js +154 -270
- package/lib/steps/run_steps.js +91 -174
- package/lib/steps/update_config.js +45 -72
- package/lib/telemetry/main.js +89 -128
- package/lib/time/aggregate.js +84 -110
- package/lib/time/main.js +23 -34
- package/lib/time/measure.js +11 -15
- package/lib/time/report.js +32 -44
- package/lib/utils/errors.js +10 -9
- package/lib/utils/json.js +11 -15
- package/lib/utils/omit.js +3 -4
- package/lib/utils/package.js +19 -22
- package/lib/utils/remove_falsy.js +5 -7
- package/lib/utils/resolve.js +30 -34
- package/lib/utils/runtime.js +4 -4
- package/lib/utils/semver.js +19 -25
- package/package.json +14 -7
|
@@ -1,178 +1,120 @@
|
|
|
1
|
-
import semver from 'semver'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
packageName
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
52
|
+
return version !== undefined;
|
|
53
|
+
};
|
|
80
54
|
const getVersionField = function ([versionFieldName, version]) {
|
|
81
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
178
|
-
}
|
|
119
|
+
return version === '' ? '' : `@${version}`;
|
|
120
|
+
};
|
|
@@ -1,107 +1,91 @@
|
|
|
1
|
-
import { cleanupConfig } from '@netlify/config'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
56
|
+
logSubHeader(logs, 'Current directory');
|
|
57
|
+
logMessage(logs, buildDir);
|
|
58
|
+
};
|
|
66
59
|
export const logConfigPath = function (logs, configPath = NO_CONFIG_MESSAGE) {
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
86
|
+
if (context === undefined) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
logSubHeader(logs, 'Context');
|
|
90
|
+
logMessage(logs, context);
|
|
91
|
+
};
|
package/lib/log/messages/core.js
CHANGED
|
@@ -1,70 +1,50 @@
|
|
|
1
|
-
import ansiEscapes from 'ansi-escapes'
|
|
2
|
-
import prettyMs from 'pretty-ms'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
28
|
+
logHeader(logs, 'Netlify Build Complete');
|
|
29
|
+
logMessage(logs, '');
|
|
30
|
+
};
|
|
37
31
|
export const logTimer = function (logs, durationNs, timerName) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
45
|
-
|
|
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
|
-
|
|
56
|
-
logs,
|
|
57
|
-
`
|
|
44
|
+
logWarning(logs, `
|
|
58
45
|
The build completed successfully, but the following processes were still running:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
+
};
|