playground

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package playground serves the local TypeRB playground and guided tour. Compilation and evaluation use the same compiler and typed IR as the CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportStatic added in v0.1.9

func ExportStatic(options StaticOptions) error

func Handler

func Handler(options Options) http.Handler

func Serve

func Serve(options Options) error

func ValidMode added in v0.1.9

func ValidMode(mode string) bool

Types

type Config added in v0.1.9

type Config struct {
	Transport string   `json:"transport"`
	Mode      string   `json:"mode"`
	Modes     []string `json:"modes"`
	Page      string   `json:"page,omitempty"`
	Version   string   `json:"version"`
}

type Diagnostic

type Diagnostic struct {
	Severity  string `json:"severity"`
	Message   string `json:"message"`
	Line      int    `json:"line,omitempty"`
	Column    int    `json:"column,omitempty"`
	EndLine   int    `json:"endLine,omitempty"`
	EndColumn int    `json:"endColumn,omitempty"`
}

type Lesson

type Lesson struct {
	ID          string `json:"id"`
	Chapter     string `json:"chapter"`
	Title       string `json:"title"`
	Eyebrow     string `json:"eyebrow"`
	Description string `json:"description"`
	Source      string `json:"source"`
	Expected    string `json:"expected"`
	Hint        string `json:"hint"`
}

func Tour

func Tour() []Lesson

type Options

type Options struct {
	Mode        string
	Page        string
	Port        int
	OpenBrowser bool
	Version     string
	Stdout      io.Writer
	Stderr      io.Writer
}

type Request added in v0.1.9

type Request struct {
	Source string `json:"source"`
	Mode   string `json:"mode"`
}

type Response added in v0.1.9

type Response struct {
	OK          bool         `json:"ok"`
	Output      string       `json:"output,omitempty"`
	Generated   string       `json:"generated,omitempty"`
	Formatted   string       `json:"formatted,omitempty"`
	Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
	DurationMS  int64        `json:"durationMs"`
}

func Format added in v0.1.9

func Format(source string) Response

func Run added in v0.1.9

func Run(parent context.Context, source, mode string) Response

func Transpile added in v0.1.9

func Transpile(source, mode string) Response

type StaticOptions added in v0.1.9

type StaticOptions struct {
	OutputDir string
	Version   string
}

Jump to

Keyboard shortcuts

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