Classifies bindings from a parsed <script setup> into server-owned,
client-owned, and mixed categories using AST-based dataflow analysis.
Given the output of PhoenixVapor.ScriptSetup.parse/1, determines:
- Which props the client needs (for serialization)
- Which functions are server actions vs client handlers
- Which computeds are pure-client vs mixed (depend on server props)
Summary
Functions
Classify all bindings and handlers from a parsed script setup.
Extract free variables from a JavaScript expression string.
Extract property names accessed via props.X pattern in a JS expression.
Types
@type classification() :: %{ bindings: %{required(String.t()) => binding_kind()}, handlers: %{required(String.t()) => handler_kind()}, client_props: [String.t()], server_only_props: [String.t()] }
@type handler_kind() :: :client_handler | {:server_action, body :: String.t()}
Functions
@spec classify( refs :: %{required(String.t()) => String.t()}, computeds :: %{required(String.t()) => String.t()}, functions :: [String.t()], function_bodies :: %{required(String.t()) => String.t()}, props :: [String.t()] ) :: classification()
Classify all bindings and handlers from a parsed script setup.
Accepts the tuple returned by PhoenixVapor.ScriptSetup.parse/1.
Extract free variables from a JavaScript expression string.
Extract property names accessed via props.X pattern in a JS expression.
Handles props.contacts, props.users, etc. — common when using
const props = defineProps([...]) in Vue script setup.