@netlify/build 29.49.1 → 29.50.1
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.d.ts +2 -1
- package/lib/core/build.js +7 -3
- package/lib/core/config.d.ts +1 -1
- package/lib/core/config.js +9 -4
- package/lib/plugins_core/edge_functions/index.js +1 -1
- package/lib/plugins_core/functions/index.js +1 -1
- package/lib/plugins_core/pre_cleanup/index.js +5 -5
- package/lib/steps/core_step.d.ts +2 -1
- package/lib/steps/core_step.js +3 -1
- package/lib/steps/get.js +1 -1
- package/lib/steps/plugin.d.ts +2 -1
- package/lib/steps/plugin.js +2 -1
- package/lib/steps/run_core_steps.js +3 -1
- package/lib/steps/run_step.d.ts +2 -1
- package/lib/steps/run_step.js +5 -2
- package/lib/steps/run_steps.d.ts +2 -1
- package/lib/steps/run_steps.js +2 -1
- package/lib/steps/update_config.d.ts +2 -1
- package/lib/steps/update_config.js +4 -4
- package/lib/utils/blobs.js +3 -5
- package/lib/utils/frameworks_api.d.ts +1 -0
- package/lib/utils/frameworks_api.js +5 -4
- package/package.json +4 -4
- /package/lib/plugins_core/{deploy_config → frameworks_api}/index.d.ts +0 -0
- /package/lib/plugins_core/{deploy_config → frameworks_api}/index.js +0 -0
- /package/lib/plugins_core/{deploy_config → frameworks_api}/util.d.ts +0 -0
- /package/lib/plugins_core/{deploy_config → frameworks_api}/util.js +0 -0
package/lib/core/build.d.ts
CHANGED
|
@@ -32,9 +32,10 @@ export declare const startBuild: (flags: Partial<BuildFlags>) => {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
export declare const execBuild: any;
|
|
35
|
-
export declare const runAndReportBuild: ({ pluginsOptions, netlifyConfig, 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, edgeFunctionsBootstrapURL, eventHandlers, }: {
|
|
35
|
+
export declare const runAndReportBuild: ({ pluginsOptions, netlifyConfig, cachedConfig, 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, edgeFunctionsBootstrapURL, eventHandlers, }: {
|
|
36
36
|
pluginsOptions: any;
|
|
37
37
|
netlifyConfig: any;
|
|
38
|
+
cachedConfig: any;
|
|
38
39
|
configOpts: any;
|
|
39
40
|
siteInfo: any;
|
|
40
41
|
configPath: any;
|
package/lib/core/build.js
CHANGED
|
@@ -97,6 +97,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
97
97
|
const { pluginsOptions: pluginsOptionsA, netlifyConfig: netlifyConfigA, stepsCount, timers: timersB, configMutations, metrics, } = await runAndReportBuild({
|
|
98
98
|
pluginsOptions,
|
|
99
99
|
netlifyConfig,
|
|
100
|
+
cachedConfig,
|
|
100
101
|
configOpts,
|
|
101
102
|
siteInfo,
|
|
102
103
|
configPath,
|
|
@@ -152,11 +153,12 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
152
153
|
};
|
|
153
154
|
export const execBuild = measureDuration(tExecBuild, 'total', { parentTag: 'build_site' });
|
|
154
155
|
// Runs a build then report any plugin statuses
|
|
155
|
-
export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig, 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, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
156
|
+
export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig, cachedConfig, 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, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
156
157
|
try {
|
|
157
158
|
const { stepsCount, netlifyConfig: netlifyConfigA, statuses, pluginsOptions: pluginsOptionsA, failedPlugins, timers: timersA, configMutations, metrics, } = await initAndRunBuild({
|
|
158
159
|
pluginsOptions,
|
|
159
160
|
netlifyConfig,
|
|
161
|
+
cachedConfig,
|
|
160
162
|
configOpts,
|
|
161
163
|
siteInfo,
|
|
162
164
|
configPath,
|
|
@@ -258,7 +260,7 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
|
|
|
258
260
|
}
|
|
259
261
|
};
|
|
260
262
|
// Initialize plugin processes then runs a build
|
|
261
|
-
const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, packagePath, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, dry, mode, api, token, errorMonitor, deployId, errorParams, logs, debug, systemLog, systemLogFile, verbose, sendStatus, saveConfig, timers, testOpts, buildbotServerSocket, constants, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
263
|
+
const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, cachedConfig, configOpts, siteInfo, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, packagePath, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, dry, mode, api, token, errorMonitor, deployId, errorParams, logs, debug, systemLog, systemLogFile, verbose, sendStatus, saveConfig, timers, testOpts, buildbotServerSocket, constants, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
262
264
|
const { pluginsOptions: pluginsOptionsA, timers: timersA } = await getPluginsOptions({
|
|
263
265
|
pluginsOptions,
|
|
264
266
|
netlifyConfig,
|
|
@@ -311,6 +313,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
311
313
|
childProcesses,
|
|
312
314
|
pluginsOptions: pluginsOptionsA,
|
|
313
315
|
netlifyConfig,
|
|
316
|
+
cachedConfig,
|
|
314
317
|
configOpts,
|
|
315
318
|
packageJson,
|
|
316
319
|
configPath,
|
|
@@ -380,7 +383,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
380
383
|
};
|
|
381
384
|
// Load plugin main files, retrieve their event handlers then runs them,
|
|
382
385
|
// together with the build command
|
|
383
|
-
const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig, configOpts, packageJson, configPath, outputConfigPath, userNodeVersion, headersPath, redirectsPath, buildDir, repositoryRoot, packagePath, nodePath, childEnv, context, branch, dry, buildbotServerSocket, constants, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, timeline, devCommand, quiet, explicitSecretKeys, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
386
|
+
const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig, cachedConfig, configOpts, packageJson, configPath, outputConfigPath, userNodeVersion, headersPath, redirectsPath, buildDir, repositoryRoot, packagePath, nodePath, childEnv, context, branch, dry, buildbotServerSocket, constants, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, timeline, devCommand, quiet, explicitSecretKeys, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
384
387
|
const { pluginsSteps, timers: timersA } = await loadPlugins({
|
|
385
388
|
pluginsOptions,
|
|
386
389
|
childProcesses,
|
|
@@ -420,6 +423,7 @@ const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig
|
|
|
420
423
|
deployId,
|
|
421
424
|
errorParams,
|
|
422
425
|
netlifyConfig,
|
|
426
|
+
cachedConfig,
|
|
423
427
|
configOpts,
|
|
424
428
|
logs,
|
|
425
429
|
debug,
|
package/lib/core/config.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export function getConfigOpts({ config, defaultConfig, cwd, repositoryRoot, pack
|
|
|
38
38
|
featureFlags: any;
|
|
39
39
|
};
|
|
40
40
|
export const loadConfig: any;
|
|
41
|
-
export function resolveUpdatedConfig(configOpts: any, configMutations: any): Promise<any>;
|
|
41
|
+
export function resolveUpdatedConfig(configOpts: any, configMutations: any, cachedConfig: any): Promise<any>;
|
|
42
42
|
export function saveUpdatedConfig({ configMutations, buildDir, repositoryRoot, configPath, outputConfigPath, headersPath, redirectsPath, logs, featureFlags, context, branch, debug, saveConfig, }: {
|
|
43
43
|
configMutations: any;
|
|
44
44
|
buildDir: any;
|
package/lib/core/config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { resolveConfig,
|
|
1
|
+
import { resolveConfig, restoreConfig, updateConfig } from '@netlify/config';
|
|
2
2
|
import mapObj from 'map-obj';
|
|
3
3
|
import { getChildEnv } from '../env/main.js';
|
|
4
4
|
import { addApiErrorHandlers } from '../error/api.js';
|
|
5
5
|
import { changeErrorType } from '../error/info.js';
|
|
6
|
-
import { logBuildDir,
|
|
6
|
+
import { logBuildDir, logConfig, logConfigPath, logContext } from '../log/messages/config.js';
|
|
7
7
|
import { logConfigOnUpload, logHeadersOnUpload, logRedirectsOnUpload } from '../log/messages/mutations.js';
|
|
8
8
|
import { measureDuration } from '../time/main.js';
|
|
9
9
|
import { getPackageJson } from '../utils/package.js';
|
|
@@ -85,9 +85,14 @@ const logConfigInfo = function ({ logs, configPath, buildDir, netlifyConfig, con
|
|
|
85
85
|
// change would create debug logs which would be too verbose.
|
|
86
86
|
// Errors are propagated and assigned to the specific plugin or core step
|
|
87
87
|
// which changed the configuration.
|
|
88
|
-
export const resolveUpdatedConfig = async function (configOpts, configMutations) {
|
|
88
|
+
export const resolveUpdatedConfig = async function (configOpts, configMutations, cachedConfig) {
|
|
89
89
|
try {
|
|
90
|
-
return await resolveConfig({
|
|
90
|
+
return await resolveConfig({
|
|
91
|
+
...configOpts,
|
|
92
|
+
configMutations,
|
|
93
|
+
cachedConfig,
|
|
94
|
+
debug: false,
|
|
95
|
+
});
|
|
91
96
|
}
|
|
92
97
|
catch (error) {
|
|
93
98
|
changeErrorType(error, 'resolveConfig', 'pluginValidation');
|
|
@@ -22,7 +22,7 @@ const coreStep = async function ({ buildDir, packagePath, constants: { EDGE_FUNC
|
|
|
22
22
|
const generatedFunctionPaths = [internalSrcPath];
|
|
23
23
|
if (featureFlags.netlify_build_frameworks_api) {
|
|
24
24
|
if (await pathExists(frameworksAPISrcPath)) {
|
|
25
|
-
generatedFunctionPaths.
|
|
25
|
+
generatedFunctionPaths.push(frameworksAPISrcPath);
|
|
26
26
|
}
|
|
27
27
|
const frameworkImportMap = resolve(buildDir, packagePath || '', FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT, FRAMEWORKS_API_EDGE_FUNCTIONS_IMPORT_MAP);
|
|
28
28
|
if (await pathExists(frameworkImportMap)) {
|
|
@@ -62,7 +62,7 @@ const zipFunctionsAndLogResults = async ({ buildDir, childEnv, featureFlags, fun
|
|
|
62
62
|
try {
|
|
63
63
|
// Printing an empty line before bundling output.
|
|
64
64
|
log(logs, '');
|
|
65
|
-
const sourceDirectories = [
|
|
65
|
+
const sourceDirectories = [internalFunctionsSrc, frameworkFunctionsSrc, functionsSrc].filter(Boolean);
|
|
66
66
|
const results = await zipItAndShipIt.zipFunctions(sourceDirectories, functionsDist, zisiParameters);
|
|
67
67
|
validateCustomRoutes(results);
|
|
68
68
|
const bundlers = Array.from(getBundlers(results));
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { rm } from 'node:fs/promises';
|
|
2
|
-
import {
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { getBlobsDirs } from '../../utils/blobs.js';
|
|
4
|
+
import { FRAMEWORKS_API_ENDPOINT } from '../../utils/frameworks_api.js';
|
|
3
5
|
const coreStep = async ({ buildDir, packagePath }) => {
|
|
4
|
-
const
|
|
6
|
+
const dirs = [...getBlobsDirs(buildDir, packagePath), resolve(buildDir, packagePath || '', FRAMEWORKS_API_ENDPOINT)];
|
|
5
7
|
try {
|
|
6
|
-
await Promise.all(
|
|
8
|
+
await Promise.all(dirs.map((dir) => rm(dir, { recursive: true, force: true })));
|
|
7
9
|
}
|
|
8
10
|
catch {
|
|
9
11
|
// Ignore errors if it fails, we can continue anyway.
|
|
10
12
|
}
|
|
11
13
|
return {};
|
|
12
14
|
};
|
|
13
|
-
const blobsPresent = async ({ buildDir, packagePath }) => Boolean(await scanForBlobs(buildDir, packagePath));
|
|
14
15
|
export const preCleanup = {
|
|
15
16
|
event: 'onPreBuild',
|
|
16
17
|
coreStep,
|
|
17
18
|
coreStepId: 'pre_cleanup',
|
|
18
19
|
coreStepName: 'Pre cleanup',
|
|
19
20
|
coreStepDescription: () => 'Cleaning up leftover files from previous builds',
|
|
20
|
-
condition: blobsPresent,
|
|
21
21
|
quiet: true,
|
|
22
22
|
};
|
package/lib/steps/core_step.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const fireCoreStep: ({ coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, packagePath, constants, buildbotServerSocket, events, logs, quiet, nodePath, childEnv, context, branch, envChanges, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, debug, systemLog, saveConfig, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, deployId, outputFlusher, }: {
|
|
1
|
+
export declare const fireCoreStep: ({ coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, packagePath, constants, buildbotServerSocket, events, logs, quiet, nodePath, childEnv, context, branch, envChanges, errorParams, configOpts, netlifyConfig, cachedConfig, configMutations, headersPath, redirectsPath, featureFlags, debug, systemLog, saveConfig, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, deployId, outputFlusher, }: {
|
|
2
2
|
coreStep: any;
|
|
3
3
|
coreStepId: any;
|
|
4
4
|
coreStepName: any;
|
|
@@ -20,6 +20,7 @@ export declare const fireCoreStep: ({ coreStep, coreStepId, coreStepName, config
|
|
|
20
20
|
errorParams: any;
|
|
21
21
|
configOpts: any;
|
|
22
22
|
netlifyConfig: any;
|
|
23
|
+
cachedConfig: any;
|
|
23
24
|
configMutations: any;
|
|
24
25
|
headersPath: any;
|
|
25
26
|
redirectsPath: any;
|
package/lib/steps/core_step.js
CHANGED
|
@@ -3,7 +3,7 @@ import { addErrorInfo, isBuildError } from '../error/info.js';
|
|
|
3
3
|
import { addOutputFlusher } from '../log/logger.js';
|
|
4
4
|
import { updateNetlifyConfig, listConfigSideFiles } from './update_config.js';
|
|
5
5
|
// Fire a core step
|
|
6
|
-
export const fireCoreStep = async function ({ coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, packagePath, constants, buildbotServerSocket, events, logs, quiet, nodePath, childEnv, context, branch, envChanges, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, debug, systemLog, saveConfig, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, deployId, outputFlusher, }) {
|
|
6
|
+
export const fireCoreStep = async function ({ coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, packagePath, constants, buildbotServerSocket, events, logs, quiet, nodePath, childEnv, context, branch, envChanges, errorParams, configOpts, netlifyConfig, cachedConfig, configMutations, headersPath, redirectsPath, featureFlags, debug, systemLog, saveConfig, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, deployId, outputFlusher, }) {
|
|
7
7
|
const logsA = outputFlusher ? addOutputFlusher(logs, outputFlusher) : logs;
|
|
8
8
|
try {
|
|
9
9
|
const configSideFiles = await listConfigSideFiles([headersPath, redirectsPath]);
|
|
@@ -23,6 +23,7 @@ export const fireCoreStep = async function ({ coreStep, coreStepId, coreStepName
|
|
|
23
23
|
branch,
|
|
24
24
|
childEnv: childEnvA,
|
|
25
25
|
netlifyConfig,
|
|
26
|
+
cachedConfig,
|
|
26
27
|
nodePath,
|
|
27
28
|
configMutations,
|
|
28
29
|
headersPath,
|
|
@@ -39,6 +40,7 @@ export const fireCoreStep = async function ({ coreStep, coreStepId, coreStepName
|
|
|
39
40
|
const { netlifyConfig: netlifyConfigA, configMutations: configMutationsA, headersPath: headersPathA, redirectsPath: redirectsPathA, } = await updateNetlifyConfig({
|
|
40
41
|
configOpts,
|
|
41
42
|
netlifyConfig,
|
|
43
|
+
cachedConfig,
|
|
42
44
|
headersPath,
|
|
43
45
|
redirectsPath,
|
|
44
46
|
configMutations,
|
package/lib/steps/get.js
CHANGED
|
@@ -3,9 +3,9 @@ import { DEV_EVENTS, EVENTS } from '../plugins/events.js';
|
|
|
3
3
|
import { uploadBlobs } from '../plugins_core/blobs_upload/index.js';
|
|
4
4
|
import { buildCommandCore } from '../plugins_core/build_command.js';
|
|
5
5
|
import { deploySite } from '../plugins_core/deploy/index.js';
|
|
6
|
-
import { applyDeployConfig } from '../plugins_core/deploy_config/index.js';
|
|
7
6
|
import { devUploadBlobs } from '../plugins_core/dev_blobs_upload/index.js';
|
|
8
7
|
import { bundleEdgeFunctions } from '../plugins_core/edge_functions/index.js';
|
|
8
|
+
import { applyDeployConfig } from '../plugins_core/frameworks_api/index.js';
|
|
9
9
|
import { bundleFunctions } from '../plugins_core/functions/index.js';
|
|
10
10
|
import { preCleanup } from '../plugins_core/pre_cleanup/index.js';
|
|
11
11
|
import { preDevCleanup } from '../plugins_core/pre_dev_cleanup/index.js';
|
package/lib/steps/plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function isTrustedPlugin(packageName: any): any;
|
|
2
|
-
export function firePluginStep({ event, childProcess, packageName, packagePath, pluginPackageJson, loadedFrom, origin, envChanges, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, constants, steps, error, logs, outputFlusher, systemLog, featureFlags, debug, verbose, }: {
|
|
2
|
+
export function firePluginStep({ event, childProcess, packageName, packagePath, pluginPackageJson, loadedFrom, origin, envChanges, errorParams, configOpts, netlifyConfig, cachedConfig, configMutations, headersPath, redirectsPath, constants, steps, error, logs, outputFlusher, systemLog, featureFlags, debug, verbose, }: {
|
|
3
3
|
event: any;
|
|
4
4
|
childProcess: any;
|
|
5
5
|
packageName: any;
|
|
@@ -11,6 +11,7 @@ export function firePluginStep({ event, childProcess, packageName, packagePath,
|
|
|
11
11
|
errorParams: any;
|
|
12
12
|
configOpts: any;
|
|
13
13
|
netlifyConfig: any;
|
|
14
|
+
cachedConfig: any;
|
|
14
15
|
configMutations: any;
|
|
15
16
|
headersPath: any;
|
|
16
17
|
redirectsPath: any;
|
package/lib/steps/plugin.js
CHANGED
|
@@ -10,7 +10,7 @@ import { getPluginErrorType } from './error.js';
|
|
|
10
10
|
import { updateNetlifyConfig, listConfigSideFiles } from './update_config.js';
|
|
11
11
|
export const isTrustedPlugin = (packageName) => packageName?.startsWith('@netlify/');
|
|
12
12
|
// Fire a plugin step
|
|
13
|
-
export const firePluginStep = async function ({ event, childProcess, packageName, packagePath, pluginPackageJson, loadedFrom, origin, envChanges, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, constants, steps, error, logs, outputFlusher, systemLog, featureFlags, debug, verbose, }) {
|
|
13
|
+
export const firePluginStep = async function ({ event, childProcess, packageName, packagePath, pluginPackageJson, loadedFrom, origin, envChanges, errorParams, configOpts, netlifyConfig, cachedConfig, configMutations, headersPath, redirectsPath, constants, steps, error, logs, outputFlusher, systemLog, featureFlags, debug, verbose, }) {
|
|
14
14
|
const standardStreams = getStandardStreams(outputFlusher);
|
|
15
15
|
const listeners = pipePluginOutput(childProcess, logs, standardStreams);
|
|
16
16
|
const otelCarrier = {};
|
|
@@ -36,6 +36,7 @@ export const firePluginStep = async function ({ event, childProcess, packageName
|
|
|
36
36
|
const { netlifyConfig: netlifyConfigA, configMutations: configMutationsA, headersPath: headersPathA, redirectsPath: redirectsPathA, } = await updateNetlifyConfig({
|
|
37
37
|
configOpts,
|
|
38
38
|
netlifyConfig,
|
|
39
|
+
cachedConfig,
|
|
39
40
|
headersPath,
|
|
40
41
|
packagePath,
|
|
41
42
|
redirectsPath,
|
|
@@ -70,6 +70,7 @@ const executeBuildStep = async function ({ config, packagePath, defaultConfig, c
|
|
|
70
70
|
Object.assign(errorParams, { netlifyConfig, siteInfo, childEnv, userNodeVersion });
|
|
71
71
|
try {
|
|
72
72
|
const { netlifyConfig: netlifyConfigA, configMutations } = await runBuildStep({
|
|
73
|
+
cachedConfig,
|
|
73
74
|
netlifyConfig,
|
|
74
75
|
buildDir,
|
|
75
76
|
nodePath,
|
|
@@ -106,13 +107,14 @@ const executeBuildStep = async function ({ config, packagePath, defaultConfig, c
|
|
|
106
107
|
throw error;
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
|
-
const runBuildStep = async function ({ netlifyConfig, buildDir, nodePath, constants, logs, debug, featureFlags, packagePath, childEnv, buildSteps, repositoryRoot, systemLog, edgeFunctionsBootstrapURL, deployId, quiet, }) {
|
|
110
|
+
const runBuildStep = async function ({ cachedConfig, netlifyConfig, buildDir, nodePath, constants, logs, debug, featureFlags, packagePath, childEnv, buildSteps, repositoryRoot, systemLog, edgeFunctionsBootstrapURL, deployId, quiet, }) {
|
|
110
111
|
const { netlifyConfig: netlifyConfigA, configMutations } = await runSteps({
|
|
111
112
|
steps: getBuildSteps(buildSteps),
|
|
112
113
|
buildDir,
|
|
113
114
|
nodePath,
|
|
114
115
|
constants,
|
|
115
116
|
netlifyConfig,
|
|
117
|
+
cachedConfig,
|
|
116
118
|
logs,
|
|
117
119
|
debug,
|
|
118
120
|
timers: [],
|
package/lib/steps/run_step.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const runStep: ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, coreStepQuiet, pluginPackageJson, loadedFrom, origin, condition, configPath, outputConfigPath, buildDir, packagePath, repositoryRoot, nodePath, index, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, mode, api, errorMonitor, deployId, errorParams, error, failedPlugins, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }: {
|
|
1
|
+
export declare const runStep: ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, coreStepQuiet, pluginPackageJson, loadedFrom, origin, condition, configPath, outputConfigPath, buildDir, packagePath, repositoryRoot, nodePath, index, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, mode, api, errorMonitor, deployId, errorParams, error, failedPlugins, configOpts, netlifyConfig, cachedConfig, configMutations, headersPath, redirectsPath, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }: {
|
|
2
2
|
event: any;
|
|
3
3
|
childProcess: any;
|
|
4
4
|
packageName: any;
|
|
@@ -35,6 +35,7 @@ export declare const runStep: ({ event, childProcess, packageName, coreStep, cor
|
|
|
35
35
|
failedPlugins: any;
|
|
36
36
|
configOpts: any;
|
|
37
37
|
netlifyConfig: any;
|
|
38
|
+
cachedConfig: any;
|
|
38
39
|
configMutations: any;
|
|
39
40
|
headersPath: any;
|
|
40
41
|
redirectsPath: any;
|
package/lib/steps/run_step.js
CHANGED
|
@@ -11,7 +11,7 @@ import { firePluginStep } from './plugin.js';
|
|
|
11
11
|
import { getStepReturn } from './return.js';
|
|
12
12
|
const tracer = trace.getTracer('steps');
|
|
13
13
|
// Run a step (core, build command or plugin)
|
|
14
|
-
export const runStep = async function ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, coreStepQuiet, pluginPackageJson, loadedFrom, origin, condition, configPath, outputConfigPath, buildDir, packagePath, repositoryRoot, nodePath, index, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, mode, api, errorMonitor, deployId, errorParams, error, failedPlugins, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }) {
|
|
14
|
+
export const runStep = async function ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, coreStepQuiet, pluginPackageJson, loadedFrom, origin, condition, configPath, outputConfigPath, buildDir, packagePath, repositoryRoot, nodePath, index, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, mode, api, errorMonitor, deployId, errorParams, error, failedPlugins, configOpts, netlifyConfig, cachedConfig, configMutations, headersPath, redirectsPath, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }) {
|
|
15
15
|
// Add relevant attributes to the upcoming span context
|
|
16
16
|
const attributes = {
|
|
17
17
|
'build.execution.step.name': coreStepName,
|
|
@@ -67,6 +67,7 @@ export const runStep = async function ({ event, childProcess, packageName, coreS
|
|
|
67
67
|
}
|
|
68
68
|
const fireStep = getFireStep(packageName, coreStepId, event);
|
|
69
69
|
const { newEnvChanges, netlifyConfig: netlifyConfigA = netlifyConfig, configMutations: configMutationsA = configMutations, headersPath: headersPathA = headersPath, redirectsPath: redirectsPathA = redirectsPath, newError, newStatus, timers: timersA, durationNs, metrics, } = await fireStep({
|
|
70
|
+
cachedConfig,
|
|
70
71
|
event,
|
|
71
72
|
childProcess,
|
|
72
73
|
packageName,
|
|
@@ -202,7 +203,7 @@ const getFireStep = function (packageName, coreStepId, event) {
|
|
|
202
203
|
const parentTag = normalizeTagName(packageName);
|
|
203
204
|
return measureDuration(tFireStep, event, { parentTag, category: 'pluginEvent' });
|
|
204
205
|
};
|
|
205
|
-
const tFireStep = function ({ event, childProcess, packageName, pluginPackageJson, loadedFrom, outputFlusher, origin, coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, packagePath, nodePath, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, error, logs, debug, quiet, systemLog, verbose, saveConfig, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, deployId, }) {
|
|
206
|
+
const tFireStep = function ({ cachedConfig, event, childProcess, packageName, pluginPackageJson, loadedFrom, outputFlusher, origin, coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, packagePath, nodePath, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, error, logs, debug, quiet, systemLog, verbose, saveConfig, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, deployId, }) {
|
|
206
207
|
if (coreStep !== undefined) {
|
|
207
208
|
return fireCoreStep({
|
|
208
209
|
coreStep,
|
|
@@ -227,6 +228,7 @@ const tFireStep = function ({ event, childProcess, packageName, pluginPackageJso
|
|
|
227
228
|
errorParams,
|
|
228
229
|
configOpts,
|
|
229
230
|
netlifyConfig,
|
|
231
|
+
cachedConfig,
|
|
230
232
|
configMutations,
|
|
231
233
|
headersPath,
|
|
232
234
|
redirectsPath,
|
|
@@ -253,6 +255,7 @@ const tFireStep = function ({ event, childProcess, packageName, pluginPackageJso
|
|
|
253
255
|
errorParams,
|
|
254
256
|
configOpts,
|
|
255
257
|
netlifyConfig,
|
|
258
|
+
cachedConfig,
|
|
256
259
|
configMutations,
|
|
257
260
|
headersPath,
|
|
258
261
|
redirectsPath,
|
package/lib/steps/run_steps.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export function runSteps({ steps, buildbotServerSocket, events, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, packagePath, repositoryRoot, nodePath, childEnv, context, branch, constants, mode, api, errorMonitor, deployId, errorParams, netlifyConfig, configOpts, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }: {
|
|
1
|
+
export function runSteps({ cachedConfig, steps, buildbotServerSocket, events, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, packagePath, repositoryRoot, nodePath, childEnv, context, branch, constants, mode, api, errorMonitor, deployId, errorParams, netlifyConfig, configOpts, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }: {
|
|
2
|
+
cachedConfig: any;
|
|
2
3
|
steps: any;
|
|
3
4
|
buildbotServerSocket: any;
|
|
4
5
|
events: any;
|
package/lib/steps/run_steps.js
CHANGED
|
@@ -7,7 +7,7 @@ import { runStep } from './run_step.js';
|
|
|
7
7
|
// list of `failedPlugins` (that ran `utils.build.failPlugin()`).
|
|
8
8
|
// If an error arises, runs `onError` events.
|
|
9
9
|
// Runs `onEnd` events at the end, whether an error was thrown or not.
|
|
10
|
-
export const runSteps = async function ({ steps, buildbotServerSocket, events, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, packagePath, repositoryRoot, nodePath, childEnv, context, branch, constants, mode, api, errorMonitor, deployId, errorParams, netlifyConfig, configOpts, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }) {
|
|
10
|
+
export const runSteps = async function ({ cachedConfig, steps, buildbotServerSocket, events, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, packagePath, repositoryRoot, nodePath, childEnv, context, branch, constants, mode, api, errorMonitor, deployId, errorParams, netlifyConfig, configOpts, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, explicitSecretKeys, edgeFunctionsBootstrapURL, }) {
|
|
11
11
|
const { index: stepsCount, error: errorA, netlifyConfig: netlifyConfigC, statuses: statusesB, failedPlugins: failedPluginsA, timers: timersC, configMutations: configMutationsB, metrics: metricsC, } = await pReduce(steps, async ({ index, error, failedPlugins, envChanges, netlifyConfig: netlifyConfigA, configMutations, headersPath: headersPathA, redirectsPath: redirectsPathA, statuses, timers: timersA, metrics: metricsA, }, { event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, pluginPackageJson, loadedFrom, origin, condition, quiet: coreStepQuiet, }) => {
|
|
12
12
|
const { newIndex = index, newError = error, failedPlugin = [], newEnvChanges = {}, netlifyConfig: netlifyConfigB = netlifyConfigA, configMutations: configMutationsA = configMutations, headersPath: headersPathB = headersPathA, redirectsPath: redirectsPathB = redirectsPathA, newStatus, timers: timersB = timersA, metrics: metricsB = [], } = await runStep({
|
|
13
13
|
event,
|
|
@@ -45,6 +45,7 @@ export const runSteps = async function ({ steps, buildbotServerSocket, events, c
|
|
|
45
45
|
error,
|
|
46
46
|
failedPlugins,
|
|
47
47
|
configOpts,
|
|
48
|
+
cachedConfig,
|
|
48
49
|
netlifyConfig: netlifyConfigA,
|
|
49
50
|
configMutations,
|
|
50
51
|
headersPath: headersPathA,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export function updateNetlifyConfig({ configOpts, netlifyConfig, headersPath, redirectsPath, configMutations, newConfigMutations, configSideFiles, errorParams, logs, systemLog, debug, source, }: {
|
|
1
|
+
export function updateNetlifyConfig({ configOpts, netlifyConfig, cachedConfig, headersPath, redirectsPath, configMutations, newConfigMutations, configSideFiles, errorParams, logs, systemLog, debug, source, }: {
|
|
2
2
|
configOpts: any;
|
|
3
3
|
netlifyConfig: any;
|
|
4
|
+
cachedConfig: any;
|
|
4
5
|
headersPath: any;
|
|
5
6
|
redirectsPath: any;
|
|
6
7
|
configMutations: any;
|
|
@@ -7,7 +7,7 @@ import { logConfigOnUpdate } from '../log/messages/config.js';
|
|
|
7
7
|
import { logConfigMutations, systemLogConfigMutations } from '../log/messages/mutations.js';
|
|
8
8
|
// If `netlifyConfig` was updated or `_redirects` was created, the configuration
|
|
9
9
|
// is updated by calling `@netlify/config` again.
|
|
10
|
-
export const updateNetlifyConfig = async function ({ configOpts, netlifyConfig, headersPath, redirectsPath, configMutations, newConfigMutations, configSideFiles, errorParams, logs, systemLog, debug, source = '', }) {
|
|
10
|
+
export const updateNetlifyConfig = async function ({ configOpts, netlifyConfig, cachedConfig, headersPath, redirectsPath, configMutations, newConfigMutations, configSideFiles, errorParams, logs, systemLog, debug, source = '', }) {
|
|
11
11
|
if (!(await shouldUpdateConfig({ newConfigMutations, configSideFiles, headersPath, redirectsPath }))) {
|
|
12
12
|
return { netlifyConfig, configMutations };
|
|
13
13
|
}
|
|
@@ -23,13 +23,13 @@ export const updateNetlifyConfig = async function ({ configOpts, netlifyConfig,
|
|
|
23
23
|
else {
|
|
24
24
|
systemLogConfigMutations(systemLog, newConfigMutations);
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
const { config: netlifyConfigA, headersPath: headersPathA, redirectsPath: redirectsPathA, } = await resolveUpdatedConfig(configOpts,
|
|
26
|
+
const mergedConfigMutations = [...configMutations, ...newConfigMutations];
|
|
27
|
+
const { config: netlifyConfigA, headersPath: headersPathA, redirectsPath: redirectsPathA, } = await resolveUpdatedConfig(configOpts, mergedConfigMutations, cachedConfig);
|
|
28
28
|
logConfigOnUpdate({ logs, netlifyConfig: netlifyConfigA, debug });
|
|
29
29
|
errorParams.netlifyConfig = netlifyConfigA;
|
|
30
30
|
return {
|
|
31
31
|
netlifyConfig: netlifyConfigA,
|
|
32
|
-
configMutations:
|
|
32
|
+
configMutations: mergedConfigMutations,
|
|
33
33
|
headersPath: headersPathA,
|
|
34
34
|
redirectsPath: redirectsPathA,
|
|
35
35
|
};
|
package/lib/utils/blobs.js
CHANGED
|
@@ -75,24 +75,22 @@ const METADATA_SUFFIX = '.json';
|
|
|
75
75
|
* path to its metadata file.
|
|
76
76
|
*/
|
|
77
77
|
export const getKeysToUpload = async (blobsDir) => {
|
|
78
|
-
const blobsToUpload = [];
|
|
79
78
|
const files = await new fdir()
|
|
80
79
|
.withRelativePaths() // we want the relative path from the blobsDir
|
|
81
80
|
.filter((fpath) => !path.basename(fpath).startsWith(METADATA_PREFIX))
|
|
82
81
|
.crawl(blobsDir)
|
|
83
82
|
.withPromise();
|
|
84
|
-
files.
|
|
83
|
+
return files.map((filePath) => {
|
|
85
84
|
const key = filePath.split(path.sep).join('/');
|
|
86
85
|
const contentPath = path.resolve(blobsDir, filePath);
|
|
87
86
|
const basename = path.basename(filePath);
|
|
88
87
|
const metadataPath = path.resolve(blobsDir, path.dirname(filePath), `${METADATA_PREFIX}${basename}${METADATA_SUFFIX}`);
|
|
89
|
-
|
|
88
|
+
return {
|
|
90
89
|
key,
|
|
91
90
|
contentPath,
|
|
92
91
|
metadataPath,
|
|
93
|
-
}
|
|
92
|
+
};
|
|
94
93
|
});
|
|
95
|
-
return blobsToUpload;
|
|
96
94
|
};
|
|
97
95
|
/** Read a file and its metadata file from the blobs directory */
|
|
98
96
|
export const getFileWithMetadata = async (key, contentPath, metadataPath) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const FRAMEWORKS_API_ENDPOINT = ".netlify/v1";
|
|
1
2
|
export declare const FRAMEWORKS_API_BLOBS_ENDPOINT = ".netlify/v1/blobs";
|
|
2
3
|
export declare const FRAMEWORKS_API_CONFIG_ENDPOINT = ".netlify/v1/config.json";
|
|
3
4
|
export declare const FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT = ".netlify/v1/edge-functions";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { basename, dirname, resolve, sep } from 'node:path';
|
|
2
2
|
import { fdir } from 'fdir';
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
3
|
+
export const FRAMEWORKS_API_ENDPOINT = '.netlify/v1';
|
|
4
|
+
export const FRAMEWORKS_API_BLOBS_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/blobs`;
|
|
5
|
+
export const FRAMEWORKS_API_CONFIG_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/config.json`;
|
|
6
|
+
export const FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/edge-functions`;
|
|
6
7
|
export const FRAMEWORKS_API_EDGE_FUNCTIONS_IMPORT_MAP = 'import_map.json';
|
|
7
|
-
export const FRAMEWORKS_API_FUNCTIONS_ENDPOINT =
|
|
8
|
+
export const FRAMEWORKS_API_FUNCTIONS_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/functions`;
|
|
8
9
|
/**
|
|
9
10
|
* Traverses a directory tree in search of leaf files. The key of each leaf
|
|
10
11
|
* file is determined by its path relative to the base directory.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.50.1",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
"@netlify/config": "^20.15.4",
|
|
74
74
|
"@netlify/edge-bundler": "12.1.1",
|
|
75
75
|
"@netlify/framework-info": "^9.8.13",
|
|
76
|
-
"@netlify/functions-utils": "^5.2.
|
|
76
|
+
"@netlify/functions-utils": "^5.2.70",
|
|
77
77
|
"@netlify/git-utils": "^5.1.1",
|
|
78
78
|
"@netlify/opentelemetry-utils": "^1.2.1",
|
|
79
79
|
"@netlify/plugins-list": "^6.80.0",
|
|
80
80
|
"@netlify/run-utils": "^5.1.1",
|
|
81
|
-
"@netlify/zip-it-and-ship-it": "9.37.
|
|
81
|
+
"@netlify/zip-it-and-ship-it": "9.37.2",
|
|
82
82
|
"@sindresorhus/slugify": "^2.0.0",
|
|
83
83
|
"ansi-escapes": "^6.0.0",
|
|
84
84
|
"chalk": "^5.0.0",
|
|
@@ -165,5 +165,5 @@
|
|
|
165
165
|
"engines": {
|
|
166
166
|
"node": "^14.16.0 || >=16.0.0"
|
|
167
167
|
},
|
|
168
|
-
"gitHead": "
|
|
168
|
+
"gitHead": "9c70c485d48f98c4f2a3ec46ddd918af3c845084"
|
|
169
169
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|