@netlify/build 29.15.6 → 29.16.1

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
@@ -53,7 +53,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
53
53
  testOpts,
54
54
  featureFlags,
55
55
  });
56
- const { netlifyConfig, configPath, headersPath, redirectsPath, buildDir, repositoryRoot: repositoryRootA, packageJson, userNodeVersion, childEnv, context: contextA, branch: branchA, token: tokenA, api, siteInfo, timers: timersA, } = await loadConfig({
56
+ const { netlifyConfig, configPath, headersPath, redirectsPath, buildDir, repositoryRoot: repositoryRootA, packageJson, userNodeVersion, childEnv, context: contextA, branch: branchA, token: tokenA, api, siteInfo, timers: timersA, integrations, } = await loadConfig({
57
57
  configOpts,
58
58
  cachedConfig,
59
59
  cachedConfigPath,
@@ -128,6 +128,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
128
128
  timeline,
129
129
  devCommand,
130
130
  quiet,
131
+ integrations,
131
132
  explicitSecretKeys,
132
133
  });
133
134
  return {
@@ -143,7 +144,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
143
144
  };
144
145
  export const execBuild = measureDuration(tExecBuild, 'total', { parentTag: 'build_site' });
145
146
  // Runs a build then report any plugin statuses
146
- export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, buildbotServerSocket, constants, dry, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, timers, sendStatus, saveConfig, testOpts, featureFlags, timeline, devCommand, quiet, explicitSecretKeys, }) {
147
+ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, buildbotServerSocket, constants, dry, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, timers, sendStatus, saveConfig, testOpts, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, }) {
147
148
  try {
148
149
  const { stepsCount, netlifyConfig: netlifyConfigA, statuses, pluginsOptions: pluginsOptionsA, failedPlugins, timers: timersA, configMutations, metrics, } = await initAndRunBuild({
149
150
  pluginsOptions,
@@ -182,6 +183,7 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
182
183
  timeline,
183
184
  devCommand,
184
185
  quiet,
186
+ integrations,
185
187
  explicitSecretKeys,
186
188
  });
187
189
  await Promise.all([
@@ -243,7 +245,7 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
243
245
  }
244
246
  };
245
247
  // Initialize plugin processes then runs a build
246
- const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, dry, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, sendStatus, saveConfig, timers, testOpts, buildbotServerSocket, constants, featureFlags, timeline, devCommand, quiet, explicitSecretKeys, }) {
248
+ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, dry, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, sendStatus, saveConfig, timers, testOpts, buildbotServerSocket, constants, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, }) {
247
249
  const { pluginsOptions: pluginsOptionsA, timers: timersA } = await getPluginsOptions({
248
250
  pluginsOptions,
249
251
  netlifyConfig,
@@ -260,6 +262,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
260
262
  timers,
261
263
  testOpts,
262
264
  featureFlags,
265
+ integrations,
263
266
  });
264
267
  errorParams.pluginsOptions = pluginsOptionsA;
265
268
  const { childProcesses, timers: timersB } = await startPlugins({
@@ -38,7 +38,7 @@ export const getConfigOpts = function ({ config, defaultConfig, cwd, repositoryR
38
38
  };
39
39
  // Retrieve configuration object
40
40
  const tLoadConfig = async function ({ configOpts, cachedConfig, cachedConfigPath, envOpt, debug, logs, nodePath, quiet, }) {
41
- const { configPath, headersPath, redirectsPath, buildDir, repositoryRoot, config: netlifyConfig, context: contextA, branch: branchA, token: tokenA, api, siteInfo, env, } = await resolveInitialConfig(configOpts, cachedConfig, cachedConfigPath);
41
+ const { configPath, headersPath, redirectsPath, buildDir, repositoryRoot, config: netlifyConfig, context: contextA, branch: branchA, token: tokenA, api, siteInfo, env, integrations, } = await resolveInitialConfig(configOpts, cachedConfig, cachedConfigPath);
42
42
  if (!quiet) {
43
43
  logConfigInfo({ logs, configPath, buildDir, netlifyConfig, context: contextA, debug });
44
44
  }
@@ -61,6 +61,7 @@ const tLoadConfig = async function ({ configOpts, cachedConfig, cachedConfigPath
61
61
  token: tokenA,
62
62
  api: apiA,
63
63
  siteInfo,
64
+ integrations,
64
65
  };
65
66
  };
66
67
  export const loadConfig = measureDuration(tLoadConfig, 'resolve_config');
@@ -2,7 +2,7 @@ import { promises as fs } from 'fs';
2
2
  import { normalize } from 'path';
3
3
  import { pathExists } from 'path-exists';
4
4
  import { isFile } from 'path-type';
5
- import { logInstallMissingPlugins } from '../log/messages/install.js';
5
+ import { logInstallMissingPlugins, logInstallIntegrations } from '../log/messages/install.js';
6
6
  import { addExactDependencies } from './main.js';
7
7
  // Automatically install plugins if not already installed.
8
8
  // Since this is done under the hood, we always use `npm` with specific `npm`
@@ -15,6 +15,15 @@ export const installMissingPlugins = async function ({ missingPlugins, autoPlugi
15
15
  await createAutoPluginsDir(logs, autoPluginsDir);
16
16
  await addExactDependencies({ packageRoot: autoPluginsDir, isLocal: mode !== 'buildbot', packages });
17
17
  };
18
+ export const installIntegrationPlugins = async function ({ integrations, autoPluginsDir, mode, logs }) {
19
+ const packages = integrations.map(getIntegrationPackage);
20
+ logInstallIntegrations(logs, integrations);
21
+ await createAutoPluginsDir(logs, autoPluginsDir);
22
+ await addExactDependencies({ packageRoot: autoPluginsDir, isLocal: mode !== 'buildbot', packages });
23
+ };
24
+ const getIntegrationPackage = function ({ version }) {
25
+ return `${version}/packages/buildhooks.tgz`;
26
+ };
18
27
  // We pin the version without using semver ranges ^ nor ~
19
28
  const getPackage = function ({ packageName, expectedVersion }) {
20
29
  return `${packageName}@${expectedVersion}`;
@@ -12,11 +12,22 @@ export const logRuntime = (logs, pluginOptions) => {
12
12
  logSubHeader(logs, `Using Next.js Runtime - v${nextRuntime.pluginPackageJson.version}`);
13
13
  }
14
14
  };
15
+ export const logLoadingIntegration = (logs, pluginOptions) => {
16
+ const loadingPlugins = pluginOptions
17
+ .filter((plugin) => plugin.isIntegration)
18
+ .map((pluginOptions) => pluginOptions.integration?.slug ?? 'no-slug');
19
+ if (loadingPlugins.length === 0) {
20
+ return;
21
+ }
22
+ logSubHeader(logs, 'Loading integrations');
23
+ logArray(logs, loadingPlugins);
24
+ };
15
25
  export const logLoadingPlugins = function (logs, pluginsOptions, debug) {
16
26
  const loadingPlugins = pluginsOptions
17
27
  .filter(isNotCorePlugin)
18
28
  // We don't want to show runtimes as plugins
19
29
  .filter((plugin) => !isRuntime(plugin))
30
+ .filter((p) => !p.isIntegration)
20
31
  .map((pluginOptions) => getPluginDescription(pluginOptions, debug));
21
32
  if (loadingPlugins.length === 0) {
22
33
  return;
@@ -12,6 +12,13 @@ export const logInstallMissingPlugins = function (logs, packages) {
12
12
  logSubHeader(logs, `Using Next.js Runtime - v${nextRuntime.pluginPackageJson.version}`);
13
13
  }
14
14
  };
15
+ export const logInstallIntegrations = function (logs, integrations) {
16
+ if (integrations.length === 0) {
17
+ return;
18
+ }
19
+ logSubHeader(logs, 'Installing integrations');
20
+ logArray(logs, integrations.map((integration) => integration.slug));
21
+ };
15
22
  export const logInstallLocalPluginsDeps = function (logs, localPluginsOptions) {
16
23
  const packages = localPluginsOptions.map(getPackageName);
17
24
  logSubHeader(logs, 'Installing local plugins dependencies');
@@ -8,7 +8,7 @@ import { getPackageJson } from '../utils/package.js';
8
8
  import { useManifest } from './manifest/main.js';
9
9
  import { resolvePluginsPath } from './resolve.js';
10
10
  // Load core plugins and user plugins
11
- const tGetPluginsOptions = async function ({ pluginsOptions, netlifyConfig: { plugins }, siteInfo, buildDir, nodePath, packageJson, userNodeVersion, mode, api, logs, debug, sendStatus, testOpts, featureFlags, }) {
11
+ const tGetPluginsOptions = async function ({ pluginsOptions, netlifyConfig: { plugins }, siteInfo, buildDir, nodePath, packageJson, userNodeVersion, mode, api, logs, debug, sendStatus, testOpts, featureFlags, integrations, }) {
12
12
  const pluginsOptionsA = await resolvePluginsPath({
13
13
  pluginsOptions,
14
14
  siteInfo,
@@ -23,6 +23,7 @@ const tGetPluginsOptions = async function ({ pluginsOptions, netlifyConfig: { pl
23
23
  sendStatus,
24
24
  testOpts,
25
25
  featureFlags,
26
+ integrations,
26
27
  });
27
28
  const pluginsOptionsB = await Promise.all(pluginsOptionsA.map((pluginOptions) => loadPluginFiles({ pluginOptions, debug })));
28
29
  const pluginsOptionsC = pluginsOptionsB.filter(isNotRedundantCorePlugin);
@@ -1,5 +1,5 @@
1
1
  import { addErrorInfo } from '../error/info.js';
2
- import { installMissingPlugins } from '../install/missing.js';
2
+ import { installMissingPlugins, installIntegrationPlugins } from '../install/missing.js';
3
3
  import { resolvePath, tryResolvePath } from '../utils/resolve.js';
4
4
  import { addExpectedVersions } from './expected_version.js';
5
5
  import { addPluginsNodeVersion } from './node_version.js';
@@ -9,7 +9,7 @@ import { addPinnedVersions } from './pinned_version.js';
9
9
  // - local plugin
10
10
  // - external plugin already installed in `node_modules`, most likely through `package.json`
11
11
  // - automatically installed by us, to `.netlify/plugins/`
12
- export const resolvePluginsPath = async function ({ pluginsOptions, siteInfo, buildDir, nodePath, packageJson, userNodeVersion, mode, api, logs, debug, sendStatus, testOpts, featureFlags, }) {
12
+ export const resolvePluginsPath = async function ({ pluginsOptions, siteInfo, buildDir, nodePath, packageJson, userNodeVersion, mode, api, logs, debug, sendStatus, testOpts, featureFlags, integrations, }) {
13
13
  const autoPluginsDir = getAutoPluginsDir(buildDir);
14
14
  const pluginsOptionsA = await Promise.all(pluginsOptions.map((pluginOptions) => resolvePluginPath({ pluginOptions, buildDir, autoPluginsDir })));
15
15
  const pluginsOptionsB = addPluginsNodeVersion({
@@ -35,7 +35,11 @@ export const resolvePluginsPath = async function ({ pluginsOptions, siteInfo, bu
35
35
  mode,
36
36
  logs,
37
37
  });
38
- return pluginsOptionsE;
38
+ let integrationPluginOptions = [];
39
+ if (featureFlags.build_fetch_integrations) {
40
+ integrationPluginOptions = await handleIntegrations({ integrations, autoPluginsDir, mode, logs });
41
+ }
42
+ return [...pluginsOptionsE, ...integrationPluginOptions];
39
43
  };
40
44
  // Find the path to the directory used to install plugins automatically.
41
45
  // It is a subdirectory of `buildDir`, so that the plugin can require the
@@ -95,7 +99,19 @@ const handleMissingPlugins = async function ({ pluginsOptions, autoPluginsDir, m
95
99
  return pluginsOptions;
96
100
  }
97
101
  await installMissingPlugins({ missingPlugins, autoPluginsDir, mode, logs });
98
- return await Promise.all(pluginsOptions.map((pluginOptions) => resolveMissingPluginPath({ pluginOptions, autoPluginsDir })));
102
+ return Promise.all(pluginsOptions.map((pluginOptions) => resolveMissingPluginPath({ pluginOptions, autoPluginsDir })));
103
+ };
104
+ const handleIntegrations = async function ({ integrations, autoPluginsDir, mode, logs }) {
105
+ const toInstall = integrations.filter((integration) => integration.has_build);
106
+ await installIntegrationPlugins({ integrations: toInstall, autoPluginsDir, mode, logs });
107
+ return Promise.all(toInstall.map((integration) => resolveIntegration({
108
+ integration,
109
+ autoPluginsDir,
110
+ })));
111
+ };
112
+ const resolveIntegration = async function ({ integration, autoPluginsDir }) {
113
+ const pluginPath = await resolvePath(`${integration.slug}-buildhooks`, autoPluginsDir);
114
+ return { pluginPath, packageName: `${integration.slug}-buildhooks`, isIntegration: true, integration };
99
115
  };
100
116
  // Resolve the plugins that just got automatically installed
101
117
  const resolveMissingPluginPath = async function ({ pluginOptions, pluginOptions: { packageName }, autoPluginsDir }) {
@@ -1,7 +1,7 @@
1
1
  import { fileURLToPath } from 'url';
2
2
  import { execaNode } from 'execa';
3
3
  import { addErrorInfo } from '../error/info.js';
4
- import { logRuntime, logLoadingPlugins, logOutdatedPlugins, logIncompatiblePlugins, } from '../log/messages/compatibility.js';
4
+ import { logRuntime, logLoadingPlugins, logOutdatedPlugins, logIncompatiblePlugins, logLoadingIntegration, } from '../log/messages/compatibility.js';
5
5
  import { measureDuration } from '../time/main.js';
6
6
  import { getEventFromChild } from './ipc.js';
7
7
  import { getSpawnInfo } from './options.js';
@@ -16,6 +16,7 @@ const tStartPlugins = async function ({ pluginsOptions, buildDir, childEnv, logs
16
16
  if (!quiet) {
17
17
  logRuntime(logs, pluginsOptions);
18
18
  logLoadingPlugins(logs, pluginsOptions, debug);
19
+ logLoadingIntegration(logs, pluginsOptions);
19
20
  }
20
21
  logOutdatedPlugins(logs, pluginsOptions);
21
22
  logIncompatiblePlugins(logs, pluginsOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "29.15.6",
3
+ "version": "29.16.1",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
6
  "exports": "./lib/core/main.js",
@@ -65,8 +65,8 @@
65
65
  "@bugsnag/js": "^7.0.0",
66
66
  "@honeycombio/opentelemetry-node": "^0.4.0",
67
67
  "@netlify/cache-utils": "^5.1.5",
68
- "@netlify/config": "^20.5.2",
69
- "@netlify/edge-bundler": "8.16.3",
68
+ "@netlify/config": "^20.6.0",
69
+ "@netlify/edge-bundler": "8.16.4",
70
70
  "@netlify/framework-info": "^9.8.10",
71
71
  "@netlify/functions-utils": "^5.2.18",
72
72
  "@netlify/git-utils": "^5.1.1",
@@ -137,7 +137,7 @@
137
137
  "process-exists": "^5.0.0",
138
138
  "sinon": "^13.0.0",
139
139
  "tmp-promise": "^3.0.2",
140
- "tsd": "^0.24.1",
140
+ "tsd": "^0.28.0",
141
141
  "yarn": "^1.22.4"
142
142
  },
143
143
  "engines": {
@@ -148,5 +148,5 @@
148
148
  "module": "commonjs"
149
149
  }
150
150
  },
151
- "gitHead": "185a994a728ca2b03edd7989456de67495657bfe"
151
+ "gitHead": "6cd25aebae914d1eb6e6dbae9bc95c49c734a588"
152
152
  }