@netlify/build 29.55.3 → 29.55.4
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
CHANGED
|
@@ -263,6 +263,10 @@ export const runAndReportBuild = async function ({ pluginsOptions, netlifyConfig
|
|
|
263
263
|
};
|
|
264
264
|
// Initialize plugin processes then runs a build
|
|
265
265
|
const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, defaultConfig, 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, }) {
|
|
266
|
+
const pluginsEnv = {
|
|
267
|
+
...childEnv,
|
|
268
|
+
...getBlobsEnvironmentContext({ api, deployId: deployId, siteId: siteInfo?.id, token }),
|
|
269
|
+
};
|
|
266
270
|
const { pluginsOptions: pluginsOptionsA, timers: timersA } = await getPluginsOptions({
|
|
267
271
|
pluginsOptions,
|
|
268
272
|
netlifyConfig,
|
|
@@ -283,11 +287,8 @@ const initAndRunBuild = async function ({ pluginsOptions, netlifyConfig, default
|
|
|
283
287
|
integrations,
|
|
284
288
|
context,
|
|
285
289
|
systemLog,
|
|
290
|
+
pluginsEnv,
|
|
286
291
|
});
|
|
287
|
-
const pluginsEnv = {
|
|
288
|
-
...childEnv,
|
|
289
|
-
...getBlobsEnvironmentContext({ api, deployId: deployId, siteId: siteInfo?.id, token }),
|
|
290
|
-
};
|
|
291
292
|
if (pluginsOptionsA?.length) {
|
|
292
293
|
const buildPlugins = {};
|
|
293
294
|
for (const plugin of pluginsOptionsA) {
|
package/lib/install/missing.d.ts
CHANGED
|
@@ -4,11 +4,13 @@ export function installMissingPlugins({ missingPlugins, autoPluginsDir, mode, lo
|
|
|
4
4
|
mode: any;
|
|
5
5
|
logs: any;
|
|
6
6
|
}): Promise<void>;
|
|
7
|
-
export function installIntegrationPlugins({ integrations, autoPluginsDir, mode, logs, context, testOpts, }: {
|
|
7
|
+
export function installIntegrationPlugins({ integrations, autoPluginsDir, mode, logs, context, testOpts, pluginsEnv, buildDir, }: {
|
|
8
8
|
integrations: any;
|
|
9
9
|
autoPluginsDir: any;
|
|
10
10
|
mode: any;
|
|
11
11
|
logs: any;
|
|
12
12
|
context: any;
|
|
13
13
|
testOpts: any;
|
|
14
|
+
pluginsEnv: any;
|
|
15
|
+
buildDir: any;
|
|
14
16
|
}): Promise<void>;
|
package/lib/install/missing.js
CHANGED
|
@@ -20,13 +20,13 @@ export const installMissingPlugins = async function ({ missingPlugins, autoPlugi
|
|
|
20
20
|
await createAutoPluginsDir(logs, autoPluginsDir);
|
|
21
21
|
await addExactDependencies({ packageRoot: autoPluginsDir, isLocal: mode !== 'buildbot', packages });
|
|
22
22
|
};
|
|
23
|
-
export const installIntegrationPlugins = async function ({ integrations, autoPluginsDir, mode, logs, context, testOpts, }) {
|
|
23
|
+
export const installIntegrationPlugins = async function ({ integrations, autoPluginsDir, mode, logs, context, testOpts, pluginsEnv, buildDir, }) {
|
|
24
24
|
const integrationsToBuild = integrations.filter((integration) => typeof integration.dev !== 'undefined' && context === 'dev');
|
|
25
25
|
if (integrationsToBuild.length) {
|
|
26
26
|
logSubHeader(logs, 'Building integrations');
|
|
27
27
|
logArray(logs, integrationsToBuild.map(({ slug, dev: { path } }) => `${slug} from ${path}`));
|
|
28
28
|
}
|
|
29
|
-
const packages = (await Promise.all(integrations.map((integration) => getIntegrationPackage({ integration, context, testOpts })))).filter(Boolean);
|
|
29
|
+
const packages = (await Promise.all(integrations.map((integration) => getIntegrationPackage({ integration, context, testOpts, buildDir, pluginsEnv })))).filter(Boolean);
|
|
30
30
|
logInstallIntegrations(logs, integrations.filter((integration) => integrationsToBuild.every((compiledIntegration) => integration.slug !== compiledIntegration.slug)));
|
|
31
31
|
if (packages.length === 0) {
|
|
32
32
|
return;
|
|
@@ -34,15 +34,15 @@ export const installIntegrationPlugins = async function ({ integrations, autoPlu
|
|
|
34
34
|
await createAutoPluginsDir(logs, autoPluginsDir);
|
|
35
35
|
await addExactDependencies({ packageRoot: autoPluginsDir, isLocal: mode !== 'buildbot', packages });
|
|
36
36
|
};
|
|
37
|
-
const getIntegrationPackage = async function ({ integration: { version, dev }, context, testOpts = {} }) {
|
|
37
|
+
const getIntegrationPackage = async function ({ integration: { version, dev }, context, testOpts = {}, buildDir, pluginsEnv, }) {
|
|
38
38
|
if (typeof version !== 'undefined') {
|
|
39
39
|
return `${version}/packages/buildhooks.tgz`;
|
|
40
40
|
}
|
|
41
41
|
if (typeof dev !== 'undefined' && context === 'dev') {
|
|
42
42
|
const { path } = dev;
|
|
43
|
-
const integrationDir = testOpts.cwd ? resolve(testOpts.cwd, path) : resolve(path);
|
|
43
|
+
const integrationDir = testOpts.cwd ? resolve(testOpts.cwd, path) : resolve(buildDir, path);
|
|
44
44
|
try {
|
|
45
|
-
const res = await execa('npm', ['run', 'build'], { cwd: integrationDir });
|
|
45
|
+
const res = await execa('npm', ['run', 'build'], { cwd: integrationDir, env: pluginsEnv });
|
|
46
46
|
// This is horrible and hacky, but `npm run build` will
|
|
47
47
|
// return status code 0 even if it fails
|
|
48
48
|
if (!res.stdout.includes('Build complete!')) {
|
|
@@ -50,7 +50,7 @@ const getIntegrationPackage = async function ({ integration: { version, dev }, c
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
catch (e) {
|
|
53
|
-
throw new Error(`Failed to build integration`);
|
|
53
|
+
throw new Error(`Failed to build integration. Error:\n\n${e.stack}`);
|
|
54
54
|
}
|
|
55
55
|
return undefined;
|
|
56
56
|
}
|
package/lib/plugins/options.js
CHANGED
|
@@ -8,7 +8,7 @@ import { getPackageJson } from '../utils/package.js';
|
|
|
8
8
|
import { useManifest } from './manifest/main.js';
|
|
9
9
|
import { resolvePluginsPath } from './resolve.js';
|
|
10
10
|
// Load core plugins and user plugins
|
|
11
|
-
const tGetPluginsOptions = async function ({ pluginsOptions, netlifyConfig: { plugins }, siteInfo, buildDir, packagePath, nodePath, packageJson, userNodeVersion, mode, api, logs, debug, sendStatus, testOpts, featureFlags, integrations, context, systemLog, }) {
|
|
11
|
+
const tGetPluginsOptions = async function ({ pluginsOptions, netlifyConfig: { plugins }, siteInfo, buildDir, packagePath, nodePath, packageJson, userNodeVersion, mode, api, logs, debug, sendStatus, testOpts, featureFlags, integrations, context, systemLog, pluginsEnv, }) {
|
|
12
12
|
const pluginsOptionsA = await resolvePluginsPath({
|
|
13
13
|
pluginsOptions,
|
|
14
14
|
siteInfo,
|
|
@@ -27,6 +27,7 @@ const tGetPluginsOptions = async function ({ pluginsOptions, netlifyConfig: { pl
|
|
|
27
27
|
integrations,
|
|
28
28
|
context,
|
|
29
29
|
systemLog,
|
|
30
|
+
pluginsEnv,
|
|
30
31
|
});
|
|
31
32
|
const pluginsOptionsB = await Promise.all(pluginsOptionsA.map((pluginOptions) => loadPluginFiles({ pluginOptions, debug })));
|
|
32
33
|
const pluginsOptionsC = pluginsOptionsB.filter(isNotRedundantCorePlugin);
|
package/lib/plugins/resolve.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function resolvePluginsPath({ pluginsOptions, siteInfo, buildDir, packagePath, nodePath, packageJson, userNodeVersion, mode, api, logs, debug, sendStatus, testOpts, featureFlags, integrations, context, systemLog, }: {
|
|
1
|
+
export function resolvePluginsPath({ pluginsOptions, siteInfo, buildDir, packagePath, nodePath, packageJson, userNodeVersion, mode, api, logs, debug, sendStatus, testOpts, featureFlags, integrations, context, systemLog, pluginsEnv, }: {
|
|
2
2
|
pluginsOptions: any;
|
|
3
3
|
siteInfo: any;
|
|
4
4
|
buildDir: any;
|
|
@@ -16,4 +16,5 @@ export function resolvePluginsPath({ pluginsOptions, siteInfo, buildDir, package
|
|
|
16
16
|
integrations: any;
|
|
17
17
|
context: any;
|
|
18
18
|
systemLog: any;
|
|
19
|
+
pluginsEnv: any;
|
|
19
20
|
}): Promise<any[]>;
|
package/lib/plugins/resolve.js
CHANGED
|
@@ -11,7 +11,7 @@ const AUTO_PLUGINS_DIR = '.netlify/plugins/';
|
|
|
11
11
|
// - local plugin
|
|
12
12
|
// - external plugin already installed in `node_modules`, most likely through `package.json`
|
|
13
13
|
// - automatically installed by us, to `.netlify/plugins/`
|
|
14
|
-
export const resolvePluginsPath = async function ({ pluginsOptions, siteInfo, buildDir, packagePath, nodePath, packageJson, userNodeVersion, mode, api, logs, debug, sendStatus, testOpts, featureFlags, integrations, context, systemLog, }) {
|
|
14
|
+
export const resolvePluginsPath = async function ({ pluginsOptions, siteInfo, buildDir, packagePath, nodePath, packageJson, userNodeVersion, mode, api, logs, debug, sendStatus, testOpts, featureFlags, integrations, context, systemLog, pluginsEnv, }) {
|
|
15
15
|
const autoPluginsDir = getAutoPluginsDir(buildDir, packagePath);
|
|
16
16
|
const pluginsOptionsA = await Promise.all(pluginsOptions.map((pluginOptions) => resolvePluginPath({ pluginOptions, buildDir, autoPluginsDir })));
|
|
17
17
|
const pluginsOptionsB = await addPluginsNodeVersion({
|
|
@@ -50,6 +50,7 @@ export const resolvePluginsPath = async function ({ pluginsOptions, siteInfo, bu
|
|
|
50
50
|
buildDir,
|
|
51
51
|
context,
|
|
52
52
|
testOpts,
|
|
53
|
+
pluginsEnv,
|
|
53
54
|
});
|
|
54
55
|
return [...pluginsOptionsE, ...integrationPluginOptions];
|
|
55
56
|
};
|
|
@@ -117,9 +118,18 @@ const handleMissingPlugins = async function ({ pluginsOptions, autoPluginsDir, m
|
|
|
117
118
|
await installMissingPlugins({ missingPlugins, autoPluginsDir, mode, logs });
|
|
118
119
|
return Promise.all(pluginsOptions.map((pluginOptions) => resolveMissingPluginPath({ pluginOptions, autoPluginsDir })));
|
|
119
120
|
};
|
|
120
|
-
const handleIntegrations = async function ({ integrations, autoPluginsDir, mode, logs, buildDir, context, testOpts }) {
|
|
121
|
+
const handleIntegrations = async function ({ integrations, autoPluginsDir, mode, logs, buildDir, context, testOpts, pluginsEnv, }) {
|
|
121
122
|
const toInstall = integrations.filter((integration) => integration.has_build);
|
|
122
|
-
await installIntegrationPlugins({
|
|
123
|
+
await installIntegrationPlugins({
|
|
124
|
+
integrations: toInstall,
|
|
125
|
+
autoPluginsDir,
|
|
126
|
+
mode,
|
|
127
|
+
logs,
|
|
128
|
+
context,
|
|
129
|
+
testOpts,
|
|
130
|
+
buildDir,
|
|
131
|
+
pluginsEnv,
|
|
132
|
+
});
|
|
123
133
|
if (toInstall.length === 0) {
|
|
124
134
|
return [];
|
|
125
135
|
}
|
|
@@ -134,7 +144,7 @@ const handleIntegrations = async function ({ integrations, autoPluginsDir, mode,
|
|
|
134
144
|
const resolveIntegration = async function ({ integration, autoPluginsDir, buildDir, context, testOpts }) {
|
|
135
145
|
if (typeof integration.dev !== 'undefined' && context === 'dev') {
|
|
136
146
|
const { path } = integration.dev;
|
|
137
|
-
const integrationDir = testOpts.cwd ? resolve(testOpts.cwd, path) : resolve(path);
|
|
147
|
+
const integrationDir = testOpts.cwd ? resolve(testOpts.cwd, path) : resolve(buildDir, path);
|
|
138
148
|
const pluginPath = await resolvePath(`${integrationDir}/.ntli/build`, buildDir);
|
|
139
149
|
return { pluginPath, packageName: `${integration.slug}`, isIntegration: true, integration, loadedFrom: 'local' };
|
|
140
150
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.55.
|
|
3
|
+
"version": "29.55.4",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -165,5 +165,5 @@
|
|
|
165
165
|
"engines": {
|
|
166
166
|
"node": "^14.16.0 || >=16.0.0"
|
|
167
167
|
},
|
|
168
|
-
"gitHead": "
|
|
168
|
+
"gitHead": "6ecd378b02bd7ad6f083cd495ad3001e7493c8a5"
|
|
169
169
|
}
|