[ci] format
This commit is contained in:
parent
f40065f510
commit
bc5cb85232
1 changed files with 8 additions and 12 deletions
|
@ -58,31 +58,27 @@ export default function tagExportsWithRenderer({
|
||||||
const addTag = (id: string) => {
|
const addTag = (id: string) => {
|
||||||
const tags = state.get('astro:tags') ?? [];
|
const tags = state.get('astro:tags') ?? [];
|
||||||
state.set('astro:tags', [...tags, id]);
|
state.set('astro:tags', [...tags, id]);
|
||||||
}
|
};
|
||||||
|
|
||||||
if (node.type === 'ExportNamedDeclaration' || node.type === 'ExportDefaultDeclaration') {
|
if (node.type === 'ExportNamedDeclaration' || node.type === 'ExportDefaultDeclaration') {
|
||||||
if (t.isIdentifier(node.declaration)) {
|
if (t.isIdentifier(node.declaration)) {
|
||||||
addTag(node.declaration.name);
|
addTag(node.declaration.name);
|
||||||
}
|
} else if (t.isFunctionDeclaration(node.declaration) && node.declaration.id?.name) {
|
||||||
else if (t.isFunctionDeclaration(node.declaration) && node.declaration.id?.name) {
|
|
||||||
addTag(node.declaration.id.name);
|
addTag(node.declaration.id.name);
|
||||||
}
|
} else if (t.isVariableDeclaration(node.declaration)) {
|
||||||
else if (t.isVariableDeclaration(node.declaration)) {
|
node.declaration.declarations?.forEach((declaration) => {
|
||||||
node.declaration.declarations?.forEach(declaration => {
|
|
||||||
if (t.isArrowFunctionExpression(declaration.init) && t.isIdentifier(declaration.id)) {
|
if (t.isArrowFunctionExpression(declaration.init) && t.isIdentifier(declaration.id)) {
|
||||||
addTag(declaration.id.name);
|
addTag(declaration.id.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else if (t.isObjectExpression(node.declaration)) {
|
||||||
else if (t.isObjectExpression(node.declaration)) {
|
node.declaration.properties?.forEach((property) => {
|
||||||
node.declaration.properties?.forEach(property => {
|
|
||||||
if (t.isProperty(property) && t.isIdentifier(property.key)) {
|
if (t.isProperty(property) && t.isIdentifier(property.key)) {
|
||||||
addTag(property.key.name);
|
addTag(property.key.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else if (t.isExportNamedDeclaration(node)) {
|
||||||
else if (t.isExportNamedDeclaration(node)) {
|
node.specifiers.forEach((specifier) => {
|
||||||
node.specifiers.forEach(specifier => {
|
|
||||||
if (t.isExportSpecifier(specifier) && t.isIdentifier(specifier.exported)) {
|
if (t.isExportSpecifier(specifier) && t.isIdentifier(specifier.exported)) {
|
||||||
addTag(specifier.local.name);
|
addTag(specifier.local.name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue