Volt.JS.Query (Volt v0.12.0)

Copy Markdown View Source

Helpers for import specifiers that include URL query parameters.

Volt keeps query strings as part of module identity, but most filesystem work must operate on the path portion only. This module centralizes those small operations so dev-server, build graph, and asset handling all interpret query modes consistently.

Summary

Functions

Appends a query string to path, preserving paths with no query.

Returns true when a query requests an asset module response.

Decodes a query string into a map.

Splits an import specifier into {path, query} without the leading ?.

Functions

append(path, query)

@spec append(String.t(), String.t()) :: String.t()

Appends a query string to path, preserving paths with no query.

asset_module_query?(query)

@spec asset_module_query?(String.t()) :: boolean()

Returns true when a query requests an asset module response.

decode(query)

@spec decode(String.t()) :: %{optional(String.t()) => String.t()}

Decodes a query string into a map.

split(specifier)

@spec split(String.t()) :: {String.t(), String.t()}

Splits an import specifier into {path, query} without the leading ?.