Skip to content

Commit

Permalink
Add display of preloaded URLs in ServiceWorker tab (#212)
Browse files Browse the repository at this point in the history
The ServiceWorker tab in the Collector template now includes an option to show preloaded URLs for each caching strategy. This additional information aids in debugging and analysis, by providing visibility into preloaded URLs at a per-strategy level.
  • Loading branch information
Spomky authored Jun 1, 2024
1 parent e34367b commit 664bfa2
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
47 changes: 46 additions & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ parameters:
count: 1
path: src/CachingStrategy/AssetCache.php

-
message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#"
count: 1
path: src/CachingStrategy/BackgroundSync.php

-
message: "#^Only iterables can be unpacked, mixed given in argument \\#1\\.$#"
count: 1
Expand All @@ -35,6 +40,16 @@ parameters:
count: 2
path: src/CachingStrategy/FontCache.php

-
message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#"
count: 1
path: src/CachingStrategy/PreloadUrlsGeneratorManager.php

-
message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#"
count: 1
path: src/CachingStrategy/ResourceCaches.php

-
message: "#^Only iterables can be unpacked, mixed given in argument \\#1\\.$#"
count: 1
Expand Down Expand Up @@ -120,6 +135,16 @@ parameters:
count: 1
path: src/Command/CreateScreenshotCommand.php

-
message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#"
count: 1
path: src/Command/ListCacheStrategiesCommand.php

-
message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#"
count: 1
path: src/DataCollector/PwaCollector.php

-
message: "#^Class SpomkyLabs\\\\PwaBundle\\\\Dto\\\\BackgroundSync has an uninitialized property \\$forceSyncFallback\\. Give it default value or assign it in the constructor\\.$#"
count: 1
Expand Down Expand Up @@ -580,6 +605,16 @@ parameters:
count: 1
path: src/Service/FaviconsCompiler.php

-
message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#"
count: 1
path: src/Service/ServiceWorkerCompiler.php

-
message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#"
count: 1
path: src/ServiceWorkerRule/AppendCacheStrategies.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
Expand All @@ -593,4 +628,14 @@ parameters:
-
message: "#^Method SpomkyLabs\\\\PwaBundle\\\\SpomkyLabsPwaBundle\\:\\:loadExtension\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#"
count: 1
path: src/SpomkyLabsPwaBundle.php
path: src/SpomkyLabsPwaBundle.php

-
message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#"
count: 1
path: src/Subscriber/FileCompileEventListener.php

-
message: "#^Attribute class Symfony\\\\Component\\\\DependencyInjection\\\\Attribute\\\\TaggedIterator is deprecated\\: since Symfony 7\\.1, use \\{@see AutowireIterator\\} instead\\.$#"
count: 1
path: src/Subscriber/PwaDevServerSubscriber.php
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ini name="intl.error_level" value="0"/>
<ini name="memory_limit" value="-1"/>
<server name="KERNEL_CLASS" value="SpomkyLabs\PwaBundle\Tests\AppKernel"/>
<server name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
</php>
<source>
<include>
Expand Down
16 changes: 15 additions & 1 deletion templates/Collector/serviceworker-tab.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
</tr>
</thead>
<tbody>
{% for cachingStrategy in collector.cachingStrategies %}
{% for id, cachingStrategy in collector.cachingStrategies %}
<tr>
<td>{{ cachingStrategy.getName() }}</td>
<td class="break-long-words font-normal">
Expand Down Expand Up @@ -163,6 +163,20 @@
{% endif %}
</td>
</tr>
{% if preloadedUrls > 0 %}
<tr>
<td colspan="5">
<div>
<a class="btn btn-link text-small sf-toggle sf-toggle-off" data-toggle-selector="#data-serialize-{{ id }}" data-toggle-alt-content="Hide preloaded URLs" data-toggle-original-content="Show preloaded URLs">
Show preloaded URLs
</a>
<div id="data-serialize-{{ id }}" class="context sf-toggle-content sf-toggle-hidden">
{{ dump(cachingStrategy.preloadUrls) }}
</div>
</div>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
Expand Down

0 comments on commit 664bfa2

Please sign in to comment.