@netlify/build 28.1.7 → 28.1.9

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/build.js CHANGED
@@ -245,6 +245,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
245
245
  logs,
246
246
  debug,
247
247
  timers: timersA,
248
+ featureFlags,
248
249
  });
249
250
  try {
250
251
  const { stepsCount, netlifyConfig: netlifyConfigA, statuses, failedPlugins, timers: timersC, configMutations, } = await runBuild({
@@ -16,4 +16,7 @@ export const DEFAULT_FEATURE_FLAGS = {
16
16
  edge_functions_cache_cli: false,
17
17
  edge_functions_produce_eszip: false,
18
18
  edge_functions_system_logger: false,
19
+ // TODO: remove this flag once rolled out to everyone
20
+ // FF link: https://app.launchdarkly.com/default/production/features/plugins_break_builds_with_unsupported_plugin_versions/targeting
21
+ plugins_break_builds_with_unsupported_plugin_versions: false,
19
22
  };
package/lib/error/type.js CHANGED
@@ -65,6 +65,12 @@ const TYPES = {
65
65
  locationType: 'buildFail',
66
66
  severity: 'info',
67
67
  },
68
+ // User package.json sets an unsupported plugin version
69
+ pluginUnsupportedVersion: {
70
+ title: 'Unsupported plugin version detected',
71
+ stackType: 'none',
72
+ severity: 'info',
73
+ },
68
74
  // `build.command` non-0 exit code
69
75
  buildCommand: {
70
76
  title: '"build.command" failed',
@@ -1,4 +1,5 @@
1
1
  import semver from 'semver';
2
+ import { addErrorInfo } from '../../error/info.js';
2
3
  import { isRuntime } from '../../utils/runtime.js';
3
4
  import { isPreviousMajor } from '../../utils/semver.js';
4
5
  import { getPluginOrigin } from '../description.js';
@@ -56,11 +57,15 @@ const getVersionField = function ([versionFieldName, version]) {
56
57
  };
57
58
  // Print a warning message when old versions plugins are used.
58
59
  // This can only happen when they are installed to `package.json`.
59
- export const logOutdatedPlugins = function (logs, pluginsOptions) {
60
+ // Also throws an error if the Next runtime is >= 4.0.0 || < 4.26.0
61
+ export const logOutdatedPlugins = function (logs, pluginsOptions, featureFlags) {
60
62
  const outdatedPlugins = pluginsOptions.filter(hasOutdatedVersion).map(getOutdatedPlugin);
61
63
  if (outdatedPlugins.length === 0) {
62
64
  return;
63
65
  }
66
+ // TODO: remove feature flag once fully rolled out
67
+ if (featureFlags.plugins_break_builds_with_unsupported_plugin_versions)
68
+ throwIfUnsupportedPluginVersion(pluginsOptions.filter(hasOutdatedVersion));
64
69
  logWarningSubHeader(logs, 'Outdated plugins');
65
70
  logWarningArray(logs, outdatedPlugins);
66
71
  };
@@ -99,6 +104,27 @@ export const logIncompatiblePlugins = function (logs, pluginsOptions) {
99
104
  logWarningSubHeader(logs, 'Incompatible plugins');
100
105
  logWarningArray(logs, incompatiblePlugins);
101
106
  };
107
+ // Throws an error if the Next runtime is >= 4.0.0 || < 4.26.0, otherwise returns.
108
+ const throwIfUnsupportedPluginVersion = function (outdatedPlugins) {
109
+ let packageName;
110
+ let version;
111
+ let latestVersion;
112
+ const nextOutdatedV4Plugin = outdatedPlugins.find((plugin) => {
113
+ packageName = plugin.pluginPackageJson.name;
114
+ version = plugin.pluginPackageJson.version;
115
+ latestVersion = plugin.latestVersion;
116
+ // https://github.com/npm/node-semver#hyphen-ranges-xyz---abc
117
+ // semver hyphen range is inclusive 4.0.0 - 4.25.0 is same as >= 4.0.0 || < 4.26.0;
118
+ return (packageName === '@netlify/plugin-nextjs' &&
119
+ semver.satisfies(version, '4.0.0 - 4.25.0', { includePrerelease: true }));
120
+ });
121
+ if (!nextOutdatedV4Plugin) {
122
+ return;
123
+ }
124
+ const error = new Error(`This site cannot be built because it is using an outdated version of the Next.js Runtime: ${packageName}@${version}. Versions greater than 4.26.0 are recommended. To upgrade this plugin, please update its version in "package.json" to the latest version: ${latestVersion}. If you cannot use a more recent version, please contact support at https://www.netlify.com/support for guidance.`);
125
+ addErrorInfo(error, { type: 'pluginUnsupportedVersion' });
126
+ throw error;
127
+ };
102
128
  const hasIncompatibleVersion = function ({ pluginPackageJson: { version }, compatibleVersion, compatWarning }) {
103
129
  return (compatWarning !== '' &&
104
130
  version !== undefined &&
@@ -12,10 +12,10 @@ const CHILD_MAIN_FILE = fileURLToPath(new URL('child/main.js', import.meta.url))
12
12
  // (for both security and safety reasons)
13
13
  // - logs can be buffered which allows manipulating them for log shipping,
14
14
  // transforming and parallel plugins
15
- const tStartPlugins = async function ({ pluginsOptions, buildDir, childEnv, logs, debug }) {
15
+ const tStartPlugins = async function ({ pluginsOptions, buildDir, childEnv, logs, debug, featureFlags }) {
16
16
  logRuntime(logs, pluginsOptions);
17
17
  logLoadingPlugins(logs, pluginsOptions, debug);
18
- logOutdatedPlugins(logs, pluginsOptions);
18
+ logOutdatedPlugins(logs, pluginsOptions, featureFlags);
19
19
  logIncompatiblePlugins(logs, pluginsOptions);
20
20
  const childProcesses = await Promise.all(pluginsOptions.map(({ pluginDir, nodePath }) => startPlugin({ pluginDir, nodePath, buildDir, childEnv })));
21
21
  return { childProcesses };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "28.1.7",
3
+ "version": "28.1.9",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
6
  "exports": "./lib/core/main.js",
@@ -67,11 +67,11 @@
67
67
  "@netlify/cache-utils": "^5.0.1",
68
68
  "@netlify/config": "^19.1.2",
69
69
  "@netlify/edge-bundler": "^3.0.1",
70
- "@netlify/functions-utils": "^5.0.1",
70
+ "@netlify/functions-utils": "^5.0.2",
71
71
  "@netlify/git-utils": "^5.0.1",
72
72
  "@netlify/plugins-list": "^6.50.0",
73
73
  "@netlify/run-utils": "^5.0.1",
74
- "@netlify/zip-it-and-ship-it": "^7.1.2",
74
+ "@netlify/zip-it-and-ship-it": "^8.0.0",
75
75
  "@sindresorhus/slugify": "^2.0.0",
76
76
  "ajv": "^8.11.0",
77
77
  "ajv-errors": "^3.0.0",
@@ -150,5 +150,5 @@
150
150
  "module": "commonjs"
151
151
  }
152
152
  },
153
- "gitHead": "452f62c69334ac40ef33156baea0d6bd64f20394"
153
+ "gitHead": "2505d18d2b074f157d0c3612016a53e11a9fa46f"
154
154
  }