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 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 boundary_count(&self) -> usize
pub fn boundary_count(&self) -> usize
Number of <boundary> streaming checkpoints compiled by the most
recent top-level HtmlParser::parse call.
Returns 0 for an ordinary, non-streaming entry. Callers use this to
decide whether streaming-specific build advisories apply.
Sourcepub fn boundary_names(&self) -> &[String]
pub fn boundary_names(&self) -> &[String]
Free-form <boundary name> values in declaration order from the most
recent top-level HtmlParser::parse call.
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 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 that
token is defined by CSS in the current fragment or an ancestor
component/root. The returned protocol token list is sorted and
deduplicated from the remaining unresolved fallback-chain candidates.