@netlify/build 33.4.5 → 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 -12
- 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 +7 -11
- 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 +9 -10
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';
|
|
@@ -33,7 +32,7 @@ export const startBuild = function (flags) {
|
|
|
33
32
|
const errorMonitor = startErrorMonitor({ flags: { debug, systemLogFile, ...flagsA }, logs, bugsnagKey });
|
|
34
33
|
return { ...flagsA, debug, systemLogFile, errorMonitor, logs, timers };
|
|
35
34
|
};
|
|
36
|
-
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, }) {
|
|
37
36
|
const configOpts = getConfigOpts({
|
|
38
37
|
config,
|
|
39
38
|
defaultConfig,
|
|
@@ -68,16 +67,6 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
68
67
|
quiet,
|
|
69
68
|
featureFlags,
|
|
70
69
|
});
|
|
71
|
-
if (featureFlags.build_automatic_runtime && framework) {
|
|
72
|
-
const runtime = supportedRuntimes[framework];
|
|
73
|
-
if (runtime !== undefined) {
|
|
74
|
-
const skip = childEnv[runtime.skipFlag] === 'true';
|
|
75
|
-
const installed = netlifyConfig.plugins.some((plugin) => plugin.package === runtime.package);
|
|
76
|
-
if (!installed && !skip) {
|
|
77
|
-
netlifyConfig.plugins.push({ package: runtime.package });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
70
|
const constants = await getConstants({
|
|
82
71
|
configPath,
|
|
83
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
|
}
|
|
@@ -51,15 +54,8 @@ const isValidPluginsList = function (pluginsList) {
|
|
|
51
54
|
const normalizePluginsList = function (pluginsList) {
|
|
52
55
|
return Object.fromEntries(pluginsList.map(normalizePluginItem));
|
|
53
56
|
};
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
*/
|
|
57
|
+
// When `compatability` array is present it takes precedence, otherwise top-level `version` field is used as latest version
|
|
58
|
+
// Plugin data comes from @netlify/plugins
|
|
63
59
|
const normalizePluginItem = function ({ package: packageName, version, compatibility = [] }) {
|
|
64
60
|
const versions = compatibility.length === 0 ? [{ version }] : compatibility;
|
|
65
61
|
const versionsA = versions.map(normalizeCompatVersion);
|
|
@@ -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,17 +67,16 @@
|
|
|
67
67
|
"license": "MIT",
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@bugsnag/js": "^8.0.0",
|
|
70
|
-
"@netlify/blobs": "^
|
|
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/
|
|
75
|
-
"@netlify/functions-utils": "^6.0.10",
|
|
74
|
+
"@netlify/functions-utils": "^6.0.11",
|
|
76
75
|
"@netlify/git-utils": "^6.0.2",
|
|
77
76
|
"@netlify/opentelemetry-utils": "^2.0.1",
|
|
78
77
|
"@netlify/plugins-list": "^6.80.0",
|
|
79
78
|
"@netlify/run-utils": "^6.0.2",
|
|
80
|
-
"@netlify/zip-it-and-ship-it": "12.1.
|
|
79
|
+
"@netlify/zip-it-and-ship-it": "12.1.5",
|
|
81
80
|
"@sindresorhus/slugify": "^2.0.0",
|
|
82
81
|
"ansi-escapes": "^7.0.0",
|
|
83
82
|
"chalk": "^5.0.0",
|
|
@@ -86,11 +85,9 @@
|
|
|
86
85
|
"fdir": "^6.0.1",
|
|
87
86
|
"figures": "^6.0.0",
|
|
88
87
|
"filter-obj": "^6.0.0",
|
|
89
|
-
"got": "^13.0.0",
|
|
90
88
|
"hot-shots": "10.2.1",
|
|
91
89
|
"indent-string": "^5.0.0",
|
|
92
90
|
"is-plain-obj": "^4.0.0",
|
|
93
|
-
"js-yaml": "^4.0.0",
|
|
94
91
|
"keep-func-props": "^6.0.0",
|
|
95
92
|
"locate-path": "^7.0.0",
|
|
96
93
|
"log-process-errors": "^11.0.0",
|
|
@@ -122,17 +119,19 @@
|
|
|
122
119
|
"ts-node": "^10.9.1",
|
|
123
120
|
"typescript": "^5.0.0",
|
|
124
121
|
"uuid": "^11.0.0",
|
|
122
|
+
"yaml": "^2.8.0",
|
|
125
123
|
"yargs": "^17.6.0"
|
|
126
124
|
},
|
|
127
125
|
"devDependencies": {
|
|
128
126
|
"@netlify/nock-udp": "^5.0.1",
|
|
129
127
|
"@opentelemetry/api": "~1.8.0",
|
|
130
128
|
"@opentelemetry/sdk-trace-base": "~1.24.0",
|
|
131
|
-
"@types/node": "^18.
|
|
129
|
+
"@types/node": "^18.19.111",
|
|
132
130
|
"atob": "^2.1.2",
|
|
133
131
|
"ava": "^5.0.0",
|
|
134
132
|
"c8": "^10.0.0",
|
|
135
133
|
"cpy": "^11.0.0",
|
|
134
|
+
"cpy-cli": "^5.0.0",
|
|
136
135
|
"get-node": "^14.2.1",
|
|
137
136
|
"get-port": "^7.0.0",
|
|
138
137
|
"has-ansi": "^6.0.0",
|
|
@@ -157,5 +156,5 @@
|
|
|
157
156
|
"engines": {
|
|
158
157
|
"node": ">=18.14.0"
|
|
159
158
|
},
|
|
160
|
-
"gitHead": "
|
|
159
|
+
"gitHead": "e663c8f1a5667e6737c689c33f7cabd6b2a98774"
|
|
161
160
|
}
|