fix @Preview bug

Signed-off-by: houhaoyu <houhaoyu@huawei.com>
Change-Id: I32807fab6bc96ee2d735f6fd985852f952f8d0e9
This commit is contained in:
houhaoyu
2022-03-06 16:17:25 +08:00
parent 7686e2f892
commit f43de76b8a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ function checkPreview(node: ts.ClassDeclaration) {
let hasPreview: boolean = false;
if (node && node.decorators) {
for (let i = 0; i < node.decorators.length; i++) {
const name: string = node.decorators[i].getText().replace(/\((.|\n)*\)/, '').trim();
const name: string = node.decorators[i].getText().replace(/\([^\(\)]*\)/, '').trim();
if (name === COMPONENT_DECORATOR_PREVIEW) {
hasPreview = true;
break;
+1 -1
View File
@@ -271,7 +271,7 @@ function checkDecorators(node: ts.MissingDeclaration | ts.ExportAssignment, resu
let hasComponentDecorator: boolean = false;
const componentName: string = component.getText();
node.decorators.forEach((element) => {
const name: string = element.getText().replace(/\((.|\n)*\)/, '').trim();
const name: string = element.getText().replace(/\([^\(\)]*\)/, '').trim();
if (INNER_COMPONENT_DECORATORS.has(name)) {
componentCollection.customComponents.add(componentName);
switch (name) {