Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UPGRADE-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class MyLiveComponent {
* Options `authReferrerPolicy`, `mapIds`, `channel`, `solutionChannel` have been added
* Options `ìd`, `nonce`, `retries`, `url` have been removed

## StimulusBundle

* The Twig function `ux_controller_link_tags()` has been removed, which requires Symfony AssetMapper >=6.4,
run `composer require symfony/asset-mapper:>=6.4` if you don't have it installed yet.

## Swup

* The package has been removed, see the [previous README](https://raw.githubusercontent.com/symfony/ux/refs/heads/2.x/src/Turbo/README.md)
Expand Down
1 change: 1 addition & 0 deletions src/StimulusBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Minimum required Symfony version is now 6.4
- Minimum required PHP version is now 8.2
- Remove Twig function `ux_controller_link_tags()`, which requires Symfony AssetMapper >=6.4

## 2.30

Expand Down
3 changes: 3 additions & 0 deletions src/StimulusBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"twig/twig": "^2.15.3|^3.8",
"symfony/deprecation-contracts": "^2.0|^3.0"
},
"conflict": {
"symfony/asset-mapper": "<6.4"
},
"require-dev": {
"symfony/asset-mapper": "^6.4|^7.0|^8.0",
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
Expand Down
13 changes: 0 additions & 13 deletions src/StimulusBundle/config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
use Symfony\UX\StimulusBundle\AssetMapper\StimulusLoaderJavaScriptCompiler;
use Symfony\UX\StimulusBundle\Helper\StimulusHelper;
use Symfony\UX\StimulusBundle\Twig\StimulusTwigExtension;
use Symfony\UX\StimulusBundle\Twig\UxControllersTwigExtension;
use Symfony\UX\StimulusBundle\Twig\UxControllersTwigRuntime;
use Symfony\UX\StimulusBundle\Ux\UxPackageReader;
use Twig\Environment;

Expand Down Expand Up @@ -45,17 +43,6 @@
])

// symfony/asset-mapper services
->set('stimulus.ux_controllers_twig_extension', UxControllersTwigExtension::class)
->tag('twig.extension')

->set('stimulus.ux_controllers_twig_runtime', UxControllersTwigRuntime::class)
->args([
service('stimulus.asset_mapper.controllers_map_generator'),
service('asset_mapper'),
service('stimulus.asset_mapper.ux_package_reader'),
param('kernel.project_dir'),
])
->tag('twig.runtime')

->set('stimulus.asset_mapper.controllers_map_generator', ControllersMapGenerator::class)
->args([
Expand Down
4 changes: 0 additions & 4 deletions src/StimulusBundle/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,6 @@ will import all your custom controllers as well as those from ``controllers.json
It will also dynamically enable "debug" mode in Stimulus when your application
is running in debug mode.

.. tip::

For AssetMapper 6.3 only, you also need a ``{{ ux_controller_link_tags() }}``
in ``base.html.twig``. This is not needed in AssetMapper 6.4+.

With WebpackEncoreBundle
~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class RemoveAssetMapperServicesCompiler implements CompilerPassInterface
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('asset_mapper')) {
$container->removeDefinition('stimulus.ux_controllers_twig_runtime');
$container->removeDefinition('stimulus.asset_mapper.controllers_map_generator');
$container->removeDefinition('stimulus.asset_mapper.loader_javascript_compiler');
}
Expand Down
30 changes: 0 additions & 30 deletions src/StimulusBundle/src/Twig/UxControllersTwigExtension.php

This file was deleted.

171 changes: 0 additions & 171 deletions src/StimulusBundle/src/Twig/UxControllersTwigRuntime.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@

class AutoImportLocatorTest extends TestCase
{
protected function setUp(): void
{
if (!class_exists(ImportMapConfigReader::class)) {
$this->markTestSkipped('Test requires AssetMapper >= 6.4.');
}
}

public function testLocateAutoImportCanHandleAssetMapperPath()
{
$assetMapper = $this->createMock(AssetMapperInterface::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use PHPUnit\Framework\TestCase;
use Symfony\Component\AssetMapper\AssetMapperInterface;
use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader;
use Symfony\Component\AssetMapper\MappedAsset;
use Symfony\UX\StimulusBundle\AssetMapper\AutoImportLocator;
use Symfony\UX\StimulusBundle\AssetMapper\ControllersMapGenerator;
Expand Down Expand Up @@ -54,17 +53,11 @@ public function testGetControllersMap()
$packageReader = new UxPackageReader(__DIR__.'/../fixtures');

$autoImportLocator = $this->createMock(AutoImportLocator::class);
if (class_exists(ImportMapConfigReader::class)) {
$autoImportLocator->expects($this->any())
->method('locateAutoImport')
->willReturnCallback(function ($path) {
return new MappedControllerAutoImport('/path/to'.$path, false);
});
} else {
// @legacy for AssetMapper 6.3
$autoImportLocator->expects($this->never())
->method('locateAutoImport');
}
$autoImportLocator->expects($this->any())
->method('locateAutoImport')
->willReturnCallback(function ($path) {
return new MappedControllerAutoImport('/path/to'.$path, false);
});

$generator = new ControllersMapGenerator(
$mapper,
Expand Down Expand Up @@ -106,11 +99,7 @@ public function testGetControllersMap()
$this->assertSame('fake-vendor/ux-package1/package-controller-second.js', $controllerSecond->asset->logicalPath);
// lazy from user's controller.json
$this->assertTrue($controllerSecond->isLazy);
// @legacy: assert can be without the conditional for AssetMapper 6.4+
if (class_exists(ImportMapConfigReader::class)) {
// 4 auto imports from package.json
$this->assertCount(4, $controllerSecond->autoImports);
}
$this->assertCount(4, $controllerSecond->autoImports);

$helloControllerFromPackage = $map['fake-vendor--ux-package2--hello-controller'];
$this->assertSame('fake-vendor/ux-package2/package-hello-controller.js', $helloControllerFromPackage->asset->logicalPath);
Expand Down
Loading
Loading