-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathservices.php
84 lines (73 loc) · 3.44 KB
/
services.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\UX\StimulusBundle\AssetMapper\AutoImportLocator;
use Symfony\UX\StimulusBundle\AssetMapper\ControllersMapGenerator;
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;
use function Symfony\Component\DependencyInjection\Loader\Configurator\abstract_arg;
use function Symfony\Component\DependencyInjection\Loader\Configurator\param;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
return static function (ContainerConfigurator $container): void {
$container->services()
->set('stimulus.helper', StimulusHelper::class)
->args([
service(Environment::class)->nullOnInvalid(),
])
->set('stimulus.twig_extension', StimulusTwigExtension::class)
->args([
service('stimulus.helper'),
])
// negative priority actually causes the stimulus_ functions from this
// bundle to be used instead of the ones from WebpackEncoreBundle.
->tag('twig.extension', ['priority' => -10])
->set('stimulus.asset_mapper.ux_package_reader', UxPackageReader::class)
->args([
param('kernel.project_dir'),
])
// 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([
service('asset_mapper'),
service('stimulus.asset_mapper.ux_package_reader'),
abstract_arg('controller paths'),
abstract_arg('controllers_json_path'),
// @legacy - only allowing null for framework-bundle 6.3
service('stimulus.asset_mapper.auto_import_locator')->nullOnInvalid(),
])
// @legacy - is removed in 6.3
->set('stimulus.asset_mapper.auto_import_locator', AutoImportLocator::class)
->args([
service('asset_mapper.importmap.config_reader'),
service('asset_mapper'),
])
->set('stimulus.asset_mapper.loader_javascript_compiler', StimulusLoaderJavaScriptCompiler::class)
->args([
service('stimulus.asset_mapper.controllers_map_generator'),
param('kernel.debug'),
])
->tag('asset_mapper.compiler', ['priority' => 100])
;
};