Skip to content

Commit 4d7c777

Browse files
authored
fix: update asset imports and remove unused asset mapper configuration (#772)
1 parent 008fbe1 commit 4d7c777

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

src/stimulus/assets/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
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": {

src/stimulus/src/WebauthnStimulusBundle.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,8 @@
44

55
namespace Webauthn\Stimulus;
66

7-
use Symfony\Component\AssetMapper\AssetMapperInterface;
8-
use Symfony\Component\DependencyInjection\ContainerBuilder;
9-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
107
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
118

129
final 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
}

0 commit comments

Comments
 (0)