@netlify/build 29.5.4 → 29.5.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/error/handle.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { cwd as getCwd } from 'process';
|
|
2
2
|
import { pathExists } from 'path-exists';
|
|
3
3
|
import { logBuildError } from '../log/messages/core.js';
|
|
4
|
-
import { logOldCliVersionError } from '../log/old_version.js';
|
|
5
4
|
import { removeErrorColors } from './colors.js';
|
|
6
5
|
import { getErrorInfo } from './info.js';
|
|
7
6
|
import { reportBuildError } from './monitor/report.js';
|
|
8
7
|
import { parseErrorInfo } from './parse/parse.js';
|
|
9
8
|
// Logs and reports a build failure
|
|
10
|
-
export const handleBuildError = async function (error, { errorMonitor, netlifyConfig, childEnv,
|
|
9
|
+
export const handleBuildError = async function (error, { errorMonitor, netlifyConfig, childEnv, logs, debug, testOpts }) {
|
|
11
10
|
const basicErrorInfo = parseErrorInfo(error);
|
|
12
11
|
if (await isCancelCrash(error)) {
|
|
13
12
|
return basicErrorInfo;
|
|
@@ -15,9 +14,8 @@ export const handleBuildError = async function (error, { errorMonitor, netlifyCo
|
|
|
15
14
|
removeErrorColors(error);
|
|
16
15
|
// Some errors, such as telemetry ones, should not be logged
|
|
17
16
|
if (basicErrorInfo.showInBuildLog) {
|
|
18
|
-
logBuildError({ error, netlifyConfig,
|
|
17
|
+
logBuildError({ error, netlifyConfig, logs, debug });
|
|
19
18
|
}
|
|
20
|
-
logOldCliVersionError({ mode, testOpts });
|
|
21
19
|
await reportBuildError({ error, errorMonitor, childEnv, logs, testOpts });
|
|
22
20
|
return basicErrorInfo;
|
|
23
21
|
};
|
|
@@ -29,7 +29,7 @@ const isNotCorePlugin = function ({ origin }) {
|
|
|
29
29
|
return origin !== 'core';
|
|
30
30
|
};
|
|
31
31
|
const getPluginDescription = function ({ packageName, pluginPackageJson: { version }, loadedFrom, origin, pinnedVersion, latestVersion, expectedVersion, compatibleVersion, }, debug) {
|
|
32
|
-
const versionedPackage = getVersionedPackage(
|
|
32
|
+
const versionedPackage = getVersionedPackage(version);
|
|
33
33
|
const pluginOrigin = getPluginOrigin(loadedFrom, origin);
|
|
34
34
|
const description = `${THEME.highlightWords(packageName)}${versionedPackage} ${pluginOrigin}`;
|
|
35
35
|
if (!debug) {
|
|
@@ -68,7 +68,7 @@ const hasOutdatedVersion = function ({ pluginPackageJson: { version }, latestVer
|
|
|
68
68
|
return version !== undefined && latestVersion !== undefined && semver.lt(version, latestVersion);
|
|
69
69
|
};
|
|
70
70
|
const getOutdatedPlugin = function ({ packageName, pluginPackageJson: { version }, latestVersion, migrationGuide, loadedFrom, origin, }) {
|
|
71
|
-
const versionedPackage = getVersionedPackage(
|
|
71
|
+
const versionedPackage = getVersionedPackage(version);
|
|
72
72
|
const outdatedDescription = getOutdatedDescription({ latestVersion, migrationGuide, loadedFrom, origin });
|
|
73
73
|
return `${THEME.warningHighlightWords(packageName)}${versionedPackage}: ${outdatedDescription}`;
|
|
74
74
|
};
|
|
@@ -110,11 +110,11 @@ const hasIncompatibleVersion = function ({ pluginPackageJson: { version }, compa
|
|
|
110
110
|
isPreviousMajor(compatibleVersion, version));
|
|
111
111
|
};
|
|
112
112
|
const getIncompatiblePlugin = function ({ packageName, pluginPackageJson: { version }, compatibleVersion, compatWarning, }) {
|
|
113
|
-
const versionedPackage = getVersionedPackage(
|
|
113
|
+
const versionedPackage = getVersionedPackage(version);
|
|
114
114
|
return `${THEME.warningHighlightWords(packageName)}${versionedPackage}: version ${compatibleVersion} is the most recent version compatible with ${compatWarning}`;
|
|
115
115
|
};
|
|
116
116
|
// Make sure we handle `package.json` with `version` being either `undefined`
|
|
117
117
|
// or an empty string
|
|
118
|
-
const getVersionedPackage = function (
|
|
118
|
+
const getVersionedPackage = function (version = '') {
|
|
119
119
|
return version === '' ? '' : `@${version}`;
|
|
120
120
|
};
|
package/lib/log/messages/core.js
CHANGED
|
@@ -6,7 +6,6 @@ import { roundTimerToMillisecs } from '../../time/measure.js';
|
|
|
6
6
|
import { ROOT_PACKAGE_JSON } from '../../utils/json.js';
|
|
7
7
|
import { getLogHeaderFunc } from '../header_func.js';
|
|
8
8
|
import { log, logMessage, logWarning, logHeader, logSubHeader, logWarningArray } from '../logger.js';
|
|
9
|
-
import { logOldCliVersionError } from '../old_version.js';
|
|
10
9
|
import { THEME } from '../theme.js';
|
|
11
10
|
import { logConfigOnError } from './config.js';
|
|
12
11
|
export const logBuildStart = function (logs) {
|
|
@@ -14,7 +13,7 @@ export const logBuildStart = function (logs) {
|
|
|
14
13
|
logSubHeader(logs, 'Version');
|
|
15
14
|
logMessage(logs, `${ROOT_PACKAGE_JSON.name} ${ROOT_PACKAGE_JSON.version}`);
|
|
16
15
|
};
|
|
17
|
-
export const logBuildError = function ({ error, netlifyConfig,
|
|
16
|
+
export const logBuildError = function ({ error, netlifyConfig, logs, debug }) {
|
|
18
17
|
const fullErrorInfo = getFullErrorInfo({ error, colors: true, debug });
|
|
19
18
|
const { severity } = fullErrorInfo;
|
|
20
19
|
const { title, body } = serializeLogError({ fullErrorInfo });
|
|
@@ -22,7 +21,6 @@ export const logBuildError = function ({ error, netlifyConfig, mode, logs, debug
|
|
|
22
21
|
logHeaderFunc(logs, title);
|
|
23
22
|
logMessage(logs, `\n${body}\n`);
|
|
24
23
|
logConfigOnError({ logs, netlifyConfig, severity });
|
|
25
|
-
logOldCliVersionError({ mode, testOpts });
|
|
26
24
|
};
|
|
27
25
|
export const logBuildSuccess = function (logs) {
|
|
28
26
|
logHeader(logs, 'Netlify Build Complete');
|
package/lib/plugins/options.js
CHANGED
|
@@ -46,7 +46,7 @@ const loadPluginFiles = async function ({ pluginOptions, pluginOptions: { plugin
|
|
|
46
46
|
// Core plugins can only be included once.
|
|
47
47
|
// For example, when testing core plugins, they might be included as local plugins,
|
|
48
48
|
// in which case they should not be included twice.
|
|
49
|
-
const isNotRedundantCorePlugin = function (pluginOptionsA,
|
|
49
|
+
const isNotRedundantCorePlugin = function (pluginOptionsA, _index, pluginsOptions) {
|
|
50
50
|
return (pluginOptionsA.loadedFrom !== 'core' ||
|
|
51
51
|
pluginsOptions.every((pluginOptionsB) => pluginOptionsA.manifest.name !== pluginOptionsB.manifest.name || pluginOptionsA === pluginOptionsB));
|
|
52
52
|
};
|
package/lib/utils/json.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFile } from 'fs/promises';
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
3
|
const ROOT_PACKAGE_JSON_PATH = fileURLToPath(new URL('../../package.json', import.meta.url));
|
|
4
4
|
// TODO: Replace with dynamic `import()` once it is supported without
|
|
5
5
|
// experimental flags
|
|
6
6
|
export const importJsonFile = async function (filePath) {
|
|
7
|
-
const fileContents = await
|
|
7
|
+
const fileContents = await readFile(filePath, 'utf-8');
|
|
8
8
|
return JSON.parse(fileContents);
|
|
9
9
|
};
|
|
10
|
-
const
|
|
11
|
-
// Use sync I/O so it is easier to migrate to `import()` later on
|
|
12
|
-
const fileContents = readFileSync(filePath, 'utf-8');
|
|
13
|
-
return JSON.parse(fileContents);
|
|
14
|
-
};
|
|
15
|
-
export const ROOT_PACKAGE_JSON = importJsonFileSync(ROOT_PACKAGE_JSON_PATH);
|
|
10
|
+
export const ROOT_PACKAGE_JSON = (await importJsonFile(ROOT_PACKAGE_JSON_PATH));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.5.
|
|
3
|
+
"version": "29.5.5",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/core/main.js",
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
"license": "MIT",
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@bugsnag/js": "^7.0.0",
|
|
67
|
-
"@netlify/cache-utils": "^5.1.
|
|
68
|
-
"@netlify/config": "^20.3.
|
|
67
|
+
"@netlify/cache-utils": "^5.1.2",
|
|
68
|
+
"@netlify/config": "^20.3.3",
|
|
69
69
|
"@netlify/edge-bundler": "8.4.0",
|
|
70
|
-
"@netlify/functions-utils": "^5.1.
|
|
70
|
+
"@netlify/functions-utils": "^5.1.7",
|
|
71
71
|
"@netlify/git-utils": "^5.1.0",
|
|
72
|
-
"@netlify/plugins-list": "^6.
|
|
72
|
+
"@netlify/plugins-list": "^6.65.0",
|
|
73
73
|
"@netlify/run-utils": "^5.1.0",
|
|
74
74
|
"@netlify/zip-it-and-ship-it": "^8.5.0",
|
|
75
75
|
"@sindresorhus/slugify": "^2.0.0",
|
|
@@ -113,12 +113,11 @@
|
|
|
113
113
|
"tmp-promise": "^3.0.2",
|
|
114
114
|
"ts-node": "^10.6.0",
|
|
115
115
|
"typescript": "^4.8.4",
|
|
116
|
-
"update-notifier": "^5.0.0",
|
|
117
116
|
"uuid": "^8.0.0",
|
|
118
117
|
"yargs": "^17.6.0"
|
|
119
118
|
},
|
|
120
119
|
"devDependencies": {
|
|
121
|
-
"@netlify/nock-udp": "^3.1.
|
|
120
|
+
"@netlify/nock-udp": "^3.1.2",
|
|
122
121
|
"@types/node": "^14.18.31",
|
|
123
122
|
"atob": "^2.1.2",
|
|
124
123
|
"ava": "^4.0.0",
|
|
@@ -132,7 +131,6 @@
|
|
|
132
131
|
"get-port": "^6.0.0",
|
|
133
132
|
"get-stream": "^6.0.0",
|
|
134
133
|
"has-ansi": "^5.0.0",
|
|
135
|
-
"is-ci": "^3.0.0",
|
|
136
134
|
"moize": "^6.0.0",
|
|
137
135
|
"path-key": "^4.0.0",
|
|
138
136
|
"process-exists": "^5.0.0",
|
|
@@ -148,5 +146,5 @@
|
|
|
148
146
|
"module": "commonjs"
|
|
149
147
|
}
|
|
150
148
|
},
|
|
151
|
-
"gitHead": "
|
|
149
|
+
"gitHead": "d78a65c209ed987d3475cd1f37cf357693b99e3c"
|
|
152
150
|
}
|
package/lib/log/old_version.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { stdout } from 'process';
|
|
2
|
-
import UpdateNotifier from 'update-notifier';
|
|
3
|
-
import { ROOT_PACKAGE_JSON } from '../utils/json.js';
|
|
4
|
-
// Many build errors happen in local builds that do not use the latest version
|
|
5
|
-
// of `@netlify/build`. We print a warning message on those.
|
|
6
|
-
// We only print this when Netlify CLI has been used. Programmatic usage might
|
|
7
|
-
// come from a deep dependency calling `@netlify/build` and user might not be
|
|
8
|
-
// able to take any upgrade action, making the message noisy.
|
|
9
|
-
export const logOldCliVersionError = function ({ mode, testOpts }) {
|
|
10
|
-
if (mode !== 'cli') {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const corePackageJson = getCorePackageJson(testOpts);
|
|
14
|
-
UpdateNotifier({ pkg: corePackageJson, updateCheckInterval: 1 }).notify({
|
|
15
|
-
message: OLD_VERSION_MESSAGE,
|
|
16
|
-
shouldNotifyInNpmScript: true,
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
const getCorePackageJson = function (testOpts) {
|
|
20
|
-
// TODO: Find a way to test this without injecting code in the `src/`
|
|
21
|
-
if (testOpts.oldCliLogs) {
|
|
22
|
-
// `update-notifier` does not do anything if not in a TTY.
|
|
23
|
-
// In tests, we need to monkey patch this
|
|
24
|
-
// Mutation is required due to how `stdout.isTTY` works
|
|
25
|
-
stdout.isTTY = true;
|
|
26
|
-
return { ...ROOT_PACKAGE_JSON, version: '0.0.1' };
|
|
27
|
-
}
|
|
28
|
-
return ROOT_PACKAGE_JSON;
|
|
29
|
-
};
|
|
30
|
-
const OLD_VERSION_MESSAGE = `Please update netlify-cli to its latest version.
|
|
31
|
-
If netlify-cli is already the latest version,
|
|
32
|
-
please update your dependencies lock file instead.`;
|