LiveVueContract.Tags (live_vue_contract v0.3.1)

Copy Markdown View Source

Compile-time check of <.vue> tags: walks a compiled HEEx template and compares the attributes of every literal <.vue v-component="X" ...> (and <.X> shortcut) with the schema of X.

The walk matches the call HEEx compiles a function component to, Phoenix.LiveView.TagEngine.component(&fun/1, attrs, caller). That form belongs to Phoenix LiveView, not to its public API. If a LiveView release changes it, the walk would find nothing and every template would pass unchecked; so the tags are also counted in the template source, and a template with more <.vue> tags than the walk found is a CompileError.

Summary

Functions

Checks the compiled template ast. Options: :file, :line (where the template starts), :source (template text; nil skips the count), :shortcuts (names of <.X> shortcut tags).

Whether the template source has a <.vue> or <.X> shortcut tag (comments excluded).

Functions

check!(ast, opts)

Checks the compiled template ast. Options: :file, :line (where the template starts), :source (template text; nil skips the count), :shortcuts (names of <.X> shortcut tags).

mentions?(source, shortcuts)

Whether the template source has a <.vue> or <.X> shortcut tag (comments excluded).