@gi.ts/parser 2.0.0-alpha.0 → 2.0.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/parser.js +64 -13
- package/dist/xml.d.ts +240 -213
- package/dist/xml.js +13 -12
- package/package.json +11 -7
package/dist/parser.js
CHANGED
|
@@ -1,15 +1,66 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { XMLParser } from "fast-xml-parser";
|
|
2
|
+
const isArrayProperty = [
|
|
3
|
+
"type",
|
|
4
|
+
"include",
|
|
5
|
+
"c:include",
|
|
6
|
+
"member",
|
|
7
|
+
"parameter",
|
|
8
|
+
"parameters",
|
|
9
|
+
"return-value",
|
|
10
|
+
"class",
|
|
11
|
+
"constructor",
|
|
12
|
+
"constructors",
|
|
13
|
+
"method",
|
|
14
|
+
"virtual-method",
|
|
15
|
+
"property",
|
|
16
|
+
"field",
|
|
17
|
+
"constant",
|
|
18
|
+
"enumeration",
|
|
19
|
+
"bitfield",
|
|
20
|
+
"alias",
|
|
21
|
+
"function",
|
|
22
|
+
"callback",
|
|
23
|
+
"record",
|
|
24
|
+
"union",
|
|
25
|
+
"interface",
|
|
26
|
+
"namespace",
|
|
27
|
+
"repository",
|
|
28
|
+
"package",
|
|
29
|
+
"glib:boxed",
|
|
30
|
+
"implements",
|
|
31
|
+
"prerequisite",
|
|
32
|
+
"doc",
|
|
33
|
+
"doc-deprecated",
|
|
34
|
+
"signal",
|
|
35
|
+
"glib:signal",
|
|
36
|
+
"annotation",
|
|
37
|
+
"stability",
|
|
38
|
+
"doc-version",
|
|
39
|
+
"doc-stability",
|
|
40
|
+
"source-position",
|
|
41
|
+
"column",
|
|
42
|
+
"array",
|
|
43
|
+
"moved-to",
|
|
44
|
+
"varargs",
|
|
45
|
+
"instance-parameter",
|
|
46
|
+
];
|
|
47
|
+
const parser = new XMLParser({
|
|
48
|
+
attributeNamePrefix: "",
|
|
49
|
+
attributesGroupName: "$",
|
|
50
|
+
textNodeName: "_",
|
|
51
|
+
ignoreAttributes: false,
|
|
52
|
+
removeNSPrefix: false,
|
|
53
|
+
allowBooleanAttributes: true,
|
|
54
|
+
parseTagValue: true,
|
|
55
|
+
parseAttributeValue: false,
|
|
56
|
+
trimValues: true,
|
|
57
|
+
isArray: (name, _jpath, isLeafNode, _isAttribute) => {
|
|
58
|
+
if (isArrayProperty.includes(name)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return !isLeafNode;
|
|
62
|
+
},
|
|
63
|
+
});
|
|
2
64
|
export function parseGir(contents) {
|
|
3
|
-
return parse(contents
|
|
4
|
-
attributeNamePrefix: "",
|
|
5
|
-
attrNodeName: "$",
|
|
6
|
-
textNodeName: "_",
|
|
7
|
-
ignoreAttributes: false,
|
|
8
|
-
ignoreNameSpace: false,
|
|
9
|
-
allowBooleanAttributes: true,
|
|
10
|
-
parseNodeValue: true,
|
|
11
|
-
parseAttributeValue: false,
|
|
12
|
-
trimValues: true,
|
|
13
|
-
arrayMode: true
|
|
14
|
-
});
|
|
65
|
+
return parser.parse(contents);
|
|
15
66
|
}
|
package/dist/xml.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
export declare enum
|
|
1
|
+
export declare enum GirDirection {
|
|
2
2
|
In = "in",
|
|
3
3
|
Inout = "inout",
|
|
4
|
-
Out = "out"
|
|
4
|
+
Out = "out",
|
|
5
|
+
InOut = "in-out"
|
|
5
6
|
}
|
|
6
7
|
export interface GirXML {
|
|
7
|
-
repository:
|
|
8
|
+
repository: GirRepository[];
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export interface
|
|
10
|
+
export type GirUnparsedNumber = string;
|
|
11
|
+
export type GirBoolean = "0" | "1";
|
|
12
|
+
export interface GirRepository {
|
|
12
13
|
$: {
|
|
13
14
|
version?: string;
|
|
14
15
|
"c:identifier-prefixes"?: string;
|
|
15
16
|
"c:symbol-prefixes"?: string;
|
|
16
17
|
};
|
|
17
|
-
include
|
|
18
|
-
"c:include":
|
|
19
|
-
package:
|
|
20
|
-
namespace
|
|
18
|
+
include?: GirInclude[];
|
|
19
|
+
"c:include": GirCInclude[];
|
|
20
|
+
package: GirPackage[];
|
|
21
|
+
namespace?: GirNamespace[];
|
|
21
22
|
}
|
|
22
|
-
export interface
|
|
23
|
-
$:
|
|
23
|
+
export interface GirNamespace {
|
|
24
|
+
$: GirInfoAttrs & {
|
|
24
25
|
name: string;
|
|
25
26
|
version: string;
|
|
26
27
|
"c:identifier-prefixes"?: string;
|
|
@@ -28,50 +29,50 @@ export interface Namespace {
|
|
|
28
29
|
"c:prefix"?: string;
|
|
29
30
|
"shared-library"?: string;
|
|
30
31
|
};
|
|
31
|
-
alias?:
|
|
32
|
-
class?:
|
|
33
|
-
interface?:
|
|
34
|
-
record?:
|
|
35
|
-
enumeration?:
|
|
36
|
-
function?:
|
|
37
|
-
union?:
|
|
38
|
-
bitfield?:
|
|
39
|
-
callback?:
|
|
40
|
-
constant?:
|
|
41
|
-
annotation?:
|
|
42
|
-
["glib:boxed"]?:
|
|
43
|
-
}
|
|
44
|
-
export interface
|
|
32
|
+
alias?: GirAliasElement[];
|
|
33
|
+
class?: GirClassElement[];
|
|
34
|
+
interface?: GirInterfaceElement[];
|
|
35
|
+
record?: GirRecordElement[];
|
|
36
|
+
enumeration?: GirEnumElement[];
|
|
37
|
+
function?: GirFunctionElement[];
|
|
38
|
+
union?: GirUnionElement[];
|
|
39
|
+
bitfield?: GirBitfieldElement[];
|
|
40
|
+
callback?: GirCallbackElement[];
|
|
41
|
+
constant?: GirConstantElement[];
|
|
42
|
+
annotation?: GirAnnotation[];
|
|
43
|
+
["glib:boxed"]?: GirBoxedElement[];
|
|
44
|
+
}
|
|
45
|
+
export interface GirAnnotation {
|
|
45
46
|
$: {
|
|
46
47
|
name: string;
|
|
47
48
|
value: string[];
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
export interface
|
|
51
|
+
export interface GirCInclude {
|
|
51
52
|
$: {
|
|
52
53
|
name: string;
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
|
-
export interface
|
|
56
|
+
export interface GirInclude {
|
|
56
57
|
$: {
|
|
57
58
|
name: string;
|
|
58
59
|
version?: string;
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
export interface
|
|
62
|
+
export interface GirPackage {
|
|
62
63
|
$: {
|
|
63
64
|
name: string;
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
|
-
export interface
|
|
67
|
-
$:
|
|
67
|
+
export interface GirAliasElement extends GirInfoElements {
|
|
68
|
+
$: GirInfoAttrs & {
|
|
68
69
|
name: string;
|
|
69
|
-
"c:type"
|
|
70
|
+
"c:type"?: string;
|
|
70
71
|
};
|
|
71
|
-
type
|
|
72
|
+
type?: GirType[];
|
|
72
73
|
}
|
|
73
|
-
export interface
|
|
74
|
-
$: {
|
|
74
|
+
export interface GirInterfaceElement extends GirInfoElements {
|
|
75
|
+
$: GirInfoAttrs & {
|
|
75
76
|
name: string;
|
|
76
77
|
"glib:type-name": string;
|
|
77
78
|
"glib:get-type": string;
|
|
@@ -79,20 +80,21 @@ export interface InterfaceElement extends InfoElements {
|
|
|
79
80
|
"c:type"?: string;
|
|
80
81
|
"glib:type-struct"?: string;
|
|
81
82
|
};
|
|
82
|
-
prerequisite?:
|
|
83
|
-
implements?:
|
|
84
|
-
function?:
|
|
85
|
-
constructors?:
|
|
86
|
-
method?:
|
|
87
|
-
"virtual-method"?:
|
|
88
|
-
field?:
|
|
89
|
-
property?:
|
|
90
|
-
signal?:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
prerequisite?: GirPrerequisite[];
|
|
84
|
+
implements?: GirImplements[];
|
|
85
|
+
function?: GirFunctionElement[];
|
|
86
|
+
constructors?: GirConstructorElement[];
|
|
87
|
+
method?: GirMethodElement[];
|
|
88
|
+
"virtual-method"?: GirVirtualMethodElement[];
|
|
89
|
+
field?: GirFieldElement[];
|
|
90
|
+
property?: GirPropertyElement[];
|
|
91
|
+
signal?: GirSignalElement[];
|
|
92
|
+
"glib:signal"?: GirSignalElement[];
|
|
93
|
+
callback?: GirCallbackElement[];
|
|
94
|
+
constant?: GirConstantElement[];
|
|
95
|
+
}
|
|
96
|
+
export interface GirClassElement extends GirInfoElements {
|
|
97
|
+
$: GirInfoAttrs & {
|
|
96
98
|
name: string;
|
|
97
99
|
"glib:type-name": string;
|
|
98
100
|
"glib:get-type": string;
|
|
@@ -104,57 +106,61 @@ export interface ClassElement extends InfoElements {
|
|
|
104
106
|
"glib:get-value-func"?: string;
|
|
105
107
|
"c:type"?: string;
|
|
106
108
|
"c:symbol-prefix"?: string;
|
|
107
|
-
abstract?:
|
|
108
|
-
"glib:fundamental"?:
|
|
109
|
+
abstract?: GirBoolean;
|
|
110
|
+
"glib:fundamental"?: GirBoolean;
|
|
111
|
+
final: GirBoolean;
|
|
109
112
|
};
|
|
110
|
-
implements?:
|
|
111
|
-
|
|
112
|
-
method?:
|
|
113
|
-
function?:
|
|
114
|
-
"virtual-method"?:
|
|
115
|
-
field?:
|
|
116
|
-
property?:
|
|
117
|
-
signal?:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
implements?: GirImplements[];
|
|
114
|
+
constructor?: GirConstructorElement[];
|
|
115
|
+
method?: GirMethodElement[];
|
|
116
|
+
function?: GirFunctionElement[];
|
|
117
|
+
"virtual-method"?: GirVirtualMethodElement[];
|
|
118
|
+
field?: GirFieldElement[];
|
|
119
|
+
property?: GirPropertyElement[];
|
|
120
|
+
signal?: GirSignalElement[];
|
|
121
|
+
"glib:signal"?: GirSignalElement[];
|
|
122
|
+
union?: GirUnionElement[];
|
|
123
|
+
constant?: GirConstantElement[];
|
|
124
|
+
record?: GirRecordElement[];
|
|
125
|
+
callback?: GirCallbackElement[];
|
|
126
|
+
}
|
|
127
|
+
export interface GirBoxedElement {
|
|
128
|
+
$: GirInfoAttrs & {
|
|
125
129
|
"glib:name": string;
|
|
126
130
|
"c:symbol-prefix"?: string;
|
|
127
131
|
"glib:type-name"?: string;
|
|
128
132
|
"glib:get-type"?: string;
|
|
129
133
|
};
|
|
130
|
-
function?:
|
|
134
|
+
function?: GirFunctionElement[];
|
|
131
135
|
}
|
|
132
|
-
export interface
|
|
133
|
-
$:
|
|
136
|
+
export interface GirRecordElement extends GirInfoElements {
|
|
137
|
+
$: GirInfoAttrs & {
|
|
134
138
|
name: string;
|
|
135
139
|
"c:type"?: string;
|
|
136
|
-
disguised?:
|
|
140
|
+
disguised?: GirBoolean;
|
|
141
|
+
opaque?: GirBoolean;
|
|
142
|
+
pointer?: GirBoolean;
|
|
137
143
|
"glib:type-name"?: string;
|
|
138
144
|
"glib:get-type"?: string;
|
|
139
145
|
"c:symbol-prefix"?: string;
|
|
140
|
-
foreign?:
|
|
146
|
+
foreign?: GirBoolean;
|
|
141
147
|
"glib:is-gtype-struct-for"?: string;
|
|
142
148
|
};
|
|
143
|
-
field?:
|
|
144
|
-
function?:
|
|
145
|
-
union?:
|
|
146
|
-
method?:
|
|
147
|
-
|
|
148
|
-
property?:
|
|
149
|
-
}
|
|
150
|
-
export interface
|
|
151
|
-
introspectable?:
|
|
149
|
+
field?: GirFieldElement[];
|
|
150
|
+
function?: GirFunctionElement[];
|
|
151
|
+
union?: GirUnionElement[];
|
|
152
|
+
method?: GirMethodElement[];
|
|
153
|
+
constructor?: GirConstructorElement[];
|
|
154
|
+
property?: GirPropertyElement[];
|
|
155
|
+
}
|
|
156
|
+
export interface GirInfoAttrs {
|
|
157
|
+
introspectable?: GirBoolean;
|
|
152
158
|
deprecated?: string;
|
|
153
159
|
"deprecated-version"?: string;
|
|
154
160
|
version?: string;
|
|
155
161
|
stability?: string[];
|
|
156
162
|
}
|
|
157
|
-
export interface
|
|
163
|
+
export interface GirDocElement {
|
|
158
164
|
"doc-version"?: [
|
|
159
165
|
{
|
|
160
166
|
$: {
|
|
@@ -202,214 +208,235 @@ export interface DocElement {
|
|
|
202
208
|
}
|
|
203
209
|
];
|
|
204
210
|
}
|
|
205
|
-
export interface
|
|
206
|
-
annotation:
|
|
211
|
+
export interface GirInfoElements extends GirDocElement {
|
|
212
|
+
annotation: GirAnnotation[];
|
|
207
213
|
}
|
|
208
|
-
export interface
|
|
209
|
-
$:
|
|
214
|
+
export interface GirConstantElement extends GirInfoElements, GirAnyType {
|
|
215
|
+
$: GirInfoAttrs & {
|
|
210
216
|
name: string;
|
|
211
217
|
value: string;
|
|
212
218
|
"c:type"?: string;
|
|
213
219
|
"c:identifier"?: string;
|
|
214
220
|
};
|
|
215
221
|
}
|
|
216
|
-
export interface
|
|
217
|
-
$:
|
|
222
|
+
export interface GirPropertyElement extends GirInfoElements, GirAnyType {
|
|
223
|
+
$: GirInfoAttrs & {
|
|
218
224
|
name: string;
|
|
219
|
-
writable?:
|
|
220
|
-
readable?:
|
|
221
|
-
construct?:
|
|
222
|
-
"construct-only"?:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
writable?: GirBoolean;
|
|
226
|
+
readable?: GirBoolean;
|
|
227
|
+
construct?: GirBoolean;
|
|
228
|
+
"construct-only"?: GirBoolean;
|
|
229
|
+
setter?: string;
|
|
230
|
+
getter?: string;
|
|
231
|
+
"default-value"?: string;
|
|
232
|
+
} & Partial<GirTransferOwnership>;
|
|
233
|
+
}
|
|
234
|
+
export interface GirSignalElement extends GirInfoElements {
|
|
235
|
+
$: GirInfoAttrs & {
|
|
228
236
|
name: string;
|
|
229
|
-
detailed?:
|
|
237
|
+
detailed?: GirBoolean;
|
|
230
238
|
when?: "first" | "last" | "cleanup";
|
|
231
|
-
action?:
|
|
232
|
-
"no-hooks"?:
|
|
233
|
-
"no-recurse"?:
|
|
239
|
+
action?: GirBoolean;
|
|
240
|
+
"no-hooks"?: GirBoolean;
|
|
241
|
+
"no-recurse"?: GirBoolean;
|
|
234
242
|
};
|
|
235
|
-
parameters?: [
|
|
236
|
-
"return-value"?:
|
|
243
|
+
parameters?: [GirCallableParams];
|
|
244
|
+
"return-value"?: GirCallableReturn[];
|
|
237
245
|
}
|
|
238
|
-
export interface
|
|
239
|
-
$:
|
|
246
|
+
export interface GirFieldElement extends GirInfoElements, GirAnyType {
|
|
247
|
+
$: GirInfoAttrs & {
|
|
240
248
|
name: string;
|
|
241
|
-
writable?:
|
|
242
|
-
readable?:
|
|
243
|
-
private?:
|
|
244
|
-
bits?:
|
|
249
|
+
writable?: GirBoolean;
|
|
250
|
+
readable?: GirBoolean;
|
|
251
|
+
private?: GirBoolean;
|
|
252
|
+
bits?: GirUnparsedNumber;
|
|
245
253
|
};
|
|
246
|
-
callback?:
|
|
254
|
+
callback?: GirCallbackElement[];
|
|
247
255
|
}
|
|
248
|
-
export interface
|
|
249
|
-
$:
|
|
256
|
+
export interface GirCallbackElement extends GirInfoElements {
|
|
257
|
+
$: GirInfoAttrs & {
|
|
250
258
|
name: string;
|
|
251
259
|
"c:type"?: string;
|
|
252
|
-
throws?:
|
|
260
|
+
throws?: GirBoolean;
|
|
261
|
+
"glib:type-name"?: string;
|
|
253
262
|
};
|
|
254
|
-
parameters?: [
|
|
255
|
-
"return-value"?:
|
|
263
|
+
parameters?: [GirCallableParams];
|
|
264
|
+
"return-value"?: GirCallableReturn[];
|
|
256
265
|
}
|
|
257
|
-
export interface
|
|
258
|
-
$:
|
|
266
|
+
export interface GirImplements {
|
|
267
|
+
$: GirInfoAttrs & {
|
|
259
268
|
name: string;
|
|
260
269
|
};
|
|
261
270
|
}
|
|
262
|
-
export interface
|
|
263
|
-
$:
|
|
264
|
-
name
|
|
271
|
+
export interface GirPrerequisite {
|
|
272
|
+
$: {
|
|
273
|
+
name?: string;
|
|
265
274
|
};
|
|
266
275
|
}
|
|
267
|
-
export interface
|
|
268
|
-
type?:
|
|
269
|
-
array?:
|
|
276
|
+
export interface GirAnyType {
|
|
277
|
+
type?: GirType[];
|
|
278
|
+
array?: GirArrayType[];
|
|
270
279
|
}
|
|
271
|
-
export interface
|
|
272
|
-
$:
|
|
280
|
+
export interface GirType extends GirDocElement {
|
|
281
|
+
$: GirInfoAttrs & {
|
|
273
282
|
name?: string;
|
|
274
283
|
"c:type"?: string;
|
|
275
|
-
introspectable?:
|
|
284
|
+
introspectable?: GirBoolean;
|
|
276
285
|
};
|
|
277
|
-
array?:
|
|
278
|
-
type:
|
|
286
|
+
array?: GirArrayType[];
|
|
287
|
+
type: GirType[];
|
|
279
288
|
}
|
|
280
|
-
export interface
|
|
281
|
-
$:
|
|
289
|
+
export interface GirArrayType {
|
|
290
|
+
$: GirInfoAttrs & {
|
|
282
291
|
name?: string;
|
|
283
|
-
"zero-terminated"?:
|
|
284
|
-
"fixed-size"?:
|
|
285
|
-
introspectable?:
|
|
286
|
-
length?:
|
|
292
|
+
"zero-terminated"?: GirBoolean;
|
|
293
|
+
"fixed-size"?: GirUnparsedNumber;
|
|
294
|
+
introspectable?: GirBoolean;
|
|
295
|
+
length?: GirUnparsedNumber;
|
|
287
296
|
"c:type"?: string;
|
|
288
297
|
};
|
|
289
|
-
array?:
|
|
290
|
-
type?:
|
|
298
|
+
array?: GirArrayType[];
|
|
299
|
+
type?: GirType[];
|
|
291
300
|
}
|
|
292
|
-
export declare enum
|
|
301
|
+
export declare enum GirTransferOwnershipType {
|
|
293
302
|
Container = "container",
|
|
294
303
|
Full = "full",
|
|
295
304
|
None = "none"
|
|
296
305
|
}
|
|
297
|
-
export interface
|
|
298
|
-
"transfer-ownership":
|
|
306
|
+
export interface GirTransferOwnership {
|
|
307
|
+
"transfer-ownership": GirTransferOwnershipType;
|
|
299
308
|
}
|
|
300
|
-
export interface
|
|
301
|
-
$:
|
|
302
|
-
parameters?: [
|
|
303
|
-
"return-value"?:
|
|
309
|
+
export interface GirConstructorElement {
|
|
310
|
+
$: GirInfoAttrs & GirCallableAttrs;
|
|
311
|
+
parameters?: [GirCallableParams];
|
|
312
|
+
"return-value"?: GirCallableReturn[];
|
|
304
313
|
}
|
|
305
|
-
export interface
|
|
314
|
+
export interface GirCallableAttrs {
|
|
306
315
|
name: string;
|
|
307
316
|
"c:identifier"?: string;
|
|
308
317
|
"shadowed-by"?: string;
|
|
309
318
|
shadows?: string;
|
|
310
|
-
throws?:
|
|
319
|
+
throws?: GirBoolean;
|
|
311
320
|
"moved-to"?: string[];
|
|
312
321
|
}
|
|
313
|
-
export interface
|
|
314
|
-
$:
|
|
322
|
+
export interface GirVarArgs {
|
|
323
|
+
$: GirInfoAttrs;
|
|
315
324
|
}
|
|
316
|
-
export interface
|
|
317
|
-
$:
|
|
325
|
+
export interface GirCallableParamElement extends GirDocElement, GirAnyType {
|
|
326
|
+
$: GirInfoAttrs & Partial<GirTransferOwnership> & {
|
|
318
327
|
name?: string;
|
|
319
|
-
nullable?:
|
|
320
|
-
"
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
328
|
+
nullable?: GirBoolean;
|
|
329
|
+
"null-ok"?: GirBoolean;
|
|
330
|
+
"allow-none"?: GirBoolean;
|
|
331
|
+
introspectable?: GirBoolean;
|
|
332
|
+
closure?: GirUnparsedNumber;
|
|
333
|
+
destroy?: GirUnparsedNumber;
|
|
324
334
|
scope?: "notified" | "async" | "call";
|
|
325
|
-
direction?:
|
|
326
|
-
"caller-allocates"?:
|
|
327
|
-
optional?:
|
|
328
|
-
skip?:
|
|
335
|
+
direction?: GirDirection;
|
|
336
|
+
"caller-allocates"?: GirBoolean;
|
|
337
|
+
optional?: GirBoolean;
|
|
338
|
+
skip?: GirBoolean;
|
|
329
339
|
};
|
|
330
|
-
varargs?:
|
|
331
|
-
}
|
|
332
|
-
export interface
|
|
333
|
-
parameter:
|
|
334
|
-
"instance-parameter"?:
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
340
|
+
varargs?: GirVarArgs[];
|
|
341
|
+
}
|
|
342
|
+
export interface GirCallableParams {
|
|
343
|
+
parameter: GirCallableParamElement[];
|
|
344
|
+
"instance-parameter"?: GirInstanceParameter[];
|
|
345
|
+
}
|
|
346
|
+
export interface GirInstanceParameter extends GirAnyType {
|
|
347
|
+
$: Partial<{
|
|
348
|
+
name: string;
|
|
349
|
+
nullable?: GirBoolean;
|
|
350
|
+
"allow-none"?: GirBoolean;
|
|
351
|
+
"null-ok"?: GirBoolean;
|
|
352
|
+
direction?: GirDirection;
|
|
353
|
+
"caller-allocates"?: GirBoolean;
|
|
354
|
+
}> & Partial<GirTransferOwnership>;
|
|
355
|
+
type?: GirType[];
|
|
356
|
+
}
|
|
357
|
+
export interface GirCallableReturn extends GirAnyType, GirDocElement {
|
|
345
358
|
$: {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
359
|
+
name?: string;
|
|
360
|
+
introspectable?: GirBoolean;
|
|
361
|
+
nullable?: GirBoolean;
|
|
362
|
+
closure?: GirUnparsedNumber;
|
|
349
363
|
scope?: "notified" | "async" | "call";
|
|
350
|
-
destroy?:
|
|
351
|
-
skip?:
|
|
352
|
-
"allow-none"?:
|
|
353
|
-
} & Partial<
|
|
354
|
-
}
|
|
355
|
-
export interface
|
|
356
|
-
$:
|
|
357
|
-
parameters?: [
|
|
358
|
-
"return-value"?:
|
|
359
|
-
}
|
|
360
|
-
export interface
|
|
361
|
-
$:
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
destroy?: GirUnparsedNumber;
|
|
365
|
+
skip?: GirBoolean;
|
|
366
|
+
"allow-none"?: GirBoolean;
|
|
367
|
+
} & Partial<GirTransferOwnership>;
|
|
368
|
+
}
|
|
369
|
+
export interface GirFunctionElement extends GirDocElement {
|
|
370
|
+
$: GirInfoAttrs & GirCallableAttrs;
|
|
371
|
+
parameters?: [GirCallableParams];
|
|
372
|
+
"return-value"?: GirCallableReturn[];
|
|
373
|
+
}
|
|
374
|
+
export interface GirMethodElement extends GirDocElement {
|
|
375
|
+
$: GirInfoAttrs & GirCallableAttrs & {
|
|
376
|
+
"glib:set-property": string;
|
|
377
|
+
"glib:get-property": string;
|
|
378
|
+
};
|
|
379
|
+
parameters?: [GirCallableParams];
|
|
380
|
+
"return-value"?: GirCallableReturn[];
|
|
381
|
+
}
|
|
382
|
+
export interface GirVirtualMethodElement extends GirDocElement {
|
|
383
|
+
$: GirInfoAttrs & GirCallableAttrs & {
|
|
367
384
|
invoker?: string;
|
|
368
385
|
};
|
|
369
|
-
parameters?: [
|
|
370
|
-
"return-value"?:
|
|
386
|
+
parameters?: [GirCallableParams];
|
|
387
|
+
"return-value"?: GirCallableReturn[];
|
|
371
388
|
}
|
|
372
|
-
export interface
|
|
373
|
-
$:
|
|
389
|
+
export interface GirUnionElement extends GirInfoElements {
|
|
390
|
+
$: GirInfoAttrs & {
|
|
374
391
|
name?: string;
|
|
375
392
|
"c:type"?: string;
|
|
376
393
|
"c:symbol-prefix"?: string;
|
|
377
394
|
"glib:type-name"?: string;
|
|
378
395
|
"glib:get-type"?: string;
|
|
379
396
|
};
|
|
380
|
-
field?:
|
|
381
|
-
|
|
382
|
-
method?:
|
|
383
|
-
function?:
|
|
384
|
-
record?:
|
|
385
|
-
}
|
|
386
|
-
export interface
|
|
387
|
-
$:
|
|
397
|
+
field?: GirFieldElement[];
|
|
398
|
+
constructor?: GirConstructorElement[];
|
|
399
|
+
method?: GirMethodElement[];
|
|
400
|
+
function?: GirFunctionElement[];
|
|
401
|
+
record?: GirRecordElement[];
|
|
402
|
+
}
|
|
403
|
+
export interface GirBitfieldElement extends GirInfoElements {
|
|
404
|
+
$: GirInfoAttrs & {
|
|
388
405
|
name: string;
|
|
389
406
|
"c:type": string;
|
|
390
407
|
"glib:type-name"?: string;
|
|
391
408
|
"glib:get-type"?: string;
|
|
392
409
|
};
|
|
393
|
-
member:
|
|
394
|
-
function:
|
|
410
|
+
member: GirMemberElement[];
|
|
411
|
+
function: GirFunctionElement[];
|
|
395
412
|
}
|
|
396
|
-
export interface
|
|
397
|
-
$:
|
|
413
|
+
export interface GirEnumElement extends GirInfoElements {
|
|
414
|
+
$: GirInfoAttrs & {
|
|
398
415
|
name: string;
|
|
399
416
|
"c:type": string;
|
|
400
417
|
"glib:type-name"?: string;
|
|
401
418
|
"glib:get-type"?: string;
|
|
402
419
|
"glib:error-domain"?: string;
|
|
403
420
|
};
|
|
404
|
-
member?:
|
|
405
|
-
function?:
|
|
421
|
+
member?: GirMemberElement[];
|
|
422
|
+
function?: GirFunctionElement[];
|
|
423
|
+
}
|
|
424
|
+
export interface GirFieldElement extends GirInfoElements, GirAnyType {
|
|
425
|
+
$: GirInfoAttrs & {
|
|
426
|
+
name: string;
|
|
427
|
+
writable?: GirBoolean;
|
|
428
|
+
readable?: GirBoolean;
|
|
429
|
+
private?: GirBoolean;
|
|
430
|
+
bits?: GirUnparsedNumber;
|
|
431
|
+
};
|
|
432
|
+
callback?: GirCallbackElement[];
|
|
406
433
|
}
|
|
407
|
-
export interface
|
|
408
|
-
$:
|
|
434
|
+
export interface GirMemberElement extends GirInfoElements {
|
|
435
|
+
$: GirInfoAttrs & {
|
|
409
436
|
name: string;
|
|
410
437
|
value: string;
|
|
411
438
|
"c:identifier": string;
|
|
412
439
|
"glib:nick"?: string;
|
|
440
|
+
"glib:name"?: string;
|
|
413
441
|
};
|
|
414
442
|
}
|
|
415
|
-
export {};
|
package/dist/xml.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export var
|
|
2
|
-
(function (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
export var GirDirection;
|
|
2
|
+
(function (GirDirection) {
|
|
3
|
+
GirDirection["In"] = "in";
|
|
4
|
+
GirDirection["Inout"] = "inout";
|
|
5
|
+
GirDirection["Out"] = "out";
|
|
6
|
+
GirDirection["InOut"] = "in-out";
|
|
7
|
+
})(GirDirection || (GirDirection = {}));
|
|
8
|
+
export var GirTransferOwnershipType;
|
|
9
|
+
(function (GirTransferOwnershipType) {
|
|
10
|
+
GirTransferOwnershipType["Container"] = "container";
|
|
11
|
+
GirTransferOwnershipType["Full"] = "full";
|
|
12
|
+
GirTransferOwnershipType["None"] = "none";
|
|
13
|
+
})(GirTransferOwnershipType || (GirTransferOwnershipType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gi.ts/parser",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/lib.js",
|
|
6
6
|
"types": "dist/lib.d.ts",
|
|
@@ -28,11 +28,15 @@
|
|
|
28
28
|
"prepack": "rm -rf dist && yarn build"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"fast-xml-parser": "^3.
|
|
31
|
+
"fast-xml-parser": "^4.3.5"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"typescript": "
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
35
|
+
"@typescript-eslint/parser": "^7.2.0",
|
|
36
|
+
"eslint": "^8.57.0",
|
|
37
|
+
"eslint-config-prettier": "^9.1.0",
|
|
38
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
39
|
+
"prettier": "^3.2.5",
|
|
40
|
+
"typescript": "^5.4.2"
|
|
41
|
+
}
|
|
42
|
+
}
|