pre-golang-removal: snapshot before removing all golang integration (2026-05-01)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package runtime
|
||||
|
||||
// BuildDeployArchive creates a deployment archive for a given language and code.
|
||||
// For Node.js, it creates a zip with an ESM wrapper.
|
||||
// For script languages (PHP, Ruby), it creates a zip with the correct entrypoint filename.
|
||||
// For others, it returns the code as is.
|
||||
func BuildDeployArchive(lang, code string) ([]byte, error) {
|
||||
switch lang {
|
||||
case "nodejs":
|
||||
return BuildJSDeployZip(code)
|
||||
case "php":
|
||||
return BuildScriptZip(code, "main.php")
|
||||
case "ruby":
|
||||
return BuildScriptZip(code, "handler.rb")
|
||||
case "python", "go", "perl": // Go is a special case handled in CreateFunction, but for archive purposes it's just the source.
|
||||
return []byte(code), nil
|
||||
default:
|
||||
// Allow unknown languages but treat them as simple scripts.
|
||||
// The environment itself will fail later if the language is truly unsupported.
|
||||
return []byte(code), nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user