Bundler-oriented helpers for Vue Single File Components.
These helpers expose Vize's SFC dependency and scope-ID logic without requiring callers to reimplement Vue template parsing with regular expressions.
Summary
Functions
Collect importable static asset references from an SFC template.
Like collect_template_assets/2 but raises Vize.Error on parse errors.
Collect SFC blocks whose contents are loaded through a src attribute.
Like external_sources/1 but raises Vize.Error on parse errors.
Rewrite asset literals in compiled SFC JavaScript to imported bindings.
Generate the deterministic scope ID used by Vize's bundler integrations.
Functions
@spec collect_template_assets( String.t(), keyword() ) :: {:ok, [Vize.SFC.Asset.t()]} | {:error, Vize.Error.t()}
Collect importable static asset references from an SFC template.
By default Vize recognizes assets such as img[src], video[src],
video[poster], source[src], and SVG image/use references.
Options
:filename— filename used when parsing the SFC
@spec collect_template_assets!( String.t(), keyword() ) :: [Vize.SFC.Asset.t()]
Like collect_template_assets/2 but raises Vize.Error on parse errors.
@spec external_sources(String.t()) :: {:ok, [Vize.SFC.ExternalSource.t()]} | {:error, Vize.Error.t()}
Collect SFC blocks whose contents are loaded through a src attribute.
Returns template, script, script-setup, style, and custom-block sources.
@spec external_sources!(String.t()) :: [Vize.SFC.ExternalSource.t()]
Like external_sources/1 but raises Vize.Error on parse errors.
@spec rewrite_asset_references(String.t(), [Vize.SFC.Asset.t()]) :: String.t()
Rewrite asset literals in compiled SFC JavaScript to imported bindings.
assets should be the result of collect_template_assets/2. The function is
total: JavaScript that cannot be parsed is returned unchanged.
Generate the deterministic scope ID used by Vize's bundler integrations.
Options
:root— project root used to normalize the filename:production— use the production hashing strategy:source— source content included by the production strategy