@netlify/functions-utils
TypeScript icon, indicating that this package has built-in type declarations

5.2.93 • Public • Published

Coverage Status Build

Utility for handling Netlify Functions in Netlify Build plugins.

This allows plugins to:

  • list available Netlify Functions
  • dynamically inject Netlify Functions inside users builds.

Example

// Add a Netlify Functions file or directory to a build
export const onPreBuild = async function ({ utils }) {
  await utils.functions.add('./path/to/function')
}

API

list()

Returns: Promise<object[]>

Returns the list of Netlify Functions main files as a Promise resolving to an array of objects with the following properties:

  • name {string}: Function name, as used in the URL https://{hostname}/.netlify/functions/{name}
  • mainFile {string}: absolute path to the Function's main file
  • extension {string}: file extension of the Function's main file. For Go Functions, this might be an empty string. For Node.js Functions, this is either .js or .zip.
  • runtime "js" | "go": Function's programming language

This throws when no functions directory was specified by the user, or when it points to a non-existing directory.

listAll()

Returns: Promise<object[]>

Same as list() except it also returns the files required by the Functions main files. This is much slower. The object have the following additional member:

  • srcFile {string}: absolute path to the file

add(path)

path: string
Returns: Promise

Add a Functions file or directory to a build.

This throws when no functions directory was specified by the user, or when it points to a non-existing directory.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
5.2.9320,179latest
4.2.11-rc7rc

Version History

VersionDownloads (Last 7 Days)Published
5.2.9320,179
5.2.926,129
5.2.9132,014
5.2.9010
5.2.8933
5.2.88966
5.2.87669
5.2.86712
5.2.85128
5.2.8482
5.2.83975
5.2.8264
5.2.813,392
5.2.80216
5.2.792,884
5.2.78146
5.2.772,053
5.2.766,112
5.2.75888
5.2.741,990
5.2.731,644
5.2.7216
5.2.7112
5.2.70156
5.2.69150
5.2.6821
5.2.678
5.2.661,444
5.2.658
5.2.64925
5.2.63370
5.2.62471
5.2.6125
5.2.60457
5.2.5916
5.2.5836
5.2.57176
5.2.561,582
5.2.55577
5.2.541,345
5.2.53100
5.2.5232
5.2.512,768
5.2.5049
5.2.49445
5.2.4858
5.2.47726
5.2.461,997
5.2.45585
5.2.448
5.2.438
5.2.4289
5.2.4170
5.2.4063
5.2.398
5.2.38122
5.2.372,855
5.2.369
5.2.35625
5.2.34649
5.2.338
5.2.328
5.2.3130
5.2.3014
5.2.294,294
5.2.28132
5.2.27510
5.2.26228
5.2.258
5.2.2440
5.2.2383
5.2.22128
5.2.2110
5.2.2080
5.2.197,639
5.2.18149
5.2.1727
5.2.1612
5.2.1541
5.2.14486
5.2.1337
5.2.1284
5.2.11545
5.2.1013
5.2.911
5.2.844
5.2.715
5.2.69
5.2.547
5.2.4106
5.2.31,174
5.2.21,272
5.2.111,394
5.2.02,063
5.1.9315
5.1.8171
5.1.732
5.1.629
5.1.573
5.1.48
5.1.38
5.1.28
5.1.1272
5.1.0558
5.0.68
5.0.5195
5.0.415
5.0.378
5.0.2152
5.0.186
5.0.024
4.2.111,183
4.2.1083
4.2.11-rc7
4.2.10-rc7
4.2.959
4.2.832
4.2.78
4.2.627
4.2.513
4.2.4839
4.2.310
4.2.2235
4.2.116
4.2.0111
4.1.1519
4.1.149
4.1.1362
4.1.12500
4.1.119
4.1.1010
4.1.9154
4.1.87
4.1.77
4.1.6345
4.1.57
4.1.410
4.1.37
4.1.27
4.1.169
4.1.013
4.0.355
4.0.215
4.0.19
4.0.017
3.0.1230
3.0.033
2.0.23,030
2.0.17
2.0.08
1.4.72,616
2.0.0-rc7
1.4.67
1.4.57
1.4.47
1.4.37
1.4.210
1.4.156
1.4.07
1.3.47131
1.3.467
1.3.457
1.3.447
1.3.4321
1.3.427
1.3.417
1.3.4011
1.3.3911
1.3.387
1.3.377
1.3.367
1.3.358
1.3.347
1.3.337
1.3.3210
1.3.3117
1.3.29204
1.3.2848
1.3.277
1.3.267
1.3.258
1.3.242
1.3.239
1.3.228
1.3.2132
1.3.2055
1.3.192
1.3.182
1.3.1726
1.3.162
1.3.152
1.3.1414
1.3.1382
1.3.123
1.3.115
1.3.102
1.3.960
1.3.82
1.3.73
1.3.62
1.3.514
1.3.44
1.3.325
1.3.225
1.3.13
1.3.03
1.2.113
1.2.108
1.2.931
1.2.849
1.2.7125
1.2.614
1.2.511
1.2.43
1.2.329
1.2.213
1.2.19
1.2.012
1.1.210
1.1.110
1.1.03
1.0.029
0.3.02
0.2.4654
0.2.310
0.2.28
0.2.119
0.2.012
0.1.033

Package Sidebar

Install

npm i @netlify/functions-utils

Weekly Downloads

145,150

Version

5.2.93

License

MIT

Unpacked Size

8.37 kB

Total Files

5

Last publish

Collaborators

  • serhalp-netlify
  • youvalv
  • berdav
  • vitaliyr
  • smnh
  • denar90
  • kathmbeck
  • akardet
  • pieh
  • hrishikeshk
  • sarahetter
  • orinokai
  • seanroberts
  • mikewen
  • biilmann
  • eduardoboucas
  • netlify-bot