@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.
- 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 +15 -8
|
@@ -1,97 +1,69 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { THEME } from '../theme.js'
|
|
5
|
-
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { log, logArray, logErrorSubHeader, logWarningSubHeader } from '../logger.js';
|
|
3
|
+
import { THEME } from '../theme.js';
|
|
6
4
|
const logBundleResultFunctions = ({ functions, headerMessage, logs, error }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
5
|
+
const functionNames = functions.map(({ path: functionPath }) => path.basename(functionPath));
|
|
6
|
+
if (error) {
|
|
7
|
+
logErrorSubHeader(logs, headerMessage);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
logWarningSubHeader(logs, headerMessage);
|
|
11
|
+
}
|
|
12
|
+
logArray(logs, functionNames);
|
|
13
|
+
};
|
|
18
14
|
export const logBundleResults = ({ logs, results = [] }) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (modulesWithDynamicImports.length !== 0) {
|
|
46
|
-
logModulesWithDynamicImports({ logs, modulesWithDynamicImports })
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
15
|
+
const resultsWithErrors = results.filter(({ bundlerErrors }) => bundlerErrors && bundlerErrors.length !== 0);
|
|
16
|
+
const resultsWithWarnings = results.filter(({ bundler, bundlerWarnings }) => bundler === 'esbuild' && bundlerWarnings && bundlerWarnings.length !== 0);
|
|
17
|
+
const modulesWithDynamicImports = [
|
|
18
|
+
...new Set(results.flatMap((result) => result.nodeModulesWithDynamicImports || [])),
|
|
19
|
+
];
|
|
20
|
+
if (resultsWithErrors.length !== 0) {
|
|
21
|
+
logBundleResultFunctions({
|
|
22
|
+
functions: resultsWithErrors,
|
|
23
|
+
headerMessage: 'Failed to bundle functions with selected bundler (fallback used):',
|
|
24
|
+
logs,
|
|
25
|
+
error: true,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (resultsWithWarnings.length !== 0) {
|
|
29
|
+
logBundleResultFunctions({
|
|
30
|
+
functions: resultsWithWarnings,
|
|
31
|
+
headerMessage: 'Functions bundled with warnings:',
|
|
32
|
+
logs,
|
|
33
|
+
error: false,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (modulesWithDynamicImports.length !== 0) {
|
|
37
|
+
logModulesWithDynamicImports({ logs, modulesWithDynamicImports });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
50
40
|
export const logFunctionsNonExistingDir = function (logs, relativeFunctionsSrc) {
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
41
|
+
log(logs, `The Netlify Functions setting targets a non-existing directory: ${relativeFunctionsSrc}`);
|
|
42
|
+
};
|
|
54
43
|
// Print the list of Netlify Functions about to be bundled
|
|
55
|
-
export const logFunctionsToBundle = function ({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (userFunctions.length === 0) {
|
|
74
|
-
log(logs, `No ${type} were found in ${THEME.highlightWords(userFunctionsSrc)} directory`)
|
|
75
|
-
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (internalFunctions.length !== 0) {
|
|
80
|
-
log(logs, '')
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
log(logs, `Packaging ${type} from ${THEME.highlightWords(userFunctionsSrc)} directory:`)
|
|
84
|
-
logArray(logs, userFunctions, { indent: false })
|
|
85
|
-
}
|
|
86
|
-
|
|
44
|
+
export const logFunctionsToBundle = function ({ logs, userFunctions, userFunctionsSrc, userFunctionsSrcExists, internalFunctions, internalFunctionsSrc, type = 'Functions', }) {
|
|
45
|
+
if (internalFunctions.length !== 0) {
|
|
46
|
+
log(logs, `Packaging ${type} from ${THEME.highlightWords(internalFunctionsSrc)} directory:`);
|
|
47
|
+
logArray(logs, internalFunctions, { indent: false });
|
|
48
|
+
}
|
|
49
|
+
if (!userFunctionsSrcExists) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (userFunctions.length === 0) {
|
|
53
|
+
log(logs, `No ${type} were found in ${THEME.highlightWords(userFunctionsSrc)} directory`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (internalFunctions.length !== 0) {
|
|
57
|
+
log(logs, '');
|
|
58
|
+
}
|
|
59
|
+
log(logs, `Packaging ${type} from ${THEME.highlightWords(userFunctionsSrc)} directory:`);
|
|
60
|
+
logArray(logs, userFunctions, { indent: false });
|
|
61
|
+
};
|
|
87
62
|
const logModulesWithDynamicImports = ({ logs, modulesWithDynamicImports }) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
log(
|
|
93
|
-
logs,
|
|
94
|
-
`\n Because files included with dynamic expressions aren't bundled with your serverless functions by default,
|
|
63
|
+
const externalNodeModules = modulesWithDynamicImports.map((moduleName) => `"${moduleName}"`).join(', ');
|
|
64
|
+
logWarningSubHeader(logs, `The following Node.js modules use dynamic expressions to include files:`);
|
|
65
|
+
logArray(logs, modulesWithDynamicImports);
|
|
66
|
+
log(logs, `\n Because files included with dynamic expressions aren't bundled with your serverless functions by default,
|
|
95
67
|
this may result in an error when invoking a function. To resolve this error, you can mark these Node.js
|
|
96
68
|
modules as external in the [functions] section of your \`netlify.toml\` configuration file:
|
|
97
69
|
|
|
@@ -99,6 +71,5 @@ const logModulesWithDynamicImports = ({ logs, modulesWithDynamicImports }) => {
|
|
|
99
71
|
external_node_modules = [${externalNodeModules}]
|
|
100
72
|
|
|
101
73
|
Visit https://ntl.fyi/dynamic-imports for more information.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
74
|
+
`);
|
|
75
|
+
};
|
package/lib/log/messages/dry.js
CHANGED
|
@@ -1,63 +1,41 @@
|
|
|
1
|
-
import figures from 'figures'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { THEME } from '../theme.js'
|
|
5
|
-
|
|
1
|
+
import figures from 'figures';
|
|
2
|
+
import { logMessage, logSubHeader } from '../logger.js';
|
|
3
|
+
import { THEME } from '../theme.js';
|
|
6
4
|
export const logDryRunStart = function ({ logs, eventWidth, stepsCount }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
logMessage(
|
|
13
|
-
logs,
|
|
14
|
-
`For more information on build events see the docs https://github.com/netlify/build
|
|
5
|
+
const columnWidth = getDryColumnWidth(eventWidth, stepsCount);
|
|
6
|
+
const line = '─'.repeat(columnWidth);
|
|
7
|
+
const secondLine = '─'.repeat(columnWidth);
|
|
8
|
+
logSubHeader(logs, 'Netlify Build Commands');
|
|
9
|
+
logMessage(logs, `For more information on build events see the docs https://github.com/netlify/build
|
|
15
10
|
|
|
16
11
|
Running \`netlify build\` will execute this build flow
|
|
17
12
|
|
|
18
13
|
${THEME.header(`┌─${line}─┬─${secondLine}─┐
|
|
19
14
|
│ ${DRY_HEADER_NAMES[0].padEnd(columnWidth)} │ ${DRY_HEADER_NAMES[1].padEnd(columnWidth)} │
|
|
20
|
-
└─${line}─┴─${secondLine}─┘`)}
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
stepsCount,
|
|
31
|
-
}) {
|
|
32
|
-
const columnWidth = getDryColumnWidth(eventWidth, stepsCount)
|
|
33
|
-
const fullName = getFullName(coreStepDescription, netlifyConfig, packageName)
|
|
34
|
-
const line = '─'.repeat(columnWidth)
|
|
35
|
-
const countText = `${index + 1}. `
|
|
36
|
-
const downArrow = stepsCount === index + 1 ? ' ' : ` ${figures.arrowDown}`
|
|
37
|
-
const eventWidthA = columnWidth - countText.length - downArrow.length
|
|
38
|
-
|
|
39
|
-
logMessage(
|
|
40
|
-
logs,
|
|
41
|
-
`${THEME.header(`┌─${line}─┐`)}
|
|
15
|
+
└─${line}─┴─${secondLine}─┘`)}`);
|
|
16
|
+
};
|
|
17
|
+
export const logDryRunStep = function ({ logs, step: { event, packageName, coreStepDescription }, index, netlifyConfig, eventWidth, stepsCount, }) {
|
|
18
|
+
const columnWidth = getDryColumnWidth(eventWidth, stepsCount);
|
|
19
|
+
const fullName = getFullName(coreStepDescription, netlifyConfig, packageName);
|
|
20
|
+
const line = '─'.repeat(columnWidth);
|
|
21
|
+
const countText = `${index + 1}. `;
|
|
22
|
+
const downArrow = stepsCount === index + 1 ? ' ' : ` ${figures.arrowDown}`;
|
|
23
|
+
const eventWidthA = columnWidth - countText.length - downArrow.length;
|
|
24
|
+
logMessage(logs, `${THEME.header(`┌─${line}─┐`)}
|
|
42
25
|
${THEME.header(`│ ${countText}${event.padEnd(eventWidthA)}${downArrow} │`)} ${fullName}
|
|
43
|
-
${THEME.header(`└─${line}─┘ `)}
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
26
|
+
${THEME.header(`└─${line}─┘ `)}`);
|
|
27
|
+
};
|
|
47
28
|
const getFullName = function (coreStepDescription, netlifyConfig, packageName) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
29
|
+
return coreStepDescription === undefined
|
|
30
|
+
? `Plugin ${THEME.highlightWords(packageName)}`
|
|
31
|
+
: coreStepDescription({ netlifyConfig });
|
|
32
|
+
};
|
|
53
33
|
const getDryColumnWidth = function (eventWidth, stepsCount) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
const DRY_HEADER_NAMES = ['Event', 'Location']
|
|
60
|
-
|
|
34
|
+
const symbolsWidth = `${stepsCount}`.length + COLUMN_EXTRA_WIDTH;
|
|
35
|
+
return Math.max(eventWidth + symbolsWidth, DRY_HEADER_NAMES[1].length);
|
|
36
|
+
};
|
|
37
|
+
const COLUMN_EXTRA_WIDTH = 4;
|
|
38
|
+
const DRY_HEADER_NAMES = ['Event', 'Location'];
|
|
61
39
|
export const logDryRunEnd = function (logs) {
|
|
62
|
-
|
|
63
|
-
}
|
|
40
|
+
logMessage(logs, `\nIf this looks good to you, run \`netlify build\` to execute the build\n`);
|
|
41
|
+
};
|
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
import { isRuntime } from '../../utils/runtime.js'
|
|
2
|
-
import { log, logArray, logSubHeader } from '../logger.js'
|
|
3
|
-
|
|
1
|
+
import { isRuntime } from '../../utils/runtime.js';
|
|
2
|
+
import { log, logArray, logSubHeader } from '../logger.js';
|
|
4
3
|
export const logInstallMissingPlugins = function (logs, packages) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
logSubHeader(logs, `Using Next.js Runtime - v${nextRuntime.pluginPackageJson.version}`)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
4
|
+
const runtimes = packages.filter((pkg) => isRuntime(pkg));
|
|
5
|
+
const plugins = packages.filter((pkg) => !isRuntime(pkg));
|
|
6
|
+
if (plugins.length !== 0) {
|
|
7
|
+
logSubHeader(logs, 'Installing plugins');
|
|
8
|
+
logArray(logs, packages);
|
|
9
|
+
}
|
|
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 logInstallLocalPluginsDeps = function (logs, localPluginsOptions) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
16
|
+
const packages = localPluginsOptions.map(getPackageName);
|
|
17
|
+
logSubHeader(logs, 'Installing local plugins dependencies');
|
|
18
|
+
logArray(logs, packages);
|
|
19
|
+
};
|
|
26
20
|
export const logInstallFunctionDependencies = function () {
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
21
|
+
log(undefined, 'Installing functions dependencies');
|
|
22
|
+
};
|
|
30
23
|
const getPackageName = function ({ packageName }) {
|
|
31
|
-
|
|
32
|
-
}
|
|
24
|
+
return packageName;
|
|
25
|
+
};
|
package/lib/log/messages/ipc.js
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
|
-
import { log } from '../logger.js'
|
|
2
|
-
|
|
1
|
+
import { log } from '../logger.js';
|
|
3
2
|
const logVerbose = function (logs, verbose, message) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
3
|
+
if (!verbose) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
log(logs, message);
|
|
7
|
+
};
|
|
11
8
|
export const logSendingEventToChild = function (logs, verbose) {
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
9
|
+
logVerbose(logs, verbose, 'Step starting.');
|
|
10
|
+
};
|
|
15
11
|
export const logSentEventToChild = function (logs, verbose) {
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
12
|
+
logVerbose(logs, verbose, 'Step started.');
|
|
13
|
+
};
|
|
19
14
|
export const logPluginMethodStart = function (verbose) {
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
15
|
+
logVerbose(undefined, verbose, 'Plugin logic started.');
|
|
16
|
+
};
|
|
23
17
|
export const logPluginMethodEnd = function (verbose) {
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
18
|
+
logVerbose(undefined, verbose, 'Plugin logic ended.');
|
|
19
|
+
};
|
|
27
20
|
export const logSendingEventToParent = function (verbose, error) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
21
|
+
const message = error instanceof Error ? `Step erroring.\n${error.stack}` : 'Stop closing.';
|
|
22
|
+
logVerbose(undefined, verbose, message);
|
|
23
|
+
};
|
|
32
24
|
export const logReceivedEventFromChild = function (logs, verbose) {
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
25
|
+
logVerbose(logs, verbose, 'Step ended.');
|
|
26
|
+
};
|
|
36
27
|
export const logStepCompleted = function (logs, verbose) {
|
|
37
|
-
|
|
38
|
-
}
|
|
28
|
+
logVerbose(logs, verbose, 'Step completed.');
|
|
29
|
+
};
|
|
@@ -1,82 +1,62 @@
|
|
|
1
|
-
import { promises as fs } from 'fs'
|
|
2
|
-
import { inspect } from 'util'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { log, logMessage, logSubHeader } from '../logger.js'
|
|
7
|
-
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import { inspect } from 'util';
|
|
3
|
+
import { pathExists } from 'path-exists';
|
|
4
|
+
import { log, logMessage, logSubHeader } from '../logger.js';
|
|
8
5
|
export const logConfigMutations = function (logs, newConfigMutations, debug) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
6
|
+
const configMutationsToLog = debug ? newConfigMutations : newConfigMutations.filter(shouldLogConfigMutation);
|
|
7
|
+
configMutationsToLog.forEach(({ keysString, value }) => {
|
|
8
|
+
logConfigMutation(logs, keysString, value);
|
|
9
|
+
});
|
|
10
|
+
};
|
|
15
11
|
// Some configuration mutations are only logged in debug mode
|
|
16
12
|
const shouldLogConfigMutation = function ({ keysString }) {
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
13
|
+
return !HIDDEN_PROPS.some((hiddenProp) => keysString.startsWith(hiddenProp));
|
|
14
|
+
};
|
|
20
15
|
// `functions` is an object which can have thousands of properties, one per
|
|
21
16
|
// function file. This can be very verbose, especially for plugins which create
|
|
22
17
|
// many function files like Essential Next.js
|
|
23
|
-
const HIDDEN_PROPS = ['functions']
|
|
24
|
-
|
|
18
|
+
const HIDDEN_PROPS = ['functions'];
|
|
25
19
|
const logConfigMutation = function (logs, keysString, value) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
20
|
+
const newValue = shouldHideConfigValue(keysString) ? '' : ` to ${inspect(value, { colors: false })}`;
|
|
21
|
+
log(logs, `Netlify configuration property "${keysString}" value changed${newValue}.`);
|
|
22
|
+
};
|
|
30
23
|
const shouldHideConfigValue = function (keysString) {
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const SECRET_PROPS = ['build.environment']
|
|
35
|
-
|
|
24
|
+
return SECRET_PROPS.some((secretProp) => keysString.startsWith(secretProp));
|
|
25
|
+
};
|
|
26
|
+
const SECRET_PROPS = ['build.environment'];
|
|
36
27
|
export const logConfigOnUpload = async function ({ logs, configPath, debug }) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const configContents = await fs.readFile(configPath, 'utf8')
|
|
49
|
-
logMessage(logs, configContents.trim())
|
|
50
|
-
}
|
|
51
|
-
|
|
28
|
+
if (!debug) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
logSubHeader(logs, 'Uploaded config');
|
|
32
|
+
if (!(await pathExists(configPath))) {
|
|
33
|
+
logMessage(logs, 'No netlify.toml');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const configContents = await fs.readFile(configPath, 'utf8');
|
|
37
|
+
logMessage(logs, configContents.trim());
|
|
38
|
+
};
|
|
52
39
|
export const logHeadersOnUpload = async function ({ logs, headersPath, debug }) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const headersContents = await fs.readFile(headersPath, 'utf8')
|
|
65
|
-
logMessage(logs, headersContents.trim())
|
|
66
|
-
}
|
|
67
|
-
|
|
40
|
+
if (!debug) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
logSubHeader(logs, 'Uploaded headers');
|
|
44
|
+
if (!(await pathExists(headersPath))) {
|
|
45
|
+
logMessage(logs, 'No headers');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const headersContents = await fs.readFile(headersPath, 'utf8');
|
|
49
|
+
logMessage(logs, headersContents.trim());
|
|
50
|
+
};
|
|
68
51
|
export const logRedirectsOnUpload = async function ({ logs, redirectsPath, debug }) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const redirectsContents = await fs.readFile(redirectsPath, 'utf8')
|
|
81
|
-
logMessage(logs, `${redirectsContents.trim()}\n`)
|
|
82
|
-
}
|
|
52
|
+
if (!debug) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
logSubHeader(logs, 'Uploaded redirects');
|
|
56
|
+
if (!(await pathExists(redirectsPath))) {
|
|
57
|
+
logMessage(logs, 'No redirects\n');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const redirectsContents = await fs.readFile(redirectsPath, 'utf8');
|
|
61
|
+
logMessage(logs, `${redirectsContents.trim()}\n`);
|
|
62
|
+
};
|
|
@@ -1,38 +1,25 @@
|
|
|
1
|
-
import { log, logArray, logWarning, logSubHeader } from '../logger.js'
|
|
2
|
-
|
|
1
|
+
import { log, logArray, logWarning, logSubHeader } from '../logger.js';
|
|
3
2
|
export const logPluginsFetchError = function (logs, message) {
|
|
4
|
-
|
|
5
|
-
logs,
|
|
6
|
-
`
|
|
3
|
+
logWarning(logs, `
|
|
7
4
|
Warning: could not fetch latest plugins list. Plugins versions might not be the latest.
|
|
8
|
-
${message}
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
5
|
+
${message}`);
|
|
6
|
+
};
|
|
12
7
|
export const logPluginsList = function ({ pluginsList, debug, logs }) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
logArray(logs, pluginsListArray)
|
|
21
|
-
}
|
|
22
|
-
|
|
8
|
+
if (!debug) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const pluginsListArray = Object.entries(pluginsList).map(getPluginsListItem).sort();
|
|
12
|
+
logSubHeader(logs, 'Available plugins');
|
|
13
|
+
logArray(logs, pluginsListArray);
|
|
14
|
+
};
|
|
23
15
|
const getPluginsListItem = function ([packageName, versions]) {
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
16
|
+
return `${packageName}@${versions[0].version}`;
|
|
17
|
+
};
|
|
27
18
|
export const logFailPluginWarning = function (methodName, event) {
|
|
28
|
-
|
|
29
|
-
undefined,
|
|
30
|
-
`Plugin error: since "${event}" happens after deploy, the build has already succeeded and cannot fail anymore. This plugin should either:
|
|
19
|
+
logWarning(undefined, `Plugin error: since "${event}" happens after deploy, the build has already succeeded and cannot fail anymore. This plugin should either:
|
|
31
20
|
- use utils.build.failPlugin() instead of utils.build.${methodName}() to clarify that the plugin failed, but not the build.
|
|
32
|
-
- use "onPostBuild" instead of "${event}" if the plugin failure should make the build fail too. Please note that "onPostBuild" (unlike "${event}") happens before deploy
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
21
|
+
- use "onPostBuild" instead of "${event}" if the plugin failure should make the build fail too. Please note that "onPostBuild" (unlike "${event}") happens before deploy.`);
|
|
22
|
+
};
|
|
36
23
|
export const logDeploySuccess = function (logs) {
|
|
37
|
-
|
|
38
|
-
}
|
|
24
|
+
log(logs, 'Site deploy was successfully initiated');
|
|
25
|
+
};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { logMessage, logHeader, logSubHeader } from '../logger.js'
|
|
2
|
-
import { THEME } from '../theme.js'
|
|
3
|
-
|
|
1
|
+
import { logMessage, logHeader, logSubHeader } from '../logger.js';
|
|
2
|
+
import { THEME } from '../theme.js';
|
|
4
3
|
export const logStatuses = function (logs, statuses) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
4
|
+
logHeader(logs, 'Summary');
|
|
5
|
+
statuses.forEach((status) => {
|
|
6
|
+
logStatus(logs, status);
|
|
7
|
+
});
|
|
8
|
+
};
|
|
11
9
|
const logStatus = function (logs, { packageName, title = `Plugin ${packageName} ran successfully`, summary, text }) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
10
|
+
const titleA = title.includes(packageName) ? title : `${packageName}: ${title}`;
|
|
11
|
+
const body = text === undefined ? summary : `${summary}\n${THEME.dimWords(text)}`;
|
|
12
|
+
logSubHeader(logs, titleA);
|
|
13
|
+
logMessage(logs, body);
|
|
14
|
+
};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { getLogHeaderFunc } from '../header_func.js'
|
|
2
|
-
import { log, logMessage } from '../logger.js'
|
|
3
|
-
import { THEME } from '../theme.js'
|
|
4
|
-
|
|
1
|
+
import { getLogHeaderFunc } from '../header_func.js';
|
|
2
|
+
import { log, logMessage } from '../logger.js';
|
|
3
|
+
import { THEME } from '../theme.js';
|
|
5
4
|
export const logStepStart = function ({ logs, event, packageName, coreStepDescription, index, error, netlifyConfig }) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
5
|
+
const description = getDescription({ coreStepDescription, netlifyConfig, packageName, event });
|
|
6
|
+
const logHeaderFunc = getLogHeaderFunc(error);
|
|
7
|
+
logHeaderFunc(logs, `${index + 1}. ${description}`);
|
|
8
|
+
logMessage(logs, '');
|
|
9
|
+
};
|
|
12
10
|
const getDescription = function ({ coreStepDescription, netlifyConfig, packageName, event }) {
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
return coreStepDescription === undefined ? `${packageName} (${event} event)` : coreStepDescription({ netlifyConfig });
|
|
12
|
+
};
|
|
16
13
|
export const logBuildCommandStart = function (logs, buildCommand) {
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
14
|
+
log(logs, THEME.highlightWords(`$ ${buildCommand}`));
|
|
15
|
+
};
|
|
20
16
|
export const logStepSuccess = function (logs) {
|
|
21
|
-
|
|
22
|
-
}
|
|
17
|
+
logMessage(logs, '');
|
|
18
|
+
};
|