@netlify/build 20.0.0 → 20.0.4
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.
|
|
3
|
+
"version": "20.0.4",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"main": "src/core/main.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"@netlify/config": "^16.0.0",
|
|
59
59
|
"@netlify/functions-utils": "^3.0.0",
|
|
60
60
|
"@netlify/git-utils": "^3.0.0",
|
|
61
|
-
"@netlify/plugin-edge-handlers": "^
|
|
62
|
-
"@netlify/plugins-list": "^
|
|
61
|
+
"@netlify/plugin-edge-handlers": "^3.0.0",
|
|
62
|
+
"@netlify/plugins-list": "^6.0.1",
|
|
63
63
|
"@netlify/run-utils": "^3.0.0",
|
|
64
|
-
"@netlify/zip-it-and-ship-it": "^5.
|
|
64
|
+
"@netlify/zip-it-and-ship-it": "^5.2.0",
|
|
65
65
|
"@sindresorhus/slugify": "^1.1.0",
|
|
66
66
|
"ansi-escapes": "^4.3.2",
|
|
67
67
|
"chalk": "^4.1.2",
|
package/src/plugins/list.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { pluginsList: oldPluginsList, pluginsUrl } = require('@netlify/plugins-list')
|
|
4
3
|
const got = require('got')
|
|
5
4
|
const isPlainObj = require('is-plain-obj')
|
|
6
5
|
|
|
6
|
+
// TODO: use static `import` after migrating this repository to pure ES modules
|
|
7
|
+
const netlifyPluginsList = import('@netlify/plugins-list')
|
|
8
|
+
|
|
7
9
|
const { logPluginsList } = require('../log/messages/plugins')
|
|
8
10
|
const { logPluginsFetchError } = require('../log/messages/plugins')
|
|
9
11
|
|
|
@@ -16,14 +18,16 @@ const { CONDITIONS } = require('./compatibility')
|
|
|
16
18
|
// make this request is somewhat ok (in the 100ms range).
|
|
17
19
|
// We only fetch this plugins list when needed, i.e. we defer it as much as
|
|
18
20
|
// possible.
|
|
19
|
-
const getPluginsList = async function ({ debug, logs, testOpts: { pluginsListUrl
|
|
21
|
+
const getPluginsList = async function ({ debug, logs, testOpts: { pluginsListUrl } }) {
|
|
20
22
|
// We try not to mock in integration tests. However, sending a request for
|
|
21
23
|
// each test would be too slow and make tests unreliable.
|
|
22
24
|
if (pluginsListUrl === 'test') {
|
|
23
25
|
return []
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
const
|
|
28
|
+
const { pluginsUrl } = await netlifyPluginsList
|
|
29
|
+
const pluginsListUrlA = pluginsListUrl === undefined ? pluginsUrl : pluginsListUrl
|
|
30
|
+
const pluginsList = await fetchPluginsList({ logs, pluginsListUrl: pluginsListUrlA })
|
|
27
31
|
const pluginsListA = normalizePluginsList(pluginsList)
|
|
28
32
|
logPluginsList({ pluginsList: pluginsListA, debug, logs })
|
|
29
33
|
return pluginsListA
|
|
@@ -46,6 +50,7 @@ const fetchPluginsList = async function ({ logs, pluginsListUrl }) {
|
|
|
46
50
|
// buildbot release.
|
|
47
51
|
} catch (error) {
|
|
48
52
|
logPluginsFetchError(logs, error.message)
|
|
53
|
+
const { pluginsList: oldPluginsList } = await netlifyPluginsList
|
|
49
54
|
return oldPluginsList
|
|
50
55
|
}
|
|
51
56
|
}
|
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
|
}
|