plushie/inspect

Inspect a plushie app’s initial view tree without a renderer.

A debugging tool that runs the app’s init and view functions, normalizes the resulting tree, and prints it as JSON to stdout. No plushie binary or renderer process is required; this runs entirely in Gleam.

Useful for verifying the initial widget tree structure, checking scoped IDs after normalization, and debugging view functions without launching a full GUI.

import plushie/inspect

pub fn main() {
  inspect.run(my_app.app())
}

Types

pub opaque type InspectError

Values

pub fn error_message(err: InspectError) -> String
pub fn run(app: app.App(model, event.Event)) -> Nil

Inspect a plushie app’s initial view tree.

Calls init with a nil argument, renders the view, normalizes the tree, converts it to a PropValue, and prints as JSON.

pub fn to_json(
  app: app.App(model, event.Event),
) -> Result(String, InspectError)

Render a plushie app’s initial view tree as JSON.

This is the testable form of run, returning inspect-specific failures instead of printing to stderr and halting the VM.

Search Document