sniff-qa 0.2.0
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.
- package/LICENSE +172 -0
- package/README.md +581 -0
- package/dist/accessibility-UNJB57T6.js +93 -0
- package/dist/accessibility-UNJB57T6.js.map +1 -0
- package/dist/anthropic-api-MRDZ7BJA.js +33 -0
- package/dist/anthropic-api-MRDZ7BJA.js.map +1 -0
- package/dist/chunk-623BAIU2.js +73 -0
- package/dist/chunk-623BAIU2.js.map +1 -0
- package/dist/chunk-CBDOJUXB.js +157 -0
- package/dist/chunk-CBDOJUXB.js.map +1 -0
- package/dist/chunk-IXDUD2UG.js +14 -0
- package/dist/chunk-IXDUD2UG.js.map +1 -0
- package/dist/chunk-MMISGY2Q.js +52 -0
- package/dist/chunk-MMISGY2Q.js.map +1 -0
- package/dist/chunk-ZM6MGWO4.js +49 -0
- package/dist/chunk-ZM6MGWO4.js.map +1 -0
- package/dist/ci-2MVD2ISE.js +52 -0
- package/dist/ci-2MVD2ISE.js.map +1 -0
- package/dist/claude-code-F722EIIC.js +42 -0
- package/dist/claude-code-F722EIIC.js.map +1 -0
- package/dist/claude-exploration-provider-QJH6IPYU.js +126 -0
- package/dist/claude-exploration-provider-QJH6IPYU.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +72 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cross-reference-MHNPSLEN.js +218 -0
- package/dist/cross-reference-MHNPSLEN.js.map +1 -0
- package/dist/element-extractor-OZTFBVKZ.js +250 -0
- package/dist/element-extractor-OZTFBVKZ.js.map +1 -0
- package/dist/errors-RFEOR527.js +7 -0
- package/dist/errors-RFEOR527.js.map +1 -0
- package/dist/flakiness-OVC7KGN2.js +11 -0
- package/dist/flakiness-OVC7KGN2.js.map +1 -0
- package/dist/formatter-HC3LT3VH.js +146 -0
- package/dist/formatter-HC3LT3VH.js.map +1 -0
- package/dist/framework-detector-ISSM2Q2I.js +95 -0
- package/dist/framework-detector-ISSM2Q2I.js.map +1 -0
- package/dist/generator-OZY3HMJW.js +7 -0
- package/dist/generator-OZY3HMJW.js.map +1 -0
- package/dist/index.d.ts +212 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/init-75MMIW4A.js +66 -0
- package/dist/init-75MMIW4A.js.map +1 -0
- package/dist/json-YDWEB33Q.js +8 -0
- package/dist/json-YDWEB33Q.js.map +1 -0
- package/dist/junit-GL44ATRR.js +52 -0
- package/dist/junit-GL44ATRR.js.map +1 -0
- package/dist/loader-QII5CZSX.js +161 -0
- package/dist/loader-QII5CZSX.js.map +1 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.js +171 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/model-SRPWXU63.js +92 -0
- package/dist/model-SRPWXU63.js.map +1 -0
- package/dist/page-hooks-DOZWXF7Z.js +13 -0
- package/dist/page-hooks-DOZWXF7Z.js.map +1 -0
- package/dist/page-state-extractor-GYYLYRFR.js +75 -0
- package/dist/page-state-extractor-GYYLYRFR.js.map +1 -0
- package/dist/performance-FBUGBRB3.js +134 -0
- package/dist/performance-FBUGBRB3.js.map +1 -0
- package/dist/persistence-RHUFBQAY.js +86 -0
- package/dist/persistence-RHUFBQAY.js.map +1 -0
- package/dist/prompt-builder-D3FBH534.js +53 -0
- package/dist/prompt-builder-D3FBH534.js.map +1 -0
- package/dist/provider-7IHXYR6V.js +13 -0
- package/dist/provider-7IHXYR6V.js.map +1 -0
- package/dist/registry-NB5CZB6W.js +43 -0
- package/dist/registry-NB5CZB6W.js.map +1 -0
- package/dist/repo-analyzer-4OURSITY.js +49 -0
- package/dist/repo-analyzer-4OURSITY.js.map +1 -0
- package/dist/report-E2JZMQED.js +61 -0
- package/dist/report-E2JZMQED.js.map +1 -0
- package/dist/response-parser-PUGNWF7S.js +46 -0
- package/dist/response-parser-PUGNWF7S.js.map +1 -0
- package/dist/route-discoverer-QBZCRQLJ.js +304 -0
- package/dist/route-discoverer-QBZCRQLJ.js.map +1 -0
- package/dist/runner-MS2SNTMR.js +153 -0
- package/dist/runner-MS2SNTMR.js.map +1 -0
- package/dist/runner-Z4I2YVVM.js +237 -0
- package/dist/runner-Z4I2YVVM.js.map +1 -0
- package/dist/source-D5KLH46F.js +896 -0
- package/dist/source-D5KLH46F.js.map +1 -0
- package/dist/unified-CQU7PSNJ.js +275 -0
- package/dist/unified-CQU7PSNJ.js.map +1 -0
- package/dist/update-baselines-MDTCFO2U.js +71 -0
- package/dist/update-baselines-MDTCFO2U.js.map +1 -0
- package/dist/visual-ZSQPDE7A.js +125 -0
- package/dist/visual-ZSQPDE7A.js.map +1 -0
- package/dist/workflow-template-3KFPCVIC.js +119 -0
- package/dist/workflow-template-3KFPCVIC.js.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
// src/analyzers/element-extractor.ts
|
|
2
|
+
import { readFile } from "fs/promises";
|
|
3
|
+
import { relative } from "path";
|
|
4
|
+
import { parse as babelParse } from "@babel/parser";
|
|
5
|
+
import _traverse from "@babel/traverse";
|
|
6
|
+
var traverse = typeof _traverse === "function" ? _traverse : _traverse.default;
|
|
7
|
+
var INTERACTIVE_TAGS = /* @__PURE__ */ new Set([
|
|
8
|
+
"form",
|
|
9
|
+
"button",
|
|
10
|
+
"a",
|
|
11
|
+
"input",
|
|
12
|
+
"select",
|
|
13
|
+
"textarea"
|
|
14
|
+
]);
|
|
15
|
+
var ATTR_MAP = {
|
|
16
|
+
"data-testid": "testId",
|
|
17
|
+
"id": "id",
|
|
18
|
+
"name": "name",
|
|
19
|
+
"aria-label": "ariaLabel",
|
|
20
|
+
"role": "role",
|
|
21
|
+
"type": "type",
|
|
22
|
+
"href": "href"
|
|
23
|
+
};
|
|
24
|
+
async function extractElements(filePaths, rootDir) {
|
|
25
|
+
const allElements = [];
|
|
26
|
+
const allComponents = [];
|
|
27
|
+
for (let i = 0; i < filePaths.length; i += 50) {
|
|
28
|
+
const batch = filePaths.slice(i, i + 50);
|
|
29
|
+
const batchResults = await Promise.all(
|
|
30
|
+
batch.map((filePath) => processFile(filePath, rootDir))
|
|
31
|
+
);
|
|
32
|
+
for (const result of batchResults) {
|
|
33
|
+
allElements.push(...result.elements);
|
|
34
|
+
if (result.component) {
|
|
35
|
+
allComponents.push(result.component);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return { elements: allElements, components: allComponents };
|
|
40
|
+
}
|
|
41
|
+
async function processFile(filePath, rootDir) {
|
|
42
|
+
try {
|
|
43
|
+
const content = await readFile(filePath, "utf-8");
|
|
44
|
+
const relPath = relative(rootDir, filePath);
|
|
45
|
+
if (filePath.endsWith(".vue")) {
|
|
46
|
+
return processVueFile(content, relPath);
|
|
47
|
+
}
|
|
48
|
+
return processJSXFile(content, relPath);
|
|
49
|
+
} catch {
|
|
50
|
+
return { elements: [], component: null };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function getJSXAttrValue(attr) {
|
|
54
|
+
if (!attr.value) return void 0;
|
|
55
|
+
if (attr.value.type === "StringLiteral") return attr.value.value;
|
|
56
|
+
if (attr.value.type === "JSXExpressionContainer" && attr.value.expression.type === "StringLiteral") {
|
|
57
|
+
return attr.value.expression.value;
|
|
58
|
+
}
|
|
59
|
+
return void 0;
|
|
60
|
+
}
|
|
61
|
+
function extractTextFromJSXElement(path) {
|
|
62
|
+
const parent = path.parent;
|
|
63
|
+
if (parent.type !== "JSXElement") return void 0;
|
|
64
|
+
const texts = [];
|
|
65
|
+
for (const child of parent.children) {
|
|
66
|
+
if (child.type === "JSXText") {
|
|
67
|
+
const trimmed = child.value.trim();
|
|
68
|
+
if (trimmed) texts.push(trimmed);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return texts.length > 0 ? texts.join(" ") : void 0;
|
|
72
|
+
}
|
|
73
|
+
function processJSXFile(content, relPath) {
|
|
74
|
+
try {
|
|
75
|
+
const ast = babelParse(content, {
|
|
76
|
+
sourceType: "module",
|
|
77
|
+
plugins: ["typescript", "jsx"]
|
|
78
|
+
});
|
|
79
|
+
const elements = [];
|
|
80
|
+
const namedExports = [];
|
|
81
|
+
let defaultExportName;
|
|
82
|
+
let hasDefaultExport = false;
|
|
83
|
+
traverse(ast, {
|
|
84
|
+
JSXOpeningElement(path) {
|
|
85
|
+
const node = path.node;
|
|
86
|
+
const tagName = node.name.type === "JSXIdentifier" ? node.name.name : null;
|
|
87
|
+
if (!tagName || !INTERACTIVE_TAGS.has(tagName)) return;
|
|
88
|
+
const info = {
|
|
89
|
+
tag: tagName,
|
|
90
|
+
filePath: relPath,
|
|
91
|
+
line: node.loc?.start.line ?? 0
|
|
92
|
+
};
|
|
93
|
+
for (const attr of node.attributes) {
|
|
94
|
+
if (attr.type !== "JSXAttribute" || attr.name.type !== "JSXIdentifier") continue;
|
|
95
|
+
const attrName = attr.name.name;
|
|
96
|
+
const fullName = attr.name.type === "JSXIdentifier" ? attr.name.name : void 0;
|
|
97
|
+
if (!fullName) continue;
|
|
98
|
+
const mappedKey = ATTR_MAP[fullName];
|
|
99
|
+
if (mappedKey) {
|
|
100
|
+
const val = getJSXAttrValue(attr);
|
|
101
|
+
if (val !== void 0) {
|
|
102
|
+
info[mappedKey] = val;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
for (const attr of node.attributes) {
|
|
107
|
+
if (attr.type !== "JSXAttribute" || attr.name.type !== "JSXNamespacedName") continue;
|
|
108
|
+
const ns = attr.name.namespace.name;
|
|
109
|
+
const name = attr.name.name.name;
|
|
110
|
+
const fullName = `${ns}-${name}`;
|
|
111
|
+
const mappedKey = ATTR_MAP[fullName];
|
|
112
|
+
if (mappedKey) {
|
|
113
|
+
const val = getJSXAttrValue(attr);
|
|
114
|
+
if (val !== void 0) {
|
|
115
|
+
info[mappedKey] = val;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const text = extractTextFromJSXElement(path);
|
|
120
|
+
if (text) info.text = text;
|
|
121
|
+
elements.push(info);
|
|
122
|
+
},
|
|
123
|
+
ExportDefaultDeclaration(path) {
|
|
124
|
+
hasDefaultExport = true;
|
|
125
|
+
const decl = path.node.declaration;
|
|
126
|
+
if (decl.type === "FunctionDeclaration" && decl.id) {
|
|
127
|
+
defaultExportName = decl.id.name;
|
|
128
|
+
} else if (decl.type === "Identifier") {
|
|
129
|
+
defaultExportName = decl.name;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
ExportNamedDeclaration(path) {
|
|
133
|
+
const decl = path.node.declaration;
|
|
134
|
+
if (decl?.type === "FunctionDeclaration" && decl.id) {
|
|
135
|
+
namedExports.push(decl.id.name);
|
|
136
|
+
} else if (decl?.type === "VariableDeclaration") {
|
|
137
|
+
for (const d of decl.declarations) {
|
|
138
|
+
if (d.id.type === "Identifier") {
|
|
139
|
+
namedExports.push(d.id.name);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const componentName = defaultExportName ?? deriveComponentName(relPath);
|
|
146
|
+
const component = hasDefaultExport || namedExports.length > 0 ? {
|
|
147
|
+
name: componentName,
|
|
148
|
+
filePath: relPath,
|
|
149
|
+
exports: namedExports,
|
|
150
|
+
hasDefaultExport,
|
|
151
|
+
elements,
|
|
152
|
+
routes: []
|
|
153
|
+
} : null;
|
|
154
|
+
return { elements, component };
|
|
155
|
+
} catch {
|
|
156
|
+
return { elements: [], component: null };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async function processVueFile(content, relPath) {
|
|
160
|
+
try {
|
|
161
|
+
const { parse } = await import("@vue/compiler-sfc");
|
|
162
|
+
const { descriptor } = parse(content);
|
|
163
|
+
const templateAst = descriptor.template?.ast;
|
|
164
|
+
if (!templateAst) return { elements: [], component: null };
|
|
165
|
+
const elements = [];
|
|
166
|
+
walkVueAst(templateAst, relPath, elements);
|
|
167
|
+
const component = {
|
|
168
|
+
name: deriveComponentName(relPath),
|
|
169
|
+
filePath: relPath,
|
|
170
|
+
exports: [],
|
|
171
|
+
hasDefaultExport: !!descriptor.scriptSetup || !!descriptor.script,
|
|
172
|
+
elements,
|
|
173
|
+
routes: []
|
|
174
|
+
};
|
|
175
|
+
return { elements, component: elements.length > 0 ? component : null };
|
|
176
|
+
} catch {
|
|
177
|
+
return { elements: [], component: null };
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function walkVueAst(node, relPath, elements) {
|
|
181
|
+
const n = node;
|
|
182
|
+
if (n.type === 1 && typeof n.tag === "string") {
|
|
183
|
+
const tag = n.tag;
|
|
184
|
+
if (INTERACTIVE_TAGS.has(tag)) {
|
|
185
|
+
const info = {
|
|
186
|
+
tag,
|
|
187
|
+
filePath: relPath,
|
|
188
|
+
line: n.loc?.start?.line ?? 0
|
|
189
|
+
};
|
|
190
|
+
const props = n.props;
|
|
191
|
+
if (props) {
|
|
192
|
+
for (const prop of props) {
|
|
193
|
+
if (prop.type === 6) {
|
|
194
|
+
const attrName = prop.name;
|
|
195
|
+
const mappedKey = ATTR_MAP[attrName];
|
|
196
|
+
if (mappedKey) {
|
|
197
|
+
const val = prop.value?.content;
|
|
198
|
+
if (val !== void 0) {
|
|
199
|
+
info[mappedKey] = val;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (prop.type === 7) {
|
|
204
|
+
const arg = prop.arg;
|
|
205
|
+
const exp = prop.exp;
|
|
206
|
+
if (arg?.content && exp?.content) {
|
|
207
|
+
const mappedKey = ATTR_MAP[arg.content];
|
|
208
|
+
if (mappedKey) {
|
|
209
|
+
const raw = exp.content;
|
|
210
|
+
const match = /^['"](.+)['"]$/.exec(raw);
|
|
211
|
+
if (match) {
|
|
212
|
+
info[mappedKey] = match[1];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const children2 = n.children;
|
|
220
|
+
if (children2) {
|
|
221
|
+
const texts = [];
|
|
222
|
+
for (const child of children2) {
|
|
223
|
+
if (child.type === 2 && typeof child.content === "string") {
|
|
224
|
+
const trimmed = child.content.trim();
|
|
225
|
+
if (trimmed) texts.push(trimmed);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (texts.length > 0) {
|
|
229
|
+
info.text = texts.join(" ");
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
elements.push(info);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const children = n.children ?? [];
|
|
236
|
+
if (Array.isArray(children)) {
|
|
237
|
+
for (const child of children) {
|
|
238
|
+
walkVueAst(child, relPath, elements);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function deriveComponentName(relPath) {
|
|
243
|
+
const base = relPath.split("/").pop() ?? relPath;
|
|
244
|
+
const name = base.replace(/\.\w+$/, "");
|
|
245
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
246
|
+
}
|
|
247
|
+
export {
|
|
248
|
+
extractElements
|
|
249
|
+
};
|
|
250
|
+
//# sourceMappingURL=element-extractor-OZTFBVKZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/analyzers/element-extractor.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { relative } from 'node:path';\nimport { parse as babelParse } from '@babel/parser';\nimport _traverse from '@babel/traverse';\nimport type { NodePath } from '@babel/traverse';\nimport type { JSXAttribute, JSXOpeningElement, Node, ExportDefaultDeclaration, ExportNamedDeclaration } from '@babel/types';\nimport type { ElementInfo, ComponentInfo } from './types.js';\n\n// Handle CJS/ESM interop for @babel/traverse\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst traverse = (\n typeof _traverse === 'function' ? _traverse : (_traverse as unknown as { default: typeof _traverse }).default\n) as unknown as (ast: unknown, opts: unknown) => void;\n\nconst INTERACTIVE_TAGS = new Set([\n 'form',\n 'button',\n 'a',\n 'input',\n 'select',\n 'textarea',\n]);\n\nconst ATTR_MAP: Record<string, keyof ElementInfo> = {\n 'data-testid': 'testId',\n 'id': 'id',\n 'name': 'name',\n 'aria-label': 'ariaLabel',\n 'role': 'role',\n 'type': 'type',\n 'href': 'href',\n};\n\n/**\n * Extract interactive elements from JSX/TSX and Vue SFC files.\n * Uses @babel/parser for JSX/TSX and @vue/compiler-sfc for Vue templates.\n */\nexport async function extractElements(\n filePaths: string[],\n rootDir: string,\n): Promise<{ elements: ElementInfo[]; components: ComponentInfo[] }> {\n const allElements: ElementInfo[] = [];\n const allComponents: ComponentInfo[] = [];\n\n // Process files in batches of 50\n for (let i = 0; i < filePaths.length; i += 50) {\n const batch = filePaths.slice(i, i + 50);\n const batchResults = await Promise.all(\n batch.map((filePath) => processFile(filePath, rootDir)),\n );\n for (const result of batchResults) {\n allElements.push(...result.elements);\n if (result.component) {\n allComponents.push(result.component);\n }\n }\n }\n\n return { elements: allElements, components: allComponents };\n}\n\ninterface FileResult {\n elements: ElementInfo[];\n component: ComponentInfo | null;\n}\n\nasync function processFile(\n filePath: string,\n rootDir: string,\n): Promise<FileResult> {\n try {\n const content = await readFile(filePath, 'utf-8');\n const relPath = relative(rootDir, filePath);\n\n if (filePath.endsWith('.vue')) {\n return processVueFile(content, relPath);\n }\n return processJSXFile(content, relPath);\n } catch {\n return { elements: [], component: null };\n }\n}\n\nfunction getJSXAttrValue(attr: JSXAttribute): string | undefined {\n if (!attr.value) return undefined;\n if (attr.value.type === 'StringLiteral') return attr.value.value;\n if (\n attr.value.type === 'JSXExpressionContainer' &&\n attr.value.expression.type === 'StringLiteral'\n ) {\n return attr.value.expression.value;\n }\n return undefined;\n}\n\nfunction getJSXTextContent(node: Node): string | undefined {\n // Look at parent's children for JSXText\n if (node.type !== 'JSXOpeningElement') return undefined;\n return undefined; // Text extraction happens in the visitor via parent\n}\n\nfunction extractTextFromJSXElement(\n path: { parent: Node },\n): string | undefined {\n const parent = path.parent;\n if (parent.type !== 'JSXElement') return undefined;\n\n const texts: string[] = [];\n for (const child of parent.children) {\n if (child.type === 'JSXText') {\n const trimmed = child.value.trim();\n if (trimmed) texts.push(trimmed);\n }\n }\n return texts.length > 0 ? texts.join(' ') : undefined;\n}\n\nfunction processJSXFile(content: string, relPath: string): FileResult {\n try {\n const ast = babelParse(content, {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n });\n\n const elements: ElementInfo[] = [];\n const namedExports: string[] = [];\n let defaultExportName: string | undefined;\n let hasDefaultExport = false;\n\n traverse(ast, {\n JSXOpeningElement(path: NodePath<JSXOpeningElement>) {\n const node = path.node as JSXOpeningElement;\n const tagName =\n node.name.type === 'JSXIdentifier' ? node.name.name : null;\n if (!tagName || !INTERACTIVE_TAGS.has(tagName)) return;\n\n const info: ElementInfo = {\n tag: tagName,\n filePath: relPath,\n line: node.loc?.start.line ?? 0,\n };\n\n for (const attr of node.attributes) {\n if (attr.type !== 'JSXAttribute' || attr.name.type !== 'JSXIdentifier') continue;\n const attrName = attr.name.name;\n // Handle hyphenated attribute names\n const fullName =\n attr.name.type === 'JSXIdentifier' ? attr.name.name : undefined;\n if (!fullName) continue;\n\n const mappedKey = ATTR_MAP[fullName];\n if (mappedKey) {\n const val = getJSXAttrValue(attr);\n if (val !== undefined) {\n (info as unknown as Record<string, unknown>)[mappedKey] = val;\n }\n }\n }\n\n // Handle hyphenated JSX attribute names (data-testid, aria-label)\n for (const attr of node.attributes) {\n if (attr.type !== 'JSXAttribute' || attr.name.type !== 'JSXNamespacedName') continue;\n // JSXNamespacedName has namespace and name\n const ns = attr.name.namespace.name;\n const name = attr.name.name.name;\n const fullName = `${ns}-${name}`;\n const mappedKey = ATTR_MAP[fullName];\n if (mappedKey) {\n const val = getJSXAttrValue(attr);\n if (val !== undefined) {\n (info as unknown as Record<string, unknown>)[mappedKey] = val;\n }\n }\n }\n\n // Extract text content from parent JSXElement children\n const text = extractTextFromJSXElement(path);\n if (text) info.text = text;\n\n elements.push(info);\n },\n\n ExportDefaultDeclaration(path: NodePath<ExportDefaultDeclaration>) {\n hasDefaultExport = true;\n const decl = path.node.declaration;\n if (decl.type === 'FunctionDeclaration' && decl.id) {\n defaultExportName = decl.id.name;\n } else if (decl.type === 'Identifier') {\n defaultExportName = decl.name;\n }\n },\n\n ExportNamedDeclaration(path: NodePath<ExportNamedDeclaration>) {\n const decl = path.node.declaration;\n if (decl?.type === 'FunctionDeclaration' && decl.id) {\n namedExports.push(decl.id.name);\n } else if (\n decl?.type === 'VariableDeclaration'\n ) {\n for (const d of decl.declarations) {\n if (d.id.type === 'Identifier') {\n namedExports.push(d.id.name);\n }\n }\n }\n },\n });\n\n const componentName =\n defaultExportName ?? deriveComponentName(relPath);\n\n const component: ComponentInfo | null =\n hasDefaultExport || namedExports.length > 0\n ? {\n name: componentName,\n filePath: relPath,\n exports: namedExports,\n hasDefaultExport,\n elements,\n routes: [],\n }\n : null;\n\n return { elements, component };\n } catch {\n return { elements: [], component: null };\n }\n}\n\nasync function processVueFile(\n content: string,\n relPath: string,\n): Promise<FileResult> {\n try {\n const { parse } = await import('@vue/compiler-sfc');\n const { descriptor } = parse(content);\n const templateAst = descriptor.template?.ast;\n if (!templateAst) return { elements: [], component: null };\n\n const elements: ElementInfo[] = [];\n walkVueAst(templateAst, relPath, elements);\n\n const component: ComponentInfo = {\n name: deriveComponentName(relPath),\n filePath: relPath,\n exports: [],\n hasDefaultExport: !!descriptor.scriptSetup || !!descriptor.script,\n elements,\n routes: [],\n };\n\n return { elements, component: elements.length > 0 ? component : null };\n } catch {\n return { elements: [], component: null };\n }\n}\n\nfunction walkVueAst(\n node: unknown,\n relPath: string,\n elements: ElementInfo[],\n): void {\n const n = node as Record<string, unknown>;\n // Element nodes have type 1\n if (n.type === 1 && typeof n.tag === 'string') {\n const tag = n.tag as string;\n if (INTERACTIVE_TAGS.has(tag)) {\n const info: ElementInfo = {\n tag,\n filePath: relPath,\n line: (n.loc as { start: { line: number } })?.start?.line ?? 0,\n };\n\n const props = n.props as Array<Record<string, unknown>> | undefined;\n if (props) {\n for (const prop of props) {\n // type 6 = attribute\n if (prop.type === 6) {\n const attrName = prop.name as string;\n const mappedKey = ATTR_MAP[attrName];\n if (mappedKey) {\n const val = (prop.value as { content?: string })?.content;\n if (val !== undefined) {\n (info as unknown as Record<string, unknown>)[mappedKey] = val;\n }\n }\n }\n // type 7 = directive (v-bind / :)\n if (prop.type === 7) {\n const arg = prop.arg as { content?: string } | undefined;\n const exp = prop.exp as {\n content?: string;\n isStatic?: boolean;\n } | undefined;\n if (arg?.content && exp?.content) {\n const mappedKey = ATTR_MAP[arg.content];\n if (mappedKey) {\n // Extract static string value: strip surrounding quotes\n const raw = exp.content;\n const match = /^['\"](.+)['\"]$/.exec(raw);\n if (match) {\n (info as unknown as Record<string, unknown>)[mappedKey] = match[1];\n }\n }\n }\n }\n }\n }\n\n // Extract text content from children\n const children = n.children as Array<Record<string, unknown>> | undefined;\n if (children) {\n const texts: string[] = [];\n for (const child of children) {\n // type 2 = text node\n if (child.type === 2 && typeof child.content === 'string') {\n const trimmed = (child.content as string).trim();\n if (trimmed) texts.push(trimmed);\n }\n }\n if (texts.length > 0) {\n info.text = texts.join(' ');\n }\n }\n\n elements.push(info);\n }\n }\n\n // Recurse into children\n const children = (n.children as Array<Record<string, unknown>>) ?? [];\n if (Array.isArray(children)) {\n for (const child of children) {\n walkVueAst(child, relPath, elements);\n }\n }\n}\n\nfunction deriveComponentName(relPath: string): string {\n const base = relPath.split('/').pop() ?? relPath;\n const name = base.replace(/\\.\\w+$/, '');\n return name.charAt(0).toUpperCase() + name.slice(1);\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,SAAS,kBAAkB;AACpC,OAAO,eAAe;AAOtB,IAAM,WACJ,OAAO,cAAc,aAAa,YAAa,UAAuD;AAGxG,IAAM,mBAAmB,oBAAI,IAAI;AAAA,EAC/B;AAAA,EACA;AA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Y,IAAI,KAAK,MAAM,CAAC;AACpD;","names":["children"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// src/cli/formatter.ts
|
|
2
|
+
import pc from "picocolors";
|
|
3
|
+
var SEVERITY_ORDER = ["critical", "high", "medium", "low", "info"];
|
|
4
|
+
var severityColors = {
|
|
5
|
+
critical: pc.red,
|
|
6
|
+
high: pc.red,
|
|
7
|
+
medium: pc.yellow,
|
|
8
|
+
low: pc.cyan,
|
|
9
|
+
info: pc.gray
|
|
10
|
+
};
|
|
11
|
+
var severityIcons = {
|
|
12
|
+
critical: "X",
|
|
13
|
+
high: "!",
|
|
14
|
+
medium: "~",
|
|
15
|
+
low: "-",
|
|
16
|
+
info: "i"
|
|
17
|
+
};
|
|
18
|
+
function groupBySeverity(findings) {
|
|
19
|
+
const groups = {
|
|
20
|
+
critical: [],
|
|
21
|
+
high: [],
|
|
22
|
+
medium: [],
|
|
23
|
+
low: [],
|
|
24
|
+
info: []
|
|
25
|
+
};
|
|
26
|
+
for (const finding of findings) {
|
|
27
|
+
groups[finding.severity].push(finding);
|
|
28
|
+
}
|
|
29
|
+
return groups;
|
|
30
|
+
}
|
|
31
|
+
function formatFindings(findings) {
|
|
32
|
+
if (findings.length === 0) {
|
|
33
|
+
return pc.green("No issues found.");
|
|
34
|
+
}
|
|
35
|
+
const lines = [];
|
|
36
|
+
const groups = groupBySeverity(findings);
|
|
37
|
+
for (const severity of SEVERITY_ORDER) {
|
|
38
|
+
const group = groups[severity];
|
|
39
|
+
if (group.length === 0) continue;
|
|
40
|
+
const color = severityColors[severity];
|
|
41
|
+
const icon = severityIcons[severity];
|
|
42
|
+
lines.push("");
|
|
43
|
+
lines.push(color(`${icon} ${severity.toUpperCase()} (${group.length})`));
|
|
44
|
+
for (const finding of group) {
|
|
45
|
+
lines.push(
|
|
46
|
+
` ${pc.dim(finding.filePath)}:${pc.yellow(String(finding.line))} ${finding.message}`
|
|
47
|
+
);
|
|
48
|
+
lines.push(` ${pc.dim(finding.snippet)}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const parts = [];
|
|
52
|
+
for (const severity of SEVERITY_ORDER) {
|
|
53
|
+
const count = groups[severity].length;
|
|
54
|
+
if (count > 0) {
|
|
55
|
+
parts.push(severityColors[severity](`${count} ${severity}`));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
lines.push("");
|
|
59
|
+
lines.push(`Found ${pc.bold(String(findings.length))} issues: ${parts.join(", ")}`);
|
|
60
|
+
return lines.join("\n");
|
|
61
|
+
}
|
|
62
|
+
var SCANNER_DISPLAY_NAMES = {
|
|
63
|
+
"e2e/": "Browser Tests",
|
|
64
|
+
"a11y/": "Accessibility",
|
|
65
|
+
"visual/": "Visual Regression",
|
|
66
|
+
"perf/": "Performance",
|
|
67
|
+
"source/": "Source Code"
|
|
68
|
+
};
|
|
69
|
+
function getScannerPrefix(ruleId) {
|
|
70
|
+
for (const prefix of Object.keys(SCANNER_DISPLAY_NAMES)) {
|
|
71
|
+
if (ruleId.startsWith(prefix)) {
|
|
72
|
+
return prefix;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return "other/";
|
|
76
|
+
}
|
|
77
|
+
function isBrowserFinding(finding) {
|
|
78
|
+
return "url" in finding && "viewport" in finding;
|
|
79
|
+
}
|
|
80
|
+
function formatBrowserFindings(findings) {
|
|
81
|
+
if (findings.length === 0) {
|
|
82
|
+
return pc.green("No issues found.");
|
|
83
|
+
}
|
|
84
|
+
const lines = [];
|
|
85
|
+
const scannerGroups = /* @__PURE__ */ new Map();
|
|
86
|
+
for (const finding of findings) {
|
|
87
|
+
const prefix = getScannerPrefix(finding.ruleId);
|
|
88
|
+
if (!scannerGroups.has(prefix)) {
|
|
89
|
+
scannerGroups.set(prefix, []);
|
|
90
|
+
}
|
|
91
|
+
scannerGroups.get(prefix).push(finding);
|
|
92
|
+
}
|
|
93
|
+
let scannerCount = 0;
|
|
94
|
+
for (const [prefix, groupFindings] of scannerGroups) {
|
|
95
|
+
scannerCount++;
|
|
96
|
+
const displayName = SCANNER_DISPLAY_NAMES[prefix] ?? prefix.replace("/", "");
|
|
97
|
+
lines.push("");
|
|
98
|
+
lines.push(pc.blue(pc.bold(`[${displayName}]`)));
|
|
99
|
+
const sorted = [...groupFindings].sort(
|
|
100
|
+
(a, b) => SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity)
|
|
101
|
+
);
|
|
102
|
+
for (const finding of sorted) {
|
|
103
|
+
const color = severityColors[finding.severity];
|
|
104
|
+
const icon = severityIcons[finding.severity];
|
|
105
|
+
const vpLabel = isBrowserFinding(finding) ? ` ${pc.magenta(`[${finding.viewport}]`)}` : "";
|
|
106
|
+
lines.push(
|
|
107
|
+
` ${color(`${icon}`)} ${color(finding.severity.toUpperCase())}${vpLabel} ${finding.message}`
|
|
108
|
+
);
|
|
109
|
+
lines.push(
|
|
110
|
+
` ${pc.dim(finding.filePath)}:${pc.yellow(String(finding.line))}`
|
|
111
|
+
);
|
|
112
|
+
if (finding.snippet) {
|
|
113
|
+
lines.push(` ${pc.dim(finding.snippet)}`);
|
|
114
|
+
}
|
|
115
|
+
if (isBrowserFinding(finding) && finding.screenshotPath) {
|
|
116
|
+
lines.push(` ${pc.dim(pc.underline(finding.screenshotPath))}`);
|
|
117
|
+
}
|
|
118
|
+
if (isBrowserFinding(finding) && finding.fixSuggestion) {
|
|
119
|
+
lines.push(` ${pc.green("Fix:")} ${finding.fixSuggestion}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const parts = [];
|
|
124
|
+
const groups = groupBySeverity(findings);
|
|
125
|
+
for (const severity of SEVERITY_ORDER) {
|
|
126
|
+
const count = groups[severity].length;
|
|
127
|
+
if (count > 0) {
|
|
128
|
+
parts.push(severityColors[severity](`${count} ${severity}`));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
lines.push("");
|
|
132
|
+
lines.push(
|
|
133
|
+
`Found ${pc.bold(String(findings.length))} issues across ${scannerCount} scanners: ${parts.join(", ")}`
|
|
134
|
+
);
|
|
135
|
+
return lines.join("\n");
|
|
136
|
+
}
|
|
137
|
+
function formatProgress(viewport, url, findingCount) {
|
|
138
|
+
const suffix = findingCount === 0 ? pc.green("0 findings") : pc.yellow(`${findingCount} finding${findingCount !== 1 ? "s" : ""}`);
|
|
139
|
+
return ` ${pc.dim(`[${viewport}]`)} ${pc.dim(url)}... done (${suffix})`;
|
|
140
|
+
}
|
|
141
|
+
export {
|
|
142
|
+
formatBrowserFindings,
|
|
143
|
+
formatFindings,
|
|
144
|
+
formatProgress
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=formatter-HC3LT3VH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/formatter.ts"],"sourcesContent":["import pc from 'picocolors';\nimport type { Finding, Severity, BrowserFinding } from '../core/types.js';\n\nconst SEVERITY_ORDER: Severity[] = ['critical', 'high', 'medium', 'low', 'info'];\n\nconst severityColors: Record<Severity, (s: string) => string> = {\n critical: pc.red,\n high: pc.red,\n medium: pc.yellow,\n low: pc.cyan,\n info: pc.gray,\n};\n\nconst severityIcons: Record<Severity, string> = {\n critical: 'X',\n high: '!',\n medium: '~',\n low: '-',\n info: 'i',\n};\n\nfunction groupBySeverity(findings: Finding[]): Record<Severity, Finding[]> {\n const groups: Record<Severity, Finding[]> = {\n critical: [],\n high: [],\n medium: [],\n low: [],\n info: [],\n };\n\n for (const finding of findings) {\n groups[finding.severity].push(finding);\n }\n\n return groups;\n}\n\nexport function formatFindings(findings: Finding[]): string {\n if (findings.length === 0) {\n return pc.green('No issues found.');\n }\n\n const lines: string[] = [];\n const groups = groupBySeverity(findings);\n\n for (const severity of SEVERITY_ORDER) {\n const group = groups[severity];\n if (group.length === 0) continue;\n\n const color = severityColors[severity];\n const icon = severityIcons[severity];\n\n lines.push('');\n lines.push(color(`${icon} ${severity.toUpperCase()} (${group.length})`));\n\n for (const finding of group) {\n lines.push(\n ` ${pc.dim(finding.filePath)}:${pc.yellow(String(finding.line))} ${finding.message}`,\n );\n lines.push(` ${pc.dim(finding.snippet)}`);\n }\n }\n\n // Summary line\n const parts: string[] = [];\n for (const severity of SEVERITY_ORDER) {\n const count = groups[severity].length;\n if (count > 0) {\n parts.push(severityColors[severity](`${count} ${severity}`));\n }\n }\n\n lines.push('');\n lines.push(`Found ${pc.bold(String(findings.length))} issues: ${parts.join(', ')}`);\n\n return lines.join('\\n');\n}\n\n// Scanner display name mapping\nconst SCANNER_DISPLAY_NAMES: Record<string, string> = {\n 'e2e/': 'Browser Tests',\n 'a11y/': 'Accessibility',\n 'visual/': 'Visual Regression',\n 'perf/': 'Performance',\n 'source/': 'Source Code',\n};\n\nfunction getScannerPrefix(ruleId: string): string {\n for (const prefix of Object.keys(SCANNER_DISPLAY_NAMES)) {\n if (ruleId.startsWith(prefix)) {\n return prefix;\n }\n }\n return 'other/';\n}\n\nfunction isBrowserFinding(finding: Finding): finding is BrowserFinding {\n return 'url' in finding && 'viewport' in finding;\n}\n\nexport function formatBrowserFindings(findings: Finding[]): string {\n if (findings.length === 0) {\n return pc.green('No issues found.');\n }\n\n const lines: string[] = [];\n\n // Group findings by scanner prefix\n const scannerGroups = new Map<string, Finding[]>();\n for (const finding of findings) {\n const prefix = getScannerPrefix(finding.ruleId);\n if (!scannerGroups.has(prefix)) {\n scannerGroups.set(prefix, []);\n }\n scannerGroups.get(prefix)!.push(finding);\n }\n\n let scannerCount = 0;\n\n // Render each scanner group\n for (const [prefix, groupFindings] of scannerGroups) {\n scannerCount++;\n const displayName = SCANNER_DISPLAY_NAMES[prefix] ?? prefix.replace('/', '');\n\n lines.push('');\n lines.push(pc.blue(pc.bold(`[${displayName}]`)));\n\n // Sort by severity within group\n const sorted = [...groupFindings].sort(\n (a, b) => SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity),\n );\n\n for (const finding of sorted) {\n const color = severityColors[finding.severity];\n const icon = severityIcons[finding.severity];\n\n // Viewport label for browser findings\n const vpLabel = isBrowserFinding(finding)\n ? ` ${pc.magenta(`[${finding.viewport}]`)}`\n : '';\n\n lines.push(\n ` ${color(`${icon}`)} ${color(finding.severity.toUpperCase())}${vpLabel} ${finding.message}`,\n );\n lines.push(\n ` ${pc.dim(finding.filePath)}:${pc.yellow(String(finding.line))}`,\n );\n\n if (finding.snippet) {\n lines.push(` ${pc.dim(finding.snippet)}`);\n }\n\n // Screenshot path for browser findings\n if (isBrowserFinding(finding) && finding.screenshotPath) {\n lines.push(` ${pc.dim(pc.underline(finding.screenshotPath))}`);\n }\n\n // Fix suggestion\n if (isBrowserFinding(finding) && finding.fixSuggestion) {\n lines.push(` ${pc.green('Fix:')} ${finding.fixSuggestion}`);\n }\n }\n }\n\n // Summary line\n const parts: string[] = [];\n const groups = groupBySeverity(findings);\n for (const severity of SEVERITY_ORDER) {\n const count = groups[severity].length;\n if (count > 0) {\n parts.push(severityColors[severity](`${count} ${severity}`));\n }\n }\n\n lines.push('');\n lines.push(\n `Found ${pc.bold(String(findings.length))} issues across ${scannerCount} scanners: ${parts.join(', ')}`,\n );\n\n return lines.join('\\n');\n}\n\nexport function formatProgress(viewport: string, url: string, findingCount: number): string {\n const suffix =\n findingCount === 0\n ? pc.green('0 findings')\n : pc.yellow(`${findingCount} finding${findingCount !== 1 ? 's' : ''}`);\n return ` ${pc.dim(`[${viewport}]`)} ${pc.dim(url)}... done (${suffix})`;\n}\n"],"mappings":";AAAA,OAAO,QAAQ;AAGf,IAAM,iBAA6B,CAAC,YAAY,QAAQ,UAAU,OAAO,MAAM;AAE/E,IAAM,iBAA0D;AAAA,EAC9D,UAAU,GAAG;AAAA,EACb,MAAM,GAAG;A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C;AAAA,IAC7D;AAAA,EACF;AAEA,QAAM,KAAK,EAAE;AACb,QAAM;AAAA,IACJ,SAAS,GAAG,KAAK,OAAO,SAAS,MAAM,CAAC,CAAC,kBAAkB,YAAY,cAAc,MAAM,KAAK,IAAI,CAAC;AAAA,EACvG;AAEA,SAAO,MAAM,KAAK,IAAI;AACxB;AAEO,SAAS,eAAe,UAAkB,KAAa,cAA8B;AAC1F,QAAM,SACJ,iBAAiB,IACb,GAAG,MAAM,YAAY,IACrB,GAAG,OAAO,GAAG,YAAY,WAAW,iBAAiB,IAAI,MAAM,EAAE,EAAE;AACzE,SAAO,KAAK,GAAG,IAAI,IAAI,QAAQ,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,aAAa,MAAM;AACvE;","names":[]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// src/analyzers/framework-detector.ts
|
|
2
|
+
import { readFile, access } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
async function fileExists(filePath) {
|
|
5
|
+
try {
|
|
6
|
+
await access(filePath);
|
|
7
|
+
return true;
|
|
8
|
+
} catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function extractMajorVersion(versionStr) {
|
|
13
|
+
const match = /(\d+)/.exec(versionStr);
|
|
14
|
+
return match ? `${match[1]}.x` : void 0;
|
|
15
|
+
}
|
|
16
|
+
async function findConfigFiles(rootDir, candidates) {
|
|
17
|
+
const found = [];
|
|
18
|
+
for (const candidate of candidates) {
|
|
19
|
+
if (await fileExists(join(rootDir, candidate))) {
|
|
20
|
+
found.push(candidate);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return found;
|
|
24
|
+
}
|
|
25
|
+
async function detectFrameworks(rootDir) {
|
|
26
|
+
let pkg;
|
|
27
|
+
try {
|
|
28
|
+
const raw = await readFile(join(rootDir, "package.json"), "utf-8");
|
|
29
|
+
const parsed = JSON.parse(raw);
|
|
30
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
pkg = parsed;
|
|
34
|
+
} catch {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
const deps = {
|
|
38
|
+
...typeof pkg.dependencies === "object" && pkg.dependencies !== null ? pkg.dependencies : {},
|
|
39
|
+
...typeof pkg.devDependencies === "object" && pkg.devDependencies !== null ? pkg.devDependencies : {}
|
|
40
|
+
};
|
|
41
|
+
const frameworks = [];
|
|
42
|
+
let hasNext = false;
|
|
43
|
+
if (deps["next"]) {
|
|
44
|
+
hasNext = true;
|
|
45
|
+
const configFiles = await findConfigFiles(rootDir, [
|
|
46
|
+
"next.config.js",
|
|
47
|
+
"next.config.mjs",
|
|
48
|
+
"next.config.ts"
|
|
49
|
+
]);
|
|
50
|
+
frameworks.push({
|
|
51
|
+
name: "nextjs",
|
|
52
|
+
version: extractMajorVersion(deps["next"]),
|
|
53
|
+
configFiles
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (!hasNext && deps["react"]) {
|
|
57
|
+
const configFiles = await findConfigFiles(rootDir, [
|
|
58
|
+
"vite.config.js",
|
|
59
|
+
"vite.config.ts",
|
|
60
|
+
"craco.config.js"
|
|
61
|
+
]);
|
|
62
|
+
frameworks.push({
|
|
63
|
+
name: "react",
|
|
64
|
+
version: extractMajorVersion(deps["react"]),
|
|
65
|
+
configFiles
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (deps["vue"]) {
|
|
69
|
+
const candidates = ["vue.config.js"];
|
|
70
|
+
if (deps["@vitejs/plugin-vue"]) {
|
|
71
|
+
candidates.push("vite.config.js", "vite.config.ts");
|
|
72
|
+
}
|
|
73
|
+
const configFiles = await findConfigFiles(rootDir, candidates);
|
|
74
|
+
frameworks.push({
|
|
75
|
+
name: "vue",
|
|
76
|
+
version: extractMajorVersion(deps["vue"]),
|
|
77
|
+
configFiles
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (deps["svelte"]) {
|
|
81
|
+
const configFiles = await findConfigFiles(rootDir, [
|
|
82
|
+
"svelte.config.js"
|
|
83
|
+
]);
|
|
84
|
+
frameworks.push({
|
|
85
|
+
name: "svelte",
|
|
86
|
+
version: extractMajorVersion(deps["svelte"]),
|
|
87
|
+
configFiles
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return frameworks;
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
detectFrameworks
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=framework-detector-ISSM2Q2I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/analyzers/framework-detector.ts"],"sourcesContent":["import { readFile, access } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { FrameworkInfo } from './types.js';\n\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Extract the major version from a semver-like dependency string.\n * E.g., \"^14.0.0\" -> \"14.x\", \"~3.4.1\" -> \"3.x\", \"18.2.0\" -> \"18.x\"\n */\nfunction extractMajorVersion(versionStr: string): string | undefined {\n const match = /(\\d+)/.exec(versionStr);\n return match ? `${match[1]}.x` : undefined;\n}\n\n/**\n * Find which config files exist for a given set of candidate filenames.\n */\nasync function findConfigFiles(\n rootDir: string,\n candidates: string[],\n): Promise<string[]> {\n const found: string[] = [];\n for (const candidate of candidates) {\n if (await fileExists(join(rootDir, candidate))) {\n found.push(candidate);\n }\n }\n return found;\n}\n\n/**\n * Detect frameworks in a project by inspecting package.json dependencies\n * and checking for framework-specific config files.\n *\n * Detection order: Next.js first (has react too), then React (no next),\n * then Vue, then Svelte. Returns multiple for monorepo-style projects.\n *\n * Graceful degradation: returns [] on any failure (missing package.json, parse error, etc.)\n */\nexport async function detectFrameworks(\n rootDir: string,\n): Promise<FrameworkInfo[]> {\n let pkg: Record<string, unknown>;\n\n try {\n const raw = await readFile(join(rootDir, 'package.json'), 'utf-8');\n const parsed: unknown = JSON.parse(raw);\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {\n return [];\n }\n pkg = parsed as Record<string, unknown>;\n } catch {\n return [];\n }\n\n const deps: Record<string, string> = {\n ...((typeof pkg.dependencies === 'object' && pkg.dependencies !== null\n ? pkg.dependencies\n : {}) as Record<string, string>),\n ...((typeof pkg.devDependencies === 'object' && pkg.devDependencies !== null\n ? pkg.devDependencies\n : {}) as Record<string, string>),\n };\n\n const frameworks: FrameworkInfo[] = [];\n let hasNext = false;\n\n // 1. Next.js — check BEFORE React (Next.js projects also have react)\n if (deps['next']) {\n hasNext = true;\n const configFiles = await findConfigFiles(rootDir, [\n 'next.config.js',\n 'next.config.mjs',\n 'next.config.ts',\n ]);\n frameworks.push({\n name: 'nextjs',\n version: extractMajorVersion(deps['next']),\n configFiles,\n });\n }\n\n // 2. React — only if NOT a Next.js project\n if (!hasNext && deps['react']) {\n const configFiles = await findConfigFiles(rootDir, [\n 'vite.config.js',\n 'vite.config.ts',\n 'craco.config.js',\n ]);\n frameworks.push({\n name: 'react',\n version: extractMajorVersion(deps['react']),\n configFiles,\n });\n }\n\n // 3. Vue\n if (deps['vue']) {\n const candidates = ['vue.config.js'];\n // Only include vite config if @vitejs/plugin-vue is in deps\n if (deps['@vitejs/plugin-vue']) {\n candidates.push('vite.config.js', 'vite.config.ts');\n }\n const configFiles = await findConfigFiles(rootDir, candidates);\n frameworks.push({\n name: 'vue',\n version: extractMajorVersion(deps['vue']),\n configFiles,\n });\n }\n\n // 4. Svelte\n if (deps['svelte']) {\n const configFiles = await findConfigFiles(rootDir, [\n 'svelte.config.js',\n ]);\n frameworks.push({\n name: 'svelte',\n version: extractMajorVersion(deps['svelte']),\n configFiles,\n });\n }\n\n return frameworks;\n}\n"],"mappings":";AAAA,SAAS,UAAU,cAAc;AACjC,SAAS,YAAY;AAGrB,eAAe,WAAW,UAAoC;AAC5D,MAAI;AACF,UAAM,O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