Skip to content

Commit 49fcc66

Browse files
committed
refactor: use exported types
1 parent 0886925 commit 49fcc66

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

packages/build/src/plugins_core/functions/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { resolve } from 'path'
22

3-
import { NodeBundlerName, RUNTIME, zipFunctions } from '@netlify/zip-it-and-ship-it'
3+
import { NodeBundlerName, RUNTIME, zipFunctions, ZippedFunctions } from '@netlify/zip-it-and-ship-it'
44
import { pathExists } from 'path-exists'
55

66
import { addErrorInfo } from '../../error/info.js'
@@ -13,7 +13,7 @@ import { getUserAndInternalFunctions, validateFunctionsSrc } from './utils.js'
1313
import { getZisiParameters } from './zisi.js'
1414

1515
// Get a list of all unique bundlers in this run
16-
const getBundlers = (results: Awaited<ReturnType<typeof zipFunctions>> = []) =>
16+
const getBundlers = (results: ZippedFunctions = []) =>
1717
// using a Set to filter duplicates
1818
new Set(
1919
results
@@ -38,7 +38,7 @@ const eventTriggeredFunctions = new Set([
3838
'identity-login',
3939
])
4040

41-
const validateCustomRoutes = function (functions: Awaited<ReturnType<typeof zipFunctions>>) {
41+
const validateCustomRoutes = function (functions: ZippedFunctions) {
4242
for (const { routes, name, schedule } of functions) {
4343
if (!routes || routes.length === 0) continue
4444

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ import { RuntimeCache } from './utils/cache.js'
1111
import { listFunctionsDirectories, resolveFunctionsDirectories } from './utils/fs.js'
1212

1313
export { Config, FunctionConfig } from './config.js'
14-
export { zipFunction, zipFunctions, ZipFunctionOptions, ZipFunctionsOptions } from './zip.js'
14+
export {
15+
zipFunction,
16+
zipFunctions,
17+
ZipFunctionOptions,
18+
ZipFunctionsOptions,
19+
ZippedFunction,
20+
ZippedFunctions,
21+
} from './zip.js'
1522

1623
export { ArchiveFormat, ARCHIVE_FORMAT } from './archive.js'
1724
export type { TrafficRules } from './rate_limit.js'

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ export const zipFunctions = async function (
135135
return formattedResults
136136
}
137137

138+
export type ZippedFunctions = Awaited<ReturnType<typeof zipFunctions>>
139+
138140
export const zipFunction = async function (
139141
relativeSrcPath: string,
140142
destFolder: string,
@@ -204,3 +206,5 @@ export const zipFunction = async function (
204206

205207
return formatZipResult({ ...zipResult, mainFile, name, runtime })
206208
}
209+
210+
export type ZippedFunction = Awaited<ReturnType<typeof zipFunction>>

0 commit comments

Comments
 (0)