@netlify/build 29.9.2 → 29.10.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.js +3 -1
- package/lib/plugins_core/functions/index.js +6 -4
- package/lib/plugins_core/functions/zisi.js +20 -4
- package/lib/steps/core_step.js +2 -1
- package/lib/steps/run_step.js +4 -2
- package/lib/steps/run_steps.js +2 -1
- package/package.json +6 -6
- package/types/config/functions.d.ts +1 -1
package/lib/core/build.js
CHANGED
|
@@ -277,6 +277,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
277
277
|
packageJson,
|
|
278
278
|
configPath,
|
|
279
279
|
outputConfigPath,
|
|
280
|
+
userNodeVersion,
|
|
280
281
|
headersPath,
|
|
281
282
|
redirectsPath,
|
|
282
283
|
buildDir,
|
|
@@ -331,7 +332,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
331
332
|
};
|
|
332
333
|
// Load plugin main files, retrieve their event handlers then runs them,
|
|
333
334
|
// together with the build command
|
|
334
|
-
const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig, configOpts, packageJson, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, dry, buildbotServerSocket, constants, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, timeline, devCommand, quiet, }) {
|
|
335
|
+
const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig, configOpts, packageJson, configPath, outputConfigPath, userNodeVersion, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, dry, buildbotServerSocket, constants, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, timeline, devCommand, quiet, }) {
|
|
335
336
|
const { pluginsSteps, timers: timersA } = await loadPlugins({
|
|
336
337
|
pluginsOptions,
|
|
337
338
|
childProcesses,
|
|
@@ -377,6 +378,7 @@ const runBuild = async function ({ childProcesses, pluginsOptions, netlifyConfig
|
|
|
377
378
|
testOpts,
|
|
378
379
|
featureFlags,
|
|
379
380
|
quiet,
|
|
381
|
+
userNodeVersion,
|
|
380
382
|
});
|
|
381
383
|
return {
|
|
382
384
|
stepsCount,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
|
-
import { zipFunctions } from '@netlify/zip-it-and-ship-it';
|
|
2
|
+
import { RUNTIME, zipFunctions } from '@netlify/zip-it-and-ship-it';
|
|
3
3
|
import { pathExists } from 'path-exists';
|
|
4
4
|
import { log } from '../../log/logger.js';
|
|
5
5
|
import { logBundleResults, logFunctionsNonExistingDir, logFunctionsToBundle } from '../../log/messages/core_steps.js';
|
|
@@ -10,9 +10,9 @@ import { getZisiParameters } from './zisi.js';
|
|
|
10
10
|
const getBundlers = (results = []) =>
|
|
11
11
|
// using a Set to filter duplicates
|
|
12
12
|
new Set(results
|
|
13
|
-
.map((bundle) => (bundle.runtime ===
|
|
13
|
+
.map((bundle) => (bundle.runtime === RUNTIME.JAVASCRIPT ? bundle.bundler : null))
|
|
14
14
|
.filter(Boolean));
|
|
15
|
-
const zipFunctionsAndLogResults = async ({ buildDir, childEnv, featureFlags, functionsConfig, functionsDist, functionsSrc, internalFunctionsSrc, isRunningLocally, logs, repositoryRoot, }) => {
|
|
15
|
+
const zipFunctionsAndLogResults = async ({ buildDir, childEnv, featureFlags, functionsConfig, functionsDist, functionsSrc, internalFunctionsSrc, isRunningLocally, logs, repositoryRoot, userNodeVersion, }) => {
|
|
16
16
|
const zisiParameters = getZisiParameters({
|
|
17
17
|
buildDir,
|
|
18
18
|
childEnv,
|
|
@@ -22,6 +22,7 @@ const zipFunctionsAndLogResults = async ({ buildDir, childEnv, featureFlags, fun
|
|
|
22
22
|
internalFunctionsSrc,
|
|
23
23
|
isRunningLocally,
|
|
24
24
|
repositoryRoot,
|
|
25
|
+
userNodeVersion,
|
|
25
26
|
});
|
|
26
27
|
try {
|
|
27
28
|
// Printing an empty line before bundling output.
|
|
@@ -37,7 +38,7 @@ const zipFunctionsAndLogResults = async ({ buildDir, childEnv, featureFlags, fun
|
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
40
|
// Plugin to package Netlify functions with @netlify/zip-it-and-ship-it
|
|
40
|
-
const coreStep = async function ({ childEnv, constants: { INTERNAL_FUNCTIONS_SRC: relativeInternalFunctionsSrc, IS_LOCAL: isRunningLocally, FUNCTIONS_SRC: relativeFunctionsSrc, FUNCTIONS_DIST: relativeFunctionsDist, }, buildDir, logs, netlifyConfig, featureFlags, repositoryRoot, }) {
|
|
41
|
+
const coreStep = async function ({ childEnv, constants: { INTERNAL_FUNCTIONS_SRC: relativeInternalFunctionsSrc, IS_LOCAL: isRunningLocally, FUNCTIONS_SRC: relativeFunctionsSrc, FUNCTIONS_DIST: relativeFunctionsDist, }, buildDir, logs, netlifyConfig, featureFlags, repositoryRoot, userNodeVersion, }) {
|
|
41
42
|
const functionsSrc = relativeFunctionsSrc === undefined ? undefined : resolve(buildDir, relativeFunctionsSrc);
|
|
42
43
|
const functionsDist = resolve(buildDir, relativeFunctionsDist);
|
|
43
44
|
const internalFunctionsSrc = resolve(buildDir, relativeInternalFunctionsSrc);
|
|
@@ -78,6 +79,7 @@ const coreStep = async function ({ childEnv, constants: { INTERNAL_FUNCTIONS_SRC
|
|
|
78
79
|
isRunningLocally,
|
|
79
80
|
logs,
|
|
80
81
|
repositoryRoot,
|
|
82
|
+
userNodeVersion,
|
|
81
83
|
});
|
|
82
84
|
const metrics = getMetrics(internalFunctions, userFunctions);
|
|
83
85
|
return {
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import { join, resolve } from 'path';
|
|
2
2
|
import mapObject from 'map-obj';
|
|
3
|
+
import semver from 'semver';
|
|
3
4
|
import { getZisiFeatureFlags } from './feature_flags.js';
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const getLambdaNodeVersion = (childEnv, userNodeVersion) => {
|
|
6
|
+
if (childEnv.AWS_LAMBDA_JS_RUNTIME) {
|
|
7
|
+
return childEnv.AWS_LAMBDA_JS_RUNTIME;
|
|
8
|
+
}
|
|
9
|
+
// As of time of writing the default Lambda Node.js version is 16 and
|
|
10
|
+
// we do not want to take the risk and downgrade users from this default version on initial release
|
|
11
|
+
// of the dependency between user and lambda Node.js version.
|
|
12
|
+
// The check ensures that if the user version is lower than 16 we keep the default version.
|
|
13
|
+
//
|
|
14
|
+
// TODO: Remove this once Node.js 16 is deprecated. Do NOT change this if the default Lambda version is updated.
|
|
15
|
+
if (semver.gte(userNodeVersion, '16.0.0')) {
|
|
16
|
+
return userNodeVersion;
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
};
|
|
20
|
+
export const getZisiParameters = ({ buildDir, childEnv, featureFlags, functionsConfig, functionsDist, internalFunctionsSrc, isRunningLocally, repositoryRoot, userNodeVersion, }) => {
|
|
21
|
+
const nodeVersion = getLambdaNodeVersion(childEnv, userNodeVersion);
|
|
6
22
|
const manifest = join(functionsDist, 'manifest.json');
|
|
7
23
|
const config = mapObject(functionsConfig, (expression, object) => [
|
|
8
24
|
expression,
|
|
9
|
-
normalizeFunctionConfig({ buildDir,
|
|
25
|
+
normalizeFunctionConfig({ buildDir, functionConfig: object, isRunningLocally, nodeVersion }),
|
|
10
26
|
]);
|
|
11
27
|
const zisiFeatureFlags = getZisiFeatureFlags(featureFlags);
|
|
12
28
|
// Only internal functions are allowed to have a json config file
|
|
@@ -24,7 +40,7 @@ export const getZisiParameters = ({ buildDir, childEnv, featureFlags, functionsC
|
|
|
24
40
|
// The function configuration keys returned by @netlify/config are not an exact
|
|
25
41
|
// match to the properties that @netlify/zip-it-and-ship-it expects. We do that
|
|
26
42
|
// translation here.
|
|
27
|
-
export const normalizeFunctionConfig = ({ buildDir, functionConfig = {}, isRunningLocally, nodeVersion }) => ({
|
|
43
|
+
export const normalizeFunctionConfig = ({ buildDir, functionConfig = {}, isRunningLocally, nodeVersion, }) => ({
|
|
28
44
|
externalNodeModules: functionConfig.external_node_modules,
|
|
29
45
|
includedFiles: functionConfig.included_files,
|
|
30
46
|
name: functionConfig.name,
|
package/lib/steps/core_step.js
CHANGED
|
@@ -2,7 +2,7 @@ import { setEnvChanges } from '../env/changes.js';
|
|
|
2
2
|
import { addErrorInfo, isBuildError } from '../error/info.js';
|
|
3
3
|
import { updateNetlifyConfig, listConfigSideFiles } from './update_config.js';
|
|
4
4
|
// Fire a core step
|
|
5
|
-
export const fireCoreStep = async function ({ coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, constants, buildbotServerSocket, events, logs, nodePath, childEnv, context, branch, envChanges, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, debug, systemLog, saveConfig, }) {
|
|
5
|
+
export const fireCoreStep = async function ({ coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, constants, buildbotServerSocket, events, logs, nodePath, childEnv, context, branch, envChanges, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, debug, systemLog, saveConfig, userNodeVersion, }) {
|
|
6
6
|
try {
|
|
7
7
|
const configSideFiles = await listConfigSideFiles([headersPath, redirectsPath]);
|
|
8
8
|
const childEnvA = setEnvChanges(envChanges, { ...childEnv });
|
|
@@ -27,6 +27,7 @@ export const fireCoreStep = async function ({ coreStep, coreStepId, coreStepName
|
|
|
27
27
|
debug,
|
|
28
28
|
systemLog,
|
|
29
29
|
saveConfig,
|
|
30
|
+
userNodeVersion,
|
|
30
31
|
});
|
|
31
32
|
const { netlifyConfig: netlifyConfigA, configMutations: configMutationsA, headersPath: headersPathA, redirectsPath: redirectsPathA, } = await updateNetlifyConfig({
|
|
32
33
|
configOpts,
|
package/lib/steps/run_step.js
CHANGED
|
@@ -7,7 +7,7 @@ import { fireCoreStep } from './core_step.js';
|
|
|
7
7
|
import { firePluginStep } from './plugin.js';
|
|
8
8
|
import { getStepReturn } from './return.js';
|
|
9
9
|
// Run a step (core, build command or plugin)
|
|
10
|
-
export const runStep = async function ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, pluginPackageJson, loadedFrom, origin, condition, configPath, outputConfigPath, buildDir, 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, }) {
|
|
10
|
+
export const runStep = async function ({ event, childProcess, packageName, coreStep, coreStepId, coreStepName, coreStepDescription, pluginPackageJson, loadedFrom, origin, condition, configPath, outputConfigPath, buildDir, 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, }) {
|
|
11
11
|
const constantsA = await addMutableConstants({ constants, buildDir, netlifyConfig });
|
|
12
12
|
if (!(await shouldRunStep({
|
|
13
13
|
event,
|
|
@@ -64,6 +64,7 @@ export const runStep = async function ({ event, childProcess, packageName, coreS
|
|
|
64
64
|
headersPath,
|
|
65
65
|
redirectsPath,
|
|
66
66
|
featureFlags,
|
|
67
|
+
userNodeVersion,
|
|
67
68
|
});
|
|
68
69
|
const newValues = await getStepReturn({
|
|
69
70
|
event,
|
|
@@ -143,7 +144,7 @@ const getFireStep = function (packageName, coreStepId, event) {
|
|
|
143
144
|
const parentTag = normalizeTagName(packageName);
|
|
144
145
|
return measureDuration(tFireStep, event, { parentTag, category: 'pluginEvent' });
|
|
145
146
|
};
|
|
146
|
-
const tFireStep = function ({ event, childProcess, packageName, pluginPackageJson, loadedFrom, origin, coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, error, logs, debug, systemLog, verbose, saveConfig, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, }) {
|
|
147
|
+
const tFireStep = function ({ event, childProcess, packageName, pluginPackageJson, loadedFrom, origin, coreStep, coreStepId, coreStepName, configPath, outputConfigPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, envChanges, constants, steps, buildbotServerSocket, events, error, logs, debug, systemLog, verbose, saveConfig, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, featureFlags, userNodeVersion, }) {
|
|
147
148
|
if (coreStep !== undefined) {
|
|
148
149
|
return fireCoreStep({
|
|
149
150
|
coreStep,
|
|
@@ -172,6 +173,7 @@ const tFireStep = function ({ event, childProcess, packageName, pluginPackageJso
|
|
|
172
173
|
debug,
|
|
173
174
|
systemLog,
|
|
174
175
|
saveConfig,
|
|
176
|
+
userNodeVersion,
|
|
175
177
|
});
|
|
176
178
|
}
|
|
177
179
|
return firePluginStep({
|
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, repositoryRoot, nodePath, childEnv, context, branch, constants, mode, api, errorMonitor, deployId, errorParams, netlifyConfig, configOpts, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, }) {
|
|
10
|
+
export const runSteps = async function ({ steps, buildbotServerSocket, events, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, repositoryRoot, nodePath, childEnv, context, branch, constants, mode, api, errorMonitor, deployId, errorParams, netlifyConfig, configOpts, logs, debug, systemLog, verbose, saveConfig, timers, testOpts, featureFlags, quiet, userNodeVersion, }) {
|
|
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, }) => {
|
|
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,
|
|
@@ -56,6 +56,7 @@ export const runSteps = async function ({ steps, buildbotServerSocket, events, c
|
|
|
56
56
|
testOpts,
|
|
57
57
|
featureFlags,
|
|
58
58
|
quiet,
|
|
59
|
+
userNodeVersion,
|
|
59
60
|
});
|
|
60
61
|
const statusesA = addStatus({ newStatus, statuses, event, packageName, pluginPackageJson });
|
|
61
62
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.10.1",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/core/main.js",
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@bugsnag/js": "^7.0.0",
|
|
67
67
|
"@netlify/cache-utils": "^5.1.3",
|
|
68
|
-
"@netlify/config": "^20.
|
|
68
|
+
"@netlify/config": "^20.4.1",
|
|
69
69
|
"@netlify/edge-bundler": "8.13.2",
|
|
70
|
-
"@netlify/framework-info": "^9.8.
|
|
71
|
-
"@netlify/functions-utils": "^5.2.
|
|
70
|
+
"@netlify/framework-info": "^9.8.6",
|
|
71
|
+
"@netlify/functions-utils": "^5.2.3",
|
|
72
72
|
"@netlify/git-utils": "^5.1.1",
|
|
73
73
|
"@netlify/plugins-list": "^6.68.0",
|
|
74
74
|
"@netlify/run-utils": "^5.1.0",
|
|
75
|
-
"@netlify/zip-it-and-ship-it": "
|
|
75
|
+
"@netlify/zip-it-and-ship-it": "9.2.1",
|
|
76
76
|
"@sindresorhus/slugify": "^2.0.0",
|
|
77
77
|
"ansi-escapes": "^6.0.0",
|
|
78
78
|
"chalk": "^5.0.0",
|
|
@@ -147,5 +147,5 @@
|
|
|
147
147
|
"module": "commonjs"
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
|
-
"gitHead": "
|
|
150
|
+
"gitHead": "3d1699220b89fad0095efd7adc0bb5c49c47b3de"
|
|
151
151
|
}
|
|
@@ -17,7 +17,7 @@ type FunctionsObject = {
|
|
|
17
17
|
/**
|
|
18
18
|
* the function bundling method used in [`@netlify/zip-it-and-ship-it`](https://github.com/netlify/zip-it-and-ship-it).
|
|
19
19
|
*/
|
|
20
|
-
node_bundler?: 'esbuild'
|
|
20
|
+
node_bundler?: 'esbuild' | 'none'
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* a list of Node.js modules that are copied to the bundled artifact without adjusting their source or references during the bundling process.
|