@netlify/build 33.4.4 → 33.4.6

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.
@@ -31,7 +31,10 @@ export declare const startBuild: (flags: Partial<BuildFlags>) => {
31
31
  port: number;
32
32
  };
33
33
  };
34
- export declare const execBuild: any;
34
+ export declare const execBuild: ({ timers, ...opts }: {
35
+ [x: string]: any;
36
+ timers: any;
37
+ }, ...args: any[]) => Promise<any>;
35
38
  export declare const runAndReportBuild: ({ pluginsOptions, netlifyConfig, defaultConfig, configOpts, siteInfo, configPath, outputConfigPath, headersPath, redirectsPath, packagePath, buildDir, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, buildbotServerSocket, constants, dry, mode, api, token, errorMonitor, deployId, errorParams, logs, debug, systemLog, systemLogFile, verbose, timers, sendStatus, saveConfig, testOpts, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, enhancedSecretScan, edgeFunctionsBootstrapURL, eventHandlers, }: {
36
39
  pluginsOptions: any;
37
40
  netlifyConfig: any;
package/lib/core/build.js CHANGED
@@ -1,4 +1,3 @@
1
- import { supportedRuntimes } from '@netlify/framework-info';
2
1
  import { addAttributesToActiveSpan } from '@netlify/opentelemetry-utils';
3
2
  import { getErrorInfo } from '../error/info.js';
4
3
  import { startErrorMonitor } from '../error/monitor/start.js';
@@ -20,6 +19,10 @@ import { doDryRun } from './dry.js';
20
19
  import { warnOnLingeringProcesses } from './lingering.js';
21
20
  import { warnOnMissingSideFiles } from './missing_side_file.js';
22
21
  import { normalizeFlags } from './normalize_flags.js';
22
+ const supportedRuntimes = {
23
+ next: { package: '@netlify/plugin-nextjs', skipFlag: 'NETLIFY_NEXT_PLUGIN_SKIP' },
24
+ gatsby: { package: '@netlify/plugin-gatsby', skipFlag: 'NETLIFY_GATSBY_PLUGIN_SKIP' },
25
+ };
23
26
  // Performed on build start. Must be kept small and unlikely to fail since it
24
27
  // does not have proper error handling. Error handling relies on `errorMonitor`
25
28
  // being built, which relies itself on flags being normalized.
@@ -39,7 +39,10 @@ export function getConfigOpts({ config, defaultConfig, cwd, repositoryRoot, pack
39
39
  testOpts: any;
40
40
  featureFlags: any;
41
41
  };
42
- export const loadConfig: any;
42
+ export const loadConfig: ({ timers, ...opts }: {
43
+ [x: string]: any;
44
+ timers: any;
45
+ }, ...args: any[]) => Promise<any>;
43
46
  export function resolveUpdatedConfig(configOpts: any, configMutations: any, defaultConfig: any): Promise<import("packages/config/lib/main.js").Config>;
44
47
  export function saveUpdatedConfig({ configMutations, buildDir, repositoryRoot, configPath, outputConfigPath, headersPath, redirectsPath, logs, featureFlags, context, branch, debug, saveConfig, }: {
45
48
  configMutations: any;
@@ -1,4 +1,4 @@
1
- import { packageDirectory } from 'pkg-dir';
1
+ import { packageDirectory } from 'package-directory';
2
2
  import { logInstallLocalPluginsDeps } from '../log/messages/install.js';
3
3
  import { installDependencies } from './main.js';
4
4
  // Install dependencies of local plugins.
@@ -1,6 +1,6 @@
1
1
  import logProcessErrors from 'log-process-errors';
2
2
  import { errorToJson } from '../../error/build.js';
3
- import { addDefaultErrorInfo, isBuildError } from '../../error/info.js';
3
+ import { addDefaultErrorInfo } from '../../error/info.js';
4
4
  import { normalizeError } from '../../error/parse/normalize.js';
5
5
  import { sendEventToParent } from '../ipc.js';
6
6
  // Handle any top-level error and communicate it back to parent
@@ -13,14 +13,12 @@ export const handleError = async function (error, verbose) {
13
13
  // On uncaught exceptions and unhandled rejections, print the stack trace.
14
14
  // Also, prevent child processes from crashing on uncaught exceptions.
15
15
  export const handleProcessErrors = function () {
16
- logProcessErrors({ log: handleProcessError, exitOn: [] });
16
+ logProcessErrors({ onError: handleProcessError, exit: false });
17
17
  };
18
- const handleProcessError = async function (error, level, originalError) {
19
- if (level !== 'error') {
20
- console[level](error);
18
+ const handleProcessError = async function (error, event) {
19
+ if (event === 'warning') {
20
+ console.warn(error);
21
21
  return;
22
22
  }
23
- // Do not use log-process-errors prettification with errors thrown by `utils.build.*`
24
- const errorA = isBuildError(originalError) ? originalError : error;
25
- await handleError(errorA);
23
+ await handleError(error);
26
24
  };
@@ -51,15 +51,8 @@ const isValidPluginsList = function (pluginsList) {
51
51
  const normalizePluginsList = function (pluginsList) {
52
52
  return Object.fromEntries(pluginsList.map(normalizePluginItem));
53
53
  };
54
- /**
55
- * `version` in `plugins.json` is the latest version.
56
- * A `compatibility` array of objects can be added to specify conditions to
57
- * apply different versions.
58
- * `netlify/plugins` ensures that `compatibility`:
59
- * - Has the proper shape.
60
- * - Is sorted from the highest to lowest version.
61
- * - Does not include the latest `version`.
62
- */
54
+ // When `compatability` array is present it takes precedence, otherwise top-level `version` field is used as latest version
55
+ // Plugin data comes from @netlify/plugins
63
56
  const normalizePluginItem = function ({ package: packageName, version, compatibility = [] }) {
64
57
  const versions = compatibility.length === 0 ? [{ version }] : compatibility;
65
58
  const versionsA = versions.map(normalizeCompatVersion);
@@ -1,5 +1,8 @@
1
1
  import { PackageJson } from 'read-package-up';
2
- export declare const getPluginsOptions: any;
2
+ export declare const getPluginsOptions: ({ timers, ...opts }: {
3
+ [x: string]: any;
4
+ timers: any;
5
+ }, ...args: any[]) => Promise<any>;
3
6
  /**
4
7
  * Retrieve information about @netlify/build when an error happens there and not
5
8
  * in a plugin
@@ -3,7 +3,10 @@ import { NetlifyConfig } from '../index.js';
3
3
  import { BufferedLogs } from '../log/logger.js';
4
4
  import { PluginsOptions } from './node_version.js';
5
5
  export type ChildProcess = ExecaChildProcess<string>;
6
- export declare const startPlugins: any;
6
+ export declare const startPlugins: ({ timers, ...opts }: {
7
+ [x: string]: any;
8
+ timers: any;
9
+ }, ...args: any[]) => Promise<any>;
7
10
  export declare const stopPlugins: ({ childProcesses, logs, verbose, pluginOptions, netlifyConfig, }: {
8
11
  logs: BufferedLogs;
9
12
  verbose: boolean;
@@ -1,6 +1,5 @@
1
1
  import { rm, stat } from 'node:fs/promises';
2
2
  import { resolve } from 'node:path';
3
- import { listFrameworks } from '@netlify/framework-info';
4
3
  const dirExists = async (path) => {
5
4
  try {
6
5
  await stat(path);
@@ -29,19 +28,6 @@ const coreStep = async (input) => {
29
28
  return {};
30
29
  };
31
30
  const condition = async (input) => {
32
- // We don't want to clear directories for Remix or Remix-based frameworks,
33
- // due to the way they run Netlify Dev.
34
- try {
35
- const frameworks = await listFrameworks({ projectDir: input.buildDir });
36
- for (const framework of frameworks) {
37
- if (framework.id === 'hydrogen' || framework.id === 'remix') {
38
- return false;
39
- }
40
- }
41
- }
42
- catch {
43
- // no-op
44
- }
45
31
  const dirs = await getDirtyDirs(input);
46
32
  return dirs.length > 0;
47
33
  };
@@ -1,16 +1,21 @@
1
1
  export declare const TOP_PARENT_TAG = "run_netlify_build";
2
2
  export declare const initTimers: () => never[];
3
- export declare const measureDuration: any;
4
- export declare const createTimer: (stageTag: any, durationNs: any, { metricName, parentTag, category, tags }?: {
5
- metricName?: string | undefined;
6
- parentTag?: string | undefined;
7
- category?: undefined;
8
- tags?: undefined;
9
- }) => {
3
+ type MeasureDurationOptions = {
4
+ metricName?: string;
5
+ parentTag?: string;
6
+ category?: string;
7
+ tags?: string[];
8
+ };
9
+ export declare const measureDuration: (func: any, stageTag: any, options?: MeasureDurationOptions) => ({ timers, ...opts }: {
10
+ [x: string]: any;
11
+ timers: any;
12
+ }, ...args: any[]) => Promise<any>;
13
+ export declare const createTimer: (stageTag: any, durationNs: any, { metricName, parentTag, category, tags, }?: MeasureDurationOptions) => {
10
14
  metricName: string;
11
15
  stageTag: any;
12
16
  parentTag: string;
13
17
  durationNs: any;
14
- category: undefined;
15
- tags: undefined;
18
+ category: string | undefined;
19
+ tags: string[] | undefined;
16
20
  };
21
+ export {};
package/lib/time/main.js CHANGED
@@ -12,9 +12,10 @@ export const initTimers = function () {
12
12
  // - return a plain object. This may or may not contain a modified `timers`.
13
13
  // The `durationNs` will be returned by the function. A new `timers` with the
14
14
  // additional duration timer will be returned as well.
15
- const kMeasureDuration = function (func, stageTag, { parentTag = undefined, category = undefined } = {}) {
15
+ const kMeasureDuration = function (func, stageTag, options = {}) {
16
16
  return async function measuredFunc({ timers, ...opts }, ...args) {
17
17
  const timerNs = startTimer();
18
+ const { parentTag, category } = options;
18
19
  const { timers: timersA = timers, ...returnObject } = await func({ timers, ...opts }, ...args);
19
20
  const { tags = {} } = returnObject;
20
21
  const durationNs = endTimer(timerNs);
@@ -32,6 +33,6 @@ const kMeasureDuration = function (func, stageTag, { parentTag = undefined, cate
32
33
  // Ensure the wrapped function `name` is not `anonymous` in stack traces
33
34
  export const measureDuration = keepFuncProps(kMeasureDuration);
34
35
  // Create a new object representing a completed timer
35
- export const createTimer = function (stageTag, durationNs, { metricName = DEFAULT_METRIC_NAME, parentTag = TOP_PARENT_TAG, category = undefined, tags = undefined } = {}) {
36
+ export const createTimer = function (stageTag, durationNs, { metricName = DEFAULT_METRIC_NAME, parentTag = TOP_PARENT_TAG, category = undefined, tags = undefined, } = {}) {
36
37
  return { metricName, stageTag, parentTag, durationNs, category, tags };
37
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "33.4.4",
3
+ "version": "33.4.6",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
6
  "exports": "./lib/index.js",
@@ -67,11 +67,10 @@
67
67
  "license": "MIT",
68
68
  "dependencies": {
69
69
  "@bugsnag/js": "^8.0.0",
70
- "@netlify/blobs": "^9.1.6",
70
+ "@netlify/blobs": "^10.0.0",
71
71
  "@netlify/cache-utils": "^6.0.3",
72
72
  "@netlify/config": "^23.0.10",
73
73
  "@netlify/edge-bundler": "14.0.6",
74
- "@netlify/framework-info": "^10.0.4",
75
74
  "@netlify/functions-utils": "^6.0.10",
76
75
  "@netlify/git-utils": "^6.0.2",
77
76
  "@netlify/opentelemetry-utils": "^2.0.1",
@@ -91,9 +90,9 @@
91
90
  "indent-string": "^5.0.0",
92
91
  "is-plain-obj": "^4.0.0",
93
92
  "js-yaml": "^4.0.0",
94
- "keep-func-props": "^4.0.0",
93
+ "keep-func-props": "^6.0.0",
95
94
  "locate-path": "^7.0.0",
96
- "log-process-errors": "^8.0.0",
95
+ "log-process-errors": "^11.0.0",
97
96
  "map-obj": "^5.0.0",
98
97
  "memoize-one": "^6.0.0",
99
98
  "minimatch": "^9.0.4",
@@ -104,9 +103,9 @@
104
103
  "p-locate": "^6.0.0",
105
104
  "p-map": "^7.0.0",
106
105
  "p-reduce": "^3.0.0",
106
+ "package-directory": "^8.0.0",
107
107
  "path-exists": "^5.0.0",
108
108
  "path-type": "^6.0.0",
109
- "pkg-dir": "^8.0.0",
110
109
  "pretty-ms": "^9.0.0",
111
110
  "ps-list": "^8.0.0",
112
111
  "read-package-up": "^11.0.0",
@@ -128,11 +127,12 @@
128
127
  "@netlify/nock-udp": "^5.0.1",
129
128
  "@opentelemetry/api": "~1.8.0",
130
129
  "@opentelemetry/sdk-trace-base": "~1.24.0",
131
- "@types/node": "^18.0.0",
130
+ "@types/node": "^18.19.111",
132
131
  "atob": "^2.1.2",
133
132
  "ava": "^5.0.0",
134
133
  "c8": "^10.0.0",
135
134
  "cpy": "^11.0.0",
135
+ "cpy-cli": "^5.0.0",
136
136
  "get-node": "^14.2.1",
137
137
  "get-port": "^7.0.0",
138
138
  "has-ansi": "^6.0.0",
@@ -157,5 +157,5 @@
157
157
  "engines": {
158
158
  "node": ">=18.14.0"
159
159
  },
160
- "gitHead": "aa23415dbf5e42628f7de95612ad42e97d5116a4"
160
+ "gitHead": "26f76a720b12a59fa65c638d73fddbc2259fa2d8"
161
161
  }