playground

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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

This section is empty.

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 Position

type Position struct {
	Line   int `json:"line"`
	Column int `json:"column"`
}

Position is a 1-based source location.

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.

type Range

type Range struct {
	Start Position `json:"start"`
	End   Position `json:"end"`
}

Range is a 1-based source range. End is exclusive.

type Result

type Result struct {
	Files       map[string]string `json:"files"`
	HTML        map[string]string `json:"html"`
	CSS         map[string]string `json:"css"`
	Routes      []Route           `json:"routes"`
	Diagnostics []Diagnostic      `json:"diagnostics"`
}

Result is the browser-compiler output.

func Compile

func Compile(project Project) Result

Compile parses, validates, and statically renders a project without writing files. It is intended for playgrounds; generated apps, binaries, request-time SSR, and action execution remain native/server compiler features.

type Route

type Route struct {
	PageID string `json:"page"`
	Route  string `json:"route"`
	Path   string `json:"path"`
}

Route describes one static HTML route produced by a compile.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL