@netlify/functions-utils 4.0.1 → 4.1.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/README.md CHANGED
@@ -11,11 +11,9 @@ This allows plugins to:
11
11
  # Example
12
12
 
13
13
  ```js
14
- module.exports = {
15
- // Add a Netlify Functions file or directory to a build
16
- async onPreBuild({ utils }) {
17
- await utils.functions.add('./path/to/function')
18
- },
14
+ // Add a Netlify Functions file or directory to a build
15
+ export const onPreBuild = async function ({ utils }) {
16
+ await utils.functions.add('./path/to/function')
19
17
  }
20
18
  ```
21
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/functions-utils",
3
- "version": "4.0.1",
3
+ "version": "4.1.1",
4
4
  "description": "Utility for adding Functions files in Netlify Build",
5
5
  "type": "module",
6
6
  "exports": "./src/main.js",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "license": "MIT",
47
47
  "dependencies": {
48
- "@netlify/zip-it-and-ship-it": "^5.3.0",
48
+ "@netlify/zip-it-and-ship-it": "^5.4.0",
49
49
  "cpy": "^8.1.0",
50
50
  "path-exists": "^4.0.0"
51
51
  },
package/src/main.js CHANGED
@@ -1,13 +1,10 @@
1
- import { stat } from 'fs'
1
+ import { promises as fs } from 'fs'
2
2
  import { basename, dirname } from 'path'
3
- import { promisify } from 'util'
4
3
 
5
4
  import { listFunctions, listFunctionsFiles } from '@netlify/zip-it-and-ship-it'
6
5
  import cpy from 'cpy'
7
6
  import pathExists from 'path-exists'
8
7
 
9
- const pStat = promisify(stat)
10
-
11
8
  // Add a Netlify Function file to the `functions` directory so it is processed
12
9
  // by `@netlify/plugin-functions-core`
13
10
  export const add = async function (src, dist, { fail = defaultFail } = {}) {
@@ -29,7 +26,7 @@ export const add = async function (src, dist, { fail = defaultFail } = {}) {
29
26
  }
30
27
 
31
28
  const getSrcGlob = async function (src, srcBasename) {
32
- const srcStat = await pStat(src)
29
+ const srcStat = await fs.stat(src)
33
30
 
34
31
  if (srcStat.isDirectory()) {
35
32
  return `${srcBasename}/**`