@netlify/build 29.56.1 → 29.58.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.
@@ -74,6 +74,14 @@ type PluginInfo = {
74
74
  pluginPackageJson: {
75
75
  version?: string;
76
76
  };
77
+ extensionMetadata?: {
78
+ slug: string;
79
+ name: string;
80
+ version: string;
81
+ has_build: boolean;
82
+ has_connector: boolean;
83
+ author?: string;
84
+ };
77
85
  };
78
86
  export type BuildCommandLocation = {
79
87
  buildCommand: string;
@@ -112,6 +112,8 @@ const pluginDataToTracingAttributes = function (pluginInfo) {
112
112
  return {
113
113
  [`${pluginAttributePrefix}.name`]: pluginInfo?.packageName,
114
114
  [`${pluginAttributePrefix}.version`]: pluginInfo?.pluginPackageJson?.version,
115
+ [`${pluginAttributePrefix}.extensionAuthor`]: pluginInfo?.extensionMetadata?.author,
116
+ [`${pluginAttributePrefix}.extensionSlug`]: pluginInfo?.extensionMetadata?.slug,
115
117
  };
116
118
  };
117
119
  /**
@@ -42,7 +42,7 @@ const tLoadAllPlugins = async function ({ pluginsOptions, childProcesses, packag
42
42
  const loadAllPlugins = measureDuration(tLoadAllPlugins, 'load_plugins');
43
43
  // Retrieve plugin steps for one plugin.
44
44
  // Do it by executing the plugin `load` event handler.
45
- const loadPlugin = async function ({ packageName, pluginPackageJson, pluginPackageJson: { version } = {}, pluginPath, inputs, loadedFrom, origin }, { childProcesses, index, packageJson, logs, debug, verbose, netlifyConfig, featureFlags, systemLog }) {
45
+ const loadPlugin = async function ({ packageName, pluginPackageJson, pluginPackageJson: { version } = {}, pluginPath, inputs, loadedFrom, origin, integration, }, { childProcesses, index, packageJson, logs, debug, verbose, netlifyConfig, featureFlags, systemLog }) {
46
46
  const { childProcess } = childProcesses[index];
47
47
  const loadEvent = 'load';
48
48
  const cleanup = captureStandardError(childProcess, systemLog, loadEvent, featureFlags);
@@ -61,6 +61,7 @@ const loadPlugin = async function ({ packageName, pluginPackageJson, pluginPacka
61
61
  origin,
62
62
  pluginPackageJson,
63
63
  childProcess,
64
+ extensionMetadata: integration,
64
65
  }));
65
66
  return pluginSteps;
66
67
  }
@@ -70,7 +71,11 @@ const loadPlugin = async function ({ packageName, pluginPackageJson, pluginPacka
70
71
  await pSetTimeout(0);
71
72
  }
72
73
  addErrorInfo(error, {
73
- plugin: { packageName, pluginPackageJson },
74
+ plugin: {
75
+ packageName,
76
+ pluginPackageJson,
77
+ extensionMetadata: integration,
78
+ },
74
79
  location: { event: loadEvent, packageName, loadedFrom, origin },
75
80
  });
76
81
  addPluginLoadErrorStatus({ error, packageName, version, debug });
@@ -1,9 +1,10 @@
1
1
  import { createRequire } from 'module';
2
+ import { platform } from 'os';
2
3
  import { fileURLToPath, pathToFileURL } from 'url';
3
4
  import { promisify } from 'util';
4
5
  import { trace } from '@opentelemetry/api';
5
6
  import { execaNode } from 'execa';
6
- import { gte } from 'semver';
7
+ import { gte, satisfies } from 'semver';
7
8
  import { addErrorInfo } from '../error/info.js';
8
9
  import { logIncompatiblePlugins, logLoadingIntegration, logLoadingPlugins, logOutdatedPlugins, logRuntime, } from '../log/messages/compatibility.js';
9
10
  import { isTrustedPlugin } from '../steps/plugin.js';
@@ -128,5 +129,17 @@ const stopPlugin = async function ({ childProcess, logs, pluginOptions: { packag
128
129
  });
129
130
  childProcess.disconnect();
130
131
  }
131
- childProcess.kill();
132
+ // On Windows with Node 21+, there's a bug where attempting to kill a child process
133
+ // results in an EPERM error. Ignore the error in that case.
134
+ // See: https://github.com/nodejs/node/issues/51766
135
+ // We also disable execa's `forceKillAfterTimeout` in this case
136
+ // which can cause unhandled rejection.
137
+ try {
138
+ childProcess.kill('SIGTERM', {
139
+ forceKillAfterTimeout: platform() === 'win32' && satisfies(process.version, '>=21') ? false : undefined,
140
+ });
141
+ }
142
+ catch {
143
+ // no-op
144
+ }
132
145
  };
@@ -47,7 +47,8 @@ const coreStep = async function ({ logs, deployId, buildDir, packagePath, consta
47
47
  await pMap(blobsToUpload, async ({ key, contentPath, metadataPath }) => {
48
48
  systemLog(`Uploading blob ${key}`);
49
49
  const { data, metadata } = await getFileWithMetadata(key, contentPath, metadataPath);
50
- await blobStore.set(key, data, { metadata });
50
+ const arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.length);
51
+ await blobStore.set(key, arrayBuffer, { metadata });
51
52
  }, { concurrency: 10 });
52
53
  }
53
54
  catch (err) {
@@ -54,7 +54,8 @@ const coreStep = async function ({ debug, logs, deployId, buildDir, quiet, packa
54
54
  log(logs, `- Uploading blob ${key}`, { indent: true });
55
55
  }
56
56
  const { data, metadata } = await getFileWithMetadata(key, contentPath, metadataPath);
57
- await blobStore.set(key, data, { metadata });
57
+ const arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.length);
58
+ await blobStore.set(key, arrayBuffer, { metadata });
58
59
  }, { concurrency: 10 });
59
60
  }
60
61
  catch (err) {
@@ -1,4 +1,4 @@
1
- import { FunctionResult } from '@netlify/zip-it-and-ship-it';
1
+ import { zipFunctions, FunctionResult } from '@netlify/zip-it-and-ship-it';
2
2
  export declare const bundleFunctions: {
3
3
  event: string;
4
4
  coreStep: ({ childEnv, constants: { INTERNAL_FUNCTIONS_SRC: relativeInternalFunctionsSrc, IS_LOCAL: isRunningLocally, FUNCTIONS_SRC: relativeFunctionsSrc, FUNCTIONS_DIST: relativeFunctionsDist, }, buildDir, branch, packagePath, logs, netlifyConfig, featureFlags, repositoryRoot, userNodeVersion, systemLog, }: {
@@ -1,7 +1,6 @@
1
1
  import { rm, stat } from 'node:fs/promises';
2
2
  import { resolve } from 'node:path';
3
3
  import { listFrameworks } from '@netlify/framework-info';
4
- import { log } from '../../log/logger.js';
5
4
  const dirExists = async (path) => {
6
5
  try {
7
6
  await stat(path);
@@ -26,7 +25,7 @@ const coreStep = async (input) => {
26
25
  for (const dir of dirs) {
27
26
  await rm(resolve(input.buildDir, dir), { recursive: true, force: true });
28
27
  }
29
- log(input.logs, `Cleaned up ${dirs.join(', ')}.`);
28
+ input.systemLog(input.logs, `Cleaned up ${dirs.join(', ')}.`);
30
29
  return {};
31
30
  };
32
31
  const condition = async (input) => {
@@ -1,5 +1,5 @@
1
1
  export function isTrustedPlugin(packageName: any): any;
2
- export function firePluginStep({ event, childProcess, packageName, packagePath, pluginPackageJson, loadedFrom, origin, envChanges, errorParams, configOpts, netlifyConfig, defaultConfig, configMutations, headersPath, redirectsPath, constants, steps, error, logs, outputFlusher, systemLog, featureFlags, debug, verbose, }: {
2
+ export function firePluginStep({ event, childProcess, packageName, packagePath, pluginPackageJson, loadedFrom, origin, envChanges, errorParams, configOpts, netlifyConfig, defaultConfig, configMutations, headersPath, redirectsPath, constants, steps, error, logs, outputFlusher, systemLog, featureFlags, debug, verbose, extensionMetadata, }: {
3
3
  event: any;
4
4
  childProcess: any;
5
5
  packageName: any;
@@ -24,6 +24,7 @@ export function firePluginStep({ event, childProcess, packageName, packagePath,
24
24
  featureFlags: any;
25
25
  debug: any;
26
26
  verbose: any;
27
+ extensionMetadata: any;
27
28
  }): Promise<{
28
29
  newEnvChanges: any;
29
30
  netlifyConfig: any;
@@ -10,7 +10,7 @@ import { getPluginErrorType } from './error.js';
10
10
  import { updateNetlifyConfig, listConfigSideFiles } from './update_config.js';
11
11
  export const isTrustedPlugin = (packageName) => packageName?.startsWith('@netlify/');
12
12
  // Fire a plugin step
13
- export const firePluginStep = async function ({ event, childProcess, packageName, packagePath, pluginPackageJson, loadedFrom, origin, envChanges, errorParams, configOpts, netlifyConfig, defaultConfig, configMutations, headersPath, redirectsPath, constants, steps, error, logs, outputFlusher, systemLog, featureFlags, debug, verbose, }) {
13
+ export const firePluginStep = async function ({ event, childProcess, packageName, packagePath, pluginPackageJson, loadedFrom, origin, envChanges, errorParams, configOpts, netlifyConfig, defaultConfig, configMutations, headersPath, redirectsPath, constants, steps, error, logs, outputFlusher, systemLog, featureFlags, debug, verbose, extensionMetadata, }) {
14
14
  const standardStreams = getStandardStreams(outputFlusher);
15
15
  const listeners = pipePluginOutput(childProcess, logs, standardStreams);
16
16
  const otelCarrier = {};
@@ -63,7 +63,7 @@ export const firePluginStep = async function ({ event, childProcess, packageName
63
63
  const errorType = getPluginErrorType(newError, loadedFrom, packageName);
64
64
  addErrorInfo(newError, {
65
65
  ...errorType,
66
- plugin: { pluginPackageJson, packageName },
66
+ plugin: { pluginPackageJson, packageName, extensionMetadata },
67
67
  location: { event, packageName, loadedFrom, origin },
68
68
  });
69
69
  return { newError };
@@ -1,4 +1,4 @@
1
- export declare const runStep: ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, coreStepQuiet, pluginPackageJson, loadedFrom, origin, condition, configPath, outputConfigPath, buildDir, packagePath, repositoryRoot, nodePath, index, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, mode, api, errorMonitor, deployId, errorParams, error, failedPlugins, configOpts, netlifyConfig, defaultConfig, configMutations, headersPath, redirectsPath, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }: {
1
+ export declare const runStep: ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, coreStepQuiet, pluginPackageJson, loadedFrom, origin, condition, configPath, outputConfigPath, buildDir, packagePath, repositoryRoot, nodePath, index, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, mode, api, errorMonitor, deployId, errorParams, error, failedPlugins, configOpts, netlifyConfig, defaultConfig, configMutations, headersPath, redirectsPath, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, extensionMetadata, }: {
2
2
  event: any;
3
3
  childProcess: any;
4
4
  packageName: any;
@@ -51,4 +51,5 @@ export declare const runStep: ({ event, childProcess, packageName, coreStep, cor
51
51
  userNodeVersion: any;
52
52
  explicitSecretKeys: any;
53
53
  edgeFunctionsBootstrapURL: any;
54
+ extensionMetadata: any;
54
55
  }) => Promise<{}>;
@@ -11,7 +11,7 @@ import { firePluginStep } from './plugin.js';
11
11
  import { getStepReturn } from './return.js';
12
12
  const tracer = trace.getTracer('steps');
13
13
  // Run a step (core, build command or plugin)
14
- export const runStep = async function ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, coreStepQuiet, pluginPackageJson, loadedFrom, origin, condition, configPath, outputConfigPath, buildDir, packagePath, repositoryRoot, nodePath, index, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, mode, api, errorMonitor, deployId, errorParams, error, failedPlugins, configOpts, netlifyConfig, defaultConfig, configMutations, headersPath, redirectsPath, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }) {
14
+ export const runStep = async function ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, coreStepQuiet, pluginPackageJson, loadedFrom, origin, condition, configPath, outputConfigPath, buildDir, packagePath, repositoryRoot, nodePath, index, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, mode, api, errorMonitor, deployId, errorParams, error, failedPlugins, configOpts, netlifyConfig, defaultConfig, configMutations, headersPath, redirectsPath, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, extensionMetadata, }) {
15
15
  // Add relevant attributes to the upcoming span context
16
16
  const attributes = {
17
17
  'build.execution.step.name': coreStepName,
@@ -67,6 +67,7 @@ export const runStep = async function ({ event, childProcess, packageName, coreS
67
67
  }
68
68
  const fireStep = getFireStep(packageName, coreStepId, event);
69
69
  const { newEnvChanges, netlifyConfig: netlifyConfigA = netlifyConfig, configMutations: configMutationsA = configMutations, headersPath: headersPathA = headersPath, redirectsPath: redirectsPathA = redirectsPath, newError, newStatus, timers: timersA, durationNs, metrics, } = await fireStep({
70
+ extensionMetadata,
70
71
  defaultConfig,
71
72
  event,
72
73
  childProcess,
@@ -203,7 +204,7 @@ const getFireStep = function (packageName, coreStepId, event) {
203
204
  const parentTag = normalizeTagName(packageName);
204
205
  return measureDuration(tFireStep, event, { parentTag, category: 'pluginEvent' });
205
206
  };
206
- const tFireStep = function ({ defaultConfig, event, childProcess, packageName, pluginPackageJson, loadedFrom, outputFlusher, origin, coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, packagePath, nodePath, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, error, logs, debug, quiet, systemLog, verbose, saveConfig, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, deployId, }) {
207
+ const tFireStep = function ({ defaultConfig, event, childProcess, packageName, pluginPackageJson, loadedFrom, outputFlusher, origin, coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, packagePath, nodePath, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, error, logs, debug, quiet, systemLog, verbose, saveConfig, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, deployId, extensionMetadata, }) {
207
208
  if (coreStep !== undefined) {
208
209
  return fireCoreStep({
209
210
  coreStep,
@@ -267,5 +268,6 @@ const tFireStep = function ({ defaultConfig, event, childProcess, packageName, p
267
268
  featureFlags,
268
269
  debug,
269
270
  verbose,
271
+ extensionMetadata,
270
272
  });
271
273
  };
@@ -8,11 +8,12 @@ import { runStep } from './run_step.js';
8
8
  // If an error arises, runs `onError` events.
9
9
  // Runs `onEnd` events at the end, whether an error was thrown or not.
10
10
  export const runSteps = async function ({ defaultConfig, steps, buildbotServerSocket, events, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, packagePath, repositoryRoot, nodePath, childEnv, context, branch, constants, mode, api, errorMonitor, deployId, errorParams, netlifyConfig, configOpts, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }) {
11
- const { index: stepsCount, error: errorA, netlifyConfig: netlifyConfigC, statuses: statusesB, failedPlugins: failedPluginsA, timers: timersC, configMutations: configMutationsB, metrics: metricsC, } = await pReduce(steps, async ({ index, error, failedPlugins, envChanges, netlifyConfig: netlifyConfigA, configMutations, headersPath: headersPathA, redirectsPath: redirectsPathA, statuses, timers: timersA, metrics: metricsA, }, { event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, pluginPackageJson, loadedFrom, origin, condition, quiet: coreStepQuiet, }) => {
11
+ const { index: stepsCount, error: errorA, netlifyConfig: netlifyConfigC, statuses: statusesB, failedPlugins: failedPluginsA, timers: timersC, configMutations: configMutationsB, metrics: metricsC, } = await pReduce(steps, async ({ index, error, failedPlugins, envChanges, netlifyConfig: netlifyConfigA, configMutations, headersPath: headersPathA, redirectsPath: redirectsPathA, statuses, timers: timersA, metrics: metricsA, }, { event, childProcess, packageName, extensionMetadata, coreStep, coreStepId, coreStepName, coreStepDescription, pluginPackageJson, loadedFrom, origin, condition, quiet: coreStepQuiet, }) => {
12
12
  const { newIndex = index, newError = error, failedPlugin = [], newEnvChanges = {}, netlifyConfig: netlifyConfigB = netlifyConfigA, configMutations: configMutationsA = configMutations, headersPath: headersPathB = headersPathA, redirectsPath: redirectsPathB = redirectsPathA, newStatus, timers: timersB = timersA, metrics: metricsB = [], } = await runStep({
13
13
  event,
14
14
  childProcess,
15
15
  packageName,
16
+ extensionMetadata,
16
17
  coreStep,
17
18
  coreStepId,
18
19
  coreStepName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "29.56.1",
3
+ "version": "29.58.0",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
6
  "exports": "./lib/index.js",
@@ -69,16 +69,16 @@
69
69
  "dependencies": {
70
70
  "@bugsnag/js": "^7.0.0",
71
71
  "@netlify/blobs": "^7.4.0",
72
- "@netlify/cache-utils": "^5.1.6",
73
- "@netlify/config": "^20.19.1",
74
- "@netlify/edge-bundler": "12.2.3",
75
- "@netlify/framework-info": "^9.8.13",
76
- "@netlify/functions-utils": "^5.2.93",
77
- "@netlify/git-utils": "^5.1.1",
78
- "@netlify/opentelemetry-utils": "^1.2.1",
72
+ "@netlify/cache-utils": "^5.2.0",
73
+ "@netlify/config": "^20.21.0",
74
+ "@netlify/edge-bundler": "12.3.1",
75
+ "@netlify/framework-info": "^9.9.0",
76
+ "@netlify/functions-utils": "^5.3.1",
77
+ "@netlify/git-utils": "^5.2.0",
78
+ "@netlify/opentelemetry-utils": "^1.3.0",
79
79
  "@netlify/plugins-list": "^6.80.0",
80
- "@netlify/run-utils": "^5.1.1",
81
- "@netlify/zip-it-and-ship-it": "9.41.1",
80
+ "@netlify/run-utils": "^5.2.0",
81
+ "@netlify/zip-it-and-ship-it": "9.42.1",
82
82
  "@sindresorhus/slugify": "^2.0.0",
83
83
  "ansi-escapes": "^6.0.0",
84
84
  "chalk": "^5.0.0",
@@ -127,7 +127,7 @@
127
127
  "yargs": "^17.6.0"
128
128
  },
129
129
  "devDependencies": {
130
- "@netlify/nock-udp": "^3.1.2",
130
+ "@netlify/nock-udp": "^3.2.0",
131
131
  "@opentelemetry/api": "~1.8.0",
132
132
  "@opentelemetry/sdk-trace-base": "~1.24.0",
133
133
  "@types/node": "^14.18.53",
@@ -165,5 +165,5 @@
165
165
  "engines": {
166
166
  "node": "^14.16.0 || >=16.0.0"
167
167
  },
168
- "gitHead": "319d6b39f8382f114b1f7d138b3ea3a312a7b55c"
168
+ "gitHead": "214d1726e1f87eedf1aeb3b62ba5b3e87b84bfab"
169
169
  }