Files
fx-serverless/bundler/rust/rust.go
Minghe fd6b1947a5 adopt the swagger-stats as API operation metrics collection tool. (#537)
* adopt the swagger-stats as API operation metrics collection tool.

FYI: https://github.com/slanatech/swagger-stats

* no need change

* naming

* fix test

* move deps to base

* bump version

* update
2020-05-27 16:24:42 +08:00

33 lines
597 B
Go

package rust
import (
"github.com/gobuffalo/packr/v2"
"github.com/metrue/fx/bundler"
)
// Rust defines javascript bundler
type Rust struct {
assets *packr.Box
}
// New a koa bundler
func New() *Rust {
return &Rust{
assets: packr.New("rust", "./assets"),
}
}
// Scaffold a koa app
func (k *Rust) Scaffold(output string) error {
return bundler.Restore(k.assets, output)
}
// Bundle a function into a koa project
func (k *Rust) Bundle(output string, fn string, deps ...string) error {
return bundler.Bundle(k.assets, output, "rust", fn, deps...)
}
var (
_ bundler.Bundler = &Rust{}
)