@netlify/build 18.15.1 → 18.17.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.17.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"main": "src/core/main.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"@netlify/functions-utils": "^2.0.0",
|
|
60
60
|
"@netlify/git-utils": "^2.0.0",
|
|
61
61
|
"@netlify/plugin-edge-handlers": "^1.11.22",
|
|
62
|
-
"@netlify/plugins-list": "^4.0.
|
|
62
|
+
"@netlify/plugins-list": "^4.0.1",
|
|
63
63
|
"@netlify/run-utils": "^2.0.0",
|
|
64
|
-
"@netlify/zip-it-and-ship-it": "^4.
|
|
64
|
+
"@netlify/zip-it-and-ship-it": "^4.25.0",
|
|
65
65
|
"@sindresorhus/slugify": "^1.1.0",
|
|
66
66
|
"@ungap/from-entries": "^0.2.1",
|
|
67
67
|
"ansi-escapes": "^4.3.2",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const getZisiFeatureFlags = (featureFlags) => ({
|
|
4
|
+
buildGoSource: featureFlags.buildbot_build_go_functions,
|
|
5
|
+
defaultEsModulesToEsbuild: featureFlags.buildbot_es_modules_esbuild,
|
|
6
|
+
parseWithEsbuild: featureFlags.buildbot_zisi_esbuild_parser,
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
module.exports = { getZisiFeatureFlags }
|
|
@@ -11,6 +11,7 @@ const { log } = require('../../log/logger')
|
|
|
11
11
|
const { logBundleResults, logFunctionsNonExistingDir, logFunctionsToBundle } = require('../../log/messages/core_steps')
|
|
12
12
|
|
|
13
13
|
const { getZipError } = require('./error')
|
|
14
|
+
const { getZisiFeatureFlags } = require('./feature_flags')
|
|
14
15
|
const { getUserAndInternalFunctions, validateFunctionsSrc } = require('./utils')
|
|
15
16
|
|
|
16
17
|
// Returns `true` if at least one of the functions has been configured to use
|
|
@@ -40,20 +41,23 @@ const normalizeFunctionConfig = ({ buildDir, functionConfig = {}, isRunningLocal
|
|
|
40
41
|
rustTargetDirectory: isRunningLocally ? undefined : resolve(buildDir, '.netlify', 'rust-functions-cache', '[name]'),
|
|
41
42
|
})
|
|
42
43
|
|
|
43
|
-
const getZisiParameters = ({
|
|
44
|
+
const getZisiParameters = ({
|
|
45
|
+
buildDir,
|
|
46
|
+
featureFlags,
|
|
47
|
+
functionsConfig,
|
|
48
|
+
functionsDist,
|
|
49
|
+
isRunningLocally,
|
|
50
|
+
repositoryRoot,
|
|
51
|
+
}) => {
|
|
44
52
|
const isManifestEnabled = featureFlags.functionsBundlingManifest === true
|
|
45
53
|
const manifest = isManifestEnabled && isRunningLocally ? join(functionsDist, 'manifest.json') : undefined
|
|
46
54
|
const config = mapObject(functionsConfig, (expression, object) => [
|
|
47
55
|
expression,
|
|
48
56
|
normalizeFunctionConfig({ buildDir, featureFlags, functionConfig: object, isRunningLocally }),
|
|
49
57
|
])
|
|
50
|
-
const zisiFeatureFlags =
|
|
51
|
-
buildGoSource: featureFlags.buildbot_build_go_functions,
|
|
52
|
-
defaultEsModulesToEsbuild: featureFlags.buildbot_es_modules_esbuild,
|
|
53
|
-
parseWithEsbuild: featureFlags.buildbot_zisi_esbuild_parser,
|
|
54
|
-
}
|
|
58
|
+
const zisiFeatureFlags = getZisiFeatureFlags(featureFlags)
|
|
55
59
|
|
|
56
|
-
return { basePath: buildDir, config, manifest, featureFlags: zisiFeatureFlags }
|
|
60
|
+
return { basePath: buildDir, config, manifest, featureFlags: zisiFeatureFlags, repositoryRoot }
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
const zipFunctionsAndLogResults = async ({
|
|
@@ -65,8 +69,16 @@ const zipFunctionsAndLogResults = async ({
|
|
|
65
69
|
internalFunctionsSrc,
|
|
66
70
|
isRunningLocally,
|
|
67
71
|
logs,
|
|
72
|
+
repositoryRoot,
|
|
68
73
|
}) => {
|
|
69
|
-
const zisiParameters = getZisiParameters({
|
|
74
|
+
const zisiParameters = getZisiParameters({
|
|
75
|
+
buildDir,
|
|
76
|
+
featureFlags,
|
|
77
|
+
functionsConfig,
|
|
78
|
+
functionsDist,
|
|
79
|
+
isRunningLocally,
|
|
80
|
+
repositoryRoot,
|
|
81
|
+
})
|
|
70
82
|
const bundler = isUsingEsbuild(functionsConfig) ? 'esbuild' : 'zisi'
|
|
71
83
|
|
|
72
84
|
try {
|
|
@@ -97,6 +109,7 @@ const coreStep = async function ({
|
|
|
97
109
|
logs,
|
|
98
110
|
netlifyConfig,
|
|
99
111
|
featureFlags,
|
|
112
|
+
repositoryRoot,
|
|
100
113
|
}) {
|
|
101
114
|
const functionsSrc = relativeFunctionsSrc === undefined ? undefined : resolve(buildDir, relativeFunctionsSrc)
|
|
102
115
|
const functionsDist = resolve(buildDir, relativeFunctionsDist)
|
|
@@ -104,6 +117,7 @@ const coreStep = async function ({
|
|
|
104
117
|
const internalFunctionsSrcExists = await pathExists(internalFunctionsSrc)
|
|
105
118
|
const functionsSrcExists = await validateFunctionsSrc({ functionsSrc, logs, relativeFunctionsSrc })
|
|
106
119
|
const [userFunctions = [], internalFunctions = []] = await getUserAndInternalFunctions({
|
|
120
|
+
featureFlags,
|
|
107
121
|
functionsSrc,
|
|
108
122
|
functionsSrcExists,
|
|
109
123
|
internalFunctionsSrc,
|
|
@@ -140,6 +154,7 @@ const coreStep = async function ({
|
|
|
140
154
|
internalFunctionsSrc,
|
|
141
155
|
isRunningLocally,
|
|
142
156
|
logs,
|
|
157
|
+
repositoryRoot,
|
|
143
158
|
})
|
|
144
159
|
|
|
145
160
|
return {
|
|
@@ -10,16 +10,22 @@ const pStat = promisify(stat)
|
|
|
10
10
|
|
|
11
11
|
const { addErrorInfo } = require('../../error/info')
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const { getZisiFeatureFlags } = require('./feature_flags')
|
|
14
|
+
|
|
15
|
+
// Returns the `mainFile` of each function found in `functionsSrc`, relative to
|
|
16
|
+
// `functionsSrc`.
|
|
17
|
+
const getRelativeFunctionMainFiles = async function ({ featureFlags, functionsSrc }) {
|
|
14
18
|
if (functionsSrc === undefined) {
|
|
15
19
|
return []
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
const
|
|
22
|
+
const zisiFeatureFlags = getZisiFeatureFlags(featureFlags)
|
|
23
|
+
const functions = await listFunctions(functionsSrc, { featureFlags: zisiFeatureFlags })
|
|
19
24
|
return functions.map(({ mainFile }) => relative(functionsSrc, mainFile))
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
const getUserAndInternalFunctions = ({
|
|
28
|
+
featureFlags,
|
|
23
29
|
functionsSrc,
|
|
24
30
|
functionsSrcExists,
|
|
25
31
|
internalFunctionsSrc,
|
|
@@ -30,7 +36,7 @@ const getUserAndInternalFunctions = ({
|
|
|
30
36
|
internalFunctionsSrcExists ? internalFunctionsSrc : undefined,
|
|
31
37
|
]
|
|
32
38
|
|
|
33
|
-
return Promise.all(paths.map((path) => path &&
|
|
39
|
+
return Promise.all(paths.map((path) => path && getRelativeFunctionMainFiles({ featureFlags, functionsSrc: path })))
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
// Returns `true` if the functions directory exists and is valid. Returns
|
package/types/config/build.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NetlifyConfig } from './config/netlify_config'
|
|
2
2
|
import { NetlifyPluginUtils } from './options/netlify_plugin_utils'
|
|
3
|
+
import { JSONValue } from './utils/json_value'
|
|
3
4
|
|
|
4
|
-
export interface NetlifyPluginOptions {
|
|
5
|
+
export interface NetlifyPluginOptions<TInputs extends Record<string, JSONValue> = Partial<Record<string, JSONValue>>> {
|
|
5
6
|
constants: {
|
|
6
7
|
/**
|
|
7
8
|
* path to the Netlify configuration file.
|
|
@@ -42,7 +43,7 @@ export interface NetlifyPluginOptions {
|
|
|
42
43
|
/**
|
|
43
44
|
* If your plugin requires additional values from the user, you can specify these requirements in an `inputs` array in the plugin’s [`manifest.yml` file](https://docs.netlify.com/configure-builds/build-plugins/create-plugins/#anatomy-of-a-plugin).
|
|
44
45
|
*/
|
|
45
|
-
inputs:
|
|
46
|
+
inputs: TInputs
|
|
46
47
|
/**
|
|
47
48
|
* @see https://docs.netlify.com/configure-builds/build-plugins/create-plugins/#netlifyconfig
|
|
48
49
|
*/
|
|
@@ -51,6 +52,6 @@ export interface NetlifyPluginOptions {
|
|
|
51
52
|
* When an event handler executes, the contents of the `package.json` in a site's base directory get passed to a plugin.
|
|
52
53
|
* The data fields are normalized to prevent plugin errors. If the site has no `package.json`, the argument is an empty object.
|
|
53
54
|
*/
|
|
54
|
-
packageJson: Partial<Record<string,
|
|
55
|
+
packageJson: Partial<Record<string, JSONValue>>
|
|
55
56
|
utils: NetlifyPluginUtils
|
|
56
57
|
}
|