@rayburst/cli 0.4.3 → 0.4.4

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.
@@ -1217,6 +1217,58 @@ function getReturnDescription(returnAnalysis) {
1217
1217
  }
1218
1218
  return "Returns value";
1219
1219
  }
1220
+ function extractProviderItems(func) {
1221
+ const items = [];
1222
+ try {
1223
+ const variables = func.getVariableDeclarations();
1224
+ for (const variable of variables) {
1225
+ const varName = variable.getName();
1226
+ if (varName === "value" || varName.includes("Value") || varName.includes("Context")) {
1227
+ const initializer = variable.getInitializer();
1228
+ if (initializer && Node.isObjectLiteralExpression(initializer)) {
1229
+ const properties = initializer.getProperties();
1230
+ for (const prop of properties) {
1231
+ if (Node.isPropertyAssignment(prop) || Node.isShorthandPropertyAssignment(prop)) {
1232
+ const propName = prop.getName();
1233
+ const propType = prop.getType().getText();
1234
+ let icon = "Other";
1235
+ if (propType.includes("function") || propType.includes("=>")) {
1236
+ icon = "Function";
1237
+ } else if (propType.includes("boolean")) {
1238
+ icon = "State";
1239
+ } else if (propType.includes("User") || propType.includes("Session")) {
1240
+ icon = "User";
1241
+ } else if (propType.includes("object") || propType.includes("{")) {
1242
+ icon = "State";
1243
+ }
1244
+ items.push({
1245
+ name: propName,
1246
+ type: simplifyType(propType),
1247
+ icon,
1248
+ connections: 0
1249
+ // Will be calculated later based on edges
1250
+ });
1251
+ }
1252
+ }
1253
+ }
1254
+ }
1255
+ }
1256
+ } catch (error) {
1257
+ console.error("Failed to extract provider items:", error);
1258
+ }
1259
+ return items;
1260
+ }
1261
+ function simplifyType(type) {
1262
+ if (type.length > 50) {
1263
+ if (type.includes("function") || type.includes("=>")) return "function";
1264
+ if (type.includes("boolean")) return "boolean";
1265
+ if (type.includes("string")) return "string";
1266
+ if (type.includes("number")) return "number";
1267
+ if (type.includes("null")) return "null";
1268
+ return "object";
1269
+ }
1270
+ return type;
1271
+ }
1220
1272
  function extractComponents(sourceFile, relativePath, gitHash, baseX, startY, nodes, nodeMap, usedIds, idCounters) {
1221
1273
  let count = 0;
1222
1274
  let y = startY;
@@ -1230,6 +1282,7 @@ function extractComponents(sourceFile, relativePath, gitHash, baseX, startY, nod
1230
1282
  const propsType = propsParam ? propsParam.getType().getText() : "any";
1231
1283
  const returnAnalysis = analyzeReturnStatements(func);
1232
1284
  const isProvider = name.endsWith("Provider");
1285
+ const providerItems = isProvider ? extractProviderItems(func) : [];
1233
1286
  const node = {
1234
1287
  id,
1235
1288
  type: isProvider ? "provider" : "component",
@@ -1238,7 +1291,7 @@ function extractComponents(sourceFile, relativePath, gitHash, baseX, startY, nod
1238
1291
  providerName: name,
1239
1292
  label: name,
1240
1293
  description: `Provider in ${relativePath}`,
1241
- providerItems: []
1294
+ providerItems
1242
1295
  } : {
1243
1296
  componentName: name,
1244
1297
  props: propsType,
@@ -1270,6 +1323,7 @@ function extractComponents(sourceFile, relativePath, gitHash, baseX, startY, nod
1270
1323
  const propsType = propsParam ? propsParam.getType().getText() : "any";
1271
1324
  const returnAnalysis = analyzeReturnStatements(init);
1272
1325
  const isProvider = name.endsWith("Provider");
1326
+ const providerItems = isProvider ? extractProviderItems(init) : [];
1273
1327
  const node = {
1274
1328
  id,
1275
1329
  type: isProvider ? "provider" : "component",
@@ -1278,7 +1332,7 @@ function extractComponents(sourceFile, relativePath, gitHash, baseX, startY, nod
1278
1332
  providerName: name,
1279
1333
  label: name,
1280
1334
  description: `Provider in ${relativePath}`,
1281
- providerItems: []
1335
+ providerItems
1282
1336
  } : {
1283
1337
  componentName: name,
1284
1338
  props: propsType,
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  readLocalMeta,
10
10
  writeLocalAnalysis,
11
11
  writeLocalMeta
12
- } from "./chunk-76MJ4WFX.js";
12
+ } from "./chunk-HXDPGVSZ.js";
13
13
  export {
14
14
  addGitignoreEntry,
15
15
  analyzeProject,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  rayburstPlugin
3
- } from "./chunk-76MJ4WFX.js";
3
+ } from "./chunk-HXDPGVSZ.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.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Rayburst - Automatic code analysis for TypeScript/JavaScript projects via Vite plugin",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",