@netlify/build 28.4.5 → 29.0.0
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/log/colors.js +14 -13
- package/lib/log/description.js +1 -1
- package/lib/log/header.js +3 -3
- package/lib/log/header_func.js +1 -1
- package/lib/log/theme.js +5 -3
- package/lib/plugins/node_version.js +3 -8
- package/lib/time/main.js +2 -2
- package/lib/time/measure.js +11 -13
- package/package.json +3 -3
package/lib/log/colors.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { inspect } from 'util';
|
|
2
2
|
import supportsColor from 'supports-color';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const hasColors = () => supportsColor.stdout !== false;
|
|
4
|
+
/**
|
|
5
|
+
* Plugin child processes use `stdio: 'pipe'` so they are always
|
|
6
|
+
* non-interactive even if the parent is an interactive TTY. This means they
|
|
7
|
+
* would normally lose colors. If the parent has colors, we pass an environment
|
|
8
|
+
* variable to the child process to force colors.
|
|
9
|
+
*/
|
|
7
10
|
export const getParentColorEnv = function () {
|
|
8
11
|
if (!hasColors()) {
|
|
9
12
|
return {};
|
|
10
13
|
}
|
|
11
14
|
return { FORCE_COLOR: '1' };
|
|
12
15
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Child processes and the buildbot relies on `FORCE_COLOR=1` to set colors.
|
|
18
|
+
* However `utils.inspect()` (used by `console.log()`) uses
|
|
19
|
+
* `process.stdout.hasColors` which is always `undefined` when the TTY is
|
|
20
|
+
* non-interactive. So we need to set `util.inspect.defaultOptions.colors`
|
|
21
|
+
* manually both in plugin processes.
|
|
22
|
+
*/
|
|
18
23
|
export const setInspectColors = function () {
|
|
19
24
|
if (!hasColors()) {
|
|
20
25
|
return;
|
|
21
26
|
}
|
|
22
|
-
// `inspect.defaultOptions` requires direct mutation
|
|
23
27
|
inspect.defaultOptions.colors = true;
|
|
24
28
|
};
|
|
25
|
-
const hasColors = function () {
|
|
26
|
-
return supportsColor.stdout !== false;
|
|
27
|
-
};
|
package/lib/log/description.js
CHANGED
|
@@ -6,7 +6,7 @@ const BUILD_COMMAND_DESCRIPTIONS = {
|
|
|
6
6
|
config: 'build.command from netlify.toml',
|
|
7
7
|
inline: 'build.command from a plugin',
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
/** Retrieve human-friendly plugin origin */
|
|
10
10
|
export const getPluginOrigin = function (loadedFrom, origin) {
|
|
11
11
|
const originName = PLUGIN_ORIGINS[origin];
|
|
12
12
|
if (loadedFrom === 'package.json') {
|
package/lib/log/header.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import stringWidth from 'string-width';
|
|
2
|
-
|
|
2
|
+
const HEADER_MIN_WIDTH = 60;
|
|
3
|
+
const PADDING_WIDTH = 2;
|
|
4
|
+
/** Print a rectangular header */
|
|
3
5
|
export const getHeader = function (message) {
|
|
4
6
|
const messageWidth = stringWidth(message);
|
|
5
7
|
const headerWidth = Math.max(HEADER_MIN_WIDTH, messageWidth);
|
|
@@ -10,5 +12,3 @@ export const getHeader = function (message) {
|
|
|
10
12
|
${paddingLeft}${message}${paddingRight}
|
|
11
13
|
${line}`;
|
|
12
14
|
};
|
|
13
|
-
const HEADER_MIN_WIDTH = 60;
|
|
14
|
-
const PADDING_WIDTH = 2;
|
package/lib/log/header_func.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseErrorInfo } from '../error/parse/parse.js';
|
|
2
2
|
import { logHeader, logErrorHeader } from './logger.js';
|
|
3
|
-
|
|
3
|
+
/** Retrieve successful or error header depending on whether `error` exists */
|
|
4
4
|
export const getLogHeaderFunc = function (error) {
|
|
5
5
|
if (error === undefined) {
|
|
6
6
|
return logHeader;
|
package/lib/log/theme.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Color theme. Please use this instead of requiring chalk directly,
|
|
4
|
+
* to ensure consistent colors.
|
|
5
|
+
*/
|
|
4
6
|
export const THEME = {
|
|
5
7
|
// Main headers
|
|
6
8
|
header: chalk.cyanBright.bold,
|
|
7
|
-
// Single lines used as
|
|
9
|
+
// Single lines used as sub-headers
|
|
8
10
|
subHeader: chalk.cyan.bold,
|
|
9
11
|
// One of several words that should be highlighted inside a line
|
|
10
12
|
highlightWords: chalk.cyan,
|
|
@@ -2,10 +2,6 @@ import { execPath, version as currentVersion } from 'process';
|
|
|
2
2
|
import semver from 'semver';
|
|
3
3
|
import link from 'terminal-link';
|
|
4
4
|
import { logWarning, logWarningSubHeader } from '../log/logger.js';
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated will be replaced with `MINIMUM_REQUIRED_NODE_VERSION` at the 5th. of December 2022
|
|
7
|
-
*/
|
|
8
|
-
const OLD_MINIMUM_REQUIRED_NODE_VERSION = '^12.20.0 || ^14.14.0 || >=16.0.0';
|
|
9
5
|
/**
|
|
10
6
|
* This node version is minimum required to run the plugins code.
|
|
11
7
|
* If the users preferred Node.js version is below that we have to fall back to the system node version
|
|
@@ -27,14 +23,13 @@ const addPluginNodeVersion = function ({ pluginOptions, pluginOptions: { loadedF
|
|
|
27
23
|
// our minimum required node version log a warning as we will default to the system node version
|
|
28
24
|
if ((loadedFrom === 'local' || loadedFrom === 'package.json') &&
|
|
29
25
|
!semver.satisfies(userNodeVersion, MINIMUM_REQUIRED_NODE_VERSION)) {
|
|
30
|
-
logWarningSubHeader(logs, `Warning: ${packageName} will be executed with Node.js version ${currentNodeVersion}
|
|
31
|
-
logWarning(logs, ` The plugin cannot be executed with your defined Node.js version ${userNodeVersion}
|
|
32
|
-
Starting December 5th 2022 our minimum required Node version range for executing plugins will be: ${MINIMUM_REQUIRED_NODE_VERSION}
|
|
26
|
+
logWarningSubHeader(logs, `Warning: ${packageName} will be executed with Node.js version ${currentNodeVersion}`);
|
|
27
|
+
logWarning(logs, ` The plugin cannot be executed with your defined Node.js version ${userNodeVersion}
|
|
33
28
|
|
|
34
29
|
Read more about our minimum required version in our ${link('forums announcement', 'https://answers.netlify.com/t/build-plugins-dropping-support-for-node-js-12/79421')}`);
|
|
35
30
|
}
|
|
36
31
|
return (loadedFrom === 'local' || loadedFrom === 'package.json') &&
|
|
37
|
-
semver.satisfies(userNodeVersion,
|
|
32
|
+
semver.satisfies(userNodeVersion, MINIMUM_REQUIRED_NODE_VERSION)
|
|
38
33
|
? { ...pluginOptions, nodePath, nodeVersion: userNodeVersion }
|
|
39
34
|
: { ...pluginOptions, nodePath: execPath, nodeVersion: currentNodeVersion };
|
|
40
35
|
};
|
package/lib/time/main.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import keepFuncProps from 'keep-func-props';
|
|
2
2
|
import { startTimer, endTimer } from './measure.js';
|
|
3
|
+
const DEFAULT_METRIC_NAME = 'buildbot.build.stage.duration';
|
|
4
|
+
export const TOP_PARENT_TAG = 'run_netlify_build';
|
|
3
5
|
// Initialize the `timers` array
|
|
4
6
|
export const initTimers = function () {
|
|
5
7
|
return [];
|
|
@@ -27,5 +29,3 @@ export const measureDuration = keepFuncProps(kMeasureDuration);
|
|
|
27
29
|
export const createTimer = function (stageTag, durationNs, { metricName = DEFAULT_METRIC_NAME, parentTag = TOP_PARENT_TAG, category = undefined, tags = undefined } = {}) {
|
|
28
30
|
return { metricName, stageTag, parentTag, durationNs, category, tags };
|
|
29
31
|
};
|
|
30
|
-
const DEFAULT_METRIC_NAME = 'buildbot.build.stage.duration';
|
|
31
|
-
export const TOP_PARENT_TAG = 'run_netlify_build';
|
package/lib/time/measure.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { hrtime } from 'process';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const endTimer =
|
|
2
|
+
const NANOSECS_TO_SECS = 1e9;
|
|
3
|
+
const NANOSECS_TO_MSECS = 1e6;
|
|
4
|
+
/** Starts a timer */
|
|
5
|
+
export const startTimer = hrtime;
|
|
6
|
+
/** Stops a timer */
|
|
7
|
+
export const endTimer = ([startSecs, startNsecs]) => {
|
|
8
8
|
const [endSecs, endNsecs] = hrtime();
|
|
9
9
|
const durationNs = (endSecs - startSecs) * NANOSECS_TO_SECS + endNsecs - startNsecs;
|
|
10
10
|
return durationNs;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const NANOSECS_TO_SECS = 1e9;
|
|
18
|
-
const NANOSECS_TO_MSECS = 1e6;
|
|
12
|
+
/**
|
|
13
|
+
* statsd expects milliseconds integers.
|
|
14
|
+
* To prevent double rounding errors, rounding should only be applied once.
|
|
15
|
+
*/
|
|
16
|
+
export const roundTimerToMillisecs = (durationNs) => Math.round(durationNs / NANOSECS_TO_MSECS);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "29.0.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/core/main.js",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@netlify/edge-bundler": "5.0.0",
|
|
70
70
|
"@netlify/functions-utils": "^5.0.5",
|
|
71
71
|
"@netlify/git-utils": "^5.0.2",
|
|
72
|
-
"@netlify/plugins-list": "^6.
|
|
72
|
+
"@netlify/plugins-list": "^6.58.0",
|
|
73
73
|
"@netlify/run-utils": "^5.0.2",
|
|
74
74
|
"@netlify/zip-it-and-ship-it": "^7.1.3",
|
|
75
75
|
"@sindresorhus/slugify": "^2.0.0",
|
|
@@ -149,5 +149,5 @@
|
|
|
149
149
|
"module": "commonjs"
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "95343e7341883e61ab6cbb0263f5bc30b4c4f4bd"
|
|
153
153
|
}
|