@nexiq/shared 1.0.1 → 1.0.3

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.
Files changed (76) hide show
  1. package/dist/component.d.ts +99 -25
  2. package/dist/component.d.ts.map +1 -1
  3. package/dist/db/sqlite.d.ts +7 -1
  4. package/dist/db/sqlite.d.ts.map +1 -1
  5. package/dist/db/sqlite.js +24 -0
  6. package/dist/db/sqlite.js.map +1 -1
  7. package/dist/index.d.ts +128 -4
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/nexiq/graph-view/graph-combo.d.ts +37 -0
  12. package/dist/nexiq/graph-view/graph-combo.d.ts.map +1 -0
  13. package/dist/nexiq/graph-view/graph-combo.js +103 -0
  14. package/dist/nexiq/graph-view/graph-combo.js.map +1 -0
  15. package/dist/nexiq/graph-view/graph-edge.d.ts +30 -0
  16. package/dist/nexiq/graph-view/graph-edge.d.ts.map +1 -0
  17. package/dist/nexiq/graph-view/graph-edge.js +78 -0
  18. package/dist/nexiq/graph-view/graph-edge.js.map +1 -0
  19. package/dist/nexiq/graph-view/graph-node-detail.d.ts +26 -0
  20. package/dist/nexiq/graph-view/graph-node-detail.d.ts.map +1 -0
  21. package/dist/nexiq/graph-view/graph-node-detail.js +62 -0
  22. package/dist/nexiq/graph-view/graph-node-detail.js.map +1 -0
  23. package/dist/nexiq/graph-view/graph-node.d.ts +35 -0
  24. package/dist/nexiq/graph-view/graph-node.d.ts.map +1 -0
  25. package/dist/nexiq/graph-view/graph-node.js +95 -0
  26. package/dist/nexiq/graph-view/graph-node.js.map +1 -0
  27. package/dist/nexiq/graph-view/graph-view.d.ts +39 -0
  28. package/dist/nexiq/graph-view/graph-view.d.ts.map +1 -0
  29. package/dist/nexiq/graph-view/graph-view.js +131 -0
  30. package/dist/nexiq/graph-view/graph-view.js.map +1 -0
  31. package/dist/nexiq/graph-view/item-type.d.ts +18 -0
  32. package/dist/nexiq/graph-view/item-type.d.ts.map +1 -0
  33. package/dist/nexiq/graph-view/item-type.js +20 -0
  34. package/dist/nexiq/graph-view/item-type.js.map +1 -0
  35. package/dist/nexiq/graph-view/loc.d.ts +16 -0
  36. package/dist/nexiq/graph-view/loc.d.ts.map +1 -0
  37. package/dist/nexiq/graph-view/loc.js +46 -0
  38. package/dist/nexiq/graph-view/loc.js.map +1 -0
  39. package/dist/nexiq/graph-view.d.ts +8 -0
  40. package/dist/nexiq/graph-view.d.ts.map +1 -0
  41. package/dist/nexiq/graph-view.js +9 -0
  42. package/dist/nexiq/graph-view.js.map +1 -0
  43. package/dist/types/backend.d.ts +17 -28
  44. package/dist/types/backend.d.ts.map +1 -1
  45. package/dist/types/config.d.ts +2 -29
  46. package/dist/types/config.d.ts.map +1 -1
  47. package/dist/types/function.d.ts.map +1 -1
  48. package/dist/types/index.d.ts +16 -14
  49. package/dist/types/index.d.ts.map +1 -1
  50. package/dist/types/index.js.map +1 -1
  51. package/dist/types/primitive.d.ts +12 -0
  52. package/dist/types/primitive.d.ts.map +1 -1
  53. package/dist/utils.d.ts +1 -0
  54. package/dist/utils.d.ts.map +1 -1
  55. package/dist/utils.js.map +1 -1
  56. package/eslint.config.js +32 -0
  57. package/package.json +16 -6
  58. package/src/component.ts +159 -35
  59. package/src/db/sqlite.ts +30 -0
  60. package/src/index.ts +144 -3
  61. package/src/nexiq/graph-view/graph-combo.ts +141 -0
  62. package/src/nexiq/graph-view/graph-edge.ts +108 -0
  63. package/src/nexiq/graph-view/graph-node-detail.ts +88 -0
  64. package/src/nexiq/graph-view/graph-node.ts +131 -0
  65. package/src/nexiq/graph-view/graph-view.ts +162 -0
  66. package/src/nexiq/graph-view/item-type.ts +19 -0
  67. package/src/nexiq/graph-view/loc.ts +56 -0
  68. package/src/nexiq/graph-view.ts +9 -0
  69. package/src/schema/graph_view.fbs +74 -0
  70. package/src/types/backend.ts +11 -23
  71. package/src/types/config.ts +2 -33
  72. package/src/types/function.ts +2 -4
  73. package/src/types/index.ts +17 -16
  74. package/src/types/primitive.ts +7 -1
  75. package/src/utils.ts +4 -0
  76. package/tsconfig.json +13 -24
