jsc-typescript-ast-mcp 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -212,6 +212,8 @@ const isStandardHtmlAttribute = (name) => {
|
|
|
212
212
|
}
|
|
213
213
|
return STANDARD_HTML_ATTRIBUTES.has(normalizedName);
|
|
214
214
|
};
|
|
215
|
+
const normalizeAttributeName = (name) => name.replace(/[-_]/g, '').toLowerCase();
|
|
216
|
+
const matchesAttributeName = (name, target) => normalizeAttributeName(name) === normalizeAttributeName(target);
|
|
215
217
|
const extractPropValue = (attribute) => {
|
|
216
218
|
const initializer = attribute.getInitializer();
|
|
217
219
|
if (!initializer) {
|
|
@@ -247,7 +249,7 @@ export const extractPropsFromNode = (node, excludedAttributeName) => {
|
|
|
247
249
|
if (Node.isJsxAttribute(attribute)) {
|
|
248
250
|
const attributeName = attribute.getNameNode().getText();
|
|
249
251
|
const isExcludedDataIdAttribute = excludedAttributeName !== undefined &&
|
|
250
|
-
attributeName
|
|
252
|
+
matchesAttributeName(attributeName, excludedAttributeName);
|
|
251
253
|
if (isStandardHtmlAttribute(attributeName) || isExcludedDataIdAttribute) {
|
|
252
254
|
continue;
|
|
253
255
|
}
|
|
@@ -268,7 +270,7 @@ export const extractAttributeValueFromNode = (node, attributeName) => {
|
|
|
268
270
|
? node.getOpeningElement().getAttributes()
|
|
269
271
|
: node.getAttributes();
|
|
270
272
|
const matchedAttribute = attributes.find((attribute) => Node.isJsxAttribute(attribute) &&
|
|
271
|
-
attribute.getNameNode().getText()
|
|
273
|
+
matchesAttributeName(attribute.getNameNode().getText(), attributeName));
|
|
272
274
|
if (!matchedAttribute || !Node.isJsxAttribute(matchedAttribute)) {
|
|
273
275
|
return undefined;
|
|
274
276
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsc-typescript-ast-mcp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"mcpName": "io.github.jscoobyced/jsc-typescript-ast-mcp",
|
|
5
5
|
"description": "A Model Context Protocol (MCP) server that provides an abstract syntax tree (AST) representation of TypeScript code using the ts-morph library. It allows clients to analyze and manipulate TypeScript code structures, making it easier for AI models to understand and work with TypeScript projects. You can create a JSON representation of your React components, and use it for various purposes such as documentation, code analysis, or even generating new code based on existing components.",
|
|
6
6
|
"main": "dist/index.js",
|