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
analysismodule 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
codestring: - mago_
format - Formats the provided
codestring with the givenFormatSettings, returning the resulting string. - mago_
get_ definitions - Returns an array (serialized to JS via
JsValue) of all plugin definitions and their associated rules.