@@ -390,12 +390,8 @@ function matchRegular(path, ctx) {
390390 args . length === 2 && t . isLiteral ( args [ 0 ] ) && is . string ( args [ 0 ] . value ) && argPaths [ 1 ] ) ;
391391
392392 if ( method . name === "component" ) {
393- const controllers = target . get ( "properties" ) . filter ( prop => prop . node . key . name == "controller" ) ;
394- if ( controllers . length === 1 ) {
395- target = controllers [ 0 ] . get ( "value" ) ;
396- } else {
397- return false ;
398- }
393+ target . node . $chained = chainedRegular ;
394+ return matchComponent ( target ) ;
399395 }
400396
401397 if ( target ) {
@@ -453,6 +449,34 @@ function matchResolve(props) {
453449 return [ ] ;
454450}
455451
452+ function matchComponent ( path ) {
453+ let chained = path . node . $chained ;
454+ if ( t . isIdentifier ( path ) ) {
455+ path = followReference ( path ) ;
456+ if ( t . isVariableDeclarator ( path ) ) {
457+ path = path . get ( 'init' ) ;
458+ }
459+ }
460+ if ( t . isObjectExpression ( path ) ) {
461+ path . node . chained = chained ;
462+ const props = path . get ( "properties" ) ;
463+
464+ const ctrl = matchProp ( "controller" , props ) ;
465+ const tmpl = matchProp ( "template" , props ) ;
466+ const tmplUrl = matchProp ( "templateUrl" , props ) ;
467+
468+ let res = [ ] ;
469+ ctrl && res . push ( ctrl ) ;
470+ tmpl && res . push ( tmpl ) ;
471+ tmplUrl && res . push ( tmplUrl ) ;
472+
473+ res . forEach ( t => t . node . $chained = chained ) ;
474+ return res ;
475+ } else {
476+ return false ;
477+ }
478+ }
479+
456480function renamedString ( ctx , originalString ) {
457481 if ( ctx . rename ) {
458482 return ctx . rename . get ( originalString ) || originalString ;
0 commit comments