@@ -21,6 +21,7 @@ export interface ListedFunction {
21
21
runtime : RuntimeType
22
22
extension : string
23
23
schedule ?: string
24
+ displayName ?: string
24
25
}
25
26
26
27
type ListedFunctionFile = ListedFunction & {
@@ -30,6 +31,7 @@ type ListedFunctionFile = ListedFunction & {
30
31
interface ListFunctionsOptions {
31
32
basePath ?: string
32
33
config ?: Config
34
+ configFileDirectories ?: string [ ]
33
35
featureFlags ?: FeatureFlags
34
36
parseISC ?: boolean
35
37
}
@@ -39,7 +41,8 @@ interface AugmentedFunctionSource extends FunctionSource {
39
41
}
40
42
41
43
const augmentWithISC = async ( func : FunctionSource ) : Promise < AugmentedFunctionSource > => {
42
- // ISC is currently only supported in JavaScript and TypeScript functions.
44
+ // ISC is currently only supported in JavaScript and TypeScript functions
45
+ // and only supports scheduled functions.
43
46
if ( func . runtime . name !== RuntimeType . JAVASCRIPT ) {
44
47
return func
45
48
}
@@ -55,14 +58,15 @@ export const listFunctions = async function (
55
58
{
56
59
featureFlags : inputFeatureFlags ,
57
60
config,
61
+ configFileDirectories,
58
62
parseISC = false ,
59
- } : { featureFlags ?: FeatureFlags ; config ?: Config ; parseISC ?: boolean } = { } ,
63
+ } : { featureFlags ?: FeatureFlags ; config ?: Config ; configFileDirectories ?: string [ ] ; parseISC ?: boolean } = { } ,
60
64
) {
61
65
const featureFlags = getFlags ( inputFeatureFlags )
62
66
const srcFolders = resolveFunctionsDirectories ( relativeSrcFolders )
63
67
const paths = await listFunctionsDirectories ( srcFolders )
64
68
const cache = new RuntimeCache ( )
65
- const functionsMap = await getFunctionsFromPaths ( paths , { cache, config, featureFlags } )
69
+ const functionsMap = await getFunctionsFromPaths ( paths , { cache, config, configFileDirectories , featureFlags } )
66
70
const functions = [ ...functionsMap . values ( ) ]
67
71
const augmentedFunctions = parseISC ? await Promise . all ( functions . map ( augmentWithISC ) ) : functions
68
72
@@ -75,12 +79,13 @@ export const listFunction = async function (
75
79
{
76
80
featureFlags : inputFeatureFlags ,
77
81
config,
82
+ configFileDirectories,
78
83
parseISC = false ,
79
- } : { featureFlags ?: FeatureFlags ; config ?: Config ; parseISC ?: boolean } = { } ,
84
+ } : { featureFlags ?: FeatureFlags ; config ?: Config ; configFileDirectories ?: string [ ] ; parseISC ?: boolean } = { } ,
80
85
) {
81
86
const featureFlags = getFlags ( inputFeatureFlags )
82
87
const cache = new RuntimeCache ( )
83
- const func = await getFunctionFromPath ( path , { cache, config, featureFlags } )
88
+ const func = await getFunctionFromPath ( path , { cache, config, configFileDirectories , featureFlags } )
84
89
85
90
if ( ! func ) {
86
91
return
@@ -94,13 +99,19 @@ export const listFunction = async function (
94
99
// List all Netlify Functions files for a specific directory
95
100
export const listFunctionsFiles = async function (
96
101
relativeSrcFolders : string | string [ ] ,
97
- { basePath, config, featureFlags : inputFeatureFlags , parseISC = false } : ListFunctionsOptions = { } ,
102
+ {
103
+ basePath,
104
+ config,
105
+ configFileDirectories,
106
+ featureFlags : inputFeatureFlags ,
107
+ parseISC = false ,
108
+ } : ListFunctionsOptions = { } ,
98
109
) {
99
110
const featureFlags = getFlags ( inputFeatureFlags )
100
111
const srcFolders = resolveFunctionsDirectories ( relativeSrcFolders )
101
112
const paths = await listFunctionsDirectories ( srcFolders )
102
113
const cache = new RuntimeCache ( )
103
- const functionsMap = await getFunctionsFromPaths ( paths , { cache, config, featureFlags } )
114
+ const functionsMap = await getFunctionsFromPaths ( paths , { cache, config, configFileDirectories , featureFlags } )
104
115
const functions = [ ...functionsMap . values ( ) ]
105
116
const augmentedFunctions = parseISC ? await Promise . all ( functions . map ( augmentWithISC ) ) : functions
106
117
const listedFunctionsFiles = await Promise . all (
@@ -118,7 +129,14 @@ const getListedFunction = function ({
118
129
config,
119
130
inSourceConfig,
120
131
} : AugmentedFunctionSource ) : ListedFunction {
121
- return { name, mainFile, runtime : runtime . name , extension, schedule : inSourceConfig ?. schedule ?? config . schedule }
132
+ return {
133
+ name,
134
+ displayName : config . name ,
135
+ mainFile,
136
+ runtime : runtime . name ,
137
+ extension,
138
+ schedule : inSourceConfig ?. schedule ?? config . schedule ,
139
+ }
122
140
}
123
141
124
142
const getListedFunctionFiles = async function (
1 commit comments
github-actions[bot] commentedon Jan 31, 2023
⏱ Benchmark results