This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate components to TypeScript (#751)
* refactor: create FunctionSource interface * refactor: create non_nullable util * refactor: migrate config util to TypeScript * refactor: migrate feature_flags to TypeScript * refactor: migrate Node function finder to TypeScript * refactor: migrate esbuild bundler_target to TypeScript * refactor: migrate parser * refactor: migrate ZISI resolve * refactor: migrate esbuild special_cases * refactor: migrate ZISI src_files * refactor: migrate Node bundlers index * refactor: migrate esbuild src_files * refactor: migrate native modules esbuild plugin * refactor: migrate dynamic imports esbuild plugin * refactor: migrate esbuild bundler (inner file) * refactor: migrate esbuild bundler * refactor: migrate nft bundler * refactor: migrate ZISI bundler * refactor: migrate Node runtime entry * refactor: add missing prop to PackageJson * refactor: add config properties * refactor: add Runtime * refactor: various updates * refactor: fix linting issues * chore: fix test * refactor: use nullish coalescing operator * refactor: add GlobPattern type * refactor: use Template Literal type * refactor: remove duplication of FeatureFlags keys * refactor: change CleanupFunction type * refactor: make BundleFunction a type * refactor: make GetSrcFilesFunction a type * refactor: use optional chaining operator * refactor: make FindFunctionsInPathsFunction a type * refactor: make GetSrcFilesFunction a type * refactor: make ZipFunction a type * refactor: fix nonNullable check Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9af28ae
commit 076b192
Showing
30 changed files
with
649 additions
and
231 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Stats } from 'fs' | ||
|
||
interface SourceFile { | ||
extension: string | ||
filename: string | ||
mainFile: string | ||
name: string | ||
srcDir: string | ||
srcPath: string | ||
stat: Stats | ||
} | ||
|
||
type FunctionSource = SourceFile & { | ||
runtime: string | ||
} | ||
|
||
export { FunctionSource, SourceFile } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const DEFAULT_VERSION = 'node12' | ||
|
||
const versionMap = { | ||
'8.x': 'node8', | ||
'10.x': 'node10', | ||
'12.x': 'node12', | ||
'14.x': 'node14', | ||
} as const | ||
|
||
type VersionKeys = keyof typeof versionMap | ||
type VersionValues = typeof versionMap[VersionKeys] | ||
|
||
const getBundlerTarget = (suppliedVersion?: string): VersionValues => { | ||
const version = normalizeVersion(suppliedVersion) | ||
|
||
if (version && version in versionMap) { | ||
return versionMap[version as VersionKeys] | ||
} | ||
|
||
return DEFAULT_VERSION | ||
} | ||
|
||
const normalizeVersion = (version?: string) => { | ||
const match = version && version.match(/^nodejs(.*)$/) | ||
|
||
return match ? match[1] : version | ||
} | ||
|
||
export { getBundlerTarget } |
Oops, something went wrong.
076b192
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏱ Benchmark results
largeDepsEsbuild: 9s
largeDepsNft: 58.1s
largeDepsZisi: 1m 13.3s