@netlify/build 28.3.1 → 28.4.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.
@@ -1,20 +1,40 @@
1
1
  import { execPath, version as currentVersion } from 'process';
2
2
  import semver from 'semver';
3
- // This node version is minimum required to use ESModules so if the user's preferred Node.js version is below that
4
- // we have to fall back to the system node version
5
- const MINIMUM_REQUIRED_NODE_VERSION = '^12.20.0 || ^14.14.0 || >=16.0.0';
6
- // Local plugins and `package.json`-installed plugins use user's preferred Node.js version if higher than our minimum
7
- // supported version. Else default to the system Node version.
8
- // Local and programmatic builds use `@netlify/build` Node.js version, which is
9
- // usually the system's Node.js version.
10
- // If the user Node version does not satisfy our supported engine range use our own system Node version
11
- export const addPluginsNodeVersion = function ({ pluginsOptions, nodePath, userNodeVersion }) {
3
+ import link from 'terminal-link';
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
+ /**
10
+ * This node version is minimum required to run the plugins code.
11
+ * If the users preferred Node.js version is below that we have to fall back to the system node version
12
+ */
13
+ const MINIMUM_REQUIRED_NODE_VERSION = '^14.14.0 || >=16.0.0';
14
+ /**
15
+ * Local plugins and `package.json`-installed plugins use user's preferred Node.js version if higher than our minimum
16
+ * supported version. Else default to the system Node version.
17
+ * Local and programmatic builds use `@netlify/build` Node.js version, which is
18
+ * usually the system's Node.js version.
19
+ * If the user Node version does not satisfy our supported engine range use our own system Node version
20
+ */
21
+ export const addPluginsNodeVersion = function ({ pluginsOptions, nodePath, userNodeVersion, logs }) {
12
22
  const currentNodeVersion = semver.clean(currentVersion);
13
- return pluginsOptions.map((pluginOptions) => addPluginNodeVersion({ pluginOptions, currentNodeVersion, userNodeVersion, nodePath }));
23
+ return pluginsOptions.map((pluginOptions) => addPluginNodeVersion({ pluginOptions, currentNodeVersion, userNodeVersion, nodePath, logs }));
14
24
  };
15
- const addPluginNodeVersion = function ({ pluginOptions, pluginOptions: { loadedFrom }, currentNodeVersion, userNodeVersion, nodePath, }) {
25
+ const addPluginNodeVersion = function ({ pluginOptions, pluginOptions: { loadedFrom, packageName }, currentNodeVersion, userNodeVersion, nodePath, logs, }) {
26
+ // if the plugin is a local one and the users node version does not satisfy
27
+ // our minimum required node version log a warning as we will default to the system node version
28
+ if ((loadedFrom === 'local' || loadedFrom === 'package.json') &&
29
+ !semver.satisfies(userNodeVersion, MINIMUM_REQUIRED_NODE_VERSION)) {
30
+ logWarningSubHeader(logs, `Warning: ${packageName} will be executed with Node.js version ${currentNodeVersion} in the future`);
31
+ logWarning(logs, ` The plugin cannot be executed with your defined Node.js version ${userNodeVersion} in the future.
32
+ Starting December 5th 2022 our minimum required Node version range for executing plugins will be: ${MINIMUM_REQUIRED_NODE_VERSION}
33
+
34
+ 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
+ }
16
36
  return (loadedFrom === 'local' || loadedFrom === 'package.json') &&
17
- semver.satisfies(userNodeVersion, MINIMUM_REQUIRED_NODE_VERSION)
37
+ semver.satisfies(userNodeVersion, OLD_MINIMUM_REQUIRED_NODE_VERSION)
18
38
  ? { ...pluginOptions, nodePath, nodeVersion: userNodeVersion }
19
39
  : { ...pluginOptions, nodePath: execPath, nodeVersion: currentNodeVersion };
20
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "28.3.1",
3
+ "version": "28.4.0",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
6
  "exports": "./lib/core/main.js",
@@ -109,6 +109,7 @@
109
109
  "string-width": "^5.0.0",
110
110
  "strip-ansi": "^7.0.0",
111
111
  "supports-color": "^9.0.0",
112
+ "terminal-link": "^3.0.0",
112
113
  "tmp-promise": "^3.0.2",
113
114
  "ts-node": "^10.6.0",
114
115
  "typescript": "^4.8.4",
@@ -148,5 +149,5 @@
148
149
  "module": "commonjs"
149
150
  }
150
151
  },
151
- "gitHead": "778bfe266735cbe5f545657e3acfd8b6bb646ed2"
152
+ "gitHead": "0f1f3ee7946a43698c7a6b45e3ce53dd79cd065d"
152
153
  }