svelte_preprocess_helpers.ts view source
(ast: Root): Map<string, string> Builds a map of statically resolvable const bindings from a Svelte AST.
Scans top-level const variable declarations in both instance and module scripts.
For each declarator with a plain Identifier pattern and a statically evaluable
initializer, adds the binding to the map. Processes declarations in source order
so that chained references resolve: const a = 'x'; const b = a; maps b to 'x'.
Skips destructuring patterns, let/var declarations, and declarations
whose initializers reference dynamic values.
ast
The parsed Svelte AST root node.
Rootreturns
Map<string, string> Map of variable names to their resolved static string values.