Skip to content

Commit 19fb38b

Browse files
committed
[FrameworkBundle] remove support for preloading ESM using headers
1 parent cf78f12 commit 19fb38b

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Psr\Container\ContainerInterface;
1515
use Psr\Link\EvolvableLinkInterface;
1616
use Psr\Link\LinkInterface;
17-
use Symfony\Component\AssetMapper\ImportMap\ImportMapManager;
1817
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
1918
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
2019
use Symfony\Component\Form\Extension\Core\Type\FormType;
@@ -97,7 +96,6 @@ public static function getSubscribedServices(): array
9796
'security.csrf.token_manager' => '?'.CsrfTokenManagerInterface::class,
9897
'parameter_bag' => '?'.ContainerBagInterface::class,
9998
'web_link.http_header_serializer' => '?'.HttpHeaderSerializer::class,
100-
'asset_mapper.importmap.manager' => '?'.ImportMapManager::class,
10199
];
102100
}
103101

@@ -412,7 +410,7 @@ protected function addLink(Request $request, LinkInterface $link): void
412410
/**
413411
* @param LinkInterface[] $links
414412
*/
415-
protected function sendEarlyHints(iterable $links = [], Response $response = null, bool $preloadJavaScriptModules = false): Response
413+
protected function sendEarlyHints(iterable $links = [], Response $response = null): Response
416414
{
417415
if (!$this->container->has('web_link.http_header_serializer')) {
418416
throw new \LogicException('You cannot use the "sendEarlyHints" method if the WebLink component is not available. Try running "composer require symfony/web-link".');
@@ -421,17 +419,6 @@ protected function sendEarlyHints(iterable $links = [], Response $response = nul
421419
$response ??= new Response();
422420

423421
$populatedLinks = [];
424-
425-
if ($preloadJavaScriptModules) {
426-
if (!$this->container->has('asset_mapper.importmap.manager')) {
427-
throw new \LogicException('You cannot use the JavaScript modules method if the AssetMapper component is not available. Try running "composer require symfony/asset-mapper".');
428-
}
429-
430-
foreach ($this->container->get('asset_mapper.importmap.manager')->getModulesToPreload() as $url) {
431-
$populatedLinks[] = new Link('modulepreload', $url);
432-
}
433-
}
434-
435422
foreach ($links as $link) {
436423
if ($link instanceof EvolvableLinkInterface && !$link->getRels()) {
437424
$link = $link->withRel('preload');

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public function testSubscribedServices()
7474
'security.token_storage' => '?Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface',
7575
'security.csrf.token_manager' => '?Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface',
7676
'web_link.http_header_serializer' => '?Symfony\\Component\\WebLink\\HttpHeaderSerializer',
77-
'asset_mapper.importmap.manager' => '?Symfony\\Component\\AssetMapper\\ImportMap\\ImportMapManager',
7877
];
7978

8079
$this->assertEquals($expectedServices, $subscribed, 'Subscribed core services in AbstractController have changed');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy