Documentation
¶
Overview ¶
Package playground exposes an in-memory compiler suitable for browser playgrounds and WASM wrappers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Diagnostic ¶
type Diagnostic struct {
File string `json:"file"`
Code string `json:"code,omitempty"`
Pos Position `json:"pos"`
Range *Range `json:"range,omitempty"`
Severity string `json:"severity"`
Message string `json:"message"`
}
Diagnostic is a source diagnostic safe to serialize to browser clients.
type PreviewOptions ¶ added in v0.1.5
PreviewOptions configures compiler-owned browser preview rendering.
type PreviewServer ¶ added in v0.1.5
type PreviewServer struct {
// contains filtered or unexported fields
}
PreviewServer renders preview HTML from compiler output and serves the generated assets that preview HTML references.
func NewPreviewServer ¶ added in v0.1.5
func NewPreviewServer(options PreviewOptions) *PreviewServer
NewPreviewServer creates a preview server for Result values returned by Compile.
func (*PreviewServer) MatchesAssetPath ¶ added in v0.1.5
func (server *PreviewServer) MatchesAssetPath(requestPath string) bool
func (*PreviewServer) Render ¶ added in v0.1.5
func (server *PreviewServer) Render(result Result) Preview
Render returns preview HTML for the first emitted HTML artifact and registers generated assets so ServeHTTP can return them.
func (*PreviewServer) ServeHTTP ¶ added in v0.1.5
func (server *PreviewServer) ServeHTTP(writer http.ResponseWriter, request *http.Request)
type Project ¶
type Project struct {
Files map[string]string `json:"files"`
Config gowdk.Config `json:"-"`
OutputDir string `json:"outputDir,omitempty"`
}
Project is a browser-compiler input. Files maps project-relative paths to file contents. The current browser compiler accepts .gwdk page, component, and layout files.