@rayburst/cli 0.3.4 → 0.3.6
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.
|
@@ -258,8 +258,18 @@ function traceConfigProperty(configObject, propertyName) {
|
|
|
258
258
|
if (isVariableDeclaration(declaration)) {
|
|
259
259
|
return traceVariableDataFlow(declaration);
|
|
260
260
|
}
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
const parent = declaration.getParent();
|
|
262
|
+
if (isImportDeclaration(parent)) {
|
|
263
|
+
return parent;
|
|
264
|
+
}
|
|
265
|
+
if (parent && parent.getKind() === 283) {
|
|
266
|
+
const grandParent = parent.getParent();
|
|
267
|
+
if (grandParent) {
|
|
268
|
+
const importDecl = grandParent.getParent();
|
|
269
|
+
if (importDecl && isImportDeclaration(importDecl)) {
|
|
270
|
+
return importDecl;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
263
273
|
}
|
|
264
274
|
return declaration;
|
|
265
275
|
}
|
|
@@ -613,7 +623,7 @@ function traceConfigToComponentPaths(configObject, propertyName, projectPath, pr
|
|
|
613
623
|
}
|
|
614
624
|
return [];
|
|
615
625
|
}
|
|
616
|
-
function detectConfigBasedComponents(sourceFile, nodes, nodeMap, edges, projectPath, project, gitHash) {
|
|
626
|
+
function detectConfigBasedComponents(sourceFile, nodes, nodeMap, edges, projectPath, project, gitHash, externalNodeMap) {
|
|
617
627
|
let totalEdgesCreated = 0;
|
|
618
628
|
try {
|
|
619
629
|
const jsxElements = sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement);
|
|
@@ -662,17 +672,35 @@ function detectConfigBasedComponents(sourceFile, nodes, nodeMap, edges, projectP
|
|
|
662
672
|
nodes.push(routerNode);
|
|
663
673
|
nodeMap.set(routerNode.id, routerNode);
|
|
664
674
|
console.log(`[DEBUG] Created router node: ${routerNode.id}`);
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
675
|
+
const routerProviderExternalId = "external::@tanstack/react-router::RouterProvider";
|
|
676
|
+
const routerProviderNode = externalNodeMap.get(routerProviderExternalId);
|
|
677
|
+
if (routerProviderNode) {
|
|
678
|
+
const providerToRouterEdgeId = `e-${routerProviderNode.id}-${routerNode.id}`;
|
|
679
|
+
if (!edges.find((e) => e.id === providerToRouterEdgeId)) {
|
|
680
|
+
edges.push({
|
|
681
|
+
id: providerToRouterEdgeId,
|
|
682
|
+
source: routerProviderNode.id,
|
|
683
|
+
target: routerNode.id,
|
|
684
|
+
type: "floating",
|
|
685
|
+
label: "router prop"
|
|
686
|
+
});
|
|
687
|
+
totalEdgesCreated++;
|
|
688
|
+
console.log(`[DEBUG] Created edge: RouterProvider -> Router`);
|
|
689
|
+
}
|
|
690
|
+
} else {
|
|
691
|
+
console.warn("[DEBUG] RouterProvider external node not found, falling back to App -> Router edge");
|
|
692
|
+
const appToRouterEdgeId = `e-${sourceNode.id}-${routerNode.id}`;
|
|
693
|
+
if (!edges.find((e) => e.id === appToRouterEdgeId)) {
|
|
694
|
+
edges.push({
|
|
695
|
+
id: appToRouterEdgeId,
|
|
696
|
+
source: sourceNode.id,
|
|
697
|
+
target: routerNode.id,
|
|
698
|
+
type: "floating",
|
|
699
|
+
label: "router prop"
|
|
700
|
+
});
|
|
701
|
+
totalEdgesCreated++;
|
|
702
|
+
console.log(`[DEBUG] Created edge: App -> Router (fallback)`);
|
|
703
|
+
}
|
|
676
704
|
}
|
|
677
705
|
const routerToRoutesEdges = createConfigBasedEdges(
|
|
678
706
|
routerNode,
|
|
@@ -770,7 +798,7 @@ async function analyzeProject(projectPath, projectId, onLog) {
|
|
|
770
798
|
log(` Analyzing config-based components...`);
|
|
771
799
|
let totalConfigEdges = 0;
|
|
772
800
|
for (const sourceFile of sourceFiles) {
|
|
773
|
-
const configEdges = detectConfigBasedComponents(sourceFile, nodes, nodeMap, edges, projectPath, project, gitHash);
|
|
801
|
+
const configEdges = detectConfigBasedComponents(sourceFile, nodes, nodeMap, edges, projectPath, project, gitHash, externalNodeMap);
|
|
774
802
|
totalConfigEdges += configEdges;
|
|
775
803
|
}
|
|
776
804
|
if (totalConfigEdges > 0) {
|
package/dist/index.js
CHANGED
package/dist/vite-plugin.js
CHANGED