devtools

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package devtools provides a devtools service for the tygor vite plugin.

Package devtools provides types for the tygor vite plugin dev server protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InfoRequest

type InfoRequest struct{}

InfoRequest is the request for Devtools.Info.

type InfoResponse

type InfoResponse struct {
	Port          int         `json:"port"`
	Version       string      `json:"version"`
	NumGoroutines int         `json:"num_goroutines"`
	NumCPU        int         `json:"num_cpu"`
	Memory        MemoryStats `json:"memory"`
}

InfoResponse provides runtime information about the server.

type MemoryStats

type MemoryStats struct {
	Alloc      uint64 `json:"alloc"`
	TotalAlloc uint64 `json:"total_alloc"`
	Sys        uint64 `json:"sys"`
	NumGC      uint32 `json:"num_gc"`
}

MemoryStats contains memory statistics.

type PingRequest

type PingRequest struct{}

PingRequest is the request for Devtools.Ping.

type PingResponse

type PingResponse struct {
	OK bool `json:"ok"`
}

PingResponse is the response for Devtools.Ping.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides devtools endpoints for the vite plugin. Register it on your App to enable devtools integration:

app := tygor.NewApp()
devtools.New(app, 8080).Register()

func New

func New(app *tygor.App, port int) *Service

New creates a new devtools service.

func (*Service) Info

func (s *Service) Info(ctx context.Context, req *InfoRequest) (*InfoResponse, error)

Info returns runtime information about the server.

func (*Service) Ping

func (s *Service) Ping(ctx context.Context, req *PingRequest) (*PingResponse, error)

Ping is a simple health check endpoint for heartbeat.

func (*Service) Register

func (s *Service) Register()

Register adds the devtools service to the app.

func (*Service) Status

func (s *Service) Status(ctx context.Context, req *StatusRequest) (*StatusResponse, error)

Status returns server status. For service discovery, use Discovery.Describe instead.

type StatusRequest

type StatusRequest struct {
	// Initial should be true on first request to receive one-time data.
	Initial bool `json:"initial,omitempty"`
}

StatusRequest is the request for Devtools.Status.

type StatusResponse

type StatusResponse struct {
	// OK indicates the server is healthy.
	OK bool `json:"ok"`
	// Port is the server's listening port.
	Port int `json:"port"`
	// RawrData contains encoded data blobs (sent on initial request).
	RawrData []string `json:"rawrData,omitempty"`
}

StatusResponse provides server status. For service discovery with type schemas, use Discovery.Describe instead.

Jump to

Keyboard shortcuts

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