Skip to main content
Glama
push-based

Angular Toolkit MCP

by push-based
ts.walk.ts•1.15 kB
import * as ts from 'typescript'; import { getDecorators, isDecorator } from 'typescript'; /** * Visits all decorators in a given class. */ export function visitAngularDecorators( node: ts.Node, visitor: (decorator: ts.Decorator) => void, ) { const decorators = getDecorators(node as ts.HasDecorators); if (!decorators?.length) return; decorators.forEach((decorator: ts.Decorator) => { if (!isDecorator(decorator)) return; visitor(decorator); }); } // đź‘€ visit every decorator // âś” in visitor use `isDecorator`or `isComponentDecorator` /** * Visits all properties inside a Angular decorator. e.g. @Component() */ export function visitAngularDecoratorProperties( decorator: ts.Decorator, visitor: (node: ts.PropertyAssignment) => void, ) { if (!ts.isCallExpression(decorator.expression)) { return; } const args = decorator.expression.arguments; if (!args?.length || !ts.isObjectLiteralExpression(args[0])) { return; } args[0].properties.forEach((prop: ts.ObjectLiteralElementLike) => { if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name)) return; visitor(prop); }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/push-based/angular-toolkit-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server