services:
    pentatrion_vite.entrypoints_lookup_collection:
        class: Pentatrion\ViteBundle\Service\EntrypointsLookupCollection

    Pentatrion\ViteBundle\Service\EntrypointsLookupCollection:
        alias: pentatrion_vite.entrypoints_lookup_collection

    pentatrion_vite.entrypoint_renderer:
        class: Pentatrion\ViteBundle\Service\EntrypointRenderer
        tags:
            - { name: "kernel.reset", method: reset }
        arguments:
            - "@pentatrion_vite.entrypoints_lookup_collection"
            - "@pentatrion_vite.tag_renderer_collection"
            - "%pentatrion_vite.default_config%"
            - "%pentatrion_vite.absolute_url%"
            - "@?request_stack"
            - "@?event_dispatcher"

    Pentatrion\ViteBundle\Service\EntrypointRenderer:
        alias: "pentatrion_vite.entrypoint_renderer"

    pentatrion_vite.tag_renderer_collection:
        class: Pentatrion\ViteBundle\Service\TagRendererCollection

    Pentatrion\ViteBundle\Service\TagRendererCollection:
        alias: pentatrion_vite.tag_renderer_collection


    pentatrion_vite.twig_type_extension:
        class: Pentatrion\ViteBundle\Twig\TypeExtension
        tags: ["twig.extension"]

    pentatrion_vite.twig_entry_files_extension:
        class: Pentatrion\ViteBundle\Twig\EntryFilesTwigExtension
        tags: ["twig.extension"]
        arguments:
            - "@pentatrion_vite.entrypoint_renderer"

    Pentatrion\ViteBundle\DataCollector\ViteCollector:
        tags:
            - { name: "data_collector", id: pentatrion_vite.vite_collector }
        arguments:
            - "@pentatrion_vite.entrypoint_renderer"

    Pentatrion\ViteBundle\Service\Debug:
        alias: pentatrion_vite.debug

    pentatrion_vite.debug:
        class: Pentatrion\ViteBundle\Service\Debug
        arguments:
            - "%pentatrion_vite.configs%"
            - "@http_client"
            - "@pentatrion_vite.entrypoints_lookup_collection"
            - "%pentatrion_vite.proxy_origin%"

    Pentatrion\ViteBundle\Controller\ViteController:
        tags: ["controller.service_arguments"]
        arguments:
            - "%pentatrion_vite.default_config%"
            - "@http_client"
            - "@pentatrion_vite.entrypoints_lookup_collection"
            - "%pentatrion_vite.proxy_origin%"

    Pentatrion\ViteBundle\Controller\ProfilerController:
        tags: ["controller.service_arguments"]
        arguments:
            - "@pentatrion_vite.debug"
            - "@twig"

    Pentatrion\ViteBundle\Asset\ViteAssetVersionStrategy:
        arguments:
            - "@pentatrion_vite.file_accessor"
            - "%pentatrion_vite.default_config%"
            - "%pentatrion_vite.absolute_url%"
            - "@?request_stack"
            - "%pentatrion_vite.throw_on_missing_asset%"

    pentatrion_vite.preload_assets_event_listener:
        class: Pentatrion\ViteBundle\EventListener\PreloadAssetsEventListener
        tags: ["kernel.event_subscriber"]
        arguments:
            - "@pentatrion_vite.entrypoint_renderer"

    pentatrion_vite.file_accessor:
        class: Pentatrion\ViteBundle\Service\FileAccessor
        arguments:
            - "%kernel.project_dir%%pentatrion_vite.public_directory%"
            - "%pentatrion_vite.configs%"
            - null

    pentatrion_vite.cache:
        class: Symfony\Component\Cache\Adapter\PhpArrayAdapter
        factory: [Symfony\Component\Cache\Adapter\PhpArrayAdapter, create]
        arguments:
            - "%kernel.cache_dir%/pentatrion_vite.cache.php"
            - "@cache.pentatrion_vite_fallback"

    pentatrion_vite.cache_warmer:
        class: Pentatrion\ViteBundle\CacheWarmer\EntrypointsCacheWarmer
        tags: ["kernel.cache_warmer"]
        arguments:
            - "%kernel.project_dir%%pentatrion_vite.public_directory%"
            - "%pentatrion_vite.configs%"
            - "%kernel.cache_dir%/pentatrion_vite.cache.php"

    cache.pentatrion_vite_fallback:
        tags: ["cache.pool"]
        parent: cache.system
