@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
package/src/types/index.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { ComponentLoc, VariableName } from "../component.js";
|
|
2
|
-
import type { TypeData, TypeDataLiteralBody } from "./primitive.js";
|
|
3
|
-
import type { NexiqConfig, 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
|
-
|
|
9
|
-
export interface ProjectStatus {
|
|
10
|
-
hasConfig: boolean;
|
|
11
|
-
isMonorepo: boolean;
|
|
12
|
-
projectType: "vite" | "next" | "unknown";
|
|
13
|
-
config: NexiqConfig | null;
|
|
14
|
-
subProjects: SubProject[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type GraphViewType = "component" | "file" | "router" | "package";
|
|
18
|
-
|
|
19
|
-
export interface AppSelectionState {
|
|
20
|
-
type: "node" | "edge";
|
|
21
|
-
id: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface AppStateData {
|
|
25
|
-
selectedSubProjects: string[];
|
|
26
|
-
centeredItemId: string | null;
|
|
27
|
-
selectedId: string | null;
|
|
28
|
-
selectedEdgeId?: string | null;
|
|
29
|
-
selectedItemType?: "node" | "edge" | null;
|
|
30
|
-
selected?: AppSelectionState | null;
|
|
31
|
-
isSidebarOpen: boolean;
|
|
32
|
-
activeTab: "projects" | "git";
|
|
33
|
-
selectedCommit: string | null;
|
|
34
|
-
gitComparisonEnabled?: boolean;
|
|
35
|
-
viewport?: { x: number; y: number; zoom: number } | null;
|
|
36
|
-
view?: GraphViewType;
|
|
37
|
-
sidebar: {
|
|
38
|
-
right: {
|
|
39
|
-
width?: number;
|
|
40
|
-
height?: number;
|
|
41
|
-
};
|
|
42
|
-
bottom?: {
|
|
43
|
-
isOpen?: boolean;
|
|
44
|
-
height?: number;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface TypeDataParam {
|
|
50
|
-
name: string;
|
|
51
|
-
default?: TypeData;
|
|
52
|
-
constraint?: TypeData;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface TypeDataParamFunction extends TypeDataParam {
|
|
56
|
-
const?: boolean;
|
|
57
|
-
in?: boolean;
|
|
58
|
-
out?: boolean;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface TypeDataDeclareBase {
|
|
62
|
-
id: string;
|
|
63
|
-
type: "interface" | "type";
|
|
64
|
-
name: VariableName;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface TypeDataDeclareInterface
|
|
68
|
-
extends TypeDataDeclareBase, ComponentLoc {
|
|
69
|
-
type: "interface";
|
|
70
|
-
extends?: string[];
|
|
71
|
-
body: TypeDataLiteralBody[];
|
|
72
|
-
params?: Record<string, TypeDataParam>;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface TypeDataDeclareType extends TypeDataDeclareBase, ComponentLoc {
|
|
76
|
-
type: "type";
|
|
77
|
-
body: TypeData;
|
|
78
|
-
params?: TypeDataParam[];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export type TypeDataDeclare = TypeDataDeclareInterface | TypeDataDeclareType;
|
|
82
|
-
|
|
83
|
-
export type ComponentTypeData =
|
|
84
|
-
| {
|
|
85
|
-
type: "name";
|
|
86
|
-
name: string;
|
|
87
|
-
}
|
|
88
|
-
| {
|
|
89
|
-
type: "inline";
|
|
90
|
-
body: TypeData;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export * from "./backend.js";
|
package/src/types/object.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export interface FuncParamName {
|
|
3
|
-
type: "named";
|
|
4
|
-
name: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface FuncParamObjectProperty {
|
|
8
|
-
type: "object-property";
|
|
9
|
-
shorthand: boolean;
|
|
10
|
-
key: string;
|
|
11
|
-
value: FuncParam;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type FuncParamObjectPatternProperty =
|
|
15
|
-
| FuncParamObjectProperty
|
|
16
|
-
| FuncParamRestElement;
|
|
17
|
-
|
|
18
|
-
export interface FuncParamObjectPattern {
|
|
19
|
-
type: "object-pattern";
|
|
20
|
-
property: FuncParamObjectPatternProperty[];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface FuncParamArrayPattern {
|
|
24
|
-
type: "array-pattern";
|
|
25
|
-
elements: FuncParam[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface FuncParamRestElement {
|
|
29
|
-
type: "rest-element";
|
|
30
|
-
name: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export type FuncParam =
|
|
34
|
-
| FuncParamName
|
|
35
|
-
| FuncParamObjectPattern
|
|
36
|
-
| FuncParamArrayPattern
|
|
37
|
-
| FuncParamRestElement;
|
package/src/types/primitive.ts
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import type { FuncParam, TypeDataParamFunction } from "./index.js";
|
|
2
|
-
|
|
3
|
-
export interface TypeDataString {
|
|
4
|
-
type: "string";
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface TypeDataNumber {
|
|
8
|
-
type: "number";
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface TypeDataBigInt {
|
|
12
|
-
type: "bigint";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface TypeDataBoolean {
|
|
16
|
-
type: "boolean";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface TypeDataNull {
|
|
20
|
-
type: "null";
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface TypeDataUndefined {
|
|
24
|
-
type: "undefined";
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface TypeDataAny {
|
|
28
|
-
type: "any";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface TypeDataVoid {
|
|
32
|
-
type: "void";
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface TypeDataUnknown {
|
|
36
|
-
type: "unknown";
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface TypeDataNever {
|
|
40
|
-
type: "never";
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface TypeDataLiteralTypeBigInt {
|
|
44
|
-
type: "bigint";
|
|
45
|
-
value: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface TypeDataLiteralTypeString {
|
|
49
|
-
type: "string";
|
|
50
|
-
value: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface TypeDataLiteralTypeNumber {
|
|
54
|
-
type: "number";
|
|
55
|
-
value: number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface TypeDataLiteralTypeBoolean {
|
|
59
|
-
type: "boolean";
|
|
60
|
-
value: boolean;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface TypeDataLiteralTypeTemplate {
|
|
64
|
-
type: "template";
|
|
65
|
-
expression: TypeData[];
|
|
66
|
-
quasis: string[];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface TypeDataLiteralTypeUnary {
|
|
70
|
-
type: "unary";
|
|
71
|
-
operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof";
|
|
72
|
-
prefix: boolean;
|
|
73
|
-
argument: TypeDataLiteralTypeLiteral;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export type TypeDataLiteralTypeLiteral =
|
|
77
|
-
| TypeDataLiteralTypeBoolean
|
|
78
|
-
| TypeDataLiteralTypeNumber
|
|
79
|
-
| TypeDataLiteralTypeString
|
|
80
|
-
| TypeDataLiteralTypeUnary
|
|
81
|
-
| TypeDataLiteralTypeBigInt
|
|
82
|
-
| TypeDataLiteralTypeTemplate;
|
|
83
|
-
|
|
84
|
-
// string, number, boolean
|
|
85
|
-
export interface TypeDataLiteralType {
|
|
86
|
-
type: "literal-type";
|
|
87
|
-
literal: TypeDataLiteralTypeLiteral;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export type TypeDataRef = {
|
|
91
|
-
type: "ref";
|
|
92
|
-
params?: TypeData[];
|
|
93
|
-
resolvedId?: string | undefined;
|
|
94
|
-
unresolvedWorkspace?: boolean | undefined;
|
|
95
|
-
} & (
|
|
96
|
-
| {
|
|
97
|
-
refType: "named";
|
|
98
|
-
name: string;
|
|
99
|
-
}
|
|
100
|
-
| {
|
|
101
|
-
refType: "qualified";
|
|
102
|
-
names: string[];
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
export interface TypeDataLiteralArray {
|
|
107
|
-
type: "literal-array";
|
|
108
|
-
elements: PropDataType[];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface TypeDataLiteralObject {
|
|
112
|
-
type: "literal-object";
|
|
113
|
-
properties: Record<string, PropDataType>;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export type PropDataType =
|
|
117
|
-
| TypeDataLiteralType
|
|
118
|
-
| TypeDataRef
|
|
119
|
-
| TypeDataNull
|
|
120
|
-
| TypeDataUndefined
|
|
121
|
-
| TypeDataLiteralArray
|
|
122
|
-
| TypeDataLiteralObject;
|
|
123
|
-
|
|
124
|
-
export type TypeDataFunctionParameter = {
|
|
125
|
-
param: FuncParam;
|
|
126
|
-
typeData?: TypeData;
|
|
127
|
-
optional?: boolean;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export type TypeDataFunction = {
|
|
131
|
-
type: "function";
|
|
132
|
-
// generic
|
|
133
|
-
params: TypeDataParamFunction[];
|
|
134
|
-
// function parameters
|
|
135
|
-
parameters: TypeDataFunctionParameter[];
|
|
136
|
-
return: TypeData;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export type TypeDataPrimitive =
|
|
140
|
-
| TypeDataString
|
|
141
|
-
| TypeDataNumber
|
|
142
|
-
| TypeDataBigInt
|
|
143
|
-
| TypeDataBoolean
|
|
144
|
-
| TypeDataNull
|
|
145
|
-
| TypeDataUndefined
|
|
146
|
-
| TypeDataAny
|
|
147
|
-
| TypeDataVoid
|
|
148
|
-
| TypeDataUnknown
|
|
149
|
-
| TypeDataNever
|
|
150
|
-
| TypeDataRef
|
|
151
|
-
| TypeDataLiteralType
|
|
152
|
-
| TypeDataFunction;
|
|
153
|
-
|
|
154
|
-
export interface TypeDataArray {
|
|
155
|
-
type: "array";
|
|
156
|
-
element: TypeData;
|
|
157
|
-
}
|
|
158
|
-
export interface TypeDataTupleElementBase {
|
|
159
|
-
type: "named" | "unnamed";
|
|
160
|
-
typeData: TypeData;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export interface TypeDataTupleElementNamed extends TypeDataTupleElementBase {
|
|
164
|
-
type: "named";
|
|
165
|
-
name: string;
|
|
166
|
-
optional: boolean;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export interface TypeDataTupleElementUnNamed extends TypeDataTupleElementBase {
|
|
170
|
-
type: "unnamed";
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export type TypeDataTupleElement =
|
|
174
|
-
| TypeDataTupleElementNamed
|
|
175
|
-
| TypeDataTupleElementUnNamed;
|
|
176
|
-
|
|
177
|
-
export interface TypeDataTuple {
|
|
178
|
-
type: "tuple";
|
|
179
|
-
elements: TypeDataTupleElement[];
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export interface TypeDataIndexAccess {
|
|
183
|
-
type: "index-access";
|
|
184
|
-
indexType: TypeData;
|
|
185
|
-
objectType: TypeData;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export interface TypeDataQuery {
|
|
189
|
-
type: "query";
|
|
190
|
-
expr: TypeData;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export interface TypeDataImport {
|
|
194
|
-
type: "import";
|
|
195
|
-
name: string;
|
|
196
|
-
qualifier?: string;
|
|
197
|
-
resolvedId?: string | undefined;
|
|
198
|
-
unresolvedWorkspace?: boolean | undefined;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export interface TypeDataLiteralBodyBase {
|
|
202
|
-
signatureType: "property" | "index" | "method";
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export interface TypeDataLiteralBodyIndexPrarameter {
|
|
206
|
-
name: string;
|
|
207
|
-
type: TypeData;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export interface TypeDataLiteralBodyIndex extends TypeDataLiteralBodyBase {
|
|
211
|
-
signatureType: "index";
|
|
212
|
-
type: TypeData;
|
|
213
|
-
parameter: TypeDataLiteralBodyIndexPrarameter;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export interface TypeDataLiteralBodyProperty extends TypeDataLiteralBodyBase {
|
|
217
|
-
signatureType: "property";
|
|
218
|
-
type: TypeData;
|
|
219
|
-
optional?: boolean;
|
|
220
|
-
computed?: boolean;
|
|
221
|
-
name: string;
|
|
222
|
-
loc?: { line: number; column: number };
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export interface TypeDataLiteralBodyMethod extends TypeDataLiteralBodyBase {
|
|
226
|
-
signatureType: "method";
|
|
227
|
-
name: string;
|
|
228
|
-
optional?: boolean;
|
|
229
|
-
computed?: boolean;
|
|
230
|
-
params: TypeDataParamFunction[];
|
|
231
|
-
parameters: TypeDataFunctionParameter[];
|
|
232
|
-
return: TypeData;
|
|
233
|
-
loc?: { line: number; column: number };
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export type TypeDataLiteralBody =
|
|
237
|
-
| TypeDataLiteralBodyProperty
|
|
238
|
-
| TypeDataLiteralBodyIndex
|
|
239
|
-
| TypeDataLiteralBodyMethod;
|
|
240
|
-
|
|
241
|
-
// object
|
|
242
|
-
export interface TypeDataTypeBodyLiteral {
|
|
243
|
-
type: "type-literal";
|
|
244
|
-
members: TypeDataLiteralBody[];
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export interface TypeDataTypeBodyParathesis {
|
|
248
|
-
type: "parenthesis";
|
|
249
|
-
members: TypeData;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export interface TypeDataTypeBodyUnion {
|
|
253
|
-
type: "union";
|
|
254
|
-
members: TypeData[];
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export interface TypeDataTypeBodyIntersection {
|
|
258
|
-
type: "intersection";
|
|
259
|
-
members: TypeData[];
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export type TypeData =
|
|
263
|
-
| TypeDataPrimitive
|
|
264
|
-
| TypeDataArray
|
|
265
|
-
| TypeDataTuple
|
|
266
|
-
| TypeDataIndexAccess
|
|
267
|
-
| TypeDataQuery
|
|
268
|
-
| TypeDataImport
|
|
269
|
-
| TypeDataTypeBodyLiteral
|
|
270
|
-
| TypeDataTypeBodyUnion
|
|
271
|
-
| TypeDataTypeBodyIntersection
|
|
272
|
-
| TypeDataTypeBodyParathesis
|
|
273
|
-
| TypeDataLiteralArray
|
|
274
|
-
| TypeDataLiteralObject;
|
package/src/utils.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { VariableName } from "./component.js";
|
|
2
|
-
import type { GitFileDiff, GitDiffHunk } from "./types/git.js";
|
|
3
|
-
|
|
4
|
-
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
5
|
-
|
|
6
|
-
export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown
|
|
7
|
-
? Omit<T, K>
|
|
8
|
-
: never;
|
|
9
|
-
|
|
10
|
-
export const getDisplayName = (
|
|
11
|
-
name: VariableName | string | undefined,
|
|
12
|
-
): string => {
|
|
13
|
-
if (!name) return "unknown";
|
|
14
|
-
if (typeof name === "string") return name;
|
|
15
|
-
if (name.type === "identifier") return name.name;
|
|
16
|
-
if (name.type === "rest") return `...${getDisplayName(name.argument)}`;
|
|
17
|
-
return "raw" in name ? name.raw : "unknown";
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export function parseRawDiff(
|
|
21
|
-
rawDiff: string,
|
|
22
|
-
filterFile?: string,
|
|
23
|
-
): GitFileDiff[] {
|
|
24
|
-
const files: GitFileDiff[] = [];
|
|
25
|
-
if (!rawDiff) return files;
|
|
26
|
-
|
|
27
|
-
const fileDiffs = rawDiff.split(/^diff --git /m).slice(1);
|
|
28
|
-
|
|
29
|
-
for (const fileDiff of fileDiffs) {
|
|
30
|
-
const lines = fileDiff.split("\n");
|
|
31
|
-
const header = lines[0];
|
|
32
|
-
if (!header) continue;
|
|
33
|
-
const pathMatch = header.match(/a\/(.*) b\/(.*)/);
|
|
34
|
-
if (!pathMatch) continue;
|
|
35
|
-
|
|
36
|
-
const filePath = pathMatch[2];
|
|
37
|
-
if (filterFile && filePath !== filterFile) continue;
|
|
38
|
-
|
|
39
|
-
const hunks: GitDiffHunk[] = [];
|
|
40
|
-
let currentHunk: GitDiffHunk | null = null;
|
|
41
|
-
|
|
42
|
-
let oldLineNum = 0;
|
|
43
|
-
let newLineNum = 0;
|
|
44
|
-
|
|
45
|
-
for (let i = 1; i < lines.length; i++) {
|
|
46
|
-
const line = lines[i]!;
|
|
47
|
-
if (line.startsWith("@@")) {
|
|
48
|
-
const hunkMatch = line.match(/@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@/);
|
|
49
|
-
if (hunkMatch) {
|
|
50
|
-
oldLineNum = parseInt(hunkMatch[1]!);
|
|
51
|
-
newLineNum = parseInt(hunkMatch[3]!);
|
|
52
|
-
currentHunk = {
|
|
53
|
-
content: line,
|
|
54
|
-
lines: [],
|
|
55
|
-
oldStart: oldLineNum,
|
|
56
|
-
oldLines: parseInt(hunkMatch[2] || "1"),
|
|
57
|
-
newStart: newLineNum,
|
|
58
|
-
newLines: parseInt(hunkMatch[4] || "1"),
|
|
59
|
-
};
|
|
60
|
-
hunks.push(currentHunk);
|
|
61
|
-
}
|
|
62
|
-
} else if (currentHunk) {
|
|
63
|
-
if (line.startsWith("+")) {
|
|
64
|
-
currentHunk.lines.push({
|
|
65
|
-
type: "added",
|
|
66
|
-
content: line.substring(1),
|
|
67
|
-
newLineNumber: newLineNum++,
|
|
68
|
-
});
|
|
69
|
-
} else if (line.startsWith("-")) {
|
|
70
|
-
currentHunk.lines.push({
|
|
71
|
-
type: "deleted",
|
|
72
|
-
content: line.substring(1),
|
|
73
|
-
oldLineNumber: oldLineNum++,
|
|
74
|
-
});
|
|
75
|
-
} else if (line.startsWith(" ")) {
|
|
76
|
-
currentHunk.lines.push({
|
|
77
|
-
type: "normal",
|
|
78
|
-
content: line.substring(1),
|
|
79
|
-
oldLineNumber: oldLineNum++,
|
|
80
|
-
newLineNumber: newLineNum++,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
files.push({
|
|
87
|
-
path: filePath!,
|
|
88
|
-
hunks,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return files;
|
|
93
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
// File layout
|
|
4
|
-
"rootDir": "./src",
|
|
5
|
-
"outDir": "./dist",
|
|
6
|
-
|
|
7
|
-
// Module & target for modern Node + React
|
|
8
|
-
"module": "nodenext",
|
|
9
|
-
"target": "esnext",
|
|
10
|
-
"moduleResolution": "nodenext",
|
|
11
|
-
"types": ["node"],
|
|
12
|
-
|
|
13
|
-
// Outputs
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"declaration": true,
|
|
16
|
-
"declarationMap": true,
|
|
17
|
-
|
|
18
|
-
// Type checking
|
|
19
|
-
"strict": true,
|
|
20
|
-
"noUncheckedIndexedAccess": true,
|
|
21
|
-
"exactOptionalPropertyTypes": true,
|
|
22
|
-
|
|
23
|
-
// React
|
|
24
|
-
"jsx": "react-jsx",
|
|
25
|
-
|
|
26
|
-
// ESM / Node interoperability
|
|
27
|
-
"isolatedModules": true,
|
|
28
|
-
"verbatimModuleSyntax": true,
|
|
29
|
-
"noUncheckedSideEffectImports": true,
|
|
30
|
-
"moduleDetection": "force",
|
|
31
|
-
"skipLibCheck": true
|
|
32
|
-
},
|
|
33
|
-
"include": ["src"],
|
|
34
|
-
"exclude": ["tsconfig.json"]
|
|
35
|
-
}
|