File Coverage

lib/Yote/Spiderpup/SFC.pm
Criterion Covered Total %
statement 274 307 89.2
branch 103 142 72.5
condition 71 129 55.0
subroutine 17 17 100.0
pod 0 1 0.0
total 465 596 78.0


line stmt bran cond sub pod time code
1             package Yote::Spiderpup::SFC;
2              
3 2     2   137220 use strict;
  2         5  
  2         71  
4 2     2   13 use warnings;
  2         3  
  2         94  
5              
6 2     2   9 use Exporter 'import';
  2         6  
  2         8546  
7             our @EXPORT_OK = qw(parse_sfc);
8              
9             # Keys whose values are function expressions (kept as raw strings)
10             my %FUNCTION_KEYS = map { $_ => 1 } qw(methods computed lifecycle watch);
11              
12             # Keys whose values are parsed as Perl data structures
13             my %DATA_KEYS = map { $_ => 1 } qw(vars import routes initial_store);
14              
15             # Keys whose values are arrays of strings
16             my %ARRAY_KEYS = map { $_ => 1 } ('import-css', 'import-js', 'include-js');
17              
18             #----------------------------------------------------------------------
19             # Public API
20             #----------------------------------------------------------------------
21              
22             sub parse_sfc {
23 28     28 0 218273 my ($content) = @_;
24 28         43 my $result = {};
25              
26             # Strip HTML comments before parsing to avoid false matches
27 28         59 $content =~ s///gs;
28              
29             # Extract