Skip to content

Commit c037b32

Browse files
committed
feat: support vue-property-decorator
1 parent 825f78f commit c037b32

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/utils/handle_file_utils.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ async function getFuncTree (files: string[], options?: GetTreeOptions): Promise<
107107
}
108108
} else if (allFunctionBelongToCurrentFile.includes(fn)) { // the called function is defined in this file
109109
allFuncsInfo[currentFnName]['calledFnFrom'][fn] = {
110-
filePath: file,
110+
filePath: allFuncsInfo[fn].filePath,
111111
position: allFuncsInfo[fn].position
112112
};
113113
} else {
@@ -430,6 +430,28 @@ function getMixin (jsAst: any) {
430430
return ele.name;
431431
});
432432
}
433+
return false;
434+
},
435+
436+
// for vue-property-decorator
437+
visitExportDefaultDeclaration (node) {
438+
const decorators = node.value.declaration?.decorators || [];
439+
for (const decorator of decorators) {
440+
if (!decorator.expression || !decorator.expression.callee || decorator.expression.callee.name !== 'Component') continue;
441+
442+
const decoratorArguments = decorator.expression?.arguments || [];
443+
for (const argumentItem of decoratorArguments) {
444+
for (const propertyItem of argumentItem.properties) {
445+
if (propertyItem.key.name !== 'mixins') continue;
446+
447+
const elements = propertyItem.value?.elements || [];
448+
elements.forEach((ele: any) => {
449+
ele.name && list.push(ele.name);
450+
});
451+
}
452+
}
453+
}
454+
433455
return false;
434456
}
435457
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy