@nexiq/shared 1.0.3 → 1.1.0
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/component.d.ts +88 -5
- package/dist/component.d.ts.map +1 -1
- package/dist/db/sqlite.d.ts +2 -1
- package/dist/db/sqlite.d.ts.map +1 -1
- package/dist/db/sqlite.js +10 -3
- package/dist/db/sqlite.js.map +1 -1
- package/dist/index.d.ts +32 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/nexiq/graph-view/graph-combo.d.ts +4 -1
- package/dist/nexiq/graph-view/graph-combo.d.ts.map +1 -1
- package/dist/nexiq/graph-view/graph-combo.js +10 -2
- package/dist/nexiq/graph-view/graph-combo.js.map +1 -1
- package/dist/nexiq/graph-view/graph-node.d.ts +4 -1
- package/dist/nexiq/graph-view/graph-node.d.ts.map +1 -1
- package/dist/nexiq/graph-view/graph-node.js +10 -2
- package/dist/nexiq/graph-view/graph-node.js.map +1 -1
- package/dist/nexiq/graph-view/item-type.d.ts +6 -1
- package/dist/nexiq/graph-view/item-type.d.ts.map +1 -1
- package/dist/nexiq/graph-view/item-type.js +90 -0
- package/dist/nexiq/graph-view/item-type.js.map +1 -1
- package/dist/nexiq/graph-view.d.ts +1 -1
- package/dist/nexiq/graph-view.d.ts.map +1 -1
- package/dist/nexiq/graph-view.js +1 -1
- package/dist/nexiq/graph-view.js.map +1 -1
- package/dist/types/backend.d.ts +21 -2
- package/dist/types/backend.d.ts.map +1 -1
- package/dist/types/config.d.ts +0 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -32
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/primitive.d.ts +58 -4
- package/dist/types/primitive.d.ts.map +1 -1
- package/dist/types/routes.d.ts +60 -0
- package/dist/types/routes.d.ts.map +1 -0
- package/dist/types/routes.js +2 -0
- package/dist/types/routes.js.map +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +14 -4
- package/dist/types/function.d.ts +0 -20
- package/dist/types/function.d.ts.map +0 -1
- package/dist/types/function.js +0 -2
- package/dist/types/function.js.map +0 -1
- package/eslint.config.js +0 -32
- package/src/component.ts +0 -503
- package/src/db/index.ts +0 -1
- package/src/db/sqlite.ts +0 -103
- package/src/index.ts +0 -288
- package/src/nexiq/graph-view/graph-combo.ts +0 -141
- package/src/nexiq/graph-view/graph-edge.ts +0 -108
- package/src/nexiq/graph-view/graph-node-detail.ts +0 -88
- package/src/nexiq/graph-view/graph-node.ts +0 -131
- package/src/nexiq/graph-view/graph-view.ts +0 -162
- package/src/nexiq/graph-view/item-type.ts +0 -19
- package/src/nexiq/graph-view/loc.ts +0 -56
- package/src/nexiq/graph-view.ts +0 -9
- package/src/schema/graph_view.fbs +0 -74
- package/src/types/backend.ts +0 -76
- package/src/types/config.ts +0 -17
- package/src/types/function.ts +0 -24
- package/src/types/git.ts +0 -48
- package/src/types/index.ts +0 -93
- package/src/types/object.ts +0 -37
- package/src/types/primitive.ts +0 -274
- package/src/utils.ts +0 -93
- package/tsconfig.json +0 -35
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../src/types/function.ts"],"names":[],"mappings":""}
|
package/eslint.config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import js from "@eslint/js";
|
|
2
|
-
import globals from "globals";
|
|
3
|
-
import tseslint from "typescript-eslint";
|
|
4
|
-
import { defineConfig, globalIgnores } from "eslint/config";
|
|
5
|
-
|
|
6
|
-
export default defineConfig([
|
|
7
|
-
globalIgnores(["dist"]),
|
|
8
|
-
{
|
|
9
|
-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
10
|
-
files: ["**/*.{ts,tsx}"],
|
|
11
|
-
languageOptions: {
|
|
12
|
-
ecmaVersion: 2020,
|
|
13
|
-
globals: globals.node,
|
|
14
|
-
parserOptions: {
|
|
15
|
-
projectService: true,
|
|
16
|
-
tsconfigRootDir: import.meta.dirname,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
rules: {
|
|
20
|
-
"@typescript-eslint/no-unused-vars": [
|
|
21
|
-
"error",
|
|
22
|
-
{
|
|
23
|
-
argsIgnorePattern: "^_",
|
|
24
|
-
varsIgnorePattern: "^_",
|
|
25
|
-
caughtErrorsIgnorePattern: "^_",
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
"no-debugger": "warn",
|
|
29
|
-
"@typescript-eslint/no-explicit-any": "error",
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
]);
|
package/src/component.ts
DELETED
|
@@ -1,503 +0,0 @@
|
|
|
1
|
-
import type { TypeDataDeclare } from "./types/index.js";
|
|
2
|
-
import type { PropDataType, TypeData } from "./types/primitive.js";
|
|
3
|
-
|
|
4
|
-
export type ComponentFileImport = {
|
|
5
|
-
localName: string;
|
|
6
|
-
importedName: string | null;
|
|
7
|
-
source: string;
|
|
8
|
-
type: "default" | "named" | "namespace" | "type";
|
|
9
|
-
importKind: "value" | "type";
|
|
10
|
-
resolvedId?: string | undefined;
|
|
11
|
-
unresolvedWorkspace?: boolean | undefined;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type ComponentFileExport = {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
type: "default" | "named" | "namespace" | "type";
|
|
18
|
-
exportKind: "value" | "type" | "component" | "function" | "class";
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export interface State extends ComponentLoc {
|
|
22
|
-
id: string;
|
|
23
|
-
setter?: string | undefined;
|
|
24
|
-
parentId?: string | undefined;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface RefData extends ComponentLoc {
|
|
28
|
-
id: string;
|
|
29
|
-
defaultData: PropDataType;
|
|
30
|
-
parentId?: string | undefined;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface Memo extends ComponentLoc, ReactDependencies {
|
|
34
|
-
id: string;
|
|
35
|
-
scope: VariableScope;
|
|
36
|
-
async?: boolean | undefined;
|
|
37
|
-
parentId?: string | undefined;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export type ComponentInfoRenderDependency = {
|
|
41
|
-
id: string;
|
|
42
|
-
name: string;
|
|
43
|
-
value: PropDataType;
|
|
44
|
-
valueId?: string;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export interface ComponentInfoRender extends ComponentLoc {
|
|
48
|
-
id: string;
|
|
49
|
-
tag: string;
|
|
50
|
-
instanceId: string;
|
|
51
|
-
parentId?: string | undefined;
|
|
52
|
-
dependencies: ComponentInfoRenderDependency[];
|
|
53
|
-
isDependency?: boolean | undefined;
|
|
54
|
-
renderIndex: number;
|
|
55
|
-
kind: "jsx" | "ternary" | "loop" | "expression" | "hook" | "call";
|
|
56
|
-
children: Record<string, ComponentInfoRender>;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface EffectInfo extends ComponentLoc, ReactDependencies {
|
|
60
|
-
id: string;
|
|
61
|
-
name?: string | undefined;
|
|
62
|
-
scope?: VariableScope | undefined;
|
|
63
|
-
file?: string | undefined;
|
|
64
|
-
kind?: "effect" | undefined;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface PropData {
|
|
68
|
-
id: string;
|
|
69
|
-
name: string;
|
|
70
|
-
type: string;
|
|
71
|
-
kind: "prop" | "spread";
|
|
72
|
-
props?: PropData[];
|
|
73
|
-
hash?: string | undefined;
|
|
74
|
-
gitStatus?: "added" | "modified" | "deleted";
|
|
75
|
-
file?: string | undefined;
|
|
76
|
-
loc?: VariableLoc | undefined;
|
|
77
|
-
defaultValue?: PropDataType | undefined;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface ReactFunctionInfoBase {
|
|
81
|
-
states: string[];
|
|
82
|
-
refs: string[];
|
|
83
|
-
hooks: string[];
|
|
84
|
-
props: PropData[];
|
|
85
|
-
propName?: string | undefined;
|
|
86
|
-
propType?: TypeData | undefined;
|
|
87
|
-
effects: Record<string, EffectInfo>;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface ReactFunctionInfo extends ReactFunctionInfoBase {
|
|
91
|
-
id: string;
|
|
92
|
-
name: string;
|
|
93
|
-
file: string;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export type HookInfo = ReactFunctionInfoBase;
|
|
97
|
-
|
|
98
|
-
export interface ComponentInfoBase {
|
|
99
|
-
contexts: string[];
|
|
100
|
-
forwardRef?: boolean;
|
|
101
|
-
memo?: boolean;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface FunctionComponentInfo
|
|
105
|
-
extends ReactFunctionInfoBase, ComponentInfoBase {
|
|
106
|
-
componentType: "Function";
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface ClassComponentInfo
|
|
110
|
-
extends ReactFunctionInfoBase, ComponentInfoBase {
|
|
111
|
-
componentType: "Class";
|
|
112
|
-
stateType?: TypeData | undefined;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export type ComponentInfo = FunctionComponentInfo | ClassComponentInfo;
|
|
116
|
-
|
|
117
|
-
export interface ComponentFileVarDependency {
|
|
118
|
-
id: string;
|
|
119
|
-
name: string;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export type UsageRelationKind =
|
|
123
|
-
| "usage-read"
|
|
124
|
-
| "usage-call"
|
|
125
|
-
| "usage-write"
|
|
126
|
-
| "usage-render-call";
|
|
127
|
-
|
|
128
|
-
export type RelationKind =
|
|
129
|
-
| "render"
|
|
130
|
-
| "dependency"
|
|
131
|
-
| "parent-child"
|
|
132
|
-
| "import"
|
|
133
|
-
| UsageRelationKind
|
|
134
|
-
| (string & {});
|
|
135
|
-
|
|
136
|
-
export interface UsageOccurrence {
|
|
137
|
-
usageId: string;
|
|
138
|
-
filePath: string;
|
|
139
|
-
line: number;
|
|
140
|
-
column: number;
|
|
141
|
-
ownerId: string;
|
|
142
|
-
ownerKind: string;
|
|
143
|
-
accessPath?: string[] | undefined;
|
|
144
|
-
isOptional?: boolean | undefined;
|
|
145
|
-
isComputed?: boolean | undefined;
|
|
146
|
-
hiddenIntermediate?: string | undefined;
|
|
147
|
-
displayLabel?: string | undefined;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export interface ComponentRelation {
|
|
151
|
-
from_id: string;
|
|
152
|
-
to_id: string;
|
|
153
|
-
kind: RelationKind;
|
|
154
|
-
line?: number | null | undefined;
|
|
155
|
-
column?: number | null | undefined;
|
|
156
|
-
data_json?: UsageOccurrence | Record<string, unknown> | null | undefined;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export interface VariableLoc {
|
|
160
|
-
line: number;
|
|
161
|
-
column: number;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface ComponentLoc {
|
|
165
|
-
loc: VariableLoc;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export interface VariableScope {
|
|
169
|
-
start: VariableLoc;
|
|
170
|
-
end: VariableLoc;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export type ComponentFileBlockScope = {
|
|
174
|
-
id: string;
|
|
175
|
-
parentId?: string | undefined;
|
|
176
|
-
scope: VariableScope;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export type VarType = "function" | "data" | "jsx" | "class";
|
|
180
|
-
|
|
181
|
-
export type ReactFunctionVar = "component" | "hook";
|
|
182
|
-
export type ReactStateVar = "state" | "ref";
|
|
183
|
-
export type ReactWithCallbackVar = "memo" | "callback";
|
|
184
|
-
export type ReactVarKind =
|
|
185
|
-
| ReactFunctionVar
|
|
186
|
-
| ReactStateVar
|
|
187
|
-
| ReactWithCallbackVar;
|
|
188
|
-
export type VarKind = "normal" | "class" | "method" | "property" | ReactVarKind;
|
|
189
|
-
|
|
190
|
-
export type VariableNamePattern =
|
|
191
|
-
| { type: "identifier"; name: string; loc: VariableLoc; id: string }
|
|
192
|
-
| {
|
|
193
|
-
type: "object";
|
|
194
|
-
properties: VariableObjectProperty[];
|
|
195
|
-
raw: string;
|
|
196
|
-
loc: VariableLoc;
|
|
197
|
-
id: string;
|
|
198
|
-
}
|
|
199
|
-
| {
|
|
200
|
-
type: "array";
|
|
201
|
-
elements: VariableArrayElement[];
|
|
202
|
-
raw: string;
|
|
203
|
-
loc: VariableLoc;
|
|
204
|
-
id: string;
|
|
205
|
-
}
|
|
206
|
-
| {
|
|
207
|
-
type: "rest";
|
|
208
|
-
argument: VariableNamePattern;
|
|
209
|
-
loc: VariableLoc;
|
|
210
|
-
id: string;
|
|
211
|
-
}
|
|
212
|
-
| {
|
|
213
|
-
type: "void";
|
|
214
|
-
loc: VariableLoc;
|
|
215
|
-
id: string;
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
export type VariableObjectProperty = {
|
|
219
|
-
key: string;
|
|
220
|
-
value: VariableNamePattern;
|
|
221
|
-
loc: VariableLoc;
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
export type VariableArrayElement =
|
|
225
|
-
| { type: "element"; value: VariableNamePattern; loc: VariableLoc }
|
|
226
|
-
| { type: "rest"; value: VariableNamePattern; loc: VariableLoc }
|
|
227
|
-
| null;
|
|
228
|
-
|
|
229
|
-
export type VariableName = VariableNamePattern;
|
|
230
|
-
|
|
231
|
-
interface ComponentFileVarBaseType<TType extends VarType> {
|
|
232
|
-
id: string;
|
|
233
|
-
name: VariableName;
|
|
234
|
-
type: TType;
|
|
235
|
-
file: string;
|
|
236
|
-
hash?: string | undefined;
|
|
237
|
-
parentId?: string | undefined;
|
|
238
|
-
declarationKind?:
|
|
239
|
-
| "const"
|
|
240
|
-
| "let"
|
|
241
|
-
| "var"
|
|
242
|
-
| "using"
|
|
243
|
-
| "await using"
|
|
244
|
-
| undefined;
|
|
245
|
-
dependencies: Record<string, ComponentFileVarDependency>;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export interface ComponentFileVarBase<
|
|
249
|
-
TType extends VarType,
|
|
250
|
-
TKind extends VarKind,
|
|
251
|
-
>
|
|
252
|
-
extends ComponentLoc, ComponentFileVarBaseType<TType> {
|
|
253
|
-
kind: TKind;
|
|
254
|
-
isStatic?: boolean | undefined;
|
|
255
|
-
memberKind?: string | undefined;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export type FunctionReturn = PropDataType | ComponentFileVarJSX | string;
|
|
259
|
-
|
|
260
|
-
export interface ComponentFileVarBaseTypeFunction<
|
|
261
|
-
TKind extends VarKind,
|
|
262
|
-
TType extends VarType = "function",
|
|
263
|
-
> extends ComponentFileVarBase<TType, TKind> {
|
|
264
|
-
type: TType;
|
|
265
|
-
scope: VariableScope;
|
|
266
|
-
async?: boolean | undefined;
|
|
267
|
-
var: Record<string, ComponentFileVar>;
|
|
268
|
-
return?: FunctionReturn | undefined;
|
|
269
|
-
superClass?: { id?: string; name: string } | undefined;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
export interface ComponentFileVarBaseTypeData<
|
|
273
|
-
TKind extends VarKind,
|
|
274
|
-
TType extends VarType = "data",
|
|
275
|
-
> extends ComponentFileVarBase<TType, TKind> {
|
|
276
|
-
type: TType;
|
|
277
|
-
children?: Record<string, ComponentInfoRender>;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
export type ComponentFileVarDependencyType<TKind extends VarKind> =
|
|
281
|
-
| ComponentFileVarBaseTypeFunction<TKind>
|
|
282
|
-
| ComponentFileVarBaseTypeData<TKind>;
|
|
283
|
-
|
|
284
|
-
export type ComponentFileVarReact<
|
|
285
|
-
TType extends VarType,
|
|
286
|
-
TKind extends ReactVarKind,
|
|
287
|
-
> = ComponentFileVarBase<TType, TKind>;
|
|
288
|
-
|
|
289
|
-
export type ComponentFileVarReactFunction<
|
|
290
|
-
TKind extends ReactVarKind,
|
|
291
|
-
TType extends VarType = "function",
|
|
292
|
-
> = ComponentFileVarBaseTypeFunction<TKind, TType> & ReactFunctionInfoBase;
|
|
293
|
-
|
|
294
|
-
export type ReactDependency = {
|
|
295
|
-
id: string;
|
|
296
|
-
name: string;
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
export type ReactDependencies = {
|
|
300
|
-
reactDeps: ReactDependency[];
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
export type ComponentFileVarReactWithCallback<
|
|
304
|
-
TKind extends ReactVarKind,
|
|
305
|
-
TType extends VarType = "function",
|
|
306
|
-
> = ComponentFileVarBaseTypeFunction<TKind, TType> &
|
|
307
|
-
ReactDependencies &
|
|
308
|
-
ReactFunctionInfoBase;
|
|
309
|
-
|
|
310
|
-
export type ComponentFileVarFunctionComponent = ComponentFileVarReactFunction<
|
|
311
|
-
"component",
|
|
312
|
-
"function"
|
|
313
|
-
> &
|
|
314
|
-
FunctionComponentInfo & {
|
|
315
|
-
kind: "component";
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
export type ComponentFileVarClassComponent = ComponentFileVarReactFunction<
|
|
319
|
-
"component",
|
|
320
|
-
"class"
|
|
321
|
-
> &
|
|
322
|
-
ClassComponentInfo & {
|
|
323
|
-
kind: "component";
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
export type ComponentFileVarComponent =
|
|
327
|
-
| ComponentFileVarFunctionComponent
|
|
328
|
-
| ComponentFileVarClassComponent;
|
|
329
|
-
|
|
330
|
-
export type ComponentFileVarState = ComponentFileVarReact<"data", "state"> & {
|
|
331
|
-
setter?: string | undefined;
|
|
332
|
-
stateType?: TypeData | undefined;
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
export type ComponentFileVarCallHook = ComponentFileVarReact<"data", "hook"> & {
|
|
336
|
-
call: {
|
|
337
|
-
id: string;
|
|
338
|
-
name: string;
|
|
339
|
-
resolvedId?: string | undefined;
|
|
340
|
-
unresolvedWorkspace?: boolean | undefined;
|
|
341
|
-
};
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
export type ComponentFileVarRef = ComponentFileVarReact<"data", "ref"> & {
|
|
345
|
-
defaultData: PropDataType;
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
export type ComponentFileVarHook = ComponentFileVarReactFunction<
|
|
349
|
-
"hook",
|
|
350
|
-
"function"
|
|
351
|
-
> &
|
|
352
|
-
HookInfo & {
|
|
353
|
-
kind: "hook";
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
export type ComponentFileVarCallback =
|
|
357
|
-
ComponentFileVarReactWithCallback<"callback"> & ReactDependencies;
|
|
358
|
-
|
|
359
|
-
export type MemoFileVarHook = ComponentFileVarReactWithCallback<"memo"> &
|
|
360
|
-
ReactDependencies;
|
|
361
|
-
|
|
362
|
-
export type ComponentFileVarNormalBase<TType extends VarType> = ComponentLoc &
|
|
363
|
-
ComponentFileVarBase<TType, "normal"> & {
|
|
364
|
-
kind: "normal";
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
export type ComponentFileVarNormalFunction = ComponentFileVarNormalBase<
|
|
368
|
-
"function" | "class"
|
|
369
|
-
> &
|
|
370
|
-
ComponentFileVarBaseTypeFunction<"normal">;
|
|
371
|
-
export type ComponentFileVarNormalData = ComponentFileVarNormalBase<"data"> &
|
|
372
|
-
ComponentFileVarBaseTypeData<"normal">;
|
|
373
|
-
|
|
374
|
-
export type ComponentFileVarNormal =
|
|
375
|
-
| ComponentFileVarNormalFunction
|
|
376
|
-
| ComponentFileVarNormalData;
|
|
377
|
-
|
|
378
|
-
export interface ComponentFileVarJSX extends ComponentFileVarBase<
|
|
379
|
-
"jsx",
|
|
380
|
-
"normal"
|
|
381
|
-
> {
|
|
382
|
-
type: "jsx";
|
|
383
|
-
render: ComponentInfoRender | null;
|
|
384
|
-
srcId?: string | undefined;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
export type ComponentFileVarClass = ComponentFileVarBaseTypeData<
|
|
388
|
-
"class",
|
|
389
|
-
"data"
|
|
390
|
-
> & {
|
|
391
|
-
var: Record<string, ComponentFileVar>;
|
|
392
|
-
scope: VariableScope;
|
|
393
|
-
superClass?: { id?: string; name: string } | undefined;
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
export type ComponentFileVarMethod = ComponentFileVarBaseTypeFunction<
|
|
397
|
-
"method",
|
|
398
|
-
"function"
|
|
399
|
-
>;
|
|
400
|
-
|
|
401
|
-
export type ComponentFileVarProperty = ComponentFileVarBaseTypeData<
|
|
402
|
-
"property",
|
|
403
|
-
"data"
|
|
404
|
-
>;
|
|
405
|
-
|
|
406
|
-
export type ComponentFileVarFunction =
|
|
407
|
-
ComponentFileVarBaseTypeFunction<"normal"> & {
|
|
408
|
-
kind: "normal";
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
export type ComponentFileVar =
|
|
412
|
-
| ComponentFileVarComponent
|
|
413
|
-
| ComponentFileVarState
|
|
414
|
-
| ComponentFileVarCallHook
|
|
415
|
-
| ComponentFileVarRef
|
|
416
|
-
| ComponentFileVarNormal
|
|
417
|
-
| ComponentFileVarHook
|
|
418
|
-
| ComponentFileVarCallback
|
|
419
|
-
| MemoFileVarHook
|
|
420
|
-
| ComponentFileVarFunction
|
|
421
|
-
| ComponentFileVarJSX
|
|
422
|
-
| ComponentFileVarClass
|
|
423
|
-
| ComponentFileVarMethod
|
|
424
|
-
| ComponentFileVarProperty;
|
|
425
|
-
|
|
426
|
-
export type IResolveAddRender = {
|
|
427
|
-
type: "comAddRender";
|
|
428
|
-
fileName: string;
|
|
429
|
-
tag: string;
|
|
430
|
-
dependency: ComponentInfoRenderDependency[];
|
|
431
|
-
loc: VariableLoc;
|
|
432
|
-
kind?: ComponentInfoRender["kind"] | undefined;
|
|
433
|
-
parentId?: string | undefined;
|
|
434
|
-
};
|
|
435
|
-
export type IResolveAddHook = {
|
|
436
|
-
type: "comAddHook";
|
|
437
|
-
name: string;
|
|
438
|
-
fileName: string;
|
|
439
|
-
hook: string;
|
|
440
|
-
loc: VariableLoc;
|
|
441
|
-
parentId?: string | undefined;
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
export type IResolveCallHook = {
|
|
445
|
-
type: "comResolveCallHook";
|
|
446
|
-
fileName: string;
|
|
447
|
-
loc: VariableLoc;
|
|
448
|
-
id: string;
|
|
449
|
-
hook: string;
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
export type IResolveTsType = {
|
|
453
|
-
type: "tsType";
|
|
454
|
-
fileName: string;
|
|
455
|
-
id: string;
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
export type IResolveComPropsTsType = {
|
|
459
|
-
type: "comPropsTsType";
|
|
460
|
-
fileName: string;
|
|
461
|
-
id: string;
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
export type IResolveComClassStateTsType = {
|
|
465
|
-
type: "comClassStateTsType";
|
|
466
|
-
fileName: string;
|
|
467
|
-
id: string;
|
|
468
|
-
};
|
|
469
|
-
|
|
470
|
-
export type IResolveCrossPackageImport = {
|
|
471
|
-
type: "crossPackageImport";
|
|
472
|
-
fileName: string;
|
|
473
|
-
source: string;
|
|
474
|
-
localName: string;
|
|
475
|
-
importedName: string | null;
|
|
476
|
-
importType: ComponentFileImport["type"];
|
|
477
|
-
importKind: ComponentFileImport["importKind"];
|
|
478
|
-
message?: string | undefined;
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
export type ComponentDBResolve =
|
|
482
|
-
| IResolveAddRender
|
|
483
|
-
| IResolveAddHook
|
|
484
|
-
| IResolveCallHook
|
|
485
|
-
| IResolveTsType
|
|
486
|
-
| IResolveComPropsTsType
|
|
487
|
-
| IResolveComClassStateTsType
|
|
488
|
-
| IResolveCrossPackageImport;
|
|
489
|
-
|
|
490
|
-
export type ComponentFile = {
|
|
491
|
-
path: string;
|
|
492
|
-
fingerPrint: string;
|
|
493
|
-
hash: string;
|
|
494
|
-
import: Record<string, ComponentFileImport>;
|
|
495
|
-
export: Record<string, ComponentFileExport>;
|
|
496
|
-
starExports: string[];
|
|
497
|
-
defaultExport: string | null;
|
|
498
|
-
tsTypes: Record<string, TypeDataDeclare>;
|
|
499
|
-
var: Record<string, ComponentFileVar>;
|
|
500
|
-
blockScopes?: ComponentFileBlockScope[] | undefined;
|
|
501
|
-
relations?: ComponentRelation[] | undefined;
|
|
502
|
-
package_id?: string | undefined;
|
|
503
|
-
};
|
package/src/db/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./sqlite.js";
|
package/src/db/sqlite.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import type { Database } from "better-sqlite3";
|
|
2
|
-
import type {
|
|
3
|
-
AnalysisRunRow,
|
|
4
|
-
FileRunStatusRow,
|
|
5
|
-
FileAnalysisErrorRow,
|
|
6
|
-
ResolveErrorRow,
|
|
7
|
-
FileRow,
|
|
8
|
-
EntityRow,
|
|
9
|
-
RelationRow,
|
|
10
|
-
ScopeRow,
|
|
11
|
-
SymbolRow,
|
|
12
|
-
RenderRow,
|
|
13
|
-
ExportRow,
|
|
14
|
-
PackageRow,
|
|
15
|
-
PackageDependencyRow,
|
|
16
|
-
} from "../index.js";
|
|
17
|
-
|
|
18
|
-
export class SqliteDB {
|
|
19
|
-
public db: Database;
|
|
20
|
-
|
|
21
|
-
constructor(db: Database) {
|
|
22
|
-
this.db = db;
|
|
23
|
-
this.db.pragma("journal_mode = WAL");
|
|
24
|
-
this.db.pragma("foreign_keys = ON");
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public getFileByPath(filePath: string): FileRow | undefined {
|
|
28
|
-
return this.db
|
|
29
|
-
.prepare("SELECT * FROM files WHERE path = ?")
|
|
30
|
-
.get(filePath) as FileRow | undefined;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public getEdges(): { from: string; to: string; label: string }[] {
|
|
34
|
-
const rows = this.db
|
|
35
|
-
.prepare(
|
|
36
|
-
`
|
|
37
|
-
SELECT from_id as 'from', to_id as 'to', kind as label
|
|
38
|
-
FROM relations
|
|
39
|
-
WHERE kind NOT IN ('parent-child', 'renders', 'calls')
|
|
40
|
-
`,
|
|
41
|
-
)
|
|
42
|
-
.all() as { from: string; to: string; label: string }[];
|
|
43
|
-
return rows;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public getAllData() {
|
|
47
|
-
const packages = this.db
|
|
48
|
-
.prepare("SELECT * FROM packages")
|
|
49
|
-
.all() as PackageRow[];
|
|
50
|
-
const package_dependencies = this.db
|
|
51
|
-
.prepare("SELECT * FROM package_dependencies")
|
|
52
|
-
.all() as PackageDependencyRow[];
|
|
53
|
-
const files = this.db.prepare("SELECT * FROM files").all() as FileRow[];
|
|
54
|
-
const entities = this.db
|
|
55
|
-
.prepare("SELECT * FROM entities")
|
|
56
|
-
.all() as EntityRow[];
|
|
57
|
-
const scopes = this.db.prepare("SELECT * FROM scopes").all() as ScopeRow[];
|
|
58
|
-
const symbols = this.db
|
|
59
|
-
.prepare("SELECT * FROM symbols")
|
|
60
|
-
.all() as SymbolRow[];
|
|
61
|
-
const renders = this.db
|
|
62
|
-
.prepare("SELECT * FROM renders")
|
|
63
|
-
.all() as RenderRow[];
|
|
64
|
-
const exports = this.db
|
|
65
|
-
.prepare("SELECT * FROM exports")
|
|
66
|
-
.all() as ExportRow[];
|
|
67
|
-
const relations = this.db
|
|
68
|
-
.prepare("SELECT * FROM relations")
|
|
69
|
-
.all() as RelationRow[];
|
|
70
|
-
const analysis_runs = this.db
|
|
71
|
-
.prepare("SELECT * FROM analysis_runs")
|
|
72
|
-
.all() as AnalysisRunRow[];
|
|
73
|
-
const file_run_status = this.db
|
|
74
|
-
.prepare("SELECT * FROM file_run_status")
|
|
75
|
-
.all() as FileRunStatusRow[];
|
|
76
|
-
const file_analysis_errors = this.db
|
|
77
|
-
.prepare("SELECT * FROM file_analysis_errors")
|
|
78
|
-
.all() as FileAnalysisErrorRow[];
|
|
79
|
-
const resolve_errors = this.db
|
|
80
|
-
.prepare("SELECT * FROM resolve_errors")
|
|
81
|
-
.all() as ResolveErrorRow[];
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
packages,
|
|
85
|
-
package_dependencies,
|
|
86
|
-
files,
|
|
87
|
-
entities,
|
|
88
|
-
scopes,
|
|
89
|
-
symbols,
|
|
90
|
-
renders,
|
|
91
|
-
exports,
|
|
92
|
-
relations,
|
|
93
|
-
analysis_runs,
|
|
94
|
-
file_run_status,
|
|
95
|
-
file_analysis_errors,
|
|
96
|
-
resolve_errors,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public close() {
|
|
101
|
-
this.db.close();
|
|
102
|
-
}
|
|
103
|
-
}
|