@nexiq/extension-sdk 1.0.1 → 1.0.2
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/package.json +4 -4
- package/tsconfig.json +3 -2
- package/dist/shared/src/component.d.ts +0 -273
- package/dist/shared/src/component.js +0 -1
- package/dist/shared/src/index.d.ts +0 -126
- package/dist/shared/src/index.js +0 -3
- package/dist/shared/src/types/backend.d.ts +0 -109
- package/dist/shared/src/types/backend.js +0 -1
- package/dist/shared/src/types/config.d.ts +0 -42
- package/dist/shared/src/types/config.js +0 -1
- package/dist/shared/src/types/git.d.ts +0 -41
- package/dist/shared/src/types/git.js +0 -1
- package/dist/shared/src/types/index.d.ts +0 -80
- package/dist/shared/src/types/index.js +0 -5
- package/dist/shared/src/types/object.d.ts +0 -24
- package/dist/shared/src/types/object.js +0 -1
- package/dist/shared/src/types/primitive.d.ts +0 -175
- package/dist/shared/src/types/primitive.js +0 -1
- package/dist/shared/src/utils.d.ts +0 -5
- package/dist/shared/src/utils.js +0 -81
- /package/dist/{extension-sdk/src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{extension-sdk/src/index.js → index.js} +0 -0
- /package/dist/{extension-sdk/src/tasks → tasks}/componentTask.d.ts +0 -0
- /package/dist/{extension-sdk/src/tasks → tasks}/componentTask.js +0 -0
- /package/dist/{extension-sdk/src/tasks → tasks}/gitTask.d.ts +0 -0
- /package/dist/{extension-sdk/src/tasks → tasks}/gitTask.js +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexiq/extension-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "SDK for creating
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "SDK for creating nexiq extensions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/Naputt1/
|
|
16
|
+
"url": "git+https://github.com/Naputt1/nexiq.git",
|
|
17
17
|
"directory": "packages/extension-sdk"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^18.0.0 || ^19.0.0",
|
|
25
|
-
"@nexiq/shared": "1.0.
|
|
25
|
+
"@nexiq/shared": "1.0.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"typescript": "^5.0.0",
|
package/tsconfig.json
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"moduleResolution": "NodeNext",
|
|
6
6
|
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
7
7
|
"declaration": true,
|
|
8
|
+
"rootDir": "src",
|
|
8
9
|
"outDir": "dist",
|
|
9
10
|
"strict": true,
|
|
10
11
|
"esModuleInterop": true,
|
|
@@ -13,8 +14,8 @@
|
|
|
13
14
|
"jsx": "react-jsx",
|
|
14
15
|
"baseUrl": ".",
|
|
15
16
|
"paths": {
|
|
16
|
-
"@nexiq/shared": ["../shared/
|
|
17
|
-
"@nexiq/shared/*": ["../shared/
|
|
17
|
+
"@nexiq/shared": ["../shared/dist/index.d.ts"],
|
|
18
|
+
"@nexiq/shared/*": ["../shared/dist/*"]
|
|
18
19
|
}
|
|
19
20
|
},
|
|
20
21
|
"include": ["src"]
|
|
@@ -1,273 +0,0 @@
|
|
|
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 {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import type { ComponentFile, ComponentFileVar, PropData, EffectInfo, ComponentDBResolve } from "./component.js";
|
|
2
|
-
export type DataEdge = {
|
|
3
|
-
from: string;
|
|
4
|
-
to: string;
|
|
5
|
-
label: string;
|
|
6
|
-
};
|
|
7
|
-
export interface EntityRow {
|
|
8
|
-
id: string;
|
|
9
|
-
scope_id: string;
|
|
10
|
-
kind: string;
|
|
11
|
-
name: string | null;
|
|
12
|
-
type: string | null;
|
|
13
|
-
line: number | null;
|
|
14
|
-
column: number | null;
|
|
15
|
-
end_line: number | null;
|
|
16
|
-
end_column: number | null;
|
|
17
|
-
declaration_kind: string | null;
|
|
18
|
-
data_json: string | null;
|
|
19
|
-
}
|
|
20
|
-
export interface ScopeRow {
|
|
21
|
-
id: string;
|
|
22
|
-
file_id: number;
|
|
23
|
-
parent_id: string | null;
|
|
24
|
-
kind: string;
|
|
25
|
-
entity_id: string | null;
|
|
26
|
-
data_json: string | null;
|
|
27
|
-
}
|
|
28
|
-
export interface SymbolRow {
|
|
29
|
-
id: string;
|
|
30
|
-
entity_id: string;
|
|
31
|
-
scope_id: string;
|
|
32
|
-
name: string;
|
|
33
|
-
path: string | null;
|
|
34
|
-
is_alias: number;
|
|
35
|
-
has_default: number;
|
|
36
|
-
data_json: string | null;
|
|
37
|
-
}
|
|
38
|
-
export interface RenderRow {
|
|
39
|
-
id: string;
|
|
40
|
-
file_id: number;
|
|
41
|
-
parent_entity_id: string;
|
|
42
|
-
parent_render_id: string | null;
|
|
43
|
-
render_index: number;
|
|
44
|
-
tag: string;
|
|
45
|
-
symbol_id: string | null;
|
|
46
|
-
line: number | null;
|
|
47
|
-
column: number | null;
|
|
48
|
-
kind: string;
|
|
49
|
-
data_json: string | null;
|
|
50
|
-
}
|
|
51
|
-
export interface RelationRow {
|
|
52
|
-
from_id: string;
|
|
53
|
-
to_id: string;
|
|
54
|
-
kind: string;
|
|
55
|
-
line: number | null;
|
|
56
|
-
column: number | null;
|
|
57
|
-
data_json: string | null;
|
|
58
|
-
}
|
|
59
|
-
export interface FileRow {
|
|
60
|
-
id: number;
|
|
61
|
-
path: string;
|
|
62
|
-
hash: string;
|
|
63
|
-
fingerprint: string;
|
|
64
|
-
default_export: string | null;
|
|
65
|
-
star_exports_json: string | null;
|
|
66
|
-
}
|
|
67
|
-
export interface ExportRow {
|
|
68
|
-
id: string;
|
|
69
|
-
scope_id: string;
|
|
70
|
-
symbol_id: string | null;
|
|
71
|
-
entity_id: string | null;
|
|
72
|
-
name: string | null;
|
|
73
|
-
is_default: number;
|
|
74
|
-
}
|
|
75
|
-
export type DatabaseData = {
|
|
76
|
-
files: FileRow[];
|
|
77
|
-
entities: EntityRow[];
|
|
78
|
-
scopes: ScopeRow[];
|
|
79
|
-
symbols: SymbolRow[];
|
|
80
|
-
renders: RenderRow[];
|
|
81
|
-
exports: ExportRow[];
|
|
82
|
-
relations: RelationRow[];
|
|
83
|
-
diff?: AnalyzedDiff;
|
|
84
|
-
};
|
|
85
|
-
export type AnalyzedDiff = {
|
|
86
|
-
added: string[];
|
|
87
|
-
modified: string[];
|
|
88
|
-
deleted: string[];
|
|
89
|
-
deletedObjects?: Record<string, ComponentFileVar | PropData | EffectInfo>;
|
|
90
|
-
};
|
|
91
|
-
export type JsonData = {
|
|
92
|
-
src: string;
|
|
93
|
-
edges: DataEdge[];
|
|
94
|
-
files: Record<string, ComponentFile>;
|
|
95
|
-
labels?: Record<string, string[]>;
|
|
96
|
-
diff?: AnalyzedDiff;
|
|
97
|
-
resolve: ComponentDBResolve[];
|
|
98
|
-
};
|
|
99
|
-
export interface BenchmarkToolCall {
|
|
100
|
-
id: string;
|
|
101
|
-
name: string;
|
|
102
|
-
arguments: Record<string, unknown>;
|
|
103
|
-
}
|
|
104
|
-
export interface BenchmarkStep {
|
|
105
|
-
role: "user" | "assistant" | "tool" | "system";
|
|
106
|
-
content?: string;
|
|
107
|
-
toolCalls?: BenchmarkToolCall[];
|
|
108
|
-
toolCallId?: string;
|
|
109
|
-
toolName?: string;
|
|
110
|
-
tokens: number;
|
|
111
|
-
}
|
|
112
|
-
export interface BenchmarkResult {
|
|
113
|
-
scenarioId: string;
|
|
114
|
-
projectName: string;
|
|
115
|
-
approach: "baseline" | "react-map-cold" | "react-map-warm";
|
|
116
|
-
testType: "single-prompt" | "planning";
|
|
117
|
-
model: string;
|
|
118
|
-
success: boolean;
|
|
119
|
-
totalTokens: number;
|
|
120
|
-
toolCallsCount: number;
|
|
121
|
-
latencyMs: number;
|
|
122
|
-
steps: BenchmarkStep[];
|
|
123
|
-
}
|
|
124
|
-
export * from "./types/index.js";
|
|
125
|
-
export * from "./component.js";
|
|
126
|
-
export * from "./utils.js";
|
package/dist/shared/src/index.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import type { DatabaseData } from "../index.js";
|
|
2
|
-
import type { ProjectStatus, GitStatus, GitCommit, GitFileDiff, ReactMapConfig, AppStateData, UIStateMap } from "./index.js";
|
|
3
|
-
export interface BackendRequestMap {
|
|
4
|
-
check_project_status: {
|
|
5
|
-
payload: {
|
|
6
|
-
projectPath: string;
|
|
7
|
-
};
|
|
8
|
-
response: ProjectStatus;
|
|
9
|
-
};
|
|
10
|
-
save_project_config: {
|
|
11
|
-
payload: {
|
|
12
|
-
projectPath: string;
|
|
13
|
-
config: ReactMapConfig;
|
|
14
|
-
};
|
|
15
|
-
response: {
|
|
16
|
-
success: boolean;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
get_project_icon: {
|
|
20
|
-
payload: {
|
|
21
|
-
projectPath: string;
|
|
22
|
-
};
|
|
23
|
-
response: string | null;
|
|
24
|
-
};
|
|
25
|
-
git_status: {
|
|
26
|
-
payload: {
|
|
27
|
-
projectPath: string;
|
|
28
|
-
};
|
|
29
|
-
response: GitStatus;
|
|
30
|
-
};
|
|
31
|
-
git_log: {
|
|
32
|
-
payload: {
|
|
33
|
-
projectPath: string;
|
|
34
|
-
options: number | {
|
|
35
|
-
limit?: number;
|
|
36
|
-
path?: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
response: GitCommit[];
|
|
40
|
-
};
|
|
41
|
-
git_diff: {
|
|
42
|
-
payload: {
|
|
43
|
-
projectPath: string;
|
|
44
|
-
options: {
|
|
45
|
-
file?: string;
|
|
46
|
-
commit?: string;
|
|
47
|
-
baseCommit?: string;
|
|
48
|
-
staged?: boolean;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
response: GitFileDiff[];
|
|
52
|
-
};
|
|
53
|
-
git_analyze_commit: {
|
|
54
|
-
payload: {
|
|
55
|
-
projectPath: string;
|
|
56
|
-
commitHash: string;
|
|
57
|
-
subPath?: string;
|
|
58
|
-
};
|
|
59
|
-
response: DatabaseData;
|
|
60
|
-
};
|
|
61
|
-
open_project: {
|
|
62
|
-
payload: {
|
|
63
|
-
projectPath: string;
|
|
64
|
-
subProject?: string;
|
|
65
|
-
};
|
|
66
|
-
response: {
|
|
67
|
-
sqlitePath: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
read_state: {
|
|
71
|
-
payload: {
|
|
72
|
-
projectPath: string;
|
|
73
|
-
};
|
|
74
|
-
response: unknown;
|
|
75
|
-
};
|
|
76
|
-
save_state: {
|
|
77
|
-
payload: {
|
|
78
|
-
projectPath: string;
|
|
79
|
-
state: AppStateData;
|
|
80
|
-
};
|
|
81
|
-
response: boolean;
|
|
82
|
-
};
|
|
83
|
-
update_graph_position: {
|
|
84
|
-
payload: {
|
|
85
|
-
projectPath: string;
|
|
86
|
-
subProject?: string;
|
|
87
|
-
positions: UIStateMap;
|
|
88
|
-
contextId?: string;
|
|
89
|
-
};
|
|
90
|
-
response: boolean;
|
|
91
|
-
};
|
|
92
|
-
call_tool: {
|
|
93
|
-
payload: {
|
|
94
|
-
name: string;
|
|
95
|
-
arguments: Record<string, unknown>;
|
|
96
|
-
};
|
|
97
|
-
response: unknown;
|
|
98
|
-
};
|
|
99
|
-
chunked_response: {
|
|
100
|
-
payload: {
|
|
101
|
-
chunk: string;
|
|
102
|
-
index: number;
|
|
103
|
-
total: number;
|
|
104
|
-
originalType: string;
|
|
105
|
-
};
|
|
106
|
-
response: void;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
export type BackendMessageType = keyof BackendRequestMap;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export type AppTheme = "dark" | "light";
|
|
2
|
-
export interface CustomColors {
|
|
3
|
-
nodeHighlight?: string;
|
|
4
|
-
comboHighlight?: string;
|
|
5
|
-
arrowColor?: string;
|
|
6
|
-
labelColor?: string;
|
|
7
|
-
gitAdded?: string;
|
|
8
|
-
gitModified?: string;
|
|
9
|
-
gitDeleted?: string;
|
|
10
|
-
stateNode?: string;
|
|
11
|
-
memoNode?: string;
|
|
12
|
-
callbackNode?: string;
|
|
13
|
-
refNode?: string;
|
|
14
|
-
effectNode?: string;
|
|
15
|
-
propNode?: string;
|
|
16
|
-
componentNode?: string;
|
|
17
|
-
hookNode?: string;
|
|
18
|
-
renderNode?: string;
|
|
19
|
-
typeKeyword?: string;
|
|
20
|
-
typeLiteral?: string;
|
|
21
|
-
typeString?: string;
|
|
22
|
-
typeNumber?: string;
|
|
23
|
-
typeBoolean?: string;
|
|
24
|
-
typePunctuation?: string;
|
|
25
|
-
typeReference?: string;
|
|
26
|
-
typeComponent?: string;
|
|
27
|
-
typeDefault?: string;
|
|
28
|
-
genericsColor?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface SubProject {
|
|
31
|
-
name: string;
|
|
32
|
-
path: string;
|
|
33
|
-
}
|
|
34
|
-
export interface ReactMapConfig {
|
|
35
|
-
entry?: string;
|
|
36
|
-
aliases?: Record<string, string>;
|
|
37
|
-
extensions?: string[];
|
|
38
|
-
dependencyDepth?: number;
|
|
39
|
-
analysisPath?: string;
|
|
40
|
-
ignorePatterns?: string[];
|
|
41
|
-
ignoreSubProjects?: string[];
|
|
42
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export interface GitFileStatus {
|
|
2
|
-
path: string;
|
|
3
|
-
index: string;
|
|
4
|
-
working_dir: string;
|
|
5
|
-
}
|
|
6
|
-
export interface GitStatus {
|
|
7
|
-
current: string | null;
|
|
8
|
-
tracking: string | null;
|
|
9
|
-
detached: boolean;
|
|
10
|
-
files: GitFileStatus[];
|
|
11
|
-
staged: string[];
|
|
12
|
-
}
|
|
13
|
-
export interface GitCommit {
|
|
14
|
-
hash: string;
|
|
15
|
-
date: string;
|
|
16
|
-
message: string;
|
|
17
|
-
author_name: string;
|
|
18
|
-
author_email: string;
|
|
19
|
-
}
|
|
20
|
-
export interface GitDiff {
|
|
21
|
-
file: string;
|
|
22
|
-
diff: string;
|
|
23
|
-
}
|
|
24
|
-
export interface GitDiffLine {
|
|
25
|
-
type: 'added' | 'deleted' | 'normal';
|
|
26
|
-
content: string;
|
|
27
|
-
newLineNumber?: number;
|
|
28
|
-
oldLineNumber?: number;
|
|
29
|
-
}
|
|
30
|
-
export interface GitFileDiff {
|
|
31
|
-
path: string;
|
|
32
|
-
hunks: GitDiffHunk[];
|
|
33
|
-
}
|
|
34
|
-
export interface GitDiffHunk {
|
|
35
|
-
content: string;
|
|
36
|
-
lines: GitDiffLine[];
|
|
37
|
-
oldStart: number;
|
|
38
|
-
oldLines: number;
|
|
39
|
-
newStart: number;
|
|
40
|
-
newLines: number;
|
|
41
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { ComponentLoc, VariableName } from "../component.js";
|
|
2
|
-
import type { TypeData, TypeDataLiteralBody } from "./primitive.js";
|
|
3
|
-
import type { ReactMapConfig, SubProject } from "./config.js";
|
|
4
|
-
export * from "./primitive.js";
|
|
5
|
-
export * from "./object.js";
|
|
6
|
-
export * from "./git.js";
|
|
7
|
-
export * from "./config.js";
|
|
8
|
-
export interface ProjectStatus {
|
|
9
|
-
hasConfig: boolean;
|
|
10
|
-
isMonorepo: boolean;
|
|
11
|
-
projectType: "vite" | "next" | "unknown";
|
|
12
|
-
config: ReactMapConfig | null;
|
|
13
|
-
subProjects: SubProject[];
|
|
14
|
-
}
|
|
15
|
-
export type GraphViewType = "component" | "file" | "router";
|
|
16
|
-
export interface AppStateData {
|
|
17
|
-
selectedSubProject: string | null;
|
|
18
|
-
centeredItemId: string | null;
|
|
19
|
-
selectedId: string | null;
|
|
20
|
-
isSidebarOpen: boolean;
|
|
21
|
-
activeTab: "projects" | "git";
|
|
22
|
-
selectedCommit: string | null;
|
|
23
|
-
viewport?: {
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
zoom: number;
|
|
27
|
-
} | null;
|
|
28
|
-
view?: GraphViewType;
|
|
29
|
-
sidebar: {
|
|
30
|
-
right: {
|
|
31
|
-
width?: number;
|
|
32
|
-
height?: number;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export interface TypeDataParam {
|
|
37
|
-
name: string;
|
|
38
|
-
default?: TypeData;
|
|
39
|
-
constraint?: TypeData;
|
|
40
|
-
}
|
|
41
|
-
export interface TypeDataParamFunction extends TypeDataParam {
|
|
42
|
-
const?: boolean;
|
|
43
|
-
in?: boolean;
|
|
44
|
-
out?: boolean;
|
|
45
|
-
}
|
|
46
|
-
export interface TypeDataDeclareBase {
|
|
47
|
-
id: string;
|
|
48
|
-
type: "interface" | "type";
|
|
49
|
-
name: VariableName;
|
|
50
|
-
}
|
|
51
|
-
export interface TypeDataDeclareInterface extends TypeDataDeclareBase, ComponentLoc {
|
|
52
|
-
type: "interface";
|
|
53
|
-
extends?: string[];
|
|
54
|
-
body: TypeDataLiteralBody[];
|
|
55
|
-
params?: Record<string, TypeDataParam>;
|
|
56
|
-
}
|
|
57
|
-
export interface TypeDataDeclareType extends TypeDataDeclareBase, ComponentLoc {
|
|
58
|
-
type: "type";
|
|
59
|
-
body: TypeData;
|
|
60
|
-
params?: TypeDataParam[];
|
|
61
|
-
}
|
|
62
|
-
export type TypeDataDeclare = TypeDataDeclareInterface | TypeDataDeclareType;
|
|
63
|
-
export type ComponentTypeData = {
|
|
64
|
-
type: "name";
|
|
65
|
-
name: string;
|
|
66
|
-
} | {
|
|
67
|
-
type: "inline";
|
|
68
|
-
body: TypeData;
|
|
69
|
-
};
|
|
70
|
-
export interface UIItemState {
|
|
71
|
-
x: number;
|
|
72
|
-
y: number;
|
|
73
|
-
radius?: number;
|
|
74
|
-
collapsedRadius?: number;
|
|
75
|
-
expandedRadius?: number;
|
|
76
|
-
isLayoutCalculated?: boolean;
|
|
77
|
-
collapsed?: boolean;
|
|
78
|
-
}
|
|
79
|
-
export type UIStateMap = Record<string, UIItemState>;
|
|
80
|
-
export * from "./backend.js";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface FuncParamName {
|
|
2
|
-
type: "named";
|
|
3
|
-
name: string;
|
|
4
|
-
}
|
|
5
|
-
export interface FuncParamObjectProperty {
|
|
6
|
-
type: "object-property";
|
|
7
|
-
shorthand: boolean;
|
|
8
|
-
key: string;
|
|
9
|
-
value: FuncParam;
|
|
10
|
-
}
|
|
11
|
-
export type FuncParamObjectPatternProperty = FuncParamObjectProperty | FuncParamRestElement;
|
|
12
|
-
export interface FuncParamObjectPattern {
|
|
13
|
-
type: "object-pattern";
|
|
14
|
-
property: FuncParamObjectPatternProperty[];
|
|
15
|
-
}
|
|
16
|
-
export interface FuncParamArrayPattern {
|
|
17
|
-
type: "array-pattern";
|
|
18
|
-
elements: FuncParam[];
|
|
19
|
-
}
|
|
20
|
-
export interface FuncParamRestElement {
|
|
21
|
-
type: "rest-element";
|
|
22
|
-
name: string;
|
|
23
|
-
}
|
|
24
|
-
export type FuncParam = FuncParamName | FuncParamObjectPattern | FuncParamArrayPattern | FuncParamRestElement;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import type { FuncParam, TypeDataParamFunction } from "./index.js";
|
|
2
|
-
export interface TypeDataString {
|
|
3
|
-
type: "string";
|
|
4
|
-
}
|
|
5
|
-
export interface TypeDataNumber {
|
|
6
|
-
type: "number";
|
|
7
|
-
}
|
|
8
|
-
export interface TypeDataBigInt {
|
|
9
|
-
type: "bigint";
|
|
10
|
-
}
|
|
11
|
-
export interface TypeDataBoolean {
|
|
12
|
-
type: "boolean";
|
|
13
|
-
}
|
|
14
|
-
export interface TypeDataNull {
|
|
15
|
-
type: "null";
|
|
16
|
-
}
|
|
17
|
-
export interface TypeDataUndefined {
|
|
18
|
-
type: "undefined";
|
|
19
|
-
}
|
|
20
|
-
export interface TypeDataAny {
|
|
21
|
-
type: "any";
|
|
22
|
-
}
|
|
23
|
-
export interface TypeDataVoid {
|
|
24
|
-
type: "void";
|
|
25
|
-
}
|
|
26
|
-
export interface TypeDataUnknown {
|
|
27
|
-
type: "unknown";
|
|
28
|
-
}
|
|
29
|
-
export interface TypeDataNever {
|
|
30
|
-
type: "never";
|
|
31
|
-
}
|
|
32
|
-
export interface TypeDataLiteralTypeBigInt {
|
|
33
|
-
type: "bigint";
|
|
34
|
-
value: string;
|
|
35
|
-
}
|
|
36
|
-
export interface TypeDataLiteralTypeString {
|
|
37
|
-
type: "string";
|
|
38
|
-
value: string;
|
|
39
|
-
}
|
|
40
|
-
export interface TypeDataLiteralTypeNumber {
|
|
41
|
-
type: "number";
|
|
42
|
-
value: number;
|
|
43
|
-
}
|
|
44
|
-
export interface TypeDataLiteralTypeBoolean {
|
|
45
|
-
type: "boolean";
|
|
46
|
-
value: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface TypeDataLiteralTypeTemplate {
|
|
49
|
-
type: "template";
|
|
50
|
-
expression: TypeData[];
|
|
51
|
-
quasis: string[];
|
|
52
|
-
}
|
|
53
|
-
export interface TypeDataLiteralTypeUnary {
|
|
54
|
-
type: "unary";
|
|
55
|
-
operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof";
|
|
56
|
-
prefix: boolean;
|
|
57
|
-
argument: TypeDataLiteralTypeLiteral;
|
|
58
|
-
}
|
|
59
|
-
export type TypeDataLiteralTypeLiteral = TypeDataLiteralTypeBoolean | TypeDataLiteralTypeNumber | TypeDataLiteralTypeString | TypeDataLiteralTypeUnary | TypeDataLiteralTypeBigInt | TypeDataLiteralTypeTemplate;
|
|
60
|
-
export interface TypeDataLiteralType {
|
|
61
|
-
type: "literal-type";
|
|
62
|
-
literal: TypeDataLiteralTypeLiteral;
|
|
63
|
-
}
|
|
64
|
-
export type TypeDataRef = {
|
|
65
|
-
type: "ref";
|
|
66
|
-
params?: TypeData[];
|
|
67
|
-
} & ({
|
|
68
|
-
refType: "named";
|
|
69
|
-
name: string;
|
|
70
|
-
} | {
|
|
71
|
-
refType: "qualified";
|
|
72
|
-
names: string[];
|
|
73
|
-
});
|
|
74
|
-
export interface TypeDataLiteralArray {
|
|
75
|
-
type: "literal-array";
|
|
76
|
-
elements: PropDataType[];
|
|
77
|
-
}
|
|
78
|
-
export interface TypeDataLiteralObject {
|
|
79
|
-
type: "literal-object";
|
|
80
|
-
properties: Record<string, PropDataType>;
|
|
81
|
-
}
|
|
82
|
-
export type PropDataType = TypeDataLiteralType | TypeDataRef | TypeDataNull | TypeDataUndefined | TypeDataLiteralArray | TypeDataLiteralObject;
|
|
83
|
-
export type TypeDataFunctionParameter = {
|
|
84
|
-
param: FuncParam;
|
|
85
|
-
typeData?: TypeData;
|
|
86
|
-
optional?: boolean;
|
|
87
|
-
};
|
|
88
|
-
export type TypeDataFunction = {
|
|
89
|
-
type: "function";
|
|
90
|
-
params: TypeDataParamFunction[];
|
|
91
|
-
parameters: TypeDataFunctionParameter[];
|
|
92
|
-
return: TypeData;
|
|
93
|
-
};
|
|
94
|
-
export type TypeDataPrimitive = TypeDataString | TypeDataNumber | TypeDataBigInt | TypeDataBoolean | TypeDataNull | TypeDataUndefined | TypeDataAny | TypeDataVoid | TypeDataUnknown | TypeDataNever | TypeDataRef | TypeDataLiteralType | TypeDataFunction;
|
|
95
|
-
export interface TypeDataArray {
|
|
96
|
-
type: "array";
|
|
97
|
-
element: TypeData;
|
|
98
|
-
}
|
|
99
|
-
export interface TypeDataTupleElementBase {
|
|
100
|
-
type: "named" | "unnamed";
|
|
101
|
-
typeData: TypeData;
|
|
102
|
-
}
|
|
103
|
-
export interface TypeDataTupleElementNamed extends TypeDataTupleElementBase {
|
|
104
|
-
type: "named";
|
|
105
|
-
name: string;
|
|
106
|
-
optional: boolean;
|
|
107
|
-
}
|
|
108
|
-
export interface TypeDataTupleElementUnNamed extends TypeDataTupleElementBase {
|
|
109
|
-
type: "unnamed";
|
|
110
|
-
}
|
|
111
|
-
export type TypeDataTupleElement = TypeDataTupleElementNamed | TypeDataTupleElementUnNamed;
|
|
112
|
-
export interface TypeDataTuple {
|
|
113
|
-
type: "tuple";
|
|
114
|
-
elements: TypeDataTupleElement[];
|
|
115
|
-
}
|
|
116
|
-
export interface TypeDataIndexAccess {
|
|
117
|
-
type: "index-access";
|
|
118
|
-
indexType: TypeData;
|
|
119
|
-
objectType: TypeData;
|
|
120
|
-
}
|
|
121
|
-
export interface TypeDataQuery {
|
|
122
|
-
type: "query";
|
|
123
|
-
expr: TypeData;
|
|
124
|
-
}
|
|
125
|
-
export interface TypeDataImport {
|
|
126
|
-
type: "import";
|
|
127
|
-
name: string;
|
|
128
|
-
qualifier?: string;
|
|
129
|
-
}
|
|
130
|
-
export interface TypeDataLiteralBodyBase {
|
|
131
|
-
signatureType: "property" | "index" | "method";
|
|
132
|
-
}
|
|
133
|
-
export interface TypeDataLiteralBodyIndexPrarameter {
|
|
134
|
-
name: string;
|
|
135
|
-
type: TypeData;
|
|
136
|
-
}
|
|
137
|
-
export interface TypeDataLiteralBodyIndex extends TypeDataLiteralBodyBase {
|
|
138
|
-
signatureType: "index";
|
|
139
|
-
type: TypeData;
|
|
140
|
-
parameter: TypeDataLiteralBodyIndexPrarameter;
|
|
141
|
-
}
|
|
142
|
-
export interface TypeDataLiteralBodyProperty extends TypeDataLiteralBodyBase {
|
|
143
|
-
signatureType: "property";
|
|
144
|
-
type: TypeData;
|
|
145
|
-
optional?: boolean;
|
|
146
|
-
computed?: boolean;
|
|
147
|
-
name: string;
|
|
148
|
-
}
|
|
149
|
-
export interface TypeDataLiteralBodyMethod extends TypeDataLiteralBodyBase {
|
|
150
|
-
signatureType: "method";
|
|
151
|
-
name: string;
|
|
152
|
-
optional?: boolean;
|
|
153
|
-
computed?: boolean;
|
|
154
|
-
params: TypeDataParamFunction[];
|
|
155
|
-
parameters: TypeDataFunctionParameter[];
|
|
156
|
-
return: TypeData;
|
|
157
|
-
}
|
|
158
|
-
export type TypeDataLiteralBody = TypeDataLiteralBodyProperty | TypeDataLiteralBodyIndex | TypeDataLiteralBodyMethod;
|
|
159
|
-
export interface TypeDataTypeBodyLiteral {
|
|
160
|
-
type: "type-literal";
|
|
161
|
-
members: TypeDataLiteralBody[];
|
|
162
|
-
}
|
|
163
|
-
export interface TypeDataTypeBodyParathesis {
|
|
164
|
-
type: "parenthesis";
|
|
165
|
-
members: TypeData;
|
|
166
|
-
}
|
|
167
|
-
export interface TypeDataTypeBodyUnion {
|
|
168
|
-
type: "union";
|
|
169
|
-
members: TypeData[];
|
|
170
|
-
}
|
|
171
|
-
export interface TypeDataTypeBodyIntersection {
|
|
172
|
-
type: "intersection";
|
|
173
|
-
members: TypeData[];
|
|
174
|
-
}
|
|
175
|
-
export type TypeData = TypeDataPrimitive | TypeDataArray | TypeDataTuple | TypeDataIndexAccess | TypeDataQuery | TypeDataImport | TypeDataTypeBodyLiteral | TypeDataTypeBodyUnion | TypeDataTypeBodyIntersection | TypeDataTypeBodyParathesis | TypeDataLiteralArray | TypeDataLiteralObject;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { VariableName } from "./component.js";
|
|
2
|
-
import type { GitFileDiff } from "./types/git.js";
|
|
3
|
-
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
4
|
-
export declare const getDisplayName: (name: VariableName | string | undefined) => string;
|
|
5
|
-
export declare function parseRawDiff(rawDiff: string, filterFile?: string): GitFileDiff[];
|
package/dist/shared/src/utils.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export const getDisplayName = (name) => {
|
|
2
|
-
if (!name)
|
|
3
|
-
return "unknown";
|
|
4
|
-
if (typeof name === "string")
|
|
5
|
-
return name;
|
|
6
|
-
if (name.type === "identifier")
|
|
7
|
-
return name.name;
|
|
8
|
-
if (name.type === "rest")
|
|
9
|
-
return `...${getDisplayName(name.argument)}`;
|
|
10
|
-
return "raw" in name ? name.raw : "unknown";
|
|
11
|
-
};
|
|
12
|
-
export function parseRawDiff(rawDiff, filterFile) {
|
|
13
|
-
const files = [];
|
|
14
|
-
if (!rawDiff)
|
|
15
|
-
return files;
|
|
16
|
-
const fileDiffs = rawDiff.split(/^diff --git /m).slice(1);
|
|
17
|
-
for (const fileDiff of fileDiffs) {
|
|
18
|
-
const lines = fileDiff.split("\n");
|
|
19
|
-
const header = lines[0];
|
|
20
|
-
if (!header)
|
|
21
|
-
continue;
|
|
22
|
-
const pathMatch = header.match(/a\/(.*) b\/(.*)/);
|
|
23
|
-
if (!pathMatch)
|
|
24
|
-
continue;
|
|
25
|
-
const filePath = pathMatch[2];
|
|
26
|
-
if (filterFile && filePath !== filterFile)
|
|
27
|
-
continue;
|
|
28
|
-
const hunks = [];
|
|
29
|
-
let currentHunk = null;
|
|
30
|
-
let oldLineNum = 0;
|
|
31
|
-
let newLineNum = 0;
|
|
32
|
-
for (let i = 1; i < lines.length; i++) {
|
|
33
|
-
const line = lines[i];
|
|
34
|
-
if (line.startsWith("@@")) {
|
|
35
|
-
const hunkMatch = line.match(/@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@/);
|
|
36
|
-
if (hunkMatch) {
|
|
37
|
-
oldLineNum = parseInt(hunkMatch[1]);
|
|
38
|
-
newLineNum = parseInt(hunkMatch[3]);
|
|
39
|
-
currentHunk = {
|
|
40
|
-
content: line,
|
|
41
|
-
lines: [],
|
|
42
|
-
oldStart: oldLineNum,
|
|
43
|
-
oldLines: parseInt(hunkMatch[2] || "1"),
|
|
44
|
-
newStart: newLineNum,
|
|
45
|
-
newLines: parseInt(hunkMatch[4] || "1"),
|
|
46
|
-
};
|
|
47
|
-
hunks.push(currentHunk);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else if (currentHunk) {
|
|
51
|
-
if (line.startsWith("+")) {
|
|
52
|
-
currentHunk.lines.push({
|
|
53
|
-
type: "added",
|
|
54
|
-
content: line.substring(1),
|
|
55
|
-
newLineNumber: newLineNum++,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
else if (line.startsWith("-")) {
|
|
59
|
-
currentHunk.lines.push({
|
|
60
|
-
type: "deleted",
|
|
61
|
-
content: line.substring(1),
|
|
62
|
-
oldLineNumber: oldLineNum++,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
else if (line.startsWith(" ")) {
|
|
66
|
-
currentHunk.lines.push({
|
|
67
|
-
type: "normal",
|
|
68
|
-
content: line.substring(1),
|
|
69
|
-
oldLineNumber: oldLineNum++,
|
|
70
|
-
newLineNumber: newLineNum++,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
files.push({
|
|
76
|
-
path: filePath,
|
|
77
|
-
hunks,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return files;
|
|
81
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|