@rayburst/cli 0.3.4 → 0.3.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.
@@ -613,7 +613,7 @@ function traceConfigToComponentPaths(configObject, propertyName, projectPath, pr
613
613
  }
614
614
  return [];
615
615
  }
616
- function detectConfigBasedComponents(sourceFile, nodes, nodeMap, edges, projectPath, project, gitHash) {
616
+ function detectConfigBasedComponents(sourceFile, nodes, nodeMap, edges, projectPath, project, gitHash, externalNodeMap) {
617
617
  let totalEdgesCreated = 0;
618
618
  try {
619
619
  const jsxElements = sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement);
@@ -662,17 +662,35 @@ function detectConfigBasedComponents(sourceFile, nodes, nodeMap, edges, projectP
662
662
  nodes.push(routerNode);
663
663
  nodeMap.set(routerNode.id, routerNode);
664
664
  console.log(`[DEBUG] Created router node: ${routerNode.id}`);
665
- const appToRouterEdgeId = `e-${sourceNode.id}-${routerNode.id}`;
666
- if (!edges.find((e) => e.id === appToRouterEdgeId)) {
667
- edges.push({
668
- id: appToRouterEdgeId,
669
- source: sourceNode.id,
670
- target: routerNode.id,
671
- type: "floating",
672
- label: "router prop"
673
- });
674
- totalEdgesCreated++;
675
- console.log(`[DEBUG] Created edge: App -> Router`);
665
+ const routerProviderExternalId = "external::@tanstack/react-router::RouterProvider";
666
+ const routerProviderNode = externalNodeMap.get(routerProviderExternalId);
667
+ if (routerProviderNode) {
668
+ const providerToRouterEdgeId = `e-${routerProviderNode.id}-${routerNode.id}`;
669
+ if (!edges.find((e) => e.id === providerToRouterEdgeId)) {
670
+ edges.push({
671
+ id: providerToRouterEdgeId,
672
+ source: routerProviderNode.id,
673
+ target: routerNode.id,
674
+ type: "floating",
675
+ label: "router prop"
676
+ });
677
+ totalEdgesCreated++;
678
+ console.log(`[DEBUG] Created edge: RouterProvider -> Router`);
679
+ }
680
+ } else {
681
+ console.warn("[DEBUG] RouterProvider external node not found, falling back to App -> Router edge");
682
+ const appToRouterEdgeId = `e-${sourceNode.id}-${routerNode.id}`;
683
+ if (!edges.find((e) => e.id === appToRouterEdgeId)) {
684
+ edges.push({
685
+ id: appToRouterEdgeId,
686
+ source: sourceNode.id,
687
+ target: routerNode.id,
688
+ type: "floating",
689
+ label: "router prop"
690
+ });
691
+ totalEdgesCreated++;
692
+ console.log(`[DEBUG] Created edge: App -> Router (fallback)`);
693
+ }
676
694
  }
677
695
  const routerToRoutesEdges = createConfigBasedEdges(
678
696
  routerNode,
@@ -770,7 +788,7 @@ async function analyzeProject(projectPath, projectId, onLog) {
770
788
  log(` Analyzing config-based components...`);
771
789
  let totalConfigEdges = 0;
772
790
  for (const sourceFile of sourceFiles) {
773
- const configEdges = detectConfigBasedComponents(sourceFile, nodes, nodeMap, edges, projectPath, project, gitHash);
791
+ const configEdges = detectConfigBasedComponents(sourceFile, nodes, nodeMap, edges, projectPath, project, gitHash, externalNodeMap);
774
792
  totalConfigEdges += configEdges;
775
793
  }
776
794
  if (totalConfigEdges > 0) {
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  readLocalMeta,
10
10
  writeLocalAnalysis,
11
11
  writeLocalMeta
12
- } from "./chunk-3IJUZFQ6.js";
12
+ } from "./chunk-ZVRNWDI5.js";
13
13
  export {
14
14
  addGitignoreEntry,
15
15
  analyzeProject,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  rayburstPlugin
3
- } from "./chunk-3IJUZFQ6.js";
3
+ } from "./chunk-ZVRNWDI5.js";
4
4
  export {
5
5
  rayburstPlugin
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rayburst/cli",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Rayburst - Automatic code analysis for TypeScript/JavaScript projects via Vite plugin",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",