@netlify/build 29.26.6 → 29.27.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 +2 -1
- package/lib/core/build.js +5 -2
- package/lib/plugins/child/run.js +12 -1
- package/lib/plugins/child/systemLog.d.ts +1 -0
- package/lib/plugins/child/systemLog.js +14 -0
- package/lib/plugins/spawn.js +5 -3
- package/lib/plugins_core/secrets_scanning/utils.js +1 -1
- package/lib/steps/plugin.d.ts +1 -0
- package/lib/steps/plugin.js +2 -2
- package/package.json +5 -5
- package/types/netlify_plugin_options.d.ts +1 -0
package/lib/core/build.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const startBuild: (flags: Partial<BuildFlags>) => {
|
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
export declare const execBuild: any;
|
|
36
|
-
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, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, timers, sendStatus, saveConfig, testOpts, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, edgeFunctionsBootstrapURL, eventHandlers, }: {
|
|
36
|
+
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, errorMonitor, deployId, errorParams, logs, debug, systemLog, systemLogFile, verbose, timers, sendStatus, saveConfig, testOpts, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, edgeFunctionsBootstrapURL, eventHandlers, }: {
|
|
37
37
|
pluginsOptions: any;
|
|
38
38
|
netlifyConfig: any;
|
|
39
39
|
configOpts: any;
|
|
@@ -62,6 +62,7 @@ export declare const runAndReportBuild: ({ pluginsOptions, netlifyConfig, config
|
|
|
62
62
|
logs: any;
|
|
63
63
|
debug: any;
|
|
64
64
|
systemLog: any;
|
|
65
|
+
systemLogFile: any;
|
|
65
66
|
verbose: any;
|
|
66
67
|
timers: any;
|
|
67
68
|
sendStatus: any;
|
package/lib/core/build.js
CHANGED
|
@@ -121,6 +121,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
121
121
|
logs,
|
|
122
122
|
debug,
|
|
123
123
|
systemLog,
|
|
124
|
+
systemLogFile,
|
|
124
125
|
verbose,
|
|
125
126
|
timers: timersA,
|
|
126
127
|
sendStatus,
|
|
@@ -150,7 +151,7 @@ const tExecBuild = async function ({ config, defaultConfig, cachedConfig, cached
|
|
|
150
151
|
};
|
|
151
152
|
export const execBuild = measureDuration(tExecBuild, 'total', { parentTag: 'build_site' });
|
|
152
153
|
// Runs a build then report any plugin statuses
|
|
153
|
-
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, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, timers, sendStatus, saveConfig, testOpts, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
154
|
+
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, errorMonitor, deployId, errorParams, logs, debug, systemLog, systemLogFile, verbose, timers, sendStatus, saveConfig, testOpts, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
154
155
|
try {
|
|
155
156
|
const { stepsCount, netlifyConfig: netlifyConfigA, statuses, pluginsOptions: pluginsOptionsA, failedPlugins, timers: timersA, configMutations, metrics, } = await initAndRunBuild({
|
|
156
157
|
pluginsOptions,
|
|
@@ -179,6 +180,7 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
|
|
|
179
180
|
logs,
|
|
180
181
|
debug,
|
|
181
182
|
systemLog,
|
|
183
|
+
systemLogFile,
|
|
182
184
|
verbose,
|
|
183
185
|
timers,
|
|
184
186
|
sendStatus,
|
|
@@ -254,7 +256,7 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
|
|
|
254
256
|
}
|
|
255
257
|
};
|
|
256
258
|
// Initialize plugin processes then runs a build
|
|
257
|
-
const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, packagePath, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, dry, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, verbose, sendStatus, saveConfig, timers, testOpts, buildbotServerSocket, constants, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
259
|
+
const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configOpts, siteInfo, configPath, outputConfigPath, headersPath, redirectsPath, buildDir, packagePath, repositoryRoot, nodePath, packageJson, userNodeVersion, childEnv, context, branch, dry, mode, api, errorMonitor, deployId, errorParams, logs, debug, systemLog, systemLogFile, verbose, sendStatus, saveConfig, timers, testOpts, buildbotServerSocket, constants, featureFlags, timeline, devCommand, quiet, integrations, explicitSecretKeys, edgeFunctionsBootstrapURL, eventHandlers, }) {
|
|
258
260
|
const { pluginsOptions: pluginsOptionsA, timers: timersA } = await getPluginsOptions({
|
|
259
261
|
pluginsOptions,
|
|
260
262
|
netlifyConfig,
|
|
@@ -285,6 +287,7 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, configO
|
|
|
285
287
|
timers: timersA,
|
|
286
288
|
featureFlags,
|
|
287
289
|
quiet,
|
|
290
|
+
systemLogFile,
|
|
288
291
|
});
|
|
289
292
|
try {
|
|
290
293
|
const { stepsCount, netlifyConfig: netlifyConfigA, statuses, failedPlugins, timers: timersC, configMutations, metrics, } = await runBuild({
|
package/lib/plugins/child/run.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { getNewEnvChanges, setEnvChanges } from '../../env/changes.js';
|
|
2
2
|
import { logPluginMethodStart, logPluginMethodEnd } from '../../log/messages/ipc.js';
|
|
3
3
|
import { cloneNetlifyConfig, getConfigMutations } from './diff.js';
|
|
4
|
+
import { getSystemLog } from './systemLog.js';
|
|
4
5
|
import { getUtils } from './utils.js';
|
|
5
6
|
// Run a specific plugin event handler
|
|
6
7
|
export const run = async function ({ event, error, constants, envChanges, featureFlags, netlifyConfig }, { methods, inputs, packageJson, verbose }) {
|
|
7
8
|
const method = methods[event];
|
|
8
9
|
const runState = {};
|
|
10
|
+
const systemLog = getSystemLog();
|
|
9
11
|
const utils = getUtils({ event, constants, runState });
|
|
10
12
|
const netlifyConfigCopy = cloneNetlifyConfig(netlifyConfig);
|
|
11
|
-
const runOptions = {
|
|
13
|
+
const runOptions = {
|
|
14
|
+
utils,
|
|
15
|
+
constants,
|
|
16
|
+
inputs,
|
|
17
|
+
netlifyConfig: netlifyConfigCopy,
|
|
18
|
+
packageJson,
|
|
19
|
+
error,
|
|
20
|
+
featureFlags,
|
|
21
|
+
systemLog,
|
|
22
|
+
};
|
|
12
23
|
const envBefore = setEnvChanges(envChanges);
|
|
13
24
|
logPluginMethodStart(verbose);
|
|
14
25
|
await method(runOptions);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getSystemLog(): ((message: any) => void) | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { appendFileSync, openSync } from 'fs';
|
|
2
|
+
const systemLogLocation = '/dev/fd/4';
|
|
3
|
+
export const getSystemLog = () => {
|
|
4
|
+
try {
|
|
5
|
+
// throws if system log wasn't hooked up
|
|
6
|
+
const fd = openSync(systemLogLocation, 'a');
|
|
7
|
+
return (message) => {
|
|
8
|
+
appendFileSync(fd, `${message}\n`);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
};
|
package/lib/plugins/spawn.js
CHANGED
|
@@ -2,6 +2,7 @@ import { fileURLToPath } from 'url';
|
|
|
2
2
|
import { execaNode } from 'execa';
|
|
3
3
|
import { addErrorInfo } from '../error/info.js';
|
|
4
4
|
import { logRuntime, logLoadingPlugins, logOutdatedPlugins, logIncompatiblePlugins, logLoadingIntegration, } from '../log/messages/compatibility.js';
|
|
5
|
+
import { isTrustedPlugin } from '../steps/plugin.js';
|
|
5
6
|
import { measureDuration } from '../time/main.js';
|
|
6
7
|
import { getEventFromChild } from './ipc.js';
|
|
7
8
|
import { getSpawnInfo } from './options.js';
|
|
@@ -12,7 +13,7 @@ const CHILD_MAIN_FILE = fileURLToPath(new URL('child/main.js', import.meta.url))
|
|
|
12
13
|
// (for both security and safety reasons)
|
|
13
14
|
// - logs can be buffered which allows manipulating them for log shipping,
|
|
14
15
|
// transforming and parallel plugins
|
|
15
|
-
const tStartPlugins = async function ({ pluginsOptions, buildDir, childEnv, logs, debug, quiet }) {
|
|
16
|
+
const tStartPlugins = async function ({ pluginsOptions, buildDir, childEnv, logs, debug, quiet, systemLogFile }) {
|
|
16
17
|
if (!quiet) {
|
|
17
18
|
logRuntime(logs, pluginsOptions);
|
|
18
19
|
logLoadingPlugins(logs, pluginsOptions, debug);
|
|
@@ -20,11 +21,11 @@ const tStartPlugins = async function ({ pluginsOptions, buildDir, childEnv, logs
|
|
|
20
21
|
}
|
|
21
22
|
logOutdatedPlugins(logs, pluginsOptions);
|
|
22
23
|
logIncompatiblePlugins(logs, pluginsOptions);
|
|
23
|
-
const childProcesses = await Promise.all(pluginsOptions.map(({ pluginDir, nodePath }) => startPlugin({ pluginDir, nodePath, buildDir, childEnv })));
|
|
24
|
+
const childProcesses = await Promise.all(pluginsOptions.map(({ pluginDir, nodePath, pluginPackageJson }) => startPlugin({ pluginDir, nodePath, buildDir, childEnv, systemLogFile, pluginPackageJson })));
|
|
24
25
|
return { childProcesses };
|
|
25
26
|
};
|
|
26
27
|
export const startPlugins = measureDuration(tStartPlugins, 'start_plugins');
|
|
27
|
-
const startPlugin = async function ({ pluginDir, nodePath, buildDir, childEnv }) {
|
|
28
|
+
const startPlugin = async function ({ pluginDir, nodePath, buildDir, childEnv, systemLogFile, pluginPackageJson }) {
|
|
28
29
|
const childProcess = execaNode(CHILD_MAIN_FILE, [], {
|
|
29
30
|
cwd: buildDir,
|
|
30
31
|
preferLocal: true,
|
|
@@ -33,6 +34,7 @@ const startPlugin = async function ({ pluginDir, nodePath, buildDir, childEnv })
|
|
|
33
34
|
execPath: nodePath,
|
|
34
35
|
env: childEnv,
|
|
35
36
|
extendEnv: false,
|
|
37
|
+
stdio: isTrustedPlugin(pluginPackageJson) && systemLogFile ? ['pipe', 'pipe', 'pipe', 'ipc', systemLogFile] : undefined,
|
|
36
38
|
});
|
|
37
39
|
try {
|
|
38
40
|
await getEventFromChild(childProcess, 'ready');
|
|
@@ -63,7 +63,7 @@ export function getSecretKeysToScanFor(env, secretKeys) {
|
|
|
63
63
|
* @returns string[] of relative paths from base of files that should be searched
|
|
64
64
|
*/
|
|
65
65
|
export async function getFilePathsToScan({ env, base }) {
|
|
66
|
-
const omitPathsAlways = ['.git/'];
|
|
66
|
+
const omitPathsAlways = ['.git/', '.cache/'];
|
|
67
67
|
// node modules is dense and is only useful to scan if the repo itself commits these
|
|
68
68
|
// files. As a simple check to understand if the repo would commit these files, we expect
|
|
69
69
|
// that they would not ignore them from their git settings. So if gitignore includes
|
package/lib/steps/plugin.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export function isTrustedPlugin(pluginPackageJson: any): any;
|
|
1
2
|
export function firePluginStep({ event, childProcess, packageName, packagePath, pluginPackageJson, loadedFrom, origin, envChanges, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, constants, steps, error, logs, featureFlags, debug, verbose, }: {
|
|
2
3
|
event: any;
|
|
3
4
|
childProcess: any;
|
package/lib/steps/plugin.js
CHANGED
|
@@ -5,10 +5,10 @@ import { callChild } from '../plugins/ipc.js';
|
|
|
5
5
|
import { getSuccessStatus } from '../status/success.js';
|
|
6
6
|
import { getPluginErrorType } from './error.js';
|
|
7
7
|
import { updateNetlifyConfig, listConfigSideFiles } from './update_config.js';
|
|
8
|
+
export const isTrustedPlugin = (pluginPackageJson) => pluginPackageJson?.name?.startsWith('@netlify/');
|
|
8
9
|
// Fire a plugin step
|
|
9
10
|
export const firePluginStep = async function ({ event, childProcess, packageName, packagePath, pluginPackageJson, loadedFrom, origin, envChanges, errorParams, configOpts, netlifyConfig, configMutations, headersPath, redirectsPath, constants, steps, error, logs, featureFlags, debug, verbose, }) {
|
|
10
11
|
const listeners = pipePluginOutput(childProcess, logs);
|
|
11
|
-
const isTrustedPlugin = pluginPackageJson?.name?.startsWith('@netlify/');
|
|
12
12
|
try {
|
|
13
13
|
const configSideFiles = await listConfigSideFiles([headersPath, redirectsPath]);
|
|
14
14
|
const { newEnvChanges, configMutations: newConfigMutations, status, } = await callChild({
|
|
@@ -18,7 +18,7 @@ export const firePluginStep = async function ({ event, childProcess, packageName
|
|
|
18
18
|
event,
|
|
19
19
|
error,
|
|
20
20
|
envChanges,
|
|
21
|
-
featureFlags: isTrustedPlugin ? featureFlags : undefined,
|
|
21
|
+
featureFlags: isTrustedPlugin(pluginPackageJson) ? featureFlags : undefined,
|
|
22
22
|
netlifyConfig,
|
|
23
23
|
constants,
|
|
24
24
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.27.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
"@honeycombio/opentelemetry-node": "^0.5.0",
|
|
69
69
|
"@netlify/cache-utils": "^5.1.5",
|
|
70
70
|
"@netlify/config": "^20.10.0",
|
|
71
|
-
"@netlify/edge-bundler": "10.1.
|
|
71
|
+
"@netlify/edge-bundler": "10.1.3",
|
|
72
72
|
"@netlify/framework-info": "^9.8.10",
|
|
73
|
-
"@netlify/functions-utils": "^5.2.
|
|
73
|
+
"@netlify/functions-utils": "^5.2.41",
|
|
74
74
|
"@netlify/git-utils": "^5.1.1",
|
|
75
75
|
"@netlify/plugins-list": "^6.72.0",
|
|
76
76
|
"@netlify/run-utils": "^5.1.1",
|
|
77
|
-
"@netlify/zip-it-and-ship-it": "9.26.
|
|
77
|
+
"@netlify/zip-it-and-ship-it": "9.26.2",
|
|
78
78
|
"@opentelemetry/api": "^1.4.1",
|
|
79
79
|
"@opentelemetry/core": "^1.17.1",
|
|
80
80
|
"@sindresorhus/slugify": "^2.0.0",
|
|
@@ -146,5 +146,5 @@
|
|
|
146
146
|
"engines": {
|
|
147
147
|
"node": "^14.16.0 || >=16.0.0"
|
|
148
148
|
},
|
|
149
|
-
"gitHead": "
|
|
149
|
+
"gitHead": "e9b30f5bedacb107dd52d95cfd7cb932791c18d8"
|
|
150
150
|
}
|