Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/functions/deploy/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (b *dockerBundler) Bundle(ctx context.Context, slug, entrypoint, importMap
}
hostOutputPath := filepath.Join(hostOutputDir, "output.eszip")
// Create exec command
cmd := []string{"bundle", "--entrypoint", utils.ToDockerPath(entrypoint), "--output", utils.ToDockerPath(hostOutputPath), "--decorator", "tc39"}
cmd := []string{"bundle", "--entrypoint", utils.ToDockerPath(entrypoint), "--output", utils.ToDockerPath(hostOutputPath)}
if len(importMap) > 0 {
cmd = append(cmd, "--import-map", utils.ToDockerPath(importMap))
}
Expand All @@ -60,6 +60,7 @@ func (b *dockerBundler) Bundle(ctx context.Context, slug, entrypoint, importMap
if viper.GetBool("DEBUG") {
cmd = append(cmd, "--verbose")
}
cmd = append(cmd, function.BundleFlags...)

env := []string{}
if custom_registry := os.Getenv("NPM_CONFIG_REGISTRY"); custom_registry != "" {
Expand Down
10 changes: 8 additions & 2 deletions pkg/function/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ func NewNativeBundler(tempDir string, fsys fs.FS) EszipBundler {
}
}

// Use a package private variable to allow testing without gosec complaining about G204
var edgeRuntimeBin = "edge-runtime"
var (
// Use a package private variable to allow testing without gosec complaining about G204
edgeRuntimeBin = "edge-runtime"
BundleFlags = []string{
"--decorator", "tc39",
}
)

func (b *nativeBundler) Bundle(ctx context.Context, slug, entrypoint, importMap string, staticFiles []string, output io.Writer) (api.FunctionDeployMetadata, error) {
meta := NewMetadata(slug, entrypoint, importMap, staticFiles)
Expand All @@ -43,6 +48,7 @@ func (b *nativeBundler) Bundle(ctx context.Context, slug, entrypoint, importMap
for _, staticFile := range staticFiles {
args = append(args, "--static", staticFile)
}
args = append(args, BundleFlags...)
cmd := exec.CommandContext(ctx, edgeRuntimeBin, args...)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
Expand Down