@@ -0,0 +1,56 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ import * as flatbuffers from 'flatbuffers';
4
+
5
+ export class Loc {
6
+ bb: flatbuffers.ByteBuffer|null = null;
7
+ bb_pos = 0;
8
+ __init(i:number, bb:flatbuffers.ByteBuffer):Loc {
9
+ this.bb_pos = i;
10
+ this.bb = bb;
11
+ return this;
12
+ }
13
+
14
+ static getRootAsLoc(bb:flatbuffers.ByteBuffer, obj?:Loc):Loc {
15
+ return (obj || new Loc()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
16
+ }
17
+
18
+ static getSizePrefixedRootAsLoc(bb:flatbuffers.ByteBuffer, obj?:Loc):Loc {
19
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
20
+ return (obj || new Loc()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21
+ }
22
+
23
+ line():number {
24
+ const offset = this.bb!.__offset(this.bb_pos, 4);
25
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
26
+ }
27
+
28
+ column():number {
29
+ const offset = this.bb!.__offset(this.bb_pos, 6);
30
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
31
+ }
32
+
33
+ static startLoc(builder:flatbuffers.Builder) {
34
+ builder.startObject(2);
35
+ }
36
+
37
+ static addLine(builder:flatbuffers.Builder, line:number) {
38
+ builder.addFieldInt32(0, line, 0);
39
+ }
40
+
41
+ static addColumn(builder:flatbuffers.Builder, column:number) {
42
+ builder.addFieldInt32(1, column, 0);
43
+ }
44
+
45
+ static endLoc(builder:flatbuffers.Builder):flatbuffers.Offset {
46
+ const offset = builder.endObject();
47
+ return offset;
48
+ }
49
+
50
+ static createLoc(builder:flatbuffers.Builder, line:number, column:number):flatbuffers.Offset {
51
+ Loc.startLoc(builder);
52
+ Loc.addLine(builder, line);
53
+ Loc.addColumn(builder, column);
54
+ return Loc.endLoc(builder);
55
+ }
56
+ }
@@ -0,0 +1,9 @@
1
+ // automatically generated by the FlatBuffers compiler, do not modify
2
+
3
+ export { GraphCombo } from './graph-view/graph-combo.js';
4
+ export { GraphEdge } from './graph-view/graph-edge.js';
5
+ export { GraphNode } from './graph-view/graph-node.js';
6
+ export { GraphNodeDetail } from './graph-view/graph-node-detail.js';
7
+ export { GraphView } from './graph-view/graph-view.js';
8
+ export { ItemType } from './graph-view/item-type.js';
9
+ export { Loc } from './graph-view/loc.js';
@@ -0,0 +1,74 @@
1
+ namespace Nexiq.GraphView;
2
+
3
+ enum ItemType : byte {
4
+ Package = 0,
5
+ Scope = 1,
6
+ Component = 2,
7
+ Hook = 3,
8
+ State = 4,
9
+ Memo = 5,
10
+ Callback = 6,
11
+ Ref = 7,
12
+ Effect = 8,
13
+ Prop = 9,
14
+ Render = 10,
15
+ RenderGroup = 11,
16
+ SourceGroup = 12,
17
+ PathGroup = 13,
18
+ Variable = 14
19
+ }
20
+
21
+ table Loc {
22
+ line:int;
23
+ column:int;
24
+ }
25
+
26
+ table GraphNode {
27
+ id:string;
28
+ type:ItemType;
29
+ name:string;
30
+ displayName:string;
31
+ comboId:string;
32
+ color:string;
33
+ radius:float;
34
+ gitStatus:string;
35
+ }
36
+
37
+ table GraphCombo {
38
+ id:string;
39
+ type:ItemType;
40
+ name:string;
41
+ displayName:string;
42
+ parentId:string;
43
+ color:string;
44
+ radius:float;
45
+ collapsed:bool;
46
+ gitStatus:string;
47
+ }
48
+
49
+ table GraphEdge {
50
+ id:string;
51
+ source:string;
52
+ target:string;
53
+ name:string;
54
+ kind:string;
55
+ category:string;
56
+ }
57
+
58
+ table GraphNodeDetail {
59
+ id:string;
60
+ fileName:string;
61
+ projectPath:string;
62
+ loc:Loc;
63
+ data_json:string;
64
+ }
65
+
66
+ table GraphView {
67
+ nodes:[GraphNode];
68
+ combos:[GraphCombo];
69
+ edges:[GraphEdge];
70
+ details:[GraphNodeDetail];
71
+ }
72
+
73
+ root_type GraphView;
74
+ file_identifier "NXGV";
@@ -1,12 +1,9 @@
1
- import type { DatabaseData, JsonData } from "../index.js";
2
1
  import type {
3
2
  ProjectStatus,
4
3
  GitStatus,
5
4
  GitCommit,
6
5
  GitFileDiff,
7
- ReactMapConfig,
8
- AppStateData,
9
- UIStateMap,
6
+ NexiqConfig,
10
7
  } from "./index.js";
11
8
 
12
9
  export interface BackendRequestMap {
@@ -15,12 +12,12 @@ export interface BackendRequestMap {
15
12
  response: ProjectStatus;
16
13
  };
17
14
  save_project_config: {
18
- payload: { projectPath: string; config: ReactMapConfig };
15
+ payload: { projectPath: string; config: NexiqConfig };
19
16
  response: { success: boolean };
20
17
  };
21
18
  get_project_icon: {
22
19
  payload: { projectPath: string };
23
- response: string | null;
20
+ response: { icon: string } | null;
24
21
  };
25
22
  git_status: {
26
23
  payload: { projectPath: string };
@@ -46,29 +43,16 @@ export interface BackendRequestMap {
46
43
  response: GitFileDiff[];
47
44
  };
48
45
  git_analyze_commit: {
49
- payload: { projectPath: string; commitHash: string; subPath?: string };
50
- response: DatabaseData;
51
- };
52
- open_project: {
53
- payload: { projectPath: string; subProject?: string };
46
+ payload: { projectPath: string; commitHash: string; subProject?: string };
54
47
  response: { sqlitePath: string };
55
48
  };
56
- read_state: {
57
- payload: { projectPath: string };
58
- response: unknown;
59
- };
60
- save_state: {
61
- payload: { projectPath: string; state: AppStateData };
62
- response: boolean;
63
- };
64
- update_graph_position: {
49
+ open_project: {
65
50
  payload: {
66
51
  projectPath: string;
67
52
  subProject?: string;
68
- positions: UIStateMap;
69
- contextId?: string;
53
+ subProjects?: string[];
70
54
  };
71
- response: boolean;
55
+ response: { sqlitePath: string };
72
56
  };
73
57
  call_tool: {
74
58
  payload: { name: string; arguments: Record<string, unknown> };
@@ -83,6 +67,10 @@ export interface BackendRequestMap {
83
67
  };
84
68
  response: void;
85
69
  };
70
+ get_node_detail: {
71
+ payload: { projectPath: string; nodeId: string };
72
+ response: any; // We'll use GraphNodeDetail here, but need to import it or use a generic object
73
+ };
86
74
  }
87
75
 
88
76
  export type BackendMessageType = keyof BackendRequestMap;
@@ -1,48 +1,17 @@
1
1
  export type AppTheme = "dark" | "light";
2
2
 
3
- export interface CustomColors {
4
- nodeHighlight?: string;
5
- comboHighlight?: string;
6
- arrowColor?: string;
7
- labelColor?: string;
8
- gitAdded?: string;
9
- gitModified?: string;
10
- gitDeleted?: string;
11
- // Node types
12
- stateNode?: string;
13
- memoNode?: string;
14
- callbackNode?: string;
15
- refNode?: string;
16
- effectNode?: string;
17
- propNode?: string;
18
- componentNode?: string;
19
- hookNode?: string;
20
- renderNode?: string;
21
- // Type highlighting
22
- typeKeyword?: string;
23
- typeLiteral?: string;
24
- typeString?: string;
25
- typeNumber?: string;
26
- typeBoolean?: string;
27
- typePunctuation?: string;
28
- typeReference?: string;
29
- typeComponent?: string;
30
- typeDefault?: string;
31
- // UI Specific
32
- genericsColor?: string;
33
- }
34
-
35
3
  export interface SubProject {
36
4
  name: string;
37
5
  path: string;
38
6
  }
39
7
 
40
- export interface ReactMapConfig {
8
+ export interface NexiqConfig {
41
9
  entry?: string;
42
10
  aliases?: Record<string, string>;
43
11
  extensions?: string[];
44
12
  dependencyDepth?: number;
45
13
  analysisPath?: string;
14
+ analysisPaths?: string[];
46
15
  ignorePatterns?: string[];
47
16
  ignoreSubProjects?: string[];
48
17
  }
@@ -7,14 +7,12 @@ export interface TypeDataFunctionParameterBase {
7
7
  decorator: never;
8
8
  }
9
9
 
10
- export interface TypeDataFunctionParameterName
11
- extends TypeDataFunctionParameterBase {
10
+ export interface TypeDataFunctionParameterName extends TypeDataFunctionParameterBase {
12
11
  name: string;
13
12
  body: TypeData;
14
13
  }
15
14
 
16
- export interface TypeDataFunctionParameterObject
17
- extends TypeDataFunctionParameterBase {
15
+ export interface TypeDataFunctionParameterObject extends TypeDataFunctionParameterBase {
18
16
  name: string;
19
17
  body: TypeDataLiteralBody[];
20
18
  properties: FuncParam[];
@@ -1,6 +1,6 @@
1
1
  import type { ComponentLoc, VariableName } from "../component.js";
2
2
  import type { TypeData, TypeDataLiteralBody } from "./primitive.js";
3
- import type { ReactMapConfig, SubProject } from "./config.js";
3
+ import type { NexiqConfig, SubProject } from "./config.js";
4
4
  export * from "./primitive.js";
5
5
  export * from "./object.js";
6
6
  export * from "./git.js";
@@ -10,19 +10,28 @@ export interface ProjectStatus {
10
10
  hasConfig: boolean;
11
11
  isMonorepo: boolean;
12
12
  projectType: "vite" | "next" | "unknown";
13
- config: ReactMapConfig | null;
13
+ config: NexiqConfig | null;
14
14
  subProjects: SubProject[];
15
15
  }
16
16
 
17
- export type GraphViewType = "component" | "file" | "router";
17
+ export type GraphViewType = "component" | "file" | "router" | "package";
18
+
19
+ export interface AppSelectionState {
20
+ type: "node" | "edge";
21
+ id: string;
22
+ }
18
23
 
19
24
  export interface AppStateData {
20
- selectedSubProject: string | null;
25
+ selectedSubProjects: string[];
21
26
  centeredItemId: string | null;
22
27
  selectedId: string | null;
28
+ selectedEdgeId?: string | null;
29
+ selectedItemType?: "node" | "edge" | null;
30
+ selected?: AppSelectionState | null;
23
31
  isSidebarOpen: boolean;
24
32
  activeTab: "projects" | "git";
25
33
  selectedCommit: string | null;
34
+ gitComparisonEnabled?: boolean;
26
35
  viewport?: { x: number; y: number; zoom: number } | null;
27
36
  view?: GraphViewType;
28
37
  sidebar: {
@@ -30,6 +39,10 @@ export interface AppStateData {
30
39
  width?: number;
31
40
  height?: number;
32
41
  };
42
+ bottom?: {
43
+ isOpen?: boolean;
44
+ height?: number;
45
+ };
33
46
  };
34
47
  }
35
48
 
@@ -77,16 +90,4 @@ export type ComponentTypeData =
77
90
  body: TypeData;
78
91
  };
79
92
 
80
- export interface UIItemState {
81
- x: number;
82
- y: number;
83
- radius?: number;
84
- collapsedRadius?: number;
85
- expandedRadius?: number;
86
- isLayoutCalculated?: boolean;
87
- collapsed?: boolean;
88
- }
89
-
90
- export type UIStateMap = Record<string, UIItemState>;
91
-
92
93
  export * from "./backend.js";
@@ -90,6 +90,8 @@ export interface TypeDataLiteralType {
90
90
  export type TypeDataRef = {
91
91
  type: "ref";
92
92
  params?: TypeData[];
93
+ resolvedId?: string | undefined;
94
+ unresolvedWorkspace?: boolean | undefined;
93
95
  } & (
94
96
  | {
95
97
  refType: "named";
@@ -192,6 +194,8 @@ export interface TypeDataImport {
192
194
  type: "import";
193
195
  name: string;
194
196
  qualifier?: string;
197
+ resolvedId?: string | undefined;
198
+ unresolvedWorkspace?: boolean | undefined;
195
199
  }
196
200
 
197
201
  export interface TypeDataLiteralBodyBase {
@@ -215,6 +219,7 @@ export interface TypeDataLiteralBodyProperty extends TypeDataLiteralBodyBase {
215
219
  optional?: boolean;
216
220
  computed?: boolean;
217
221
  name: string;
222
+ loc?: { line: number; column: number };
218
223
  }
219
224
 
220
225
  export interface TypeDataLiteralBodyMethod extends TypeDataLiteralBodyBase {
@@ -225,6 +230,7 @@ export interface TypeDataLiteralBodyMethod extends TypeDataLiteralBodyBase {
225
230
  params: TypeDataParamFunction[];
226
231
  parameters: TypeDataFunctionParameter[];
227
232
  return: TypeData;
233
+ loc?: { line: number; column: number };
228
234
  }
229
235
 
230
236
  export type TypeDataLiteralBody =
@@ -265,4 +271,4 @@ export type TypeData =
265
271
  | TypeDataTypeBodyIntersection
266
272
  | TypeDataTypeBodyParathesis
267
273
  | TypeDataLiteralArray
268
- | TypeDataLiteralObject;
274
+ | TypeDataLiteralObject;
package/src/utils.ts CHANGED
@@ -3,6 +3,10 @@ import type { GitFileDiff, GitDiffHunk } from "./types/git.js";
3
3
 
4
4
  export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
5
5
 
6
+ export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown
7
+ ? Omit<T, K>
8
+ : never;
9
+
6
10
  export const getDisplayName = (
7
11
  name: VariableName | string | undefined,
8
12
  ): string => {
package/tsconfig.json CHANGED
@@ -1,46 +1,35 @@
1
1
  {
2
- // Visit https://aka.ms/tsconfig to read more about this file
3
2
  "compilerOptions": {
4
- // File Layout
3
+ // File layout
5
4
  "rootDir": "./src",
6
5
  "outDir": "./dist",
7
6
 
8
- // Environment Settings
9
- // See also https://aka.ms/tsconfig/module
7
+ // Module & target for modern Node + React
10
8
  "module": "nodenext",
11
9
  "target": "esnext",
12
- "types": [],
13
- // For nodejs:
14
- // "lib": ["esnext"],
15
- // "types": ["node"],
16
- // and npm install -D @types/node
10
+ "moduleResolution": "nodenext",
11
+ "types": ["node"],
17
12
 
18
- // Other Outputs
13
+ // Outputs
19
14
  "sourceMap": true,
20
15
  "declaration": true,
21
16
  "declarationMap": true,
22
17
 
23
- // Stricter Typechecking Options
18
+ // Type checking
19
+ "strict": true,
24
20
  "noUncheckedIndexedAccess": true,
25
21
  "exactOptionalPropertyTypes": true,
26
22
 
27
- // Style Options
28
- // "noImplicitReturns": true,
29
- // "noImplicitOverride": true,
30
- // "noUnusedLocals": true,
31
- // "noUnusedParameters": true,
32
- // "noFallthroughCasesInSwitch": true,
33
- // "noPropertyAccessFromIndexSignature": true,
34
-
35
- // Recommended Options
36
- "strict": true,
23
+ // React
37
24
  "jsx": "react-jsx",
38
- "verbatimModuleSyntax": true,
25
+
26
+ // ESM / Node interoperability
39
27
  "isolatedModules": true,
28
+ "verbatimModuleSyntax": true,
40
29
  "noUncheckedSideEffectImports": true,
41
30
  "moduleDetection": "force",
42
- "skipLibCheck": true,
31
+ "skipLibCheck": true
43
32
  },
44
33
  "include": ["src"],
45
34
  "exclude": ["tsconfig.json"]
46
- }
35
+ }