diff --git a/src/stimulus/assets/package.json b/src/stimulus/assets/package.json index f394c99a..ab18d7c6 100644 --- a/src/stimulus/assets/package.json +++ b/src/stimulus/assets/package.json @@ -30,7 +30,10 @@ }, "importmap": { "@hotwired/stimulus": "^3.0.0", - "@simplewebauthn/browser": "^13.2.0" + "@simplewebauthn/browser": "^13.2.0", + "@web-auth/webauthn-stimulus/webauthn": "path:%PACKAGE%/src/controller.js", + "@web-auth/webauthn-stimulus/authentication": "path:%PACKAGE%/src/authentication-controller.js", + "@web-auth/webauthn-stimulus/registration": "path:%PACKAGE%/src/registration-controller.js" } }, "peerDependencies": { diff --git a/src/stimulus/src/WebauthnStimulusBundle.php b/src/stimulus/src/WebauthnStimulusBundle.php index e5fe2baf..ae5e3f0a 100644 --- a/src/stimulus/src/WebauthnStimulusBundle.php +++ b/src/stimulus/src/WebauthnStimulusBundle.php @@ -4,40 +4,8 @@ namespace Webauthn\Stimulus; -use Symfony\Component\AssetMapper\AssetMapperInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\HttpKernel\Bundle\AbstractBundle; final class WebauthnStimulusBundle extends AbstractBundle { - public function prependExtension(ContainerConfigurator $container, ContainerBuilder $builder): void - { - if (! $this->isAssetMapperAvailable($builder)) { - return; - } - - $builder->prependExtensionConfig('framework', [ - 'asset_mapper' => [ - 'paths' => [ - dirname(__DIR__) . '/assets/src' => '@web-auth/webauthn-stimulus', - ], - ], - ]); - } - - private function isAssetMapperAvailable(ContainerBuilder $container): bool - { - if (! interface_exists(AssetMapperInterface::class)) { - return false; - } - - // check that FrameworkBundle is installed - $bundlesMetadata = $container->getParameter('kernel.bundles_metadata'); - if (! isset($bundlesMetadata['FrameworkBundle'])) { - return false; - } - - return is_file($bundlesMetadata['FrameworkBundle']['path'] . '/Resources/config/asset_mapper.php'); - } }