@netlify/build 36.4.7 → 37.0.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.
- package/lib/core/config.d.ts +1 -1
- package/lib/core/config.js +6 -6
- package/lib/core/normalize_flags.js +0 -3
- package/lib/error/parse/parse.js +8 -2
- package/lib/error/types.d.ts +1 -0
- package/lib/error/types.js +2 -0
- package/lib/plugins_core/frameworks_api/index.js +2 -1
- package/lib/steps/core_step.js +2 -1
- package/lib/steps/plugin.js +1 -0
- package/lib/steps/update_config.d.ts +3 -1
- package/lib/steps/update_config.js +5 -5
- package/package.json +10 -10
package/lib/core/config.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export const loadConfig: ({ timers, ...opts }: {
|
|
|
45
45
|
[x: string]: any;
|
|
46
46
|
timers: any;
|
|
47
47
|
}, ...args: any[]) => Promise<any>;
|
|
48
|
-
export function resolveUpdatedConfig(configOpts: any, configMutations: any, defaultConfig: any): Promise<import("packages/config/lib/main.js").Config>;
|
|
48
|
+
export function resolveUpdatedConfig(configOpts: any, configMutations: any, defaultConfig: any, configMutationsOrigin: any, errorType: any): Promise<import("packages/config/lib/main.js").Config>;
|
|
49
49
|
export function saveUpdatedConfig({ configMutations, buildDir, repositoryRoot, configPath, outputConfigPath, headersPath, redirectsPath, logs, featureFlags, context, branch, debug, saveConfig, }: {
|
|
50
50
|
configMutations: any;
|
|
51
51
|
buildDir: any;
|
package/lib/core/config.js
CHANGED
|
@@ -84,20 +84,20 @@ const logConfigInfo = function ({ logs, configPath, buildDir, netlifyConfig, con
|
|
|
84
84
|
// normalized.
|
|
85
85
|
// We use `debug: false` to avoid any debug logs. Otherwise, every configuration
|
|
86
86
|
// change would create debug logs which would be too verbose.
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
export const resolveUpdatedConfig = async function (configOpts, configMutations, defaultConfig) {
|
|
87
|
+
// Configuration errors are assigned the type given by the caller, which knows
|
|
88
|
+
// whether a plugin or a core step changed the configuration.
|
|
89
|
+
export const resolveUpdatedConfig = async function (configOpts, configMutations, defaultConfig, configMutationsOrigin, errorType) {
|
|
90
90
|
try {
|
|
91
|
-
|
|
91
|
+
return await resolveConfig({
|
|
92
92
|
...configOpts,
|
|
93
93
|
configMutations,
|
|
94
|
+
configMutationsOrigin,
|
|
94
95
|
defaultConfig,
|
|
95
96
|
debug: false,
|
|
96
97
|
});
|
|
97
|
-
return resolved;
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
100
|
-
changeErrorType(error, 'resolveConfig',
|
|
100
|
+
changeErrorType(error, 'resolveConfig', errorType);
|
|
101
101
|
throw error;
|
|
102
102
|
}
|
|
103
103
|
};
|
|
@@ -55,12 +55,9 @@ const getDefaultFlags = function ({ env: envOpt = {} }, combinedEnv) {
|
|
|
55
55
|
testOpts: {},
|
|
56
56
|
featureFlags: DEFAULT_FEATURE_FLAGS,
|
|
57
57
|
statsd: { port: DEFAULT_STATSD_PORT },
|
|
58
|
-
// tracing.apiKey defaults to '-' else we'll get warning logs if not using
|
|
59
|
-
// honeycomb directly - https://github.com/honeycombio/honeycomb-opentelemetry-node/issues/201
|
|
60
58
|
tracing: {
|
|
61
59
|
enabled: false,
|
|
62
60
|
preloadingEnabled: false,
|
|
63
|
-
apiKey: '-',
|
|
64
61
|
// defaults to always sample
|
|
65
62
|
sampleRate: 1,
|
|
66
63
|
httpProtocol: DEFAULT_OTEL_ENDPOINT_PROTOCOL,
|
package/lib/error/parse/parse.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { serializeObject } from '../../log/serialize.js';
|
|
2
2
|
import { getErrorInfo } from '../info.js';
|
|
3
|
-
import { getTypeInfo } from '../types.js';
|
|
3
|
+
import { DEFAULT_TITLE, getTypeInfo } from '../types.js';
|
|
4
4
|
import { getLocationInfo } from './location.js';
|
|
5
5
|
import { normalizeError } from './normalize.js';
|
|
6
6
|
import { getPluginInfo } from './plugin.js';
|
|
@@ -66,5 +66,11 @@ const getTitle = function (title, errorInfo) {
|
|
|
66
66
|
if (typeof title !== 'function') {
|
|
67
67
|
return title;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
try {
|
|
70
|
+
return title(errorInfo);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// A title built from missing error information must not lose the error.
|
|
74
|
+
return DEFAULT_TITLE;
|
|
75
|
+
}
|
|
70
76
|
};
|
package/lib/error/types.d.ts
CHANGED
|
@@ -165,4 +165,5 @@ type ErrorTypeMap =
|
|
|
165
165
|
*/
|
|
166
166
|
'cancelBuild' | 'resolveConfig' | 'dependencies' | 'pluginInput' | 'pluginUnsupportedVersion' | 'buildCommand' | 'functionsBundling' | 'secretScanningFoundSecrets' | 'failPlugin' | 'failBuild' | 'pluginValidation' | 'pluginInternal' | 'ipc' | 'corePlugin' | 'trustedPlugin' | 'coreStep' | 'api' | 'deploy' | 'deployInternal' | 'exception' | 'telemetry';
|
|
167
167
|
export type ErrorTypes = ErrorTypeMap;
|
|
168
|
+
export declare const DEFAULT_TITLE: string;
|
|
168
169
|
export {};
|
package/lib/error/types.js
CHANGED
|
@@ -320,3 +320,5 @@ const TYPES = {
|
|
|
320
320
|
};
|
|
321
321
|
// When no error type matches, it's an uncaught exception, i.e. a bug
|
|
322
322
|
const DEFAULT_TYPE = 'exception';
|
|
323
|
+
// Fallback when a title cannot be built from the error information
|
|
324
|
+
export const DEFAULT_TITLE = TYPES[DEFAULT_TYPE].title;
|
|
@@ -56,7 +56,7 @@ const coreStep = async function ({ buildDir, netlifyConfig, packagePath, systemL
|
|
|
56
56
|
}
|
|
57
57
|
catch (err) {
|
|
58
58
|
systemLog(`Failed to read Frameworks API: ${err.message}`);
|
|
59
|
-
throw new Error('An error
|
|
59
|
+
throw new Error('An error occurred while processing the platform configuration defined by your framework');
|
|
60
60
|
}
|
|
61
61
|
if (!config) {
|
|
62
62
|
return {};
|
|
@@ -83,6 +83,7 @@ const coreStep = async function ({ buildDir, netlifyConfig, packagePath, systemL
|
|
|
83
83
|
const configMutations = getConfigMutations(netlifyConfig, newConfig, applyDeployConfig.event);
|
|
84
84
|
return {
|
|
85
85
|
configMutations,
|
|
86
|
+
configMutationsOrigin: 'the Frameworks API',
|
|
86
87
|
};
|
|
87
88
|
};
|
|
88
89
|
export const applyDeployConfig = {
|
package/lib/steps/core_step.js
CHANGED
|
@@ -8,7 +8,7 @@ export const fireCoreStep = async function ({ deployEnvVars, coreStep, coreStepI
|
|
|
8
8
|
try {
|
|
9
9
|
const configSideFiles = await listConfigSideFiles([headersPath, redirectsPath]);
|
|
10
10
|
const childEnvA = setEnvChanges(envChanges, { ...childEnv });
|
|
11
|
-
const { newEnvChanges = {}, configMutations: newConfigMutations = [], tags, metrics, } = await coreStep({
|
|
11
|
+
const { newEnvChanges = {}, configMutations: newConfigMutations = [], configMutationsOrigin, tags, metrics, } = await coreStep({
|
|
12
12
|
deployEnvVars,
|
|
13
13
|
api,
|
|
14
14
|
configPath,
|
|
@@ -54,6 +54,7 @@ export const fireCoreStep = async function ({ deployEnvVars, coreStep, coreStepI
|
|
|
54
54
|
logs: logsA,
|
|
55
55
|
systemLog,
|
|
56
56
|
debug,
|
|
57
|
+
configMutationsOrigin: configMutationsOrigin ?? coreStepName,
|
|
57
58
|
});
|
|
58
59
|
return {
|
|
59
60
|
newEnvChanges,
|
package/lib/steps/plugin.js
CHANGED
|
@@ -49,6 +49,7 @@ export const firePluginStep = async function ({ event, childProcess, packageName
|
|
|
49
49
|
systemLog,
|
|
50
50
|
debug,
|
|
51
51
|
source: packageName,
|
|
52
|
+
configErrorType: 'pluginValidation',
|
|
52
53
|
});
|
|
53
54
|
const newStatus = getSuccessStatus(status, { steps, event, packageName });
|
|
54
55
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function updateNetlifyConfig({ configOpts, netlifyConfig, defaultConfig, headersPath, redirectsPath, configMutations, newConfigMutations, configSideFiles, errorParams, logs, systemLog, debug, source, }: {
|
|
1
|
+
export function updateNetlifyConfig({ configOpts, netlifyConfig, defaultConfig, headersPath, redirectsPath, configMutations, newConfigMutations, configSideFiles, errorParams, logs, systemLog, debug, source, configMutationsOrigin, configErrorType, }: {
|
|
2
2
|
configOpts: any;
|
|
3
3
|
netlifyConfig: any;
|
|
4
4
|
defaultConfig: any;
|
|
@@ -12,6 +12,8 @@ export function updateNetlifyConfig({ configOpts, netlifyConfig, defaultConfig,
|
|
|
12
12
|
systemLog: any;
|
|
13
13
|
debug: any;
|
|
14
14
|
source?: string | undefined;
|
|
15
|
+
configMutationsOrigin?: any;
|
|
16
|
+
configErrorType?: string | undefined;
|
|
15
17
|
}): Promise<{
|
|
16
18
|
netlifyConfig: any;
|
|
17
19
|
configMutations: any;
|
|
@@ -6,11 +6,11 @@ import { logConfigMutations, systemLogConfigMutations } from '../log/messages/mu
|
|
|
6
6
|
import { pathExists } from '../utils/path_exists.js';
|
|
7
7
|
// If `netlifyConfig` was updated or `_redirects` was created, the configuration
|
|
8
8
|
// is updated by calling `@netlify/config` again.
|
|
9
|
-
export const updateNetlifyConfig = async function ({ configOpts, netlifyConfig, defaultConfig, headersPath, redirectsPath, configMutations, newConfigMutations, configSideFiles, errorParams, logs, systemLog, debug, source = '', }) {
|
|
9
|
+
export const updateNetlifyConfig = async function ({ configOpts, netlifyConfig, defaultConfig, headersPath, redirectsPath, configMutations, newConfigMutations, configSideFiles, errorParams, logs, systemLog, debug, source = '', configMutationsOrigin = source || undefined, configErrorType = 'resolveConfig', }) {
|
|
10
10
|
if (!(await shouldUpdateConfig({ newConfigMutations, configSideFiles, headersPath, redirectsPath }))) {
|
|
11
11
|
return { netlifyConfig, configMutations };
|
|
12
12
|
}
|
|
13
|
-
validateConfigMutations(newConfigMutations);
|
|
13
|
+
validateConfigMutations(newConfigMutations, configErrorType);
|
|
14
14
|
// Don't log configuration mutations performed by code that has been authored
|
|
15
15
|
// by Netlify (i.e. core steps or build plugins in the `@netlify/` scope),
|
|
16
16
|
// since that won't give users any useful or actionable information. For
|
|
@@ -23,7 +23,7 @@ export const updateNetlifyConfig = async function ({ configOpts, netlifyConfig,
|
|
|
23
23
|
systemLogConfigMutations(systemLog, newConfigMutations);
|
|
24
24
|
}
|
|
25
25
|
const mergedConfigMutations = [...configMutations, ...newConfigMutations];
|
|
26
|
-
const { config: netlifyConfigA, headersPath: headersPathA, redirectsPath: redirectsPathA, } = await resolveUpdatedConfig(configOpts, mergedConfigMutations, defaultConfig);
|
|
26
|
+
const { config: netlifyConfigA, headersPath: headersPathA, redirectsPath: redirectsPathA, } = await resolveUpdatedConfig(configOpts, mergedConfigMutations, defaultConfig, configMutationsOrigin, configErrorType);
|
|
27
27
|
logConfigOnUpdate({ logs, netlifyConfig: netlifyConfigA, debug });
|
|
28
28
|
errorParams.netlifyConfig = netlifyConfigA;
|
|
29
29
|
return {
|
|
@@ -54,12 +54,12 @@ export const listConfigSideFiles = async function (sideFiles) {
|
|
|
54
54
|
return existingSideFiles.filter(Boolean).sort();
|
|
55
55
|
};
|
|
56
56
|
// Validate each new configuration change
|
|
57
|
-
const validateConfigMutations = function (newConfigMutations) {
|
|
57
|
+
const validateConfigMutations = function (newConfigMutations, errorType) {
|
|
58
58
|
try {
|
|
59
59
|
newConfigMutations.forEach(validateConfigMutation);
|
|
60
60
|
}
|
|
61
61
|
catch (error) {
|
|
62
|
-
addErrorInfo(error, { type:
|
|
62
|
+
addErrorInfo(error, { type: errorType });
|
|
63
63
|
throw error;
|
|
64
64
|
}
|
|
65
65
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "37.0.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"@bugsnag/js": "^8.0.0",
|
|
67
67
|
"@netlify/blobs": "^11.0.3",
|
|
68
68
|
"@netlify/cache-utils": "^7.1.2",
|
|
69
|
-
"@netlify/config": "^25.2.
|
|
69
|
+
"@netlify/config": "^25.2.5",
|
|
70
70
|
"@netlify/edge-bundler": "16.0.4",
|
|
71
|
-
"@netlify/functions-utils": "^7.1.
|
|
71
|
+
"@netlify/functions-utils": "^7.1.10",
|
|
72
72
|
"@netlify/git-utils": "^7.1.1",
|
|
73
|
-
"@netlify/opentelemetry-utils": "^
|
|
73
|
+
"@netlify/opentelemetry-utils": "^4.0.0",
|
|
74
74
|
"@netlify/plugins-list": "^6.81.6",
|
|
75
75
|
"@netlify/run-utils": "^7.1.0",
|
|
76
|
-
"@netlify/zip-it-and-ship-it": "
|
|
76
|
+
"@netlify/zip-it-and-ship-it": "16.0.0",
|
|
77
77
|
"@sindresorhus/slugify": "^2.0.0",
|
|
78
78
|
"ansis": "^4.1.0",
|
|
79
79
|
"execa": "^8.0.0",
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@netlify/nock-udp": "^6.1.0",
|
|
111
|
-
"@opentelemetry/api": "~1.
|
|
112
|
-
"@opentelemetry/sdk-trace-base": "~
|
|
111
|
+
"@opentelemetry/api": "~1.9.0",
|
|
112
|
+
"@opentelemetry/sdk-trace-base": "~2.8.0",
|
|
113
113
|
"@types/node": "^22.12.0",
|
|
114
114
|
"@vitest/coverage-v8": "^3.2.6",
|
|
115
115
|
"atob": "^2.1.2",
|
|
@@ -126,8 +126,8 @@
|
|
|
126
126
|
"yarn": "^1.22.22"
|
|
127
127
|
},
|
|
128
128
|
"peerDependencies": {
|
|
129
|
-
"@netlify/opentelemetry-sdk-setup": "^
|
|
130
|
-
"@opentelemetry/api": "~1.
|
|
129
|
+
"@netlify/opentelemetry-sdk-setup": "^3.0.0 || ^4.0.0",
|
|
130
|
+
"@opentelemetry/api": "~1.9.0"
|
|
131
131
|
},
|
|
132
132
|
"peerDependenciesMeta": {
|
|
133
133
|
"@netlify/opentelemetry-sdk-setup": {
|
|
@@ -137,5 +137,5 @@
|
|
|
137
137
|
"engines": {
|
|
138
138
|
"node": ">=22.12.0"
|
|
139
139
|
},
|
|
140
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "224d0ab995156edc7e7b08859cf651e2adfeacfa"
|
|
141
141
|
}
|