Crate mago_wasm

Crate mago_wasm 

Source
Expand description

§Mago WASM Bindings

This crate provides [wasm-bindgen] exports that wrap Mago’s internal functionality (formatter, parser, linter, etc.) so they can be called from JavaScript in a WebAssembly environment.

§Overview

  • mago_get_definitions: Returns metadata about all available plugins and rules in Mago.
  • mago_analysis: Parses, lints, and optionally formats a given PHP snippet and returns structured results.
  • mago_format: Formats a given PHP snippet according to the specified FormatSettings.

See each function’s documentation below for details on usage and return values.

Modules§

analysis
The analysis module contains data structures and logic used to run combined parsing, linting, and formatting operations within this WASM crate.

Functions§

mago_analysis
Performs a full “analysis” of the given code string:
mago_format
Formats the provided code string with the given FormatSettings, returning the resulting string.
mago_get_definitions
Returns an array (serialized to JS via JsValue) of all plugin definitions and their associated rules.