@netlify/build 28.1.99-test4 → 28.2.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/main.js +5 -2
- package/lib/error/type.js +0 -2
- package/lib/log/messages/core.js +2 -1
- package/lib/plugins/ipc.js +0 -5
- package/lib/plugins/spawn.js +0 -8
- package/lib/plugins_core/edge_functions/index.js +2 -1
- package/lib/plugins_core/edge_functions/lib/internal_manifest.js +2 -0
- package/lib/plugins_core/edge_functions/validate_manifest/validate_edge_functions_manifest.js +15 -0
- package/lib/steps/return.js +2 -2
- package/lib/steps/run_step.js +1 -0
- package/package.json +11 -10
package/lib/core/main.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { handleBuildError } from '../error/handle.js';
|
|
2
2
|
import { reportError } from '../error/report.js';
|
|
3
|
+
import { getSystemLogger } from '../log/logger.js';
|
|
3
4
|
import { logTimer, logBuildSuccess } from '../log/messages/core.js';
|
|
4
5
|
import { trackBuildComplete } from '../telemetry/main.js';
|
|
5
6
|
import { reportTimers } from '../time/report.js';
|
|
@@ -16,6 +17,7 @@ export { runCoreSteps } from '../steps/run_core_steps.js';
|
|
|
16
17
|
export default async function buildSite(flags = {}) {
|
|
17
18
|
const { errorMonitor, framework, mode, logs, debug, systemLogFile, testOpts, statsdOpts, dry, telemetry, buildId, deployId, ...flagsA } = startBuild(flags);
|
|
18
19
|
const errorParams = { errorMonitor, mode, logs, debug, testOpts };
|
|
20
|
+
const systemLog = getSystemLogger(logs, debug, systemLogFile);
|
|
19
21
|
try {
|
|
20
22
|
const { pluginsOptions, netlifyConfig: netlifyConfigA, siteInfo, userNodeVersion, stepsCount, timers, durationNs, configMutations, } = await execBuild({
|
|
21
23
|
...flagsA,
|
|
@@ -37,6 +39,7 @@ export default async function buildSite(flags = {}) {
|
|
|
37
39
|
timers,
|
|
38
40
|
durationNs,
|
|
39
41
|
statsdOpts,
|
|
42
|
+
systemLog,
|
|
40
43
|
});
|
|
41
44
|
const { success, severityCode, status } = getSeverity('success');
|
|
42
45
|
await telemetryReport({
|
|
@@ -76,12 +79,12 @@ export default async function buildSite(flags = {}) {
|
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
// Logs and reports that a build successfully ended
|
|
79
|
-
const handleBuildSuccess = async function ({ framework, dry, logs, timers, durationNs, statsdOpts }) {
|
|
82
|
+
const handleBuildSuccess = async function ({ framework, dry, logs, timers, durationNs, statsdOpts, systemLog }) {
|
|
80
83
|
if (dry) {
|
|
81
84
|
return;
|
|
82
85
|
}
|
|
83
86
|
logBuildSuccess(logs);
|
|
84
|
-
logTimer(logs, durationNs, 'Netlify Build');
|
|
87
|
+
logTimer(logs, durationNs, 'Netlify Build', systemLog);
|
|
85
88
|
await reportTimers({ timers, statsdOpts, framework });
|
|
86
89
|
};
|
|
87
90
|
// Handles the calls and errors of telemetry reports
|
package/lib/error/type.js
CHANGED
|
@@ -110,7 +110,6 @@ const TYPES = {
|
|
|
110
110
|
pluginValidation: {
|
|
111
111
|
title: ({ location: { packageName } }) => `Plugin "${packageName}" internal error`,
|
|
112
112
|
stackType: 'stack',
|
|
113
|
-
showErrorProps: true,
|
|
114
113
|
locationType: 'buildFail',
|
|
115
114
|
severity: 'warning',
|
|
116
115
|
},
|
|
@@ -127,7 +126,6 @@ const TYPES = {
|
|
|
127
126
|
ipc: {
|
|
128
127
|
title: ({ location: { packageName } }) => `Plugin "${packageName}" internal error`,
|
|
129
128
|
stackType: 'none',
|
|
130
|
-
showErrorProps: true,
|
|
131
129
|
locationType: 'buildFail',
|
|
132
130
|
severity: 'warning',
|
|
133
131
|
},
|
package/lib/log/messages/core.js
CHANGED
|
@@ -28,10 +28,11 @@ export const logBuildSuccess = function (logs) {
|
|
|
28
28
|
logHeader(logs, 'Netlify Build Complete');
|
|
29
29
|
logMessage(logs, '');
|
|
30
30
|
};
|
|
31
|
-
export const logTimer = function (logs, durationNs, timerName) {
|
|
31
|
+
export const logTimer = function (logs, durationNs, timerName, systemLog) {
|
|
32
32
|
const durationMs = roundTimerToMillisecs(durationNs);
|
|
33
33
|
const duration = prettyMs(durationMs);
|
|
34
34
|
log(logs, THEME.dimWords(`(${timerName} completed in ${duration})`));
|
|
35
|
+
systemLog(`Build step duration: ${timerName} completed in ${durationMs}ms`);
|
|
35
36
|
};
|
|
36
37
|
export const logMissingSideFile = function (logs, sideFile, publish) {
|
|
37
38
|
logWarning(logs, `
|
package/lib/plugins/ipc.js
CHANGED
|
@@ -35,11 +35,6 @@ export const getEventFromChild = async function (childProcess, callId) {
|
|
|
35
35
|
try {
|
|
36
36
|
return await Promise.race([getMessage(messagePromise), getError(errorPromise), getExit(exitPromise)]);
|
|
37
37
|
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
error.stdout = childProcess.stdoutArray.join('');
|
|
40
|
-
error.stderr = childProcess.stderrArray.join('');
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
38
|
finally {
|
|
44
39
|
messagePromise.cancel();
|
|
45
40
|
errorPromise.cancel();
|
package/lib/plugins/spawn.js
CHANGED
|
@@ -32,14 +32,6 @@ const startPlugin = async function ({ pluginDir, nodePath, buildDir, childEnv })
|
|
|
32
32
|
extendEnv: false,
|
|
33
33
|
serialization: 'advanced',
|
|
34
34
|
});
|
|
35
|
-
childProcess.stdoutArray = [];
|
|
36
|
-
childProcess.stdout.on('data', (data) => {
|
|
37
|
-
childProcess.stdoutArray.push(data);
|
|
38
|
-
});
|
|
39
|
-
childProcess.stderrArray = [];
|
|
40
|
-
childProcess.stderr.on('data', (data) => {
|
|
41
|
-
childProcess.stderrArray.push(data);
|
|
42
|
-
});
|
|
43
35
|
try {
|
|
44
36
|
await getEventFromChild(childProcess, 'ready');
|
|
45
37
|
return { childProcess };
|
|
@@ -17,7 +17,7 @@ const coreStep = async function ({ buildDir, constants: { EDGE_FUNCTIONS_DIST: d
|
|
|
17
17
|
const srcPath = srcDirectory ? resolve(buildDir, srcDirectory) : undefined;
|
|
18
18
|
const sourcePaths = [internalSrcPath, srcPath].filter(Boolean);
|
|
19
19
|
logFunctions({ internalSrcDirectory, internalSrcPath, logs, srcDirectory, srcPath });
|
|
20
|
-
const { declarations: internalDeclarations, importMap } = await parseManifest(internalSrcPath, systemLog);
|
|
20
|
+
const { declarations: internalDeclarations, importMap, layers } = await parseManifest(internalSrcPath, systemLog);
|
|
21
21
|
const declarations = [...configDeclarations, ...internalDeclarations];
|
|
22
22
|
// If we're running in buildbot and the feature flag is enabled, we set the
|
|
23
23
|
// Deno cache dir to a directory that is persisted between builds.
|
|
@@ -32,6 +32,7 @@ const coreStep = async function ({ buildDir, constants: { EDGE_FUNCTIONS_DIST: d
|
|
|
32
32
|
distImportMapPath,
|
|
33
33
|
featureFlags,
|
|
34
34
|
importMaps: [importMap].filter(Boolean),
|
|
35
|
+
layers,
|
|
35
36
|
systemLogger: featureFlags.edge_functions_system_logger ? systemLog : undefined,
|
|
36
37
|
});
|
|
37
38
|
systemLog('Edge Functions manifest:', manifest);
|
|
@@ -11,6 +11,7 @@ const parseManifest = async (internalSourceDirectory, systemLog) => {
|
|
|
11
11
|
}
|
|
12
12
|
const result = {
|
|
13
13
|
declarations: manifest.functions,
|
|
14
|
+
layers: manifest.layers,
|
|
14
15
|
};
|
|
15
16
|
if (manifest.import_map) {
|
|
16
17
|
const importMapPath = resolve(dirname(manifestPath), manifest.import_map);
|
|
@@ -32,6 +33,7 @@ const parseManifest = async (internalSourceDirectory, systemLog) => {
|
|
|
32
33
|
}
|
|
33
34
|
return {
|
|
34
35
|
declarations: [],
|
|
36
|
+
layers: [],
|
|
35
37
|
};
|
|
36
38
|
};
|
|
37
39
|
const readImportMap = async (path) => {
|
package/lib/plugins_core/edge_functions/validate_manifest/validate_edge_functions_manifest.js
CHANGED
|
@@ -35,6 +35,17 @@ const routesSchema = {
|
|
|
35
35
|
},
|
|
36
36
|
additionalProperties: false,
|
|
37
37
|
};
|
|
38
|
+
const layersSchema = {
|
|
39
|
+
$async: true,
|
|
40
|
+
type: 'object',
|
|
41
|
+
required: ['flag', 'name'],
|
|
42
|
+
properties: {
|
|
43
|
+
flag: { type: 'string' },
|
|
44
|
+
name: { type: 'string' },
|
|
45
|
+
local: { type: 'string' },
|
|
46
|
+
},
|
|
47
|
+
additionalProperties: false,
|
|
48
|
+
};
|
|
38
49
|
const edgeManifestSchema = {
|
|
39
50
|
$async: true,
|
|
40
51
|
type: 'object',
|
|
@@ -52,6 +63,10 @@ const edgeManifestSchema = {
|
|
|
52
63
|
type: 'array',
|
|
53
64
|
items: routesSchema,
|
|
54
65
|
},
|
|
66
|
+
layers: {
|
|
67
|
+
type: 'array',
|
|
68
|
+
items: layersSchema,
|
|
69
|
+
},
|
|
55
70
|
bundler_version: { type: 'string' },
|
|
56
71
|
},
|
|
57
72
|
additionalProperties: false,
|
package/lib/steps/return.js
CHANGED
|
@@ -2,7 +2,7 @@ import { logTimer } from '../log/messages/core.js';
|
|
|
2
2
|
import { logStepSuccess } from '../log/messages/steps.js';
|
|
3
3
|
import { handleStepError } from './error.js';
|
|
4
4
|
// Retrieve the return value of a step
|
|
5
|
-
export const getStepReturn = function ({ event, packageName, newError, newEnvChanges, newStatus, coreStep, coreStepName: timerName = `${packageName} ${event}`, childEnv, mode, api, errorMonitor, deployId, netlifyConfig, configMutations, headersPath, redirectsPath, logs, debug, timers, durationNs, testOpts, }) {
|
|
5
|
+
export const getStepReturn = function ({ event, packageName, newError, newEnvChanges, newStatus, coreStep, coreStepName: timerName = `${packageName} ${event}`, childEnv, mode, api, errorMonitor, deployId, netlifyConfig, configMutations, headersPath, redirectsPath, logs, debug, timers, durationNs, testOpts, systemLog, }) {
|
|
6
6
|
if (newError !== undefined) {
|
|
7
7
|
return handleStepError({
|
|
8
8
|
event,
|
|
@@ -20,6 +20,6 @@ export const getStepReturn = function ({ event, packageName, newError, newEnvCha
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
logStepSuccess(logs);
|
|
23
|
-
logTimer(logs, durationNs, timerName);
|
|
23
|
+
logTimer(logs, durationNs, timerName, systemLog);
|
|
24
24
|
return { newEnvChanges, netlifyConfig, configMutations, headersPath, redirectsPath, newStatus, timers };
|
|
25
25
|
};
|
package/lib/steps/run_step.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "28.1
|
|
3
|
+
"version": "28.2.1",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/core/main.js",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"license": "MIT",
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@bugsnag/js": "^7.0.0",
|
|
67
|
-
"@netlify/cache-utils": "^5.0.
|
|
68
|
-
"@netlify/config": "^
|
|
69
|
-
"@netlify/edge-bundler": "
|
|
70
|
-
"@netlify/functions-utils": "^5.0.
|
|
71
|
-
"@netlify/git-utils": "^5.0.
|
|
67
|
+
"@netlify/cache-utils": "^5.0.2",
|
|
68
|
+
"@netlify/config": "^20.0.1",
|
|
69
|
+
"@netlify/edge-bundler": "4.3.0",
|
|
70
|
+
"@netlify/functions-utils": "^5.0.4",
|
|
71
|
+
"@netlify/git-utils": "^5.0.2",
|
|
72
72
|
"@netlify/plugins-list": "^6.54.0",
|
|
73
|
-
"@netlify/run-utils": "^5.0.
|
|
74
|
-
"@netlify/zip-it-and-ship-it": "^
|
|
73
|
+
"@netlify/run-utils": "^5.0.2",
|
|
74
|
+
"@netlify/zip-it-and-ship-it": "^7.1.2",
|
|
75
75
|
"@sindresorhus/slugify": "^2.0.0",
|
|
76
76
|
"ajv": "^8.11.0",
|
|
77
77
|
"ajv-errors": "^3.0.0",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"yargs": "^17.6.0"
|
|
120
120
|
},
|
|
121
121
|
"devDependencies": {
|
|
122
|
-
"@netlify/nock-udp": "^3.0.
|
|
122
|
+
"@netlify/nock-udp": "^3.0.1",
|
|
123
123
|
"@types/node": "^14.18.31",
|
|
124
124
|
"@types/statsd-client": "^0.4.3",
|
|
125
125
|
"atob": "^2.1.2",
|
|
@@ -149,5 +149,6 @@
|
|
|
149
149
|
"compilerOptions": {
|
|
150
150
|
"module": "commonjs"
|
|
151
151
|
}
|
|
152
|
-
}
|
|
152
|
+
},
|
|
153
|
+
"gitHead": "68feefc0d483a887c91c7647aa74f3eed65c3d93"
|
|
153
154
|
}
|