File tree Expand file tree Collapse file tree 4 files changed +127
-477
lines changed
lib/styles/context/vue-components Expand file tree Collapse file tree 4 files changed +127
-477
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ function getVueComponentObject(
1818 if ( declaration . type === "ObjectExpression" ) {
1919 return declaration
2020 }
21- if ( declaration . type === "CallExpression" ) {
21+ if (
22+ declaration . type === "CallExpression" &&
23+ declaration . arguments . length >= 1
24+ ) {
2225 const callee = declaration . callee
2326
2427 if ( callee . type === "MemberExpression" ) {
@@ -28,9 +31,20 @@ function getVueComponentObject(
2831 calleeObject . type === "Identifier" &&
2932 calleeObject . name === "Vue" &&
3033 callee . property . type === "Identifier" &&
31- callee . property . name === "extend" &&
32- declaration . arguments . length >= 1
34+ callee . property . name === "extend"
3335 ) {
36+ // for Vue.js 2.x
37+ // Vue.extend({})
38+ const object = unwrapTypesExpression ( declaration . arguments [ 0 ] )
39+ if ( object . type === "ObjectExpression" ) {
40+ return object
41+ }
42+ }
43+ }
44+ if ( callee . type === "Identifier" ) {
45+ if ( callee . name === "defineComponent" ) {
46+ // for Vue.js 3.x
47+ // defineComponent({})
3448 const object = unwrapTypesExpression ( declaration . arguments [ 0 ] )
3549 if ( object . type === "ObjectExpression" ) {
3650 return object
You can’t perform that action at this time.
0 commit comments