pub struct HtmlParser { /* private fields */ }Expand description
Parser for WebUI directives.
Implementations§
Source§impl HtmlParser
impl HtmlParser
Sourcepub fn with_options(options: impl Into<ParserOptions>) -> Self
pub fn with_options(options: impl Into<ParserOptions>) -> Self
Create a new directive parser with explicit parser options.
Sourcepub fn with_plugin(plugin: Box<dyn ParserPlugin>) -> Self
pub fn with_plugin(plugin: Box<dyn ParserPlugin>) -> Self
Create a new parser with a plugin and default parser options.
Sourcepub fn with_plugin_options(
plugin: Box<dyn ParserPlugin>,
options: impl Into<ParserOptions>,
) -> Self
pub fn with_plugin_options( plugin: Box<dyn ParserPlugin>, options: impl Into<ParserOptions>, ) -> Self
Create a new parser with a plugin and explicit parser options.
Sourcepub fn component_registry_mut(&mut self) -> &mut ComponentRegistry
pub fn component_registry_mut(&mut self) -> &mut ComponentRegistry
Get a mutable reference to the component registry.
Sourcepub fn component_registry(&self) -> &ComponentRegistry
pub fn component_registry(&self) -> &ComponentRegistry
Get a shared reference to the component registry.
pub fn into_fragment_records(self) -> WebUIFragmentRecords
Sourcepub fn take_warnings(&mut self) -> Vec<Diagnostic>
pub fn take_warnings(&mut self) -> Vec<Diagnostic>
Take non-fatal parser warnings collected so far.
Sourcepub fn has_fragment(&self, fragment_id: &str) -> bool
pub fn has_fragment(&self, fragment_id: &str) -> bool
Check if a fragment ID has been parsed (exists in the fragment records).
Sourcepub fn module_entry_srcs(&self) -> &[String]
pub fn module_entry_srcs(&self) -> &[String]
src of every authored <script type="module"> outside any
<boundary>, in document order, from the most recent top-level
HtmlParser::parse call.
These are the page’s critical module entries — the ones whose shared
chunks belong in <link rel="modulepreload">. Island loaders placed
inside a boundary are excluded, because deferring them is the point.
A src containing {{ is skipped: it is a binding resolved per
request, so no build-time artifact can be matched to it.
Sourcepub fn component_shadow_dom_usage(&self) -> impl Iterator<Item = (&str, bool)>
pub fn component_shadow_dom_usage(&self) -> impl Iterator<Item = (&str, bool)>
Iterate component tags and whether each effectively uses Shadow DOM.
This remains available independently of parser plugins so protocol builders can persist effective per-component ownership in plugin-free builds.
Sourcepub fn component_work_policies(&self) -> impl Iterator<Item = (&str, u8)>
pub fn component_work_policies(&self) -> impl Iterator<Item = (&str, u8)>
Iterate non-eager component work-policy codes.
Sourcepub fn take_plugin_artifacts(&mut self) -> Result<ParserPluginArtifacts>
pub fn take_plugin_artifacts(&mut self) -> Result<ParserPluginArtifacts>
Take any post-parse artifacts captured by the parser plugin.
§Errors
Returns ParserError::Template if a tracked component contains an
invalid @event handler or a non-braced w-ref binding.
Sourcepub fn take_tokens(&mut self) -> Vec<String>
pub fn take_tokens(&mut self) -> Vec<String>
Take the accumulated CSS tokens as a sorted, deduplicated Vec.
Convenience wrapper around HtmlParser::token_analysis.
Sourcepub fn token_analysis(&self) -> CssTokenAnalysis
pub fn token_analysis(&self) -> CssTokenAnalysis
Analyze CSS token requirements from the parsed fragment/component graph.
Each token candidate in a var() fallback chain is removed when covered
by a same-block definition or an unconditional root/host default in the
current fragment or an ancestor component/root. The returned list is
sorted and deduplicated from the remaining unresolved candidates.