@netlify/build 21.0.1 → 23.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "21.0.1",
3
+ "version": "23.0.1",
4
4
  "description": "Netlify build module",
5
5
  "main": "src/core/main.js",
6
6
  "types": "types/index.d.ts",
@@ -56,8 +56,8 @@
56
56
  "@bugsnag/js": "^7.0.0",
57
57
  "@netlify/cache-utils": "^3.0.0",
58
58
  "@netlify/config": "^16.0.0",
59
- "@netlify/functions-utils": "^3.0.0",
60
- "@netlify/git-utils": "^3.0.0",
59
+ "@netlify/functions-utils": "^4.0.0",
60
+ "@netlify/git-utils": "^4.0.0",
61
61
  "@netlify/plugin-edge-handlers": "^3.0.0",
62
62
  "@netlify/plugins-list": "^6.2.0",
63
63
  "@netlify/run-utils": "^4.0.0",
@@ -1,8 +1,6 @@
1
1
  'use strict'
2
2
 
3
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
4
 
7
5
  const { failBuild, failPlugin, cancelBuild, failPluginWithWarning } = require('../error')
8
6
  const { isSoftFailEvent } = require('../events')
@@ -10,17 +8,23 @@ const { isSoftFailEvent } = require('../events')
10
8
  const { addLazyProp } = require('./lazy')
11
9
  const { show } = require('./status')
12
10
 
11
+ const gitUtilsPromise = import('@netlify/git-utils')
12
+ const functionsUtilsPromise = import('@netlify/functions-utils')
13
13
  const runUtilsPromise = import('@netlify/run-utils')
14
14
 
15
15
  // Retrieve the `utils` argument.
16
16
  const getUtils = async function ({ event, constants: { FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC, CACHE_DIR }, runState }) {
17
- const { run, runCommand } = await runUtilsPromise
17
+ const [functionsUtils, { getGitUtils }, { run, runCommand }] = await Promise.all([
18
+ functionsUtilsPromise,
19
+ gitUtilsPromise,
20
+ runUtilsPromise,
21
+ ])
18
22
  // eslint-disable-next-line fp/no-mutation
19
23
  run.command = runCommand
20
24
 
21
25
  const build = getBuildUtils(event)
22
26
  const cache = getCacheUtils(CACHE_DIR)
23
- const functions = getFunctionsUtils(FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC)
27
+ const functions = getFunctionsUtils(functionsUtils, FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC)
24
28
  const status = getStatusUtils(runState)
25
29
  const utils = { build, cache, run, functions, status }
26
30
  addLazyProp(utils, 'git', () => getGitUtils())
@@ -43,11 +47,11 @@ const getCacheUtils = function (CACHE_DIR) {
43
47
  return cacheBindOpts({ cacheDir: CACHE_DIR })
44
48
  }
45
49
 
46
- const getFunctionsUtils = function (FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC) {
50
+ const getFunctionsUtils = function (functionsUtils, FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC) {
47
51
  const functionsDirectories = [INTERNAL_FUNCTIONS_SRC, FUNCTIONS_SRC].filter(Boolean)
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 })
52
+ const add = (src) => functionsUtils.add(src, INTERNAL_FUNCTIONS_SRC, { fail: failBuild })
53
+ const list = functionsUtils.list.bind(null, functionsDirectories, { fail: failBuild })
54
+ const listAll = functionsUtils.listAll.bind(null, functionsDirectories, { fail: failBuild })
51
55
  return { add, list, listAll }
52
56
  }
53
57