File tree Expand file tree Collapse file tree 2 files changed +4
-33
lines changed Expand file tree Collapse file tree 2 files changed +4
-33
lines changed Original file line number Diff line number Diff line change 3030 },
3131 "importmap" : {
3232 "@hotwired/stimulus" : " ^3.0.0" ,
33- "@simplewebauthn/browser" : " ^13.2.0"
33+ "@simplewebauthn/browser" : " ^13.2.0" ,
34+ "@web-auth/webauthn-stimulus/webauthn" : " path:%PACKAGE%/src/controller.js" ,
35+ "@web-auth/webauthn-stimulus/authentication" : " path:%PACKAGE%/src/authentication-controller.js" ,
36+ "@web-auth/webauthn-stimulus/registration" : " path:%PACKAGE%/src/registration-controller.js"
3437 }
3538 },
3639 "peerDependencies" : {
Original file line number Diff line number Diff line change 44
55namespace Webauthn \Stimulus ;
66
7- use Symfony \Component \AssetMapper \AssetMapperInterface ;
8- use Symfony \Component \DependencyInjection \ContainerBuilder ;
9- use Symfony \Component \DependencyInjection \Loader \Configurator \ContainerConfigurator ;
107use Symfony \Component \HttpKernel \Bundle \AbstractBundle ;
118
129final class WebauthnStimulusBundle extends AbstractBundle
1310{
14- public function prependExtension (ContainerConfigurator $ container , ContainerBuilder $ builder ): void
15- {
16- if (! $ this ->isAssetMapperAvailable ($ builder )) {
17- return ;
18- }
19-
20- $ builder ->prependExtensionConfig ('framework ' , [
21- 'asset_mapper ' => [
22- 'paths ' => [
23- dirname (__DIR__ ) . '/assets/src ' => '@web-auth/webauthn-stimulus ' ,
24- ],
25- ],
26- ]);
27- }
28-
29- private function isAssetMapperAvailable (ContainerBuilder $ container ): bool
30- {
31- if (! interface_exists (AssetMapperInterface::class)) {
32- return false ;
33- }
34-
35- // check that FrameworkBundle is installed
36- $ bundlesMetadata = $ container ->getParameter ('kernel.bundles_metadata ' );
37- if (! isset ($ bundlesMetadata ['FrameworkBundle ' ])) {
38- return false ;
39- }
40-
41- return is_file ($ bundlesMetadata ['FrameworkBundle ' ]['path ' ] . '/Resources/config/asset_mapper.php ' );
42- }
4311}
You can’t perform that action at this time.
0 commit comments