@netlify/build 28.4.1 → 28.4.3

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.
@@ -2,7 +2,12 @@ import { env, execPath } from 'process';
2
2
  import { logFlags } from '../log/messages/config.js';
3
3
  import { removeFalsy } from '../utils/remove_falsy.js';
4
4
  import { DEFAULT_FEATURE_FLAGS } from './feature_flags.js';
5
- // Normalize CLI flags
5
+ const REQUIRE_MODE = 'require';
6
+ const DEFAULT_EDGE_FUNCTIONS_DIST = '.netlify/edge-functions-dist/';
7
+ const DEFAULT_FUNCTIONS_DIST = '.netlify/functions/';
8
+ const DEFAULT_CACHE_DIR = '.netlify/cache/';
9
+ const DEFAULT_STATSD_PORT = 8125;
10
+ /** Normalize CLI flags */
6
11
  export const normalizeFlags = function (flags, logs) {
7
12
  const rawFlags = removeFalsy(flags);
8
13
  // Combine the flags object env with the process.env
@@ -52,8 +57,3 @@ const getDefaultFlags = function ({ env: envOpt = {} }, combinedEnv) {
52
57
  const computeTelemetry = function (flags, envOpts) {
53
58
  return envOpts.BUILD_TELEMETRY_DISABLED ? { telemetry: false } : { telemetry: flags.telemetry };
54
59
  };
55
- const REQUIRE_MODE = 'require';
56
- const DEFAULT_EDGE_FUNCTIONS_DIST = '.netlify/edge-functions-dist/';
57
- const DEFAULT_FUNCTIONS_DIST = '.netlify/functions/';
58
- const DEFAULT_CACHE_DIR = '.netlify/cache/';
59
- const DEFAULT_STATSD_PORT = 8125;
package/lib/log/logger.js CHANGED
@@ -2,7 +2,7 @@ import { createWriteStream } from 'fs';
2
2
  import figures from 'figures';
3
3
  import indentString from 'indent-string';
4
4
  import { getHeader } from './header.js';
5
- import { serializeObject, serializeArray } from './serialize.js';
5
+ import { serializeArray, serializeObject } from './serialize.js';
6
6
  import { THEME } from './theme.js';
7
7
  const INDENT_SIZE = 2;
8
8
  /**
@@ -132,7 +132,7 @@ systemLogFile) {
132
132
  }
133
133
  // Return a function that writes to the file descriptor configured for system
134
134
  // logs.
135
- const fileDescriptor = createWriteStream(null, { fd: systemLogFile });
135
+ const fileDescriptor = createWriteStream('', { fd: systemLogFile });
136
136
  fileDescriptor.on('error', () => {
137
137
  logError(logs, 'Could not write to system log file');
138
138
  });
@@ -54,10 +54,15 @@ const isNotRedundantCorePlugin = function (pluginOptionsA, index, pluginsOptions
54
54
  * Retrieve information about @netlify/build when an error happens there and not
55
55
  * in a plugin
56
56
  */
57
- export const getSpawnInfo = () => ({
58
- plugin: { packageName: ROOT_PACKAGE_JSON.name, pluginPackageJson: ROOT_PACKAGE_JSON },
59
- location: { event: 'load', packageName: ROOT_PACKAGE_JSON.name, loadedFrom: 'core', origin: 'core' },
60
- });
57
+ export const getSpawnInfo = () => {
58
+ // we know that this package.json has a name as it's ours
59
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
60
+ const packageName = ROOT_PACKAGE_JSON.name;
61
+ return {
62
+ plugin: { packageName, pluginPackageJson: ROOT_PACKAGE_JSON },
63
+ location: { event: 'load', packageName, loadedFrom: 'core', origin: 'core' },
64
+ };
65
+ };
61
66
  const throwUserError = function (message) {
62
67
  const error = new Error(message);
63
68
  addErrorInfo(error, { type: 'resolveConfig' });
@@ -17,12 +17,12 @@ const tStartPlugins = async function ({ pluginsOptions, buildDir, childEnv, logs
17
17
  logLoadingPlugins(logs, pluginsOptions, debug);
18
18
  logOutdatedPlugins(logs, pluginsOptions, featureFlags);
19
19
  logIncompatiblePlugins(logs, pluginsOptions);
20
- const childProcesses = await Promise.all(pluginsOptions.map(({ pluginDir, nodePath }) => startPlugin({ pluginDir, nodePath, buildDir, childEnv })));
20
+ const childProcesses = await Promise.all(pluginsOptions.map(({ pluginDir, nodePath }) => startPlugin({ pluginDir, nodePath, buildDir, childEnv, featureFlags })));
21
21
  return { childProcesses };
22
22
  };
23
23
  export const startPlugins = measureDuration(tStartPlugins, 'start_plugins');
24
- const startPlugin = async function ({ pluginDir, nodePath, buildDir, childEnv }) {
25
- const childProcess = execaNode(CHILD_MAIN_FILE, {
24
+ const startPlugin = async function ({ pluginDir, nodePath, buildDir, childEnv, featureFlags }) {
25
+ const childProcess = execaNode(CHILD_MAIN_FILE, [], {
26
26
  cwd: buildDir,
27
27
  preferLocal: true,
28
28
  localDir: pluginDir,
@@ -30,7 +30,11 @@ const startPlugin = async function ({ pluginDir, nodePath, buildDir, childEnv })
30
30
  execPath: nodePath,
31
31
  env: childEnv,
32
32
  extendEnv: false,
33
- serialization: 'advanced',
33
+ // Feature flag: https://app.launchdarkly.com/default/production/features/netlify_build_use_json_serialization_for_plugin_ipc/targeting
34
+ // TODO: remove feature flag once fully rolled out
35
+ ...(!featureFlags.netlify_build_use_json_serialization_for_plugin_ipc && {
36
+ serialization: 'advanced',
37
+ }),
34
38
  });
35
39
  try {
36
40
  await getEventFromChild(childProcess, 'ready');
@@ -1,12 +1,10 @@
1
+ import { startBuild } from '../core/build.js';
1
2
  import { getConfigOpts, loadConfig } from '../core/config.js';
2
3
  import { getConstants } from '../core/constants.js';
3
- import { normalizeFlags } from '../core/normalize_flags.js';
4
4
  import { getSeverity } from '../core/severity.js';
5
5
  import { handleBuildError } from '../error/handle.js';
6
6
  import { getErrorInfo } from '../error/info.js';
7
- import { startErrorMonitor } from '../error/monitor/start.js';
8
- import { getBufferLogs, getSystemLogger } from '../log/logger.js';
9
- import { logBuildStart } from '../log/messages/core.js';
7
+ import { getSystemLogger } from '../log/logger.js';
10
8
  import { reportStatuses } from '../status/report.js';
11
9
  import { getSteps } from './get.js';
12
10
  import { runSteps } from './run_steps.js';
@@ -37,13 +35,6 @@ export const runCoreSteps = async (buildSteps, flags = {}) => {
37
35
  return { success, severityCode, logs };
38
36
  }
39
37
  };
40
- const startBuild = function (flags) {
41
- const logs = getBufferLogs(flags);
42
- logBuildStart(logs);
43
- const { bugsnagKey, ...flagsA } = normalizeFlags(flags, logs);
44
- const errorMonitor = startErrorMonitor({ flags: flagsA, logs, bugsnagKey });
45
- return { ...flagsA, errorMonitor, logs };
46
- };
47
38
  const getBuildSteps = function (buildSteps) {
48
39
  const allSteps = getSteps([]).steps.filter(({ coreStepId }) => buildSteps.includes(coreStepId));
49
40
  return allSteps;
@@ -8,12 +8,14 @@ export const getPackageJson = async function (cwd, options = {}) {
8
8
  packageJson: {},
9
9
  };
10
10
  try {
11
- const { path, packageJson } = await readPackageUp({
11
+ const readResult = await readPackageUp({
12
12
  cwd,
13
13
  ...Object.assign({ normalize: true }, options),
14
14
  });
15
- result.packageJson = packageJson;
16
- result.packageDir = dirname(path);
15
+ if (readResult) {
16
+ result.packageJson = readResult.packageJson;
17
+ result.packageDir = dirname(readResult.path);
18
+ }
17
19
  }
18
20
  catch {
19
21
  // continue regardless error
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "28.4.1",
3
+ "version": "28.4.3",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
6
  "exports": "./lib/core/main.js",
@@ -66,7 +66,7 @@
66
66
  "@bugsnag/js": "^7.0.0",
67
67
  "@netlify/cache-utils": "^5.0.2",
68
68
  "@netlify/config": "^20.0.2",
69
- "@netlify/edge-bundler": "4.4.1",
69
+ "@netlify/edge-bundler": "4.4.2",
70
70
  "@netlify/functions-utils": "^5.0.4",
71
71
  "@netlify/git-utils": "^5.0.2",
72
72
  "@netlify/plugins-list": "^6.54.0",
@@ -149,5 +149,5 @@
149
149
  "module": "commonjs"
150
150
  }
151
151
  },
152
- "gitHead": "3e80c5e33030d37eec733ecb927c54eceebd2fd5"
152
+ "gitHead": "e201ff43d3dfc93b712b1644eae1729ba1c014c2"
153
153
  }