@netlify/build 29.58.9 → 29.59.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/feature_flags.js +0 -2
- package/lib/plugins/child/run.d.ts +2 -1
- package/lib/plugins/child/run.js +2 -1
- package/lib/plugins_core/edge_functions/index.d.ts +1 -2
- package/lib/plugins_core/edge_functions/index.js +9 -14
- package/lib/plugins_core/functions/index.d.ts +1 -2
- package/lib/plugins_core/functions/index.js +3 -6
- package/lib/plugins_core/functions/utils.js +1 -3
- package/lib/steps/get.js +4 -2
- package/lib/steps/plugin.js +1 -0
- package/lib/steps/run_step.js +1 -7
- package/lib/types/netlify_plugin_options.d.ts +6 -0
- package/package.json +6 -6
|
@@ -12,8 +12,6 @@ const getFeatureFlag = function (name) {
|
|
|
12
12
|
export const DEFAULT_FEATURE_FLAGS = {
|
|
13
13
|
buildbot_zisi_trace_nft: false,
|
|
14
14
|
buildbot_zisi_esbuild_parser: false,
|
|
15
|
-
netlify_build_reduced_output: false,
|
|
16
15
|
netlify_build_updated_plugin_compatibility: false,
|
|
17
|
-
netlify_build_frameworks_api: false,
|
|
18
16
|
netlify_build_plugin_system_log: false,
|
|
19
17
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function run({ event, error, constants, envChanges, featureFlags, netlifyConfig, otelCarrier }: {
|
|
1
|
+
export function run({ event, error, constants, envChanges, featureFlags, netlifyConfig, otelCarrier, extensionMetadata }: {
|
|
2
2
|
event: any;
|
|
3
3
|
error: any;
|
|
4
4
|
constants: any;
|
|
@@ -6,6 +6,7 @@ export function run({ event, error, constants, envChanges, featureFlags, netlify
|
|
|
6
6
|
featureFlags: any;
|
|
7
7
|
netlifyConfig: any;
|
|
8
8
|
otelCarrier: any;
|
|
9
|
+
extensionMetadata: any;
|
|
9
10
|
}, { methods, inputs, packageJson, verbose }: {
|
|
10
11
|
methods: any;
|
|
11
12
|
inputs: any;
|
package/lib/plugins/child/run.js
CHANGED
|
@@ -6,7 +6,7 @@ import { cloneNetlifyConfig, getConfigMutations } from './diff.js';
|
|
|
6
6
|
import { getSystemLog } from './systemLog.js';
|
|
7
7
|
import { getUtils } from './utils.js';
|
|
8
8
|
/** Run a specific plugin event handler */
|
|
9
|
-
export const run = async function ({ event, error, constants, envChanges, featureFlags, netlifyConfig, otelCarrier }, { methods, inputs, packageJson, verbose }) {
|
|
9
|
+
export const run = async function ({ event, error, constants, envChanges, featureFlags, netlifyConfig, otelCarrier, extensionMetadata }, { methods, inputs, packageJson, verbose }) {
|
|
10
10
|
setGlobalContext(propagation.extract(context.active(), otelCarrier));
|
|
11
11
|
// set the global context for the plugin run
|
|
12
12
|
return context.with(getGlobalContext(), async () => {
|
|
@@ -24,6 +24,7 @@ export const run = async function ({ event, error, constants, envChanges, featur
|
|
|
24
24
|
error,
|
|
25
25
|
featureFlags,
|
|
26
26
|
systemLog,
|
|
27
|
+
extensionMetadata,
|
|
27
28
|
};
|
|
28
29
|
const envBefore = setEnvChanges(envChanges);
|
|
29
30
|
logPluginMethodStart(verbose);
|
|
@@ -17,13 +17,12 @@ export declare const bundleEdgeFunctions: {
|
|
|
17
17
|
coreStepId: string;
|
|
18
18
|
coreStepName: string;
|
|
19
19
|
coreStepDescription: () => string;
|
|
20
|
-
condition: ({ buildDir, constants: { INTERNAL_EDGE_FUNCTIONS_SRC, EDGE_FUNCTIONS_SRC },
|
|
20
|
+
condition: ({ buildDir, constants: { INTERNAL_EDGE_FUNCTIONS_SRC, EDGE_FUNCTIONS_SRC }, packagePath, }: {
|
|
21
21
|
buildDir: any;
|
|
22
22
|
constants: {
|
|
23
23
|
INTERNAL_EDGE_FUNCTIONS_SRC: any;
|
|
24
24
|
EDGE_FUNCTIONS_SRC: any;
|
|
25
25
|
};
|
|
26
|
-
featureFlags: any;
|
|
27
26
|
packagePath: any;
|
|
28
27
|
}) => Promise<boolean>;
|
|
29
28
|
};
|
|
@@ -20,14 +20,12 @@ const coreStep = async function ({ buildDir, packagePath, constants: { EDGE_FUNC
|
|
|
20
20
|
const srcPath = srcDirectory ? resolve(buildDir, srcDirectory) : undefined;
|
|
21
21
|
const frameworksAPISrcPath = resolve(buildDir, packagePath || '', FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT);
|
|
22
22
|
const generatedFunctionPaths = [internalSrcPath];
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
importMapPaths.push(frameworkImportMap);
|
|
30
|
-
}
|
|
23
|
+
if (await pathExists(frameworksAPISrcPath)) {
|
|
24
|
+
generatedFunctionPaths.push(frameworksAPISrcPath);
|
|
25
|
+
}
|
|
26
|
+
const frameworkImportMap = resolve(buildDir, packagePath || '', FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT, FRAMEWORKS_API_EDGE_FUNCTIONS_IMPORT_MAP);
|
|
27
|
+
if (await pathExists(frameworkImportMap)) {
|
|
28
|
+
importMapPaths.push(frameworkImportMap);
|
|
31
29
|
}
|
|
32
30
|
const sourcePaths = [...generatedFunctionPaths, srcPath].filter(Boolean);
|
|
33
31
|
logFunctions({ frameworksAPISrcPath, internalSrcDirectory, internalSrcPath, logs, srcDirectory, srcPath });
|
|
@@ -97,7 +95,7 @@ const getMetrics = (manifest) => {
|
|
|
97
95
|
// one configured by the user or the internal one) exists. We use a dynamic
|
|
98
96
|
// `condition` because the directories might be created by the build command
|
|
99
97
|
// or plugins.
|
|
100
|
-
const hasEdgeFunctionsDirectories = async function ({ buildDir, constants: { INTERNAL_EDGE_FUNCTIONS_SRC, EDGE_FUNCTIONS_SRC },
|
|
98
|
+
const hasEdgeFunctionsDirectories = async function ({ buildDir, constants: { INTERNAL_EDGE_FUNCTIONS_SRC, EDGE_FUNCTIONS_SRC }, packagePath, }) {
|
|
101
99
|
const hasFunctionsSrc = EDGE_FUNCTIONS_SRC !== undefined && EDGE_FUNCTIONS_SRC !== '';
|
|
102
100
|
if (hasFunctionsSrc) {
|
|
103
101
|
return true;
|
|
@@ -106,11 +104,8 @@ const hasEdgeFunctionsDirectories = async function ({ buildDir, constants: { INT
|
|
|
106
104
|
if (await pathExists(internalFunctionsSrc)) {
|
|
107
105
|
return true;
|
|
108
106
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return await pathExists(frameworkFunctionsSrc);
|
|
112
|
-
}
|
|
113
|
-
return false;
|
|
107
|
+
const frameworkFunctionsSrc = resolve(buildDir, packagePath || '', FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT);
|
|
108
|
+
return await pathExists(frameworkFunctionsSrc);
|
|
114
109
|
};
|
|
115
110
|
const logFunctions = async ({ frameworksAPISrcPath, internalSrcDirectory, internalSrcPath, logs, srcDirectory: userFunctionsSrc, srcPath, }) => {
|
|
116
111
|
const [userFunctionsSrcExists, userFunctions, internalFunctions, frameworkFunctions] = await Promise.all([
|
|
@@ -37,13 +37,12 @@ export declare const bundleFunctions: {
|
|
|
37
37
|
coreStepId: string;
|
|
38
38
|
coreStepName: string;
|
|
39
39
|
coreStepDescription: () => string;
|
|
40
|
-
condition: ({ buildDir, constants: { INTERNAL_FUNCTIONS_SRC, FUNCTIONS_SRC },
|
|
40
|
+
condition: ({ buildDir, constants: { INTERNAL_FUNCTIONS_SRC, FUNCTIONS_SRC }, packagePath, }: {
|
|
41
41
|
buildDir: any;
|
|
42
42
|
constants: {
|
|
43
43
|
INTERNAL_FUNCTIONS_SRC: any;
|
|
44
44
|
FUNCTIONS_SRC: any;
|
|
45
45
|
};
|
|
46
|
-
featureFlags: any;
|
|
47
46
|
packagePath: any;
|
|
48
47
|
}) => Promise<boolean>;
|
|
49
48
|
};
|
|
@@ -138,7 +138,7 @@ const coreStep = async function ({ childEnv, constants: { INTERNAL_FUNCTIONS_SRC
|
|
|
138
138
|
// one configured by the user or the internal one) exists. We use a dynamic
|
|
139
139
|
// `condition` because the directories might be created by the build command
|
|
140
140
|
// or plugins.
|
|
141
|
-
const hasFunctionsDirectories = async function ({ buildDir, constants: { INTERNAL_FUNCTIONS_SRC, FUNCTIONS_SRC },
|
|
141
|
+
const hasFunctionsDirectories = async function ({ buildDir, constants: { INTERNAL_FUNCTIONS_SRC, FUNCTIONS_SRC }, packagePath, }) {
|
|
142
142
|
const hasFunctionsSrc = FUNCTIONS_SRC !== undefined && FUNCTIONS_SRC !== '';
|
|
143
143
|
if (hasFunctionsSrc) {
|
|
144
144
|
return true;
|
|
@@ -147,11 +147,8 @@ const hasFunctionsDirectories = async function ({ buildDir, constants: { INTERNA
|
|
|
147
147
|
if (await pathExists(internalFunctionsSrc)) {
|
|
148
148
|
return true;
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return await pathExists(frameworkFunctionsSrc);
|
|
153
|
-
}
|
|
154
|
-
return false;
|
|
150
|
+
const frameworkFunctionsSrc = resolve(buildDir, packagePath || '', FRAMEWORKS_API_FUNCTIONS_ENDPOINT);
|
|
151
|
+
return await pathExists(frameworkFunctionsSrc);
|
|
155
152
|
};
|
|
156
153
|
export const bundleFunctions = {
|
|
157
154
|
event: 'onBuild',
|
|
@@ -17,10 +17,8 @@ export const getUserAndInternalFunctions = ({ featureFlags, functionsSrc, functi
|
|
|
17
17
|
const paths = [
|
|
18
18
|
functionsSrcExists ? functionsSrc : undefined,
|
|
19
19
|
internalFunctionsSrcExists ? internalFunctionsSrc : undefined,
|
|
20
|
+
frameworkFunctionsSrcExists ? frameworkFunctionsSrc : undefined,
|
|
20
21
|
];
|
|
21
|
-
if (featureFlags.netlify_build_frameworks_api && frameworkFunctionsSrcExists) {
|
|
22
|
-
paths.push(frameworkFunctionsSrc);
|
|
23
|
-
}
|
|
24
22
|
return Promise.all(paths.map((path) => path && getRelativeFunctionMainFiles({ featureFlags, functionsSrc: path })));
|
|
25
23
|
};
|
|
26
24
|
// Returns `true` if the functions directory exists and is valid. Returns
|
package/lib/steps/get.js
CHANGED
|
@@ -24,8 +24,10 @@ export const getSteps = function (steps, eventHandlers) {
|
|
|
24
24
|
export const getDevSteps = function (command, steps, eventHandlers) {
|
|
25
25
|
const devCommandStep = {
|
|
26
26
|
event: 'onDev',
|
|
27
|
-
coreStep: async () => {
|
|
28
|
-
|
|
27
|
+
coreStep: async (args) => {
|
|
28
|
+
const { constants, event } = args;
|
|
29
|
+
const utils = getUtils({ event, constants, runState: {} });
|
|
30
|
+
await command({ utils, ...args });
|
|
29
31
|
return {};
|
|
30
32
|
},
|
|
31
33
|
coreStepId: 'dev_command',
|
package/lib/steps/plugin.js
CHANGED
package/lib/steps/run_step.js
CHANGED
|
@@ -58,13 +58,7 @@ export const runStep = async function ({ event, childProcess, packageName, coreS
|
|
|
58
58
|
: () => {
|
|
59
59
|
// no-op
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
if (featureFlags.netlify_build_reduced_output) {
|
|
63
|
-
outputFlusher = new OutputFlusher(logPluginStart);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
logPluginStart();
|
|
67
|
-
}
|
|
61
|
+
const outputFlusher = new OutputFlusher(logPluginStart);
|
|
68
62
|
const fireStep = getFireStep(packageName, coreStepId, event);
|
|
69
63
|
const { newEnvChanges, netlifyConfig: netlifyConfigA = netlifyConfig, configMutations: configMutationsA = configMutations, headersPath: headersPathA = headersPath, redirectsPath: redirectsPathA = redirectsPath, newError, newStatus, timers: timersA, durationNs, metrics, } = await fireStep({
|
|
70
64
|
extensionMetadata,
|
|
@@ -21,4 +21,10 @@ export interface NetlifyPluginOptions<TInputs extends PluginInputs<StringKeys<TI
|
|
|
21
21
|
utils: NetlifyPluginUtils;
|
|
22
22
|
featureFlags?: Record<string, unknown>;
|
|
23
23
|
systemLog?(message: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* When an extension's event handler executes, we pass extension-specific metadata to the exension
|
|
26
|
+
*/
|
|
27
|
+
extensionMetadata: {
|
|
28
|
+
extension_token?: string;
|
|
29
|
+
};
|
|
24
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.59.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -69,19 +69,19 @@
|
|
|
69
69
|
"@bugsnag/js": "^7.0.0",
|
|
70
70
|
"@netlify/blobs": "^7.4.0",
|
|
71
71
|
"@netlify/cache-utils": "^5.2.0",
|
|
72
|
-
"@netlify/config": "^20.
|
|
72
|
+
"@netlify/config": "^20.22.0",
|
|
73
73
|
"@netlify/edge-bundler": "12.3.2",
|
|
74
74
|
"@netlify/framework-info": "^9.9.1",
|
|
75
|
-
"@netlify/functions-utils": "^5.3.
|
|
75
|
+
"@netlify/functions-utils": "^5.3.6",
|
|
76
76
|
"@netlify/git-utils": "^5.2.0",
|
|
77
77
|
"@netlify/opentelemetry-utils": "^1.3.0",
|
|
78
78
|
"@netlify/plugins-list": "^6.80.0",
|
|
79
79
|
"@netlify/run-utils": "^5.2.0",
|
|
80
|
-
"@netlify/zip-it-and-ship-it": "9.42.
|
|
80
|
+
"@netlify/zip-it-and-ship-it": "9.42.6",
|
|
81
81
|
"@sindresorhus/slugify": "^2.0.0",
|
|
82
82
|
"ansi-escapes": "^6.0.0",
|
|
83
83
|
"chalk": "^5.0.0",
|
|
84
|
-
"clean-stack": "^
|
|
84
|
+
"clean-stack": "^5.0.0",
|
|
85
85
|
"execa": "^7.0.0",
|
|
86
86
|
"fdir": "^6.0.1",
|
|
87
87
|
"figures": "^5.0.0",
|
|
@@ -164,5 +164,5 @@
|
|
|
164
164
|
"engines": {
|
|
165
165
|
"node": "^14.16.0 || >=16.0.0"
|
|
166
166
|
},
|
|
167
|
-
"gitHead": "
|
|
167
|
+
"gitHead": "b1de419113daee962ab37b1e75bcfc0d32f778e7"
|
|
168
168
|
}
|