@netlify/build 20.0.0 → 20.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": "20.0.0",
3
+ "version": "20.0.1",
4
4
  "description": "Netlify build module",
5
5
  "main": "src/core/main.js",
6
6
  "types": "types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export { OnBuild, OnEnd, OnError, OnPostBuild, OnPreBuild, OnSuccess } from './n
4
4
  export { NetlifyConfig } from './config/netlify_config'
5
5
  export { NetlifyPluginUtils } from './options'
6
6
  export { NetlifyPluginConstants } from './netlify_plugin_constants'
7
+ export { ListedFunction, ListedFunctionFile } from './options/netlify_plugin_functions_util'
@@ -0,0 +1,32 @@
1
+ import type { listFunctions, listFunctionsFiles } from '@netlify/zip-it-and-ship-it'
2
+
3
+ type Resolved<T> = T extends Promise<infer U> ? U : T
4
+
5
+ export type ListedFunction = Resolved<ReturnType<typeof listFunctions>>[0]
6
+ export type ListedFunctionFile = Resolved<ReturnType<typeof listFunctionsFiles>>[0]
7
+
8
+ export interface NetlifyPluginFunctionsUtil {
9
+ /**
10
+ * Returns the list of Netlify Functions main files as a Promise resolving to an array of objects with the following properties:
11
+ *
12
+ * - `name`: Function name, as used in the URL `https://{hostname}/.netlify/functions/{name}`
13
+ * - `mainFile`: absolute path to the Function's main file
14
+ * - `extension`: 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`.
15
+ * - `runtime` `"js" | "go"`: Function's language runtime. TypeScript Functions use the "js" runtime
16
+ */
17
+ list(): Promise<Array<ListedFunction>>
18
+
19
+ /**
20
+ * 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:
21
+ *
22
+ * - `srcFile`: absolute path to the file
23
+ */
24
+ listAll(): Promise<Array<ListedFunctionFile>>
25
+
26
+ /**
27
+ * Add a Functions file or directory to a build.
28
+ *
29
+ * @param path Path to the function file or directory.
30
+ */
31
+ add(path: string): Promise<void>
32
+ }
@@ -1,5 +1,6 @@
1
1
  import { NetlifyPluginBuildUtil } from './netlify_plugin_build_util'
2
2
  import { NetlifyPluginCacheUtil } from './netlify_plugin_cache_util'
3
+ import { NetlifyPluginFunctionsUtil } from './netlify_plugin_functions_util'
3
4
  import { NetlifyPluginGitUtil } from './netlify_plugin_git_util'
4
5
  import { NetlifyPluginRunUtil } from './netlify_plugin_run_util'
5
6
  import { NetlifyPluginStatusUtil } from './netlify_plugin_status_util'
@@ -10,4 +11,5 @@ export interface NetlifyPluginUtils {
10
11
  cache: NetlifyPluginCacheUtil
11
12
  run: NetlifyPluginRunUtil
12
13
  git: NetlifyPluginGitUtil
14
+ functions: NetlifyPluginFunctionsUtil
13
15
  }