@netlify/build 35.1.10 → 35.2.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/build.d.ts +1 -1
- package/lib/core/dev.d.ts +2 -2
- package/lib/core/main.d.ts +2 -2
- package/lib/core/main.js +2 -2
- package/lib/core/types.d.ts +2 -0
- package/lib/error/monitor/start.d.ts +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/log/header_func.d.ts +1 -1
- package/lib/log/logger.d.ts +18 -14
- package/lib/log/logger.js +23 -15
- package/lib/log/messages/config.js +2 -1
- package/lib/log/messages/core.d.ts +2 -2
- package/package.json +4 -4
package/lib/core/build.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const startBuild: (flags: Partial<BuildFlags>) => {
|
|
|
3
3
|
debug: boolean;
|
|
4
4
|
systemLogFile: number | undefined;
|
|
5
5
|
errorMonitor: any;
|
|
6
|
-
logs: import("../log/logger.js").
|
|
6
|
+
logs: import("../log/logger.js").Logs | undefined;
|
|
7
7
|
timers: never[];
|
|
8
8
|
env: Record<string, unknown>;
|
|
9
9
|
token: string;
|
package/lib/core/dev.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ export function startDev(devCommand: any, flags?: {}): Promise<{
|
|
|
2
2
|
success: boolean;
|
|
3
3
|
severityCode: number;
|
|
4
4
|
netlifyConfig: any;
|
|
5
|
-
logs: import("../log/logger.js").
|
|
5
|
+
logs: import("../log/logger.js").Logs | undefined;
|
|
6
6
|
configMutations: any;
|
|
7
7
|
generatedFunctions: import("../steps/return_values.js").GeneratedFunction[];
|
|
8
8
|
error?: undefined;
|
|
9
9
|
} | {
|
|
10
10
|
success: boolean;
|
|
11
11
|
severityCode: number;
|
|
12
|
-
logs: import("../log/logger.js").
|
|
12
|
+
logs: import("../log/logger.js").Logs | undefined;
|
|
13
13
|
error: {
|
|
14
14
|
message: string;
|
|
15
15
|
stack: string;
|
package/lib/core/main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Logs } from '../log/logger.js';
|
|
2
2
|
import { BuildFlags } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Main entry point of Netlify Build.
|
|
@@ -9,7 +9,7 @@ import { BuildFlags } from './types.js';
|
|
|
9
9
|
export declare function buildSite(flags?: Partial<BuildFlags>): Promise<{
|
|
10
10
|
success: boolean;
|
|
11
11
|
severityCode: number;
|
|
12
|
-
logs:
|
|
12
|
+
logs: Logs | undefined;
|
|
13
13
|
netlifyConfig?: any;
|
|
14
14
|
configMutations?: any;
|
|
15
15
|
}>;
|
package/lib/core/main.js
CHANGED
|
@@ -2,7 +2,7 @@ import { setMultiSpanAttributes, getGlobalContext } from '@netlify/opentelemetry
|
|
|
2
2
|
import { trace, context } from '@opentelemetry/api';
|
|
3
3
|
import { handleBuildError } from '../error/handle.js';
|
|
4
4
|
import { reportError } from '../error/report.js';
|
|
5
|
-
import { getSystemLogger } from '../log/logger.js';
|
|
5
|
+
import { getLogsOutput, getSystemLogger } from '../log/logger.js';
|
|
6
6
|
import { logTimer, logBuildSuccess } from '../log/messages/core.js';
|
|
7
7
|
import { getGeneratedFunctions } from '../steps/return_values.js';
|
|
8
8
|
import { trackBuildComplete } from '../telemetry/main.js';
|
|
@@ -82,7 +82,7 @@ export async function buildSite(flags = {}) {
|
|
|
82
82
|
success,
|
|
83
83
|
severityCode,
|
|
84
84
|
netlifyConfig: netlifyConfigA,
|
|
85
|
-
logs,
|
|
85
|
+
logs: getLogsOutput(logs),
|
|
86
86
|
configMutations,
|
|
87
87
|
generatedFunctions: getGeneratedFunctions(returnValues),
|
|
88
88
|
};
|
package/lib/core/types.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export type BuildCLIFlags = {
|
|
|
42
42
|
export type BuildFlags = BuildCLIFlags & {
|
|
43
43
|
env?: Record<string, unknown>;
|
|
44
44
|
eventHandlers?: EventHandlers;
|
|
45
|
+
/** Custom logger function to capture build output */
|
|
46
|
+
logger?: (message: string) => void;
|
|
45
47
|
};
|
|
46
48
|
type EventHandlers = {
|
|
47
49
|
[K in keyof NetlifyPlugin]: NetlifyPlugin[K] | {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ResolvedFlags } from '../../core/normalize_flags.js';
|
|
2
|
-
import {
|
|
2
|
+
import { Logs } from '../../log/logger.js';
|
|
3
3
|
export declare const startErrorMonitor: (config: {
|
|
4
4
|
flags: ResolvedFlags;
|
|
5
|
-
logs?:
|
|
5
|
+
logs?: Logs;
|
|
6
6
|
bugsnagKey?: string;
|
|
7
7
|
}) => any;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { buildSite } from './core/main.js';
|
|
2
2
|
export { NetlifyPluginConstants } from './core/constants.js';
|
|
3
|
+
export type { LogOutput as Logs } from './log/logger.js';
|
|
3
4
|
export type { GeneratedFunction } from './steps/return_values.js';
|
|
4
5
|
export type { NetlifyPlugin } from './types/netlify_plugin.js';
|
|
5
6
|
export type { NetlifyPluginOptions } from './types/netlify_plugin_options.js';
|
package/lib/log/header_func.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Retrieve successful or error header depending on whether `error` exists */
|
|
2
|
-
export declare const getLogHeaderFunc: (error?: Error) => (logs: import("./logger.js").
|
|
2
|
+
export declare const getLogHeaderFunc: (error?: Error) => (logs: import("./logger.js").Logs | undefined, string: string, opts?: {}) => void;
|
package/lib/log/logger.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type BufferedLogs = {
|
|
|
8
8
|
};
|
|
9
9
|
export type StreamedLogs = {
|
|
10
10
|
outputFlusher?: OutputFlusher;
|
|
11
|
+
logFunction?: (message: string) => void;
|
|
11
12
|
};
|
|
12
13
|
export declare const logsAreBuffered: (logs: Logs | undefined) => logs is BufferedLogs;
|
|
13
14
|
/**
|
|
@@ -16,29 +17,32 @@ export declare const logsAreBuffered: (logs: Logs | undefined) => logs is Buffer
|
|
|
16
17
|
*/
|
|
17
18
|
export declare const getBufferLogs: (config: {
|
|
18
19
|
buffer?: boolean;
|
|
19
|
-
|
|
20
|
+
logger?: (message: string) => void;
|
|
21
|
+
}) => Logs | undefined;
|
|
20
22
|
export declare const log: (logs: Logs | undefined, string: string, config?: {
|
|
21
23
|
indent?: boolean;
|
|
22
24
|
color?: (string: string) => string;
|
|
23
25
|
}) => void;
|
|
24
|
-
export
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const
|
|
33
|
-
export declare const
|
|
34
|
-
export declare const
|
|
35
|
-
export declare const
|
|
26
|
+
export type LogOutput = Pick<BufferedLogs, 'stderr' | 'stdout'>;
|
|
27
|
+
export declare const getLogsOutput: (logs: Logs | undefined) => LogOutput;
|
|
28
|
+
export declare const logError: (logs: Logs | undefined, string: string, opts?: {}) => void;
|
|
29
|
+
export declare const logWarning: (logs: Logs | undefined, string: string, opts?: {}) => void;
|
|
30
|
+
export declare const logMessage: (logs: Logs | undefined, string: string, opts?: {}) => void;
|
|
31
|
+
export declare const logObject: (logs: Logs | undefined, object: any, opts: any) => void;
|
|
32
|
+
export declare const logArray: (logs: Logs | undefined, array: any, opts?: {}) => void;
|
|
33
|
+
export declare const logErrorArray: (logs: Logs | undefined, array: any, opts?: {}) => void;
|
|
34
|
+
export declare const logWarningArray: (logs: Logs | undefined, array: any, opts?: {}) => void;
|
|
35
|
+
export declare const logHeader: (logs: Logs | undefined, string: string, opts?: {}) => void;
|
|
36
|
+
export declare const logErrorHeader: (logs: Logs | undefined, string: string, opts?: {}) => void;
|
|
37
|
+
export declare const logSubHeader: (logs: Logs | undefined, string: string, opts?: {}) => void;
|
|
38
|
+
export declare const logErrorSubHeader: (logs: Logs | undefined, string: string, opts?: {}) => void;
|
|
39
|
+
export declare const logWarningSubHeader: (logs: Logs | undefined, string: string, opts?: {}) => void;
|
|
36
40
|
export declare const reduceLogLines: (lines: any) => any;
|
|
37
41
|
/**
|
|
38
42
|
* Builds a function for logging data to the system logger (i.e. hidden from
|
|
39
43
|
* the user-facing build logs)
|
|
40
44
|
*/
|
|
41
|
-
export declare const getSystemLogger: (logs:
|
|
45
|
+
export declare const getSystemLogger: (logs: Logs | undefined, debug: boolean,
|
|
42
46
|
/** A system log file descriptor, if non is provided it will be a noop logger */
|
|
43
47
|
systemLogFile?: number) => SystemLogger;
|
|
44
48
|
export declare const addOutputFlusher: (logs: Logs, outputFlusher: OutputFlusher) => Logs;
|
package/lib/log/logger.js
CHANGED
|
@@ -19,11 +19,13 @@ const EMPTY_LINE = '\u{200B}';
|
|
|
19
19
|
* on the console. The logs are accumulated in a `logs` array variable.
|
|
20
20
|
*/
|
|
21
21
|
export const getBufferLogs = (config) => {
|
|
22
|
-
const { buffer = false } = config;
|
|
23
|
-
if (
|
|
24
|
-
return;
|
|
22
|
+
const { buffer = false, logger } = config;
|
|
23
|
+
if (logger) {
|
|
24
|
+
return { logFunction: logger };
|
|
25
|
+
}
|
|
26
|
+
if (buffer) {
|
|
27
|
+
return { stdout: [], stderr: [] };
|
|
25
28
|
}
|
|
26
|
-
return { stdout: [], stderr: [] };
|
|
27
29
|
};
|
|
28
30
|
// Core logging utility, used by the other methods.
|
|
29
31
|
// This should be used instead of `console.log()` as it allows us to instrument
|
|
@@ -41,8 +43,21 @@ export const log = function (logs, string, config = {}) {
|
|
|
41
43
|
logs.stdout.push(stringC);
|
|
42
44
|
return;
|
|
43
45
|
}
|
|
46
|
+
if (typeof logs?.logFunction === 'function') {
|
|
47
|
+
logs.logFunction(stringC);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
44
50
|
console.log(stringC);
|
|
45
51
|
};
|
|
52
|
+
// Returns a `logs` object to be returned in the public interface,
|
|
53
|
+
// always containing a `stderr` and `stdout` arrays, regardless of
|
|
54
|
+
// whether the `buffer` input property was used.
|
|
55
|
+
export const getLogsOutput = (logs) => {
|
|
56
|
+
if (!logs || !logsAreBuffered(logs)) {
|
|
57
|
+
return { stdout: [], stderr: [] };
|
|
58
|
+
}
|
|
59
|
+
return { stdout: logs.stdout, stderr: logs.stderr };
|
|
60
|
+
};
|
|
46
61
|
const serializeIndentedArray = function (array) {
|
|
47
62
|
return serializeArray(array.map(serializeIndentedItem));
|
|
48
63
|
};
|
|
@@ -144,14 +159,7 @@ systemLogFile) {
|
|
|
144
159
|
});
|
|
145
160
|
return (...args) => fileDescriptor.write(`${reduceLogLines(args)}\n`);
|
|
146
161
|
};
|
|
147
|
-
export const addOutputFlusher = (logs, outputFlusher) => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
outputFlusher,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
return {
|
|
155
|
-
outputFlusher,
|
|
156
|
-
};
|
|
157
|
-
};
|
|
162
|
+
export const addOutputFlusher = (logs, outputFlusher) => ({
|
|
163
|
+
...logs,
|
|
164
|
+
outputFlusher,
|
|
165
|
+
});
|
|
@@ -54,9 +54,10 @@ const INTERNAL_FLAGS = [
|
|
|
54
54
|
'enhancedSecretScan',
|
|
55
55
|
'edgeFunctionsBootstrapURL',
|
|
56
56
|
'eventHandlers',
|
|
57
|
+
'logger',
|
|
57
58
|
];
|
|
58
59
|
const HIDDEN_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS, ...INTERNAL_FLAGS];
|
|
59
|
-
const HIDDEN_DEBUG_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS, 'eventHandlers'];
|
|
60
|
+
const HIDDEN_DEBUG_FLAGS = [...SECURE_FLAGS, ...TEST_FLAGS, 'eventHandlers', 'logger'];
|
|
60
61
|
export const logBuildDir = function (logs, buildDir) {
|
|
61
62
|
logSubHeader(logs, 'Current directory');
|
|
62
63
|
logMessage(logs, buildDir);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Logs } from '../logger.js';
|
|
2
2
|
import { OutputFlusher } from '../output_flusher.js';
|
|
3
|
-
export declare const logBuildStart: (logs?:
|
|
3
|
+
export declare const logBuildStart: (logs?: Logs) => void;
|
|
4
4
|
export declare const logBuildError: ({ error, netlifyConfig, logs, debug }: {
|
|
5
5
|
error: any;
|
|
6
6
|
netlifyConfig: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.2.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -71,12 +71,12 @@
|
|
|
71
71
|
"@netlify/cache-utils": "^6.0.4",
|
|
72
72
|
"@netlify/config": "^24.0.5",
|
|
73
73
|
"@netlify/edge-bundler": "14.5.6",
|
|
74
|
-
"@netlify/functions-utils": "^6.2.
|
|
74
|
+
"@netlify/functions-utils": "^6.2.10",
|
|
75
75
|
"@netlify/git-utils": "^6.0.2",
|
|
76
76
|
"@netlify/opentelemetry-utils": "^2.0.1",
|
|
77
77
|
"@netlify/plugins-list": "^6.80.0",
|
|
78
78
|
"@netlify/run-utils": "^6.0.2",
|
|
79
|
-
"@netlify/zip-it-and-ship-it": "14.1.
|
|
79
|
+
"@netlify/zip-it-and-ship-it": "14.1.10",
|
|
80
80
|
"@sindresorhus/slugify": "^2.0.0",
|
|
81
81
|
"ansi-escapes": "^7.0.0",
|
|
82
82
|
"ansis": "^4.1.0",
|
|
@@ -152,5 +152,5 @@
|
|
|
152
152
|
"engines": {
|
|
153
153
|
"node": ">=18.14.0"
|
|
154
154
|
},
|
|
155
|
-
"gitHead": "
|
|
155
|
+
"gitHead": "4aebfe99730221de3e3ebbd9edb119e1029ee596"
|
|
156
156
|
}
|