@netlify/build 20.3.0 → 21.0.1
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 +3 -3
- package/src/plugins/child/run.js +1 -1
- package/src/plugins/child/utils.js +20 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.1",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"main": "src/core/main.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"@netlify/functions-utils": "^3.0.0",
|
|
60
60
|
"@netlify/git-utils": "^3.0.0",
|
|
61
61
|
"@netlify/plugin-edge-handlers": "^3.0.0",
|
|
62
|
-
"@netlify/plugins-list": "^6.0
|
|
63
|
-
"@netlify/run-utils": "^
|
|
62
|
+
"@netlify/plugins-list": "^6.2.0",
|
|
63
|
+
"@netlify/run-utils": "^4.0.0",
|
|
64
64
|
"@netlify/zip-it-and-ship-it": "^5.2.0",
|
|
65
65
|
"@sindresorhus/slugify": "^1.1.0",
|
|
66
66
|
"ansi-escapes": "^4.3.2",
|
package/src/plugins/child/run.js
CHANGED
|
@@ -13,7 +13,7 @@ const run = async function (
|
|
|
13
13
|
) {
|
|
14
14
|
const method = methods[event]
|
|
15
15
|
const runState = {}
|
|
16
|
-
const utils = getUtils({ event, constants, runState })
|
|
16
|
+
const utils = await getUtils({ event, constants, runState })
|
|
17
17
|
const netlifyConfigCopy = cloneNetlifyConfig(netlifyConfig)
|
|
18
18
|
const runOptions = { utils, constants, inputs, netlifyConfig: netlifyConfigCopy, packageJson, error }
|
|
19
19
|
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { bindOpts: cacheBindOpts } = require('@netlify/cache-utils')
|
|
4
|
+
const { add: functionsAdd, list: functionsList, listAll: functionsListAll } = require('@netlify/functions-utils')
|
|
5
|
+
const getGitUtils = require('@netlify/git-utils')
|
|
6
|
+
|
|
3
7
|
const { failBuild, failPlugin, cancelBuild, failPluginWithWarning } = require('../error')
|
|
4
8
|
const { isSoftFailEvent } = require('../events')
|
|
5
9
|
|
|
6
10
|
const { addLazyProp } = require('./lazy')
|
|
7
11
|
const { show } = require('./status')
|
|
8
12
|
|
|
13
|
+
const runUtilsPromise = import('@netlify/run-utils')
|
|
14
|
+
|
|
9
15
|
// Retrieve the `utils` argument.
|
|
10
|
-
const getUtils = function ({ event, constants: { FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC, CACHE_DIR }, runState }) {
|
|
16
|
+
const getUtils = async function ({ event, constants: { FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC, CACHE_DIR }, runState }) {
|
|
17
|
+
const { run, runCommand } = await runUtilsPromise
|
|
18
|
+
// eslint-disable-next-line fp/no-mutation
|
|
19
|
+
run.command = runCommand
|
|
20
|
+
|
|
11
21
|
const build = getBuildUtils(event)
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
addLazyProp(utils, '
|
|
17
|
-
addLazyProp(utils, 'status', getStatusUtils.bind(null, runState))
|
|
22
|
+
const cache = getCacheUtils(CACHE_DIR)
|
|
23
|
+
const functions = getFunctionsUtils(FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC)
|
|
24
|
+
const status = getStatusUtils(runState)
|
|
25
|
+
const utils = { build, cache, run, functions, status }
|
|
26
|
+
addLazyProp(utils, 'git', () => getGitUtils())
|
|
18
27
|
return utils
|
|
19
28
|
}
|
|
20
29
|
|
|
@@ -30,29 +39,15 @@ const getBuildUtils = function (event) {
|
|
|
30
39
|
return { failBuild, failPlugin, cancelBuild }
|
|
31
40
|
}
|
|
32
41
|
|
|
33
|
-
const getGitUtils = function () {
|
|
34
|
-
// eslint-disable-next-line node/global-require
|
|
35
|
-
return require('@netlify/git-utils')()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
42
|
const getCacheUtils = function (CACHE_DIR) {
|
|
39
|
-
|
|
40
|
-
const cacheUtils = require('@netlify/cache-utils')
|
|
41
|
-
return cacheUtils.bindOpts({ cacheDir: CACHE_DIR })
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const getRunUtils = function () {
|
|
45
|
-
// eslint-disable-next-line node/global-require
|
|
46
|
-
return require('@netlify/run-utils')
|
|
43
|
+
return cacheBindOpts({ cacheDir: CACHE_DIR })
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
const getFunctionsUtils = function (FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC) {
|
|
50
47
|
const functionsDirectories = [INTERNAL_FUNCTIONS_SRC, FUNCTIONS_SRC].filter(Boolean)
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const list = functionsUtils.list.bind(null, functionsDirectories, { fail: failBuild })
|
|
55
|
-
const listAll = functionsUtils.listAll.bind(null, functionsDirectories, { fail: failBuild })
|
|
48
|
+
const add = (src) => functionsAdd(src, INTERNAL_FUNCTIONS_SRC, { fail: failBuild })
|
|
49
|
+
const list = functionsList.bind(null, functionsDirectories, { fail: failBuild })
|
|
50
|
+
const listAll = functionsListAll.bind(null, functionsDirectories, { fail: failBuild })
|
|
56
51
|
return { add, list, listAll }
|
|
57
52
|
}
|
|
58
53
|
|