Documentation
¶
Index ¶
- type Config
- type Goflare
- func (h *Goflare) Change(newValue string, progress func(msgs ...any))
- func (g *Goflare) GeneratePagesFiles() error
- func (g *Goflare) GenerateWorkerFiles() error
- func (h *Goflare) Label() string
- func (h *Goflare) Name() string
- func (g *Goflare) SetCompilerMode(mode string)
- func (h *Goflare) Shortcuts() map[string]string
- func (h *Goflare) Value() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
AppRootDir string // default: "."
RelativeInputDirectory string // input relative directory for source code server app.go to deploy app.wasm (relative) default: "web"
RelativeOutputDirectory string // output relative directory for worker.js and app.wasm file (relative) default: "deploy/cloudflare"
MainInputFile string // eg: "main.go"
Logger func(message ...any)
CompilingArguments func() []string
// Pages-specific configuration
//PagesApiRoutePrefix string // API route prefix for Pages Functions (default: "/api/")
OutputWasmFileName string // WASM file name (default: "worker.wasm")
BuildPageFunctionShortcut string // build assets wasm,js, json files to pages functions (default: "f")
BuildWorkerShortcut string // build assets wasm,js, json files to workers (default: "w")
}
func DefaultConfig ¶ added in v0.0.6
func DefaultConfig() *Config
DefaultConfig returns a Config with all default values set AppRootDir=".", RelativeInputDirectory="web", RelativeOutputDirectory="deploy/cloudflare", MainInputFile="main.worker.go", OutputWasmFileName="worker.wasm"
type Goflare ¶
type Goflare struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new Goflare instance with the provided configuration Timeout is set to 40 seconds maximum as TinyGo compilation can be slow Default values: AppRootDir=".", RelativeOutputDirectory="deploy/cloudflare", MainInputFile="main.worker.go", OutputWasmFileName="app.wasm"
func (*Goflare) GeneratePagesFiles ¶ added in v0.0.3
GeneratePagesFiles generates all necessary files for Cloudflare Pages Functions using Advanced Mode generates the _worker.js file for Pages (Advanced Mode) https://developers.cloudflare.com/pages/functions/advanced-mode/ This creates a single combined file with wasm_exec.js and runtime.mjs inline
func (*Goflare) GenerateWorkerFiles ¶ added in v0.0.3
func (*Goflare) SetCompilerMode ¶ added in v0.0.6
SetCompilerMode changes the compiler mode mode: "f" (fast/Go), "b" (bug/TinyGo debug), "m" (minimal/TinyGo production)