@nexiq/extension-sdk 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tasks/componentTask.js +332 -0
- package/dist/tasks/componentTask.test.js +520 -0
- package/eslint.config.js +1 -0
- package/package.json +9 -6
- package/src/tasks/componentTask.test.ts +572 -0
- package/src/tasks/componentTask.ts +268 -44
- package/tsconfig.json +3 -2
- package/dist/extension-sdk/src/tasks/componentTask.js +0 -129
- package/dist/shared/src/component.d.ts +0 -273
- 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/{shared/src/component.js → tasks/componentTask.test.d.ts} +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
|
@@ -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
|