@@ -10,7 +10,19 @@ export default function getApplicableDirectives(babel, path, directives) {
1010 if ( t . isJSXSpreadAttribute ( attribute . node ) ) {
1111 return null ;
1212 }
13- return attribute . get ( 'name.name' ) . node ;
13+
14+ if ( t . isJSXNamespacedName ( attribute . get ( 'name' ) ) ) {
15+ return {
16+ name : attribute . get ( 'name.name.name' ) . node ,
17+ as : attribute . get ( 'name.namespace.name' ) . node ,
18+ value : attribute . get ( 'value' ) . node ,
19+ } ;
20+ }
21+
22+ return {
23+ name : attribute . get ( 'name.name' ) . node ,
24+ value : attribute . get ( 'value' ) . node ,
25+ } ;
1426 } ) . filter ( a => a ) ;
1527
1628 return directives . reduce (
@@ -32,7 +44,7 @@ export default function getApplicableDirectives(babel, path, directives) {
3244 name === directiveName
3345 ) || (
3446 viaAttribute &&
35- attributes . indexOf ( directiveName ) !== - 1
47+ attributes . map ( ( { name : n } ) => n ) . indexOf ( directiveName ) !== - 1
3648 )
3749 ) {
3850 const directive = {
@@ -43,11 +55,9 @@ export default function getApplicableDirectives(babel, path, directives) {
4355 } ;
4456
4557 if ( viaAttribute ) {
46- const options = path . get ( 'attributes' ) . find ( ( attribute ) => {
47- return ! t . isJSXSpreadAttribute ( attribute . node ) &&
48- attribute . get ( 'name.name' ) . node === directiveName ;
49- } ) . get ( 'value' ) . node ;
58+ const { value : options , as } = attributes . find ( ( { name : n } ) => n === directiveName ) ;
5059
60+ directive . as = as ;
5161 directive . options = transformOptions
5262 ? transformOptions ( babel , options )
5363 : options ;
0 commit comments