Skip to content

Commit 5b7da6b

Browse files
feat: surface routes in listFunctions result (#6353)
* feat: surface routes in `listFunctions` result * chore: update snapshot * chore: update snapshot --------- Co-authored-by: Jake Champion <[email protected]>
1 parent c47a5f1 commit 5b7da6b

File tree

5 files changed

+285
-0
lines changed

5 files changed

+285
-0
lines changed

packages/zip-it-and-ship-it/src/main.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { ModuleFormat } from './runtimes/node/utils/module_format.js'
99
import { GetSrcFilesFunction, RuntimeName, RUNTIME } from './runtimes/runtime.js'
1010
import { RuntimeCache } from './utils/cache.js'
1111
import { listFunctionsDirectories, resolveFunctionsDirectories } from './utils/fs.js'
12+
import type { ExtendedRoute, Route } from './utils/routes.js'
1213

1314
export { Config, FunctionConfig } from './config.js'
1415
export { zipFunction, zipFunctions, ZipFunctionOptions, ZipFunctionsOptions } from './zip.js'
@@ -33,6 +34,8 @@ export interface ListedFunction {
3334
generator?: string
3435
timeout?: number
3536
inputModuleFormat?: ModuleFormat
37+
excludedRoutes?: Route[]
38+
routes?: ExtendedRoute[]
3639
}
3740

3841
type ListedFunctionFile = ListedFunction & {
@@ -145,10 +148,12 @@ const getListedFunction = function ({
145148
return {
146149
displayName: config.name,
147150
extension,
151+
excludedRoutes: staticAnalysisResult?.excludedRoutes,
148152
generator: config.generator,
149153
timeout: config.timeout,
150154
mainFile,
151155
name,
156+
routes: staticAnalysisResult?.routes,
152157
runtime: runtime.name,
153158
runtimeAPIVersion: staticAnalysisResult ? (staticAnalysisResult?.runtimeAPIVersion ?? 1) : undefined,
154159
schedule: staticAnalysisResult?.config?.schedule ?? config.schedule,

packages/zip-it-and-ship-it/tests/__snapshots__/list_function.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
exports[`listFunction > V2 API > listFunction includes metadata properties when parseISC true 1`] = `
44
{
55
"displayName": undefined,
6+
"excludedRoutes": [],
67
"extension": ".ts",
78
"generator": undefined,
89
"inputModuleFormat": "esm",
910
"mainFile": "v2-api-esm-ts-aliases/function.ts",
1011
"name": "function",
12+
"routes": [],
1113
"runtime": "js",
1214
"runtimeAPIVersion": 2,
1315
"schedule": undefined,

0 commit comments

Comments
 (0)