docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A utility that reads JSX attribute values while staying resilient to unfamiliar expression node types.
label="Hello" returns "Hello", and a JSXAttribute for count={4} returns 4. @testImportExpression triggers one log entry mentioning ImportExpression and returns null without throwing. @testlabel="Hi" and data={ImportExpression}, the result map is { label: "Hi", data: null }, the logger is called once for the unsupported node, and evaluation continues without errors. @test/**
* Evaluates a single JSXAttribute node into its JavaScript value.
* @param {object} attributeNode - A JSXAttribute node with a value that may be a literal or an expression container.
* @param {(message: string) => void} logger - A callback invoked when encountering unsupported expression node types.
* @returns {unknown} JavaScript value for supported expressions, or null when unsupported.
*/
export function evaluatePropValue(attributeNode, logger);
/**
* Evaluates multiple JSXAttribute nodes, returning a name-to-value map.
* Unsupported nodes are logged and set to null without stopping evaluation of other attributes.
* @param {object[]} attributeNodes - Array of JSXAttribute nodes to evaluate.
* @param {(message: string) => void} logger - A callback invoked for each unsupported expression node type.
* @returns {Record<string, unknown>} Map of attribute names to evaluated values (null for unsupported nodes).
*/
export function collectPropValues(attributeNodes, logger);Utilities for inspecting JSX attribute nodes and extracting their values without manual AST traversal.