A module embedded in a source file owned by a Volt plugin.
Embedded modules model single-file-component subresources such as <script>
and <style> blocks. They are addressed as query modules derived from the
real parent file instead of opaque synthetic ids, which preserves source-file
identity for resolution, watching, and diagnostics.
Summary
Functions
Content type inferred from an embedded module kind.
Return a compiler-friendly filename for the embedded module.
Build the internal query-module id for an embedded module under a parent file.
Return true when an id addresses an embedded module.
Normalize legacy tuple modules or maps into embedded module structs.
Normalize a list of embedded modules and assign indexes where omitted.
Return the real parent file for ids that address embedded modules.
Parse an embedded query-module id.
Build an import specifier for an embedded module from its parent module.
Types
@type kind() :: :script | :style | :custom
@type t() :: %Volt.Plugin.EmbeddedModule{ content_type: String.t() | nil, extension: String.t(), index: non_neg_integer() | nil, source: String.t(), type: kind() }
Functions
Content type inferred from an embedded module kind.
Return a compiler-friendly filename for the embedded module.
Build the internal query-module id for an embedded module under a parent file.
Return true when an id addresses an embedded module.
@spec normalize(term(), non_neg_integer()) :: t()
Normalize legacy tuple modules or maps into embedded module structs.
Normalize a list of embedded modules and assign indexes where omitted.
Return the real parent file for ids that address embedded modules.
@spec parse_id(String.t()) :: {:ok, Volt.Plugin.EmbeddedModule.ID.t()} | :error
Parse an embedded query-module id.
Build an import specifier for an embedded module from its parent module.