playground

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 23 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 Handler

func Handler(options Options) http.Handler

func Serve

func Serve(options Options) error

func ValidateTour

func ValidateTour(ctx context.Context) (int, error)

ValidateTour compiles and evaluates every lesson in every output mode. It is intentionally exposed through `trb tour --check` rather than run as part of every ordinary project build.

Types

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
}

Jump to

Keyboard shortcuts

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