@netlify/build 22.0.1 → 24.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": "22.0.1",
3
+ "version": "24.0.1",
4
4
  "description": "Netlify build module",
5
5
  "main": "src/core/main.js",
6
6
  "types": "types/index.d.ts",
@@ -54,9 +54,9 @@
54
54
  "license": "MIT",
55
55
  "dependencies": {
56
56
  "@bugsnag/js": "^7.0.0",
57
- "@netlify/cache-utils": "^3.0.0",
57
+ "@netlify/cache-utils": "^4.0.0",
58
58
  "@netlify/config": "^16.0.0",
59
- "@netlify/functions-utils": "^3.0.0",
59
+ "@netlify/functions-utils": "^4.0.0",
60
60
  "@netlify/git-utils": "^4.0.0",
61
61
  "@netlify/plugin-edge-handlers": "^3.0.0",
62
62
  "@netlify/plugins-list": "^6.2.0",
@@ -2,12 +2,13 @@
2
2
 
3
3
  const { relative, normalize } = require('path')
4
4
 
5
- const { getCacheDir } = require('@netlify/cache-utils')
6
5
  const mapObj = require('map-obj')
7
6
  const pathExists = require('path-exists')
8
7
 
9
8
  const { version } = require('../../package.json')
10
9
 
10
+ const cacheUtilsPromise = import('@netlify/cache-utils')
11
+
11
12
  // Retrieve constants passed to plugins
12
13
  const getConstants = async function ({
13
14
  configPath,
@@ -21,6 +22,7 @@ const getConstants = async function ({
21
22
  mode,
22
23
  }) {
23
24
  const isLocal = mode !== 'buildbot'
25
+ const { getCacheDir } = await cacheUtilsPromise
24
26
  const normalizedCacheDir = getCacheDir({ cacheDir, cwd: buildDir })
25
27
 
26
28
  const constants = {
@@ -1,26 +1,30 @@
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
-
6
3
  const { failBuild, failPlugin, cancelBuild, failPluginWithWarning } = require('../error')
7
4
  const { isSoftFailEvent } = require('../events')
8
5
 
9
6
  const { addLazyProp } = require('./lazy')
10
7
  const { show } = require('./status')
11
8
 
9
+ const cacheUtilsPromise = import('@netlify/cache-utils')
10
+ const functionsUtilsPromise = import('@netlify/functions-utils')
12
11
  const gitUtilsPromise = import('@netlify/git-utils')
13
12
  const runUtilsPromise = import('@netlify/run-utils')
14
13
 
15
14
  // Retrieve the `utils` argument.
16
15
  const getUtils = async function ({ event, constants: { FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC, CACHE_DIR }, runState }) {
17
- const [{ getGitUtils }, { run, runCommand }] = await Promise.all([gitUtilsPromise, runUtilsPromise])
16
+ const [cacheUtils, functionsUtils, { getGitUtils }, { run, runCommand }] = await Promise.all([
17
+ cacheUtilsPromise,
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
- const cache = getCacheUtils(CACHE_DIR)
23
- const functions = getFunctionsUtils(FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC)
26
+ const cache = getCacheUtils(cacheUtils, CACHE_DIR)
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())
@@ -39,15 +43,15 @@ const getBuildUtils = function (event) {
39
43
  return { failBuild, failPlugin, cancelBuild }
40
44
  }
41
45
 
42
- const getCacheUtils = function (CACHE_DIR) {
43
- return cacheBindOpts({ cacheDir: CACHE_DIR })
46
+ const getCacheUtils = function (cacheUtils, CACHE_DIR) {
47
+ return cacheUtils.bindOpts({ 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