@netlify/build 33.4.6 → 33.4.7
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 +1 -15
- package/lib/error/colors.js +8 -2
- package/lib/error/monitor/report.js +7 -1
- package/lib/error/types.d.ts +1 -1
- package/lib/log/serialize.d.ts +2 -2
- package/lib/log/serialize.js +2 -2
- package/lib/plugins/compatibility.d.ts +1 -1
- package/lib/plugins/list.js +5 -2
- package/lib/plugins/manifest/load.js +4 -4
- package/lib/plugins/manifest/main.d.ts +1 -1
- package/lib/plugins/options.d.ts +1 -1
- package/lib/plugins/plugin_conditions.d.ts +1 -1
- package/lib/plugins/spawn.d.ts +1 -1
- package/lib/plugins_core/functions/index.d.ts +1 -1
- package/lib/plugins_core/functions/zisi.d.ts +1 -1
- package/lib/telemetry/main.d.ts +1 -3
- package/lib/telemetry/main.js +12 -7
- package/lib/types/options/netlify_plugin_functions_util.d.ts +2 -2
- package/lib/types/options/netlify_plugin_git_util.d.ts +2 -2
- package/lib/types/utils/json_value.d.ts +1 -1
- package/lib/utils/omit.d.ts +1 -1
- package/lib/utils/package.d.ts +1 -1
- package/package.json +7 -8
package/lib/core/build.js
CHANGED
|
@@ -19,10 +19,6 @@ import { doDryRun } from './dry.js';
|
|
|
19
19
|
import { warnOnLingeringProcesses } from './lingering.js';
|
|
20
20
|
import { warnOnMissingSideFiles } from './missing_side_file.js';
|
|
21
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
|
-
};
|
|
26
22
|
// Performed on build start. Must be kept small and unlikely to fail since it
|
|
27
23
|
// does not have proper error handling. Error handling relies on `errorMonitor`
|
|
28
24
|
// being built, which relies itself on flags being normalized.
|
|
@@ -36,7 +32,7 @@ export const startBuild = function (flags) {
|
|
|
36
32
|
const errorMonitor = startErrorMonitor({ flags: { debug, systemLogFile, ...flagsA }, logs, bugsnagKey });
|
|
37
33
|
return { ...flagsA, debug, systemLogFile, errorMonitor, logs, timers };
|
|
38
34
|
};
|
|
39
|
-
const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cachedConfigPath, outputConfigPath, cwd, packagePath, repositoryRoot, apiHost, token, siteId, accountId, context, branch, baseRelDir, env: envOpt, debug, systemLogFile, verbose, nodePath, functionsDistDir, edgeFunctionsDistDir, cacheDir, dry, mode, offline, deployId, buildId, testOpts, errorMonitor, errorParams, logs, timers, buildbotServerSocket, sendStatus, saveConfig, featureFlags, timeline, devCommand, quiet,
|
|
35
|
+
const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cachedConfigPath, outputConfigPath, cwd, packagePath, repositoryRoot, apiHost, token, siteId, accountId, context, branch, baseRelDir, env: envOpt, debug, systemLogFile, verbose, nodePath, functionsDistDir, edgeFunctionsDistDir, cacheDir, dry, mode, offline, deployId, buildId, testOpts, errorMonitor, errorParams, logs, timers, buildbotServerSocket, sendStatus, saveConfig, featureFlags, timeline, devCommand, quiet, explicitSecretKeys, enhancedSecretScan, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
40
36
|
const configOpts = getConfigOpts({
|
|
41
37
|
config,
|
|
42
38
|
defaultConfig,
|
|
@@ -71,16 +67,6 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
71
67
|
quiet,
|
|
72
68
|
featureFlags,
|
|
73
69
|
});
|
|
74
|
-
if (featureFlags.build_automatic_runtime && framework) {
|
|
75
|
-
const runtime = supportedRuntimes[framework];
|
|
76
|
-
if (runtime !== undefined) {
|
|
77
|
-
const skip = childEnv[runtime.skipFlag] === 'true';
|
|
78
|
-
const installed = netlifyConfig.plugins.some((plugin) => plugin.package === runtime.package);
|
|
79
|
-
if (!installed && !skip) {
|
|
80
|
-
netlifyConfig.plugins.push({ package: runtime.package });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
70
|
const constants = await getConstants({
|
|
85
71
|
configPath,
|
|
86
72
|
buildDir,
|
package/lib/error/colors.js
CHANGED
|
@@ -4,6 +4,12 @@ export const removeErrorColors = function (error) {
|
|
|
4
4
|
if (!(error instanceof Error)) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
|
-
error
|
|
8
|
-
|
|
7
|
+
// Setting error values might fail if they are getters or are non-writable.
|
|
8
|
+
try {
|
|
9
|
+
error.message = stripAnsi(error.message);
|
|
10
|
+
error.stack = stripAnsi(error.stack);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
// continue
|
|
14
|
+
}
|
|
9
15
|
};
|
|
@@ -25,7 +25,13 @@ export const reportBuildError = async function ({ error, errorMonitor, childEnv,
|
|
|
25
25
|
await reportError({ errorMonitor, error, logs, testOpts, eventProps });
|
|
26
26
|
}
|
|
27
27
|
finally {
|
|
28
|
-
|
|
28
|
+
try {
|
|
29
|
+
// Setting error values might fail if they are getters or are non-writable.
|
|
30
|
+
error.name = errorName;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// continue
|
|
34
|
+
}
|
|
29
35
|
}
|
|
30
36
|
};
|
|
31
37
|
// Plugin authors test their plugins as local plugins. Errors there are more
|
package/lib/error/types.d.ts
CHANGED
package/lib/log/serialize.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export declare const serializeObject: (object: object) => string;
|
|
2
|
+
export declare const serializeArray: (array: string[]) => string;
|
package/lib/log/serialize.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { stringify } from 'yaml';
|
|
2
2
|
export const serializeObject = function (object) {
|
|
3
|
-
return
|
|
3
|
+
return stringify(object, { sortMapEntries: true }).trimEnd();
|
|
4
4
|
};
|
|
5
5
|
export const serializeArray = function (array) {
|
|
6
6
|
return array.map(addDash).join('\n');
|
package/lib/plugins/list.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { pluginsUrl, pluginsList as oldPluginsList } from '@netlify/plugins-list';
|
|
2
|
-
import got from 'got';
|
|
3
2
|
import isPlainObj from 'is-plain-obj';
|
|
4
3
|
import { logPluginsList, logPluginsFetchError } from '../log/messages/plugins.js';
|
|
5
4
|
import { CONDITIONS } from './plugin_conditions.js';
|
|
@@ -28,7 +27,11 @@ export const getPluginsList = async function ({ debug, logs, testOpts: { plugins
|
|
|
28
27
|
};
|
|
29
28
|
const fetchPluginsList = async function ({ logs, pluginsListUrl, }) {
|
|
30
29
|
try {
|
|
31
|
-
const
|
|
30
|
+
const response = await fetch(pluginsListUrl, { signal: AbortSignal.timeout(PLUGINS_LIST_TIMEOUT) });
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
throw new Error(`Request failed with a response code: ${response.status.toString()}`);
|
|
33
|
+
}
|
|
34
|
+
const body = await response.json();
|
|
32
35
|
if (!isValidPluginsList(body)) {
|
|
33
36
|
throw new Error(`Request succeeded but with an invalid response:\n${JSON.stringify(body, null, 2)}`);
|
|
34
37
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { promises as fs } from 'fs';
|
|
2
|
-
import {
|
|
2
|
+
import { parse } from 'yaml';
|
|
3
3
|
import { addErrorInfo } from '../../error/info.js';
|
|
4
4
|
import { validateManifest } from './validate.js';
|
|
5
5
|
// Load "manifest.yml" using its file path
|
|
6
6
|
export const loadManifest = async function ({ manifestPath, packageName, pluginPackageJson, loadedFrom, origin }) {
|
|
7
7
|
try {
|
|
8
8
|
const rawManifest = await loadRawManifest(manifestPath);
|
|
9
|
-
const manifest =
|
|
9
|
+
const manifest = parseManifest(rawManifest);
|
|
10
10
|
validateManifest(manifest, rawManifest);
|
|
11
11
|
return manifest;
|
|
12
12
|
}
|
|
@@ -28,9 +28,9 @@ const loadRawManifest = async function (manifestPath) {
|
|
|
28
28
|
throw error;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
const parseManifest =
|
|
31
|
+
const parseManifest = function (rawManifest) {
|
|
32
32
|
try {
|
|
33
|
-
return
|
|
33
|
+
return parse(rawManifest, { logLevel: 'error' });
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
36
36
|
throw new Error(`Could not parse plugin's "manifest.yml"\n${error.message}`);
|
package/lib/plugins/options.d.ts
CHANGED
package/lib/plugins/spawn.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { zipFunctions, FunctionResult } from '@netlify/zip-it-and-ship-it';
|
|
1
|
+
import { zipFunctions, type 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,4 +1,4 @@
|
|
|
1
|
-
import { FunctionConfig, ZipFunctionsOptions } from '@netlify/zip-it-and-ship-it';
|
|
1
|
+
import { type FunctionConfig, type ZipFunctionsOptions } from '@netlify/zip-it-and-ship-it';
|
|
2
2
|
import type { FeatureFlags } from '../../core/feature_flags.js';
|
|
3
3
|
type GetZisiParametersType = {
|
|
4
4
|
branch?: string;
|
package/lib/telemetry/main.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ export declare const trackBuildComplete: ({ deployId, buildId, status, stepsCoun
|
|
|
11
11
|
framework: any;
|
|
12
12
|
testOpts: {
|
|
13
13
|
telemetryOrigin?: string | undefined;
|
|
14
|
-
telemetryTimeout?:
|
|
15
|
-
request: number;
|
|
16
|
-
} | undefined;
|
|
14
|
+
telemetryTimeout?: number | undefined;
|
|
17
15
|
};
|
|
18
16
|
}) => Promise<void>;
|
package/lib/telemetry/main.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { platform } from 'process';
|
|
2
|
-
import got from 'got';
|
|
3
2
|
import osName from 'os-name';
|
|
4
3
|
import { addErrorInfo } from '../error/info.js';
|
|
5
4
|
import { roundTimerToMillisecs } from '../time/measure.js';
|
|
@@ -8,7 +7,7 @@ const DEFAULT_TELEMETRY_TIMEOUT = 1200;
|
|
|
8
7
|
const DEFAULT_TELEMETRY_CONFIG = {
|
|
9
8
|
origin: 'https://api.segment.io/v1',
|
|
10
9
|
writeKey: 'dWhlM1lYSlpNd1k5Uk9rcjFra2JSOEoybnRjZjl0YTI6',
|
|
11
|
-
timeout:
|
|
10
|
+
timeout: DEFAULT_TELEMETRY_TIMEOUT,
|
|
12
11
|
};
|
|
13
12
|
// Send telemetry request when build completes
|
|
14
13
|
export const trackBuildComplete = async function ({ deployId, buildId, status, stepsCount, pluginsOptions, durationNs, siteInfo, telemetry, userNodeVersion, framework, testOpts: { telemetryOrigin = DEFAULT_TELEMETRY_CONFIG.origin, telemetryTimeout = DEFAULT_TELEMETRY_CONFIG.timeout }, }) {
|
|
@@ -37,12 +36,18 @@ export const trackBuildComplete = async function ({ deployId, buildId, status, s
|
|
|
37
36
|
// Send track HTTP request to telemetry.
|
|
38
37
|
const track = async function (payload, { origin, writeKey, timeout }) {
|
|
39
38
|
const url = `${origin}/track`;
|
|
40
|
-
await
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
headers: {
|
|
39
|
+
const response = await fetch(url, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
body: JSON.stringify(payload),
|
|
42
|
+
signal: AbortSignal.timeout(timeout),
|
|
43
|
+
headers: {
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
Authorization: `Basic ${writeKey}`,
|
|
46
|
+
},
|
|
45
47
|
});
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
throw new Error(`Response code: ${response.status.toString()}`);
|
|
50
|
+
}
|
|
46
51
|
};
|
|
47
52
|
// Retrieve telemetry information
|
|
48
53
|
// siteInfo can be empty if the build fails during the get config step
|
|
@@ -11,13 +11,13 @@ export interface NetlifyPluginFunctionsUtil {
|
|
|
11
11
|
* - `extension`: file extension of the Function's main file. For Go Functions, this might be an empty string. For Node.js Functions, this is either `.js` or `.zip`.
|
|
12
12
|
* - `runtime` `"js" | "go"`: Function's language runtime. TypeScript Functions use the "js" runtime
|
|
13
13
|
*/
|
|
14
|
-
list(): Promise<
|
|
14
|
+
list(): Promise<ListedFunction[]>;
|
|
15
15
|
/**
|
|
16
16
|
* Same as `list()` except it also returns the files required by the Functions' main files. This is much slower. The object have the following additional member:
|
|
17
17
|
*
|
|
18
18
|
* - `srcFile`: absolute path to the file
|
|
19
19
|
*/
|
|
20
|
-
listAll(): Promise<
|
|
20
|
+
listAll(): Promise<ListedFunctionFile[]>;
|
|
21
21
|
/**
|
|
22
22
|
* Add a Functions file or directory to a build.
|
|
23
23
|
*
|
|
@@ -19,7 +19,7 @@ export interface NetlifyPluginGitUtil {
|
|
|
19
19
|
/**
|
|
20
20
|
* Array of commits with details.
|
|
21
21
|
*/
|
|
22
|
-
commits:
|
|
22
|
+
commits: readonly {
|
|
23
23
|
sha: string;
|
|
24
24
|
parents: string;
|
|
25
25
|
author: {
|
|
@@ -33,7 +33,7 @@ export interface NetlifyPluginGitUtil {
|
|
|
33
33
|
date: string;
|
|
34
34
|
};
|
|
35
35
|
message: string;
|
|
36
|
-
}
|
|
36
|
+
}[];
|
|
37
37
|
/**
|
|
38
38
|
* How many lines of code have changed
|
|
39
39
|
*/
|
package/lib/utils/omit.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const omit: <T extends object>(obj: T, keys:
|
|
1
|
+
export declare const omit: <T extends object>(obj: T, keys: (keyof T)[]) => Partial<T>;
|
package/lib/utils/package.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "33.4.
|
|
3
|
+
"version": "33.4.7",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -67,16 +67,16 @@
|
|
|
67
67
|
"license": "MIT",
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@bugsnag/js": "^8.0.0",
|
|
70
|
-
"@netlify/blobs": "^10.0.
|
|
70
|
+
"@netlify/blobs": "^10.0.1",
|
|
71
71
|
"@netlify/cache-utils": "^6.0.3",
|
|
72
|
-
"@netlify/config": "^23.0.
|
|
72
|
+
"@netlify/config": "^23.0.11",
|
|
73
73
|
"@netlify/edge-bundler": "14.0.6",
|
|
74
|
-
"@netlify/functions-utils": "^6.0.
|
|
74
|
+
"@netlify/functions-utils": "^6.0.11",
|
|
75
75
|
"@netlify/git-utils": "^6.0.2",
|
|
76
76
|
"@netlify/opentelemetry-utils": "^2.0.1",
|
|
77
77
|
"@netlify/plugins-list": "^6.80.0",
|
|
78
78
|
"@netlify/run-utils": "^6.0.2",
|
|
79
|
-
"@netlify/zip-it-and-ship-it": "12.1.
|
|
79
|
+
"@netlify/zip-it-and-ship-it": "12.1.5",
|
|
80
80
|
"@sindresorhus/slugify": "^2.0.0",
|
|
81
81
|
"ansi-escapes": "^7.0.0",
|
|
82
82
|
"chalk": "^5.0.0",
|
|
@@ -85,11 +85,9 @@
|
|
|
85
85
|
"fdir": "^6.0.1",
|
|
86
86
|
"figures": "^6.0.0",
|
|
87
87
|
"filter-obj": "^6.0.0",
|
|
88
|
-
"got": "^13.0.0",
|
|
89
88
|
"hot-shots": "10.2.1",
|
|
90
89
|
"indent-string": "^5.0.0",
|
|
91
90
|
"is-plain-obj": "^4.0.0",
|
|
92
|
-
"js-yaml": "^4.0.0",
|
|
93
91
|
"keep-func-props": "^6.0.0",
|
|
94
92
|
"locate-path": "^7.0.0",
|
|
95
93
|
"log-process-errors": "^11.0.0",
|
|
@@ -121,6 +119,7 @@
|
|
|
121
119
|
"ts-node": "^10.9.1",
|
|
122
120
|
"typescript": "^5.0.0",
|
|
123
121
|
"uuid": "^11.0.0",
|
|
122
|
+
"yaml": "^2.8.0",
|
|
124
123
|
"yargs": "^17.6.0"
|
|
125
124
|
},
|
|
126
125
|
"devDependencies": {
|
|
@@ -157,5 +156,5 @@
|
|
|
157
156
|
"engines": {
|
|
158
157
|
"node": ">=18.14.0"
|
|
159
158
|
},
|
|
160
|
-
"gitHead": "
|
|
159
|
+
"gitHead": "e663c8f1a5667e6737c689c33f7cabd6b2a98774"
|
|
161
160
|
}
|