@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
- if (isImportDeclaration(declaration.getParent())) {
262
- return declaration.getParent();
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 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`);
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
@@ -9,7 +9,7 @@ import {
9
9
  readLocalMeta,
10
10
  writeLocalAnalysis,
11
11
  writeLocalMeta
12
- } from "./chunk-3IJUZFQ6.js";
12
+ } from "./chunk-7MVXRAM4.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-7MVXRAM4.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.6",
4
4
  "description": "Rayburst - Automatic code analysis for TypeScript/JavaScript projects via Vite plugin",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",