@nexiq/extension-sdk 1.0.1
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.
- package/dist/extension-sdk/src/index.d.ts +94 -0
- package/dist/extension-sdk/src/index.js +2 -0
- package/dist/extension-sdk/src/tasks/componentTask.d.ts +2 -0
- package/dist/extension-sdk/src/tasks/componentTask.js +129 -0
- package/dist/extension-sdk/src/tasks/gitTask.d.ts +6 -0
- package/dist/extension-sdk/src/tasks/gitTask.js +69 -0
- package/dist/shared/src/component.d.ts +273 -0
- package/dist/shared/src/component.js +1 -0
- package/dist/shared/src/index.d.ts +126 -0
- package/dist/shared/src/index.js +3 -0
- package/dist/shared/src/types/backend.d.ts +109 -0
- package/dist/shared/src/types/backend.js +1 -0
- package/dist/shared/src/types/config.d.ts +42 -0
- package/dist/shared/src/types/config.js +1 -0
- package/dist/shared/src/types/git.d.ts +41 -0
- package/dist/shared/src/types/git.js +1 -0
- package/dist/shared/src/types/index.d.ts +80 -0
- package/dist/shared/src/types/index.js +5 -0
- package/dist/shared/src/types/object.d.ts +24 -0
- package/dist/shared/src/types/object.js +1 -0
- package/dist/shared/src/types/primitive.d.ts +175 -0
- package/dist/shared/src/types/primitive.js +1 -0
- package/dist/shared/src/utils.d.ts +5 -0
- package/dist/shared/src/utils.js +81 -0
- package/eslint.config.js +31 -0
- package/package.json +35 -0
- package/src/index.ts +112 -0
- package/src/tasks/componentTask.ts +166 -0
- package/src/tasks/gitTask.ts +83 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { TypeDataDeclare, ComponentFileVar, VariableName, DatabaseData } from "@nexiq/shared";
|
|
2
|
+
export type { TypeDataDeclare, ComponentFileVar, VariableName, DatabaseData };
|
|
3
|
+
export interface GraphItemPosition {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface GraphNodeData {
|
|
8
|
+
id: string;
|
|
9
|
+
name: VariableName | string;
|
|
10
|
+
label?: {
|
|
11
|
+
text: string;
|
|
12
|
+
fill?: string;
|
|
13
|
+
};
|
|
14
|
+
type?: string;
|
|
15
|
+
fileName?: string;
|
|
16
|
+
pureFileName?: string;
|
|
17
|
+
loc?: {
|
|
18
|
+
line: number;
|
|
19
|
+
column: number;
|
|
20
|
+
};
|
|
21
|
+
radius?: number;
|
|
22
|
+
color?: string;
|
|
23
|
+
combo?: string;
|
|
24
|
+
gitStatus?: "added" | "modified" | "deleted";
|
|
25
|
+
declarationKind?: "const" | "let" | "var" | "using" | "await using";
|
|
26
|
+
tag?: string;
|
|
27
|
+
raw?: ComponentFileVar;
|
|
28
|
+
displayName?: string;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
export interface GraphComboData extends GraphNodeData {
|
|
32
|
+
collapsed?: boolean;
|
|
33
|
+
collapsedRadius?: number;
|
|
34
|
+
expandedRadius?: number;
|
|
35
|
+
padding?: number;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
export interface GraphArrowData {
|
|
39
|
+
id: string;
|
|
40
|
+
source: string;
|
|
41
|
+
target: string;
|
|
42
|
+
label?: string;
|
|
43
|
+
combo?: string;
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
export interface useGraphProps {
|
|
47
|
+
nodes: GraphNodeData[];
|
|
48
|
+
edges: GraphArrowData[];
|
|
49
|
+
combos: GraphComboData[];
|
|
50
|
+
}
|
|
51
|
+
export interface GraphViewResult extends useGraphProps {
|
|
52
|
+
typeData: Record<string, TypeDataDeclare>;
|
|
53
|
+
}
|
|
54
|
+
export interface GraphViewTask {
|
|
55
|
+
id: string;
|
|
56
|
+
priority: number;
|
|
57
|
+
run: (data: DatabaseData, result: GraphViewResult, batch?: Partial<DatabaseData>) => GraphViewResult;
|
|
58
|
+
}
|
|
59
|
+
export interface DetailSectionProps {
|
|
60
|
+
selectedId: string;
|
|
61
|
+
item: GraphNodeData | GraphComboData;
|
|
62
|
+
graph: unknown;
|
|
63
|
+
projectPath: string;
|
|
64
|
+
typeData: Record<string, TypeDataDeclare>;
|
|
65
|
+
onSelect?: (id: string) => void;
|
|
66
|
+
renderNodes?: GraphNodeData[];
|
|
67
|
+
}
|
|
68
|
+
export interface DetailSection {
|
|
69
|
+
id: string;
|
|
70
|
+
title: string;
|
|
71
|
+
priority: number;
|
|
72
|
+
component: React.ComponentType<DetailSectionProps>;
|
|
73
|
+
shouldShow: (item: GraphNodeData | GraphComboData) => boolean;
|
|
74
|
+
defaultOpen?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface MCPToolHandlerArgs {
|
|
77
|
+
projectPath?: string;
|
|
78
|
+
projectManager: unknown;
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
export interface MCPTool {
|
|
82
|
+
name: string;
|
|
83
|
+
description: string;
|
|
84
|
+
inputSchema: Record<string, unknown>;
|
|
85
|
+
handler: (args: MCPToolHandlerArgs) => Promise<unknown>;
|
|
86
|
+
}
|
|
87
|
+
export interface Extension {
|
|
88
|
+
id: string;
|
|
89
|
+
viewTasks?: Record<string, GraphViewTask[]>;
|
|
90
|
+
detailSections?: DetailSection[];
|
|
91
|
+
mcpTools?: MCPTool[];
|
|
92
|
+
}
|
|
93
|
+
export * from "./tasks/componentTask.js";
|
|
94
|
+
export * from "./tasks/gitTask.js";
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export const componentTask = {
|
|
2
|
+
id: "component-structure",
|
|
3
|
+
priority: 10,
|
|
4
|
+
run: (data, result, batch) => {
|
|
5
|
+
const combos = [...result.combos];
|
|
6
|
+
const nodes = [...result.nodes];
|
|
7
|
+
const edges = [...result.edges];
|
|
8
|
+
const typeData = { ...result.typeData };
|
|
9
|
+
const entities = batch?.entities || data.entities || [];
|
|
10
|
+
const scopes = batch?.scopes || data.scopes || [];
|
|
11
|
+
const symbols = batch?.symbols || data.symbols || [];
|
|
12
|
+
const relations = batch?.relations || data.relations || [];
|
|
13
|
+
const renders = batch?.renders || data.renders || [];
|
|
14
|
+
const files = data.files || [];
|
|
15
|
+
const fileMap = new Map(files.map((f) => [f.id, f.path]));
|
|
16
|
+
// 1. Map Scopes to Combos
|
|
17
|
+
for (const scope of scopes) {
|
|
18
|
+
if (combos.some((c) => c.id === scope.id))
|
|
19
|
+
continue;
|
|
20
|
+
combos.push({
|
|
21
|
+
id: scope.id,
|
|
22
|
+
name: scope.kind,
|
|
23
|
+
label: { text: scope.kind },
|
|
24
|
+
combo: scope.parent_id || undefined,
|
|
25
|
+
type: "scope",
|
|
26
|
+
collapsed: true,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// 2. Map Symbols to Nodes/Labels
|
|
30
|
+
for (const symbol of symbols) {
|
|
31
|
+
if (nodes.some((n) => n.id === symbol.id) ||
|
|
32
|
+
combos.some((c) => c.id === symbol.id))
|
|
33
|
+
continue;
|
|
34
|
+
const entity = data.entities.find((e) => e.id === symbol.entity_id);
|
|
35
|
+
if (!entity)
|
|
36
|
+
continue;
|
|
37
|
+
const scope = data.scopes.find((s) => s.id === symbol.scope_id);
|
|
38
|
+
const file = scope ? fileMap.get(scope.file_id) : undefined;
|
|
39
|
+
// Check if this symbol's entity has an associated block scope (the body)
|
|
40
|
+
const blockScope = data.scopes.find((s) => s.entity_id === entity.id && s.kind === "block");
|
|
41
|
+
if (blockScope) {
|
|
42
|
+
// This symbol represents a scope (e.g. function body)
|
|
43
|
+
// We update the combo created for this scope
|
|
44
|
+
const combo = combos.find((c) => c.id === blockScope.id);
|
|
45
|
+
if (combo) {
|
|
46
|
+
combo.label = { text: symbol.name };
|
|
47
|
+
combo.displayName = symbol.name;
|
|
48
|
+
combo.type = entity.kind;
|
|
49
|
+
combo.fileName = file;
|
|
50
|
+
combo.loc = { line: entity.line || 0, column: entity.column || 0 };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// Just a variable, create a node
|
|
55
|
+
nodes.push({
|
|
56
|
+
id: symbol.id,
|
|
57
|
+
name: symbol.name,
|
|
58
|
+
label: { text: symbol.name },
|
|
59
|
+
combo: symbol.scope_id,
|
|
60
|
+
type: entity.kind,
|
|
61
|
+
fileName: file,
|
|
62
|
+
loc: { line: entity.line || 0, column: entity.column || 0 },
|
|
63
|
+
displayName: symbol.name,
|
|
64
|
+
radius: 10,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// 3. Handle Renders (JSX)
|
|
69
|
+
for (const render of renders) {
|
|
70
|
+
if (nodes.some((n) => n.id === render.id) ||
|
|
71
|
+
combos.some((c) => c.id === render.id))
|
|
72
|
+
continue;
|
|
73
|
+
const file = fileMap.get(render.file_id);
|
|
74
|
+
const parentCombo = render.parent_render_id ||
|
|
75
|
+
data.scopes.find((s) => s.entity_id === render.parent_entity_id && s.kind === "block")?.id;
|
|
76
|
+
const commonData = {
|
|
77
|
+
id: render.id,
|
|
78
|
+
name: render.tag,
|
|
79
|
+
label: { text: render.tag },
|
|
80
|
+
combo: parentCombo,
|
|
81
|
+
type: "render",
|
|
82
|
+
fileName: file,
|
|
83
|
+
loc: { line: render.line || 0, column: render.column || 0 },
|
|
84
|
+
displayName: render.tag,
|
|
85
|
+
};
|
|
86
|
+
// If it has children (renders that point to it as parent_render_id), make it a combo
|
|
87
|
+
const hasChildren = data.renders.some((r) => r.parent_render_id === render.id);
|
|
88
|
+
if (hasChildren) {
|
|
89
|
+
combos.push({
|
|
90
|
+
...commonData,
|
|
91
|
+
collapsed: true,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
nodes.push({
|
|
96
|
+
...commonData,
|
|
97
|
+
radius: 10,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (render.symbol_id) {
|
|
101
|
+
edges.push({
|
|
102
|
+
id: `${render.id}-${render.symbol_id}`,
|
|
103
|
+
source: render.id,
|
|
104
|
+
target: render.symbol_id,
|
|
105
|
+
label: "reference",
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// 4. Handle Relations (Edges)
|
|
110
|
+
for (const rel of relations) {
|
|
111
|
+
const edgeId = `${rel.from_id}-${rel.to_id}`;
|
|
112
|
+
if (edges.some((e) => e.id === edgeId))
|
|
113
|
+
continue;
|
|
114
|
+
edges.push({
|
|
115
|
+
id: edgeId,
|
|
116
|
+
source: rel.from_id,
|
|
117
|
+
target: rel.to_id,
|
|
118
|
+
label: rel.kind,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
...result,
|
|
123
|
+
nodes,
|
|
124
|
+
combos,
|
|
125
|
+
edges,
|
|
126
|
+
typeData,
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task that applies Git status (added, modified, deleted) to nodes and combos.
|
|
3
|
+
* This runs after the base graph has been generated.
|
|
4
|
+
*/
|
|
5
|
+
export const gitTask = {
|
|
6
|
+
id: "git-status",
|
|
7
|
+
priority: 100, // Run late to ensure all nodes/combos are present
|
|
8
|
+
run: (graphData, result) => {
|
|
9
|
+
const { added = [], modified = [], deleted = [] } = graphData.diff || {};
|
|
10
|
+
// Skip if no diff data
|
|
11
|
+
if (added.length === 0 && modified.length === 0 && deleted.length === 0) {
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
const combos = [...result.combos];
|
|
15
|
+
const nodes = [...result.nodes];
|
|
16
|
+
const applyStatus = (item) => {
|
|
17
|
+
// Find the base ID for mapping (e.g., stripping '-render-instanceId')
|
|
18
|
+
let baseId = item.id;
|
|
19
|
+
if (item.id.includes("-render-")) {
|
|
20
|
+
baseId = item.id.split("-render-")[0];
|
|
21
|
+
}
|
|
22
|
+
else if (item.id.includes("-props")) {
|
|
23
|
+
baseId = item.id.split("-props")[0];
|
|
24
|
+
}
|
|
25
|
+
else if (item.id.includes(":")) {
|
|
26
|
+
// Handle virtual variables (parent:id)
|
|
27
|
+
baseId = item.id.split(":")[0];
|
|
28
|
+
}
|
|
29
|
+
if (added.includes(item.id) || added.includes(baseId)) {
|
|
30
|
+
item.gitStatus = "added";
|
|
31
|
+
}
|
|
32
|
+
else if (modified.includes(item.id) || modified.includes(baseId)) {
|
|
33
|
+
item.gitStatus = "modified";
|
|
34
|
+
}
|
|
35
|
+
else if (deleted.includes(item.id) || deleted.includes(baseId)) {
|
|
36
|
+
item.gitStatus = "deleted";
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
nodes.forEach(applyStatus);
|
|
40
|
+
combos.forEach(applyStatus);
|
|
41
|
+
// Aggregate statuses for specialized combos (like 'props')
|
|
42
|
+
combos.forEach((combo) => {
|
|
43
|
+
if (combo.id.endsWith("-props")) {
|
|
44
|
+
const childStatuses = [
|
|
45
|
+
...nodes
|
|
46
|
+
.filter((n) => n.combo === combo.id)
|
|
47
|
+
.map((n) => n.gitStatus),
|
|
48
|
+
...combos
|
|
49
|
+
.filter((c) => c.combo === combo.id)
|
|
50
|
+
.map((c) => c.gitStatus),
|
|
51
|
+
].filter(Boolean);
|
|
52
|
+
if (childStatuses.length > 0) {
|
|
53
|
+
const unique = new Set(childStatuses);
|
|
54
|
+
if (unique.size === 1) {
|
|
55
|
+
combo.gitStatus = childStatuses[0];
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
combo.gitStatus = "modified";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
...result,
|
|
65
|
+
nodes,
|
|
66
|
+
combos,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import type { TypeDataDeclare, UIItemState } from "./types/index.js";
|
|
2
|
+
import type { PropDataType, TypeData } from "./types/primitive.js";
|
|
3
|
+
export type ComponentFileImport = {
|
|
4
|
+
localName: string;
|
|
5
|
+
importedName: string | null;
|
|
6
|
+
source: string;
|
|
7
|
+
type: "default" | "named" | "namespace" | "type";
|
|
8
|
+
importKind: "value" | "type";
|
|
9
|
+
};
|
|
10
|
+
export type ComponentFileExport = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
type: "default" | "named" | "namespace" | "type";
|
|
14
|
+
exportKind: "value" | "type" | "component" | "function" | "class";
|
|
15
|
+
};
|
|
16
|
+
export interface State extends ComponentLoc {
|
|
17
|
+
id: string;
|
|
18
|
+
setter?: string | undefined;
|
|
19
|
+
parentId?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface RefData extends ComponentLoc {
|
|
22
|
+
id: string;
|
|
23
|
+
defaultData: PropDataType;
|
|
24
|
+
parentId?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
export interface Memo extends ComponentLoc, ReactDependencies {
|
|
27
|
+
id: string;
|
|
28
|
+
scope: VariableScope;
|
|
29
|
+
async?: boolean | undefined;
|
|
30
|
+
parentId?: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
export type ComponentInfoRenderDependency = {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
value: PropDataType;
|
|
36
|
+
valueId?: string;
|
|
37
|
+
};
|
|
38
|
+
export interface ComponentInfoRender extends ComponentLoc {
|
|
39
|
+
id: string;
|
|
40
|
+
tag: string;
|
|
41
|
+
instanceId: string;
|
|
42
|
+
parentId?: string | undefined;
|
|
43
|
+
dependencies: ComponentInfoRenderDependency[];
|
|
44
|
+
isDependency?: boolean | undefined;
|
|
45
|
+
renderIndex: number;
|
|
46
|
+
kind: "jsx" | "ternary" | "loop" | "expression" | "hook" | "call";
|
|
47
|
+
children: Record<string, ComponentInfoRender>;
|
|
48
|
+
}
|
|
49
|
+
export interface EffectInfo extends ComponentLoc, ReactDependencies {
|
|
50
|
+
id: string;
|
|
51
|
+
scope?: VariableScope;
|
|
52
|
+
file?: string;
|
|
53
|
+
kind?: "effect";
|
|
54
|
+
}
|
|
55
|
+
export interface PropData {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
type: string;
|
|
59
|
+
kind: "prop" | "spread";
|
|
60
|
+
props?: PropData[];
|
|
61
|
+
hash?: string;
|
|
62
|
+
gitStatus?: "added" | "modified" | "deleted";
|
|
63
|
+
file?: string;
|
|
64
|
+
loc?: VariableLoc;
|
|
65
|
+
defaultValue?: PropDataType | undefined;
|
|
66
|
+
}
|
|
67
|
+
export interface ReactFunctionInfoBase {
|
|
68
|
+
states: string[];
|
|
69
|
+
hooks: string[];
|
|
70
|
+
props: PropData[];
|
|
71
|
+
propName?: string | undefined;
|
|
72
|
+
propType?: TypeData;
|
|
73
|
+
effects: Record<string, EffectInfo>;
|
|
74
|
+
}
|
|
75
|
+
export interface ReactFunctionInfo extends ReactFunctionInfoBase {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
file: string;
|
|
79
|
+
}
|
|
80
|
+
export interface HookInfo extends ReactFunctionInfoBase {
|
|
81
|
+
}
|
|
82
|
+
export interface ComponentInfo extends ReactFunctionInfoBase {
|
|
83
|
+
componentType: "Function" | "Class";
|
|
84
|
+
contexts: string[];
|
|
85
|
+
forwardRef?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface ComponentFileVarDependency {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
}
|
|
91
|
+
export interface VariableLoc {
|
|
92
|
+
line: number;
|
|
93
|
+
column: number;
|
|
94
|
+
}
|
|
95
|
+
export interface ComponentLoc {
|
|
96
|
+
loc: VariableLoc;
|
|
97
|
+
}
|
|
98
|
+
export interface VariableScope {
|
|
99
|
+
start: VariableLoc;
|
|
100
|
+
end: VariableLoc;
|
|
101
|
+
}
|
|
102
|
+
export type VarType = "function" | "data" | "jsx" | "class";
|
|
103
|
+
export type ReactFunctionVar = "component" | "hook";
|
|
104
|
+
export type ReactStateVar = "state" | "ref";
|
|
105
|
+
export type ReactWithCallbackVar = "memo" | "callback";
|
|
106
|
+
export type ReactVarKind = ReactFunctionVar | ReactStateVar | ReactWithCallbackVar;
|
|
107
|
+
export type VarKind = "normal" | ReactVarKind;
|
|
108
|
+
export type VariableNamePattern = {
|
|
109
|
+
type: "identifier";
|
|
110
|
+
name: string;
|
|
111
|
+
loc: VariableLoc;
|
|
112
|
+
id: string;
|
|
113
|
+
} | {
|
|
114
|
+
type: "object";
|
|
115
|
+
properties: VariableObjectProperty[];
|
|
116
|
+
raw: string;
|
|
117
|
+
loc: VariableLoc;
|
|
118
|
+
id: string;
|
|
119
|
+
} | {
|
|
120
|
+
type: "array";
|
|
121
|
+
elements: VariableArrayElement[];
|
|
122
|
+
raw: string;
|
|
123
|
+
loc: VariableLoc;
|
|
124
|
+
id: string;
|
|
125
|
+
} | {
|
|
126
|
+
type: "rest";
|
|
127
|
+
argument: VariableNamePattern;
|
|
128
|
+
loc: VariableLoc;
|
|
129
|
+
id: string;
|
|
130
|
+
} | {
|
|
131
|
+
type: "void";
|
|
132
|
+
loc: VariableLoc;
|
|
133
|
+
id: string;
|
|
134
|
+
};
|
|
135
|
+
export type VariableObjectProperty = {
|
|
136
|
+
key: string;
|
|
137
|
+
value: VariableNamePattern;
|
|
138
|
+
loc: VariableLoc;
|
|
139
|
+
};
|
|
140
|
+
export type VariableArrayElement = {
|
|
141
|
+
type: "element";
|
|
142
|
+
value: VariableNamePattern;
|
|
143
|
+
loc: VariableLoc;
|
|
144
|
+
} | {
|
|
145
|
+
type: "rest";
|
|
146
|
+
value: VariableNamePattern;
|
|
147
|
+
loc: VariableLoc;
|
|
148
|
+
} | null;
|
|
149
|
+
export type VariableName = VariableNamePattern;
|
|
150
|
+
interface ComponentFileVarBaseType<TType extends VarType> {
|
|
151
|
+
id: string;
|
|
152
|
+
name: VariableName;
|
|
153
|
+
type: TType;
|
|
154
|
+
file: string;
|
|
155
|
+
hash?: string | undefined;
|
|
156
|
+
parentId?: string | undefined;
|
|
157
|
+
declarationKind?: "const" | "let" | "var" | "using" | "await using" | undefined;
|
|
158
|
+
dependencies: Record<string, ComponentFileVarDependency>;
|
|
159
|
+
ui?: (UIItemState & {
|
|
160
|
+
children?: Record<string, UIItemState>;
|
|
161
|
+
vars?: Record<string, UIItemState>;
|
|
162
|
+
}) | undefined;
|
|
163
|
+
}
|
|
164
|
+
export interface ComponentFileVarBase<TType extends VarType, TKind extends VarKind> extends ComponentLoc, ComponentFileVarBaseType<TType> {
|
|
165
|
+
kind: TKind;
|
|
166
|
+
}
|
|
167
|
+
export type FunctionReturn = PropDataType | ComponentFileVarJSX | string;
|
|
168
|
+
export interface ComponentFileVarBaseTypeFunction<TKind extends VarKind, TType extends VarType = "function"> extends ComponentFileVarBase<TType, TKind> {
|
|
169
|
+
type: TType;
|
|
170
|
+
scope: VariableScope;
|
|
171
|
+
async?: boolean | undefined;
|
|
172
|
+
var: Record<string, ComponentFileVar>;
|
|
173
|
+
return?: FunctionReturn | undefined;
|
|
174
|
+
children: Record<string, ComponentInfoRender>;
|
|
175
|
+
}
|
|
176
|
+
export interface ComponentFileVarBaseTypeData<TKind extends VarKind, TType extends VarType = "data"> extends ComponentFileVarBase<TType, TKind> {
|
|
177
|
+
type: TType;
|
|
178
|
+
children?: Record<string, ComponentInfoRender>;
|
|
179
|
+
}
|
|
180
|
+
export type ComponentFileVarDependencyType<TKind extends VarKind> = ComponentFileVarBaseTypeFunction<TKind> | ComponentFileVarBaseTypeData<TKind>;
|
|
181
|
+
export type ComponentFileVarReact<TType extends VarType, TKind extends ReactVarKind> = ComponentFileVarBase<TType, TKind>;
|
|
182
|
+
export type ComponentFileVarReactFunction<TKind extends ReactVarKind, TType extends VarType = "function"> = ComponentFileVarBaseTypeFunction<TKind, TType> & ReactFunctionInfoBase;
|
|
183
|
+
export type ReactDependency = {
|
|
184
|
+
id: string;
|
|
185
|
+
name: string;
|
|
186
|
+
};
|
|
187
|
+
export type ReactDependencies = {
|
|
188
|
+
reactDeps: ReactDependency[];
|
|
189
|
+
};
|
|
190
|
+
export type ComponentFileVarReactWithCallback<TKind extends ReactVarKind, TType extends VarType = "function"> = ComponentFileVarBaseTypeFunction<TKind, TType> & ReactDependencies;
|
|
191
|
+
export type ComponentFileVarComponent = ComponentFileVarReactFunction<"component", "function" | "class"> & ComponentInfo & {
|
|
192
|
+
kind: "component";
|
|
193
|
+
};
|
|
194
|
+
export type ComponentFileVarState = ComponentFileVarReact<"data", "state"> & {
|
|
195
|
+
setter?: string | undefined;
|
|
196
|
+
};
|
|
197
|
+
export type ComponentFileVarCallHook = ComponentFileVarReact<"data", "hook"> & {
|
|
198
|
+
call: {
|
|
199
|
+
id: string;
|
|
200
|
+
name: string;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
export type ComponentFileVarRef = ComponentFileVarReact<"data", "ref"> & {
|
|
204
|
+
defaultData: PropDataType;
|
|
205
|
+
};
|
|
206
|
+
export type ComponentFileVarHook = ComponentFileVarReactFunction<"hook", "function"> & HookInfo & {
|
|
207
|
+
kind: "hook";
|
|
208
|
+
};
|
|
209
|
+
export type ComponentFileVarCallback = ComponentFileVarReactWithCallback<"callback"> & ReactDependencies;
|
|
210
|
+
export type MemoFileVarHook = ComponentFileVarReactWithCallback<"memo"> & ReactDependencies;
|
|
211
|
+
export type ComponentFileVarNormalBase<TType extends VarType> = ComponentLoc & ComponentFileVarBase<TType, "normal"> & {
|
|
212
|
+
kind: "normal";
|
|
213
|
+
};
|
|
214
|
+
export type ComponentFileVarNormalFunction = ComponentFileVarNormalBase<"function" | "class"> & ComponentFileVarBaseTypeFunction<"normal">;
|
|
215
|
+
export type ComponentFileVarNormalData = ComponentFileVarNormalBase<"data"> & ComponentFileVarBaseTypeData<"normal">;
|
|
216
|
+
export type ComponentFileVarNormal = ComponentFileVarNormalFunction | ComponentFileVarNormalData;
|
|
217
|
+
export interface ComponentFileVarJSX extends ComponentFileVarBase<"jsx", "normal"> {
|
|
218
|
+
type: "jsx";
|
|
219
|
+
tag: string;
|
|
220
|
+
props: ComponentInfoRenderDependency[];
|
|
221
|
+
children: Record<string, ComponentInfoRender>;
|
|
222
|
+
srcId?: string | undefined;
|
|
223
|
+
}
|
|
224
|
+
export type ComponentFileVarFunction = ComponentFileVarBaseTypeFunction<"normal"> & {
|
|
225
|
+
kind: "normal";
|
|
226
|
+
};
|
|
227
|
+
export type ComponentFileVar = ComponentFileVarComponent | ComponentFileVarState | ComponentFileVarCallHook | ComponentFileVarRef | ComponentFileVarNormal | ComponentFileVarHook | ComponentFileVarCallback | MemoFileVarHook | ComponentFileVarFunction | ComponentFileVarJSX;
|
|
228
|
+
export type IResolveAddRender = {
|
|
229
|
+
type: "comAddRender";
|
|
230
|
+
fileName: string;
|
|
231
|
+
tag: string;
|
|
232
|
+
dependency: ComponentInfoRenderDependency[];
|
|
233
|
+
loc: VariableLoc;
|
|
234
|
+
kind?: ComponentInfoRender["kind"] | undefined;
|
|
235
|
+
parentId?: string | undefined;
|
|
236
|
+
};
|
|
237
|
+
export type IResolveAddHook = {
|
|
238
|
+
type: "comAddHook";
|
|
239
|
+
name: string;
|
|
240
|
+
fileName: string;
|
|
241
|
+
hook: string;
|
|
242
|
+
loc: VariableLoc;
|
|
243
|
+
};
|
|
244
|
+
export type IResolveCallHook = {
|
|
245
|
+
type: "comResolveCallHook";
|
|
246
|
+
fileName: string;
|
|
247
|
+
loc: VariableLoc;
|
|
248
|
+
id: string;
|
|
249
|
+
hook: string;
|
|
250
|
+
};
|
|
251
|
+
export type IResolveTsType = {
|
|
252
|
+
type: "tsType";
|
|
253
|
+
fileName: string;
|
|
254
|
+
id: string;
|
|
255
|
+
};
|
|
256
|
+
export type IResolveComPropsTsType = {
|
|
257
|
+
type: "comPropsTsType";
|
|
258
|
+
fileName: string;
|
|
259
|
+
id: string;
|
|
260
|
+
};
|
|
261
|
+
export type ComponentDBResolve = IResolveAddRender | IResolveAddHook | IResolveCallHook | IResolveTsType | IResolveComPropsTsType;
|
|
262
|
+
export type ComponentFile = {
|
|
263
|
+
path: string;
|
|
264
|
+
fingerPrint: string;
|
|
265
|
+
hash: string;
|
|
266
|
+
import: Record<string, ComponentFileImport>;
|
|
267
|
+
export: Record<string, ComponentFileExport>;
|
|
268
|
+
starExports: string[];
|
|
269
|
+
defaultExport: string | null;
|
|
270
|
+
tsTypes: Record<string, TypeDataDeclare>;
|
|
271
|
+
var: Record<string, ComponentFileVar>;
|
|
272
|
+
};
|
|
273
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|