@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 CHANGED
@@ -1,15 +1,66 @@
1
- import { parse } from "fast-xml-parser";
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 Direction {
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: Repository[];
8
+ repository: GirRepository[];
8
9
  }
9
- declare type UnparsedNumber = string;
10
- declare type BinaryOption = "0" | "1";
11
- export interface Repository {
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: Include[];
18
- "c:include": CInclude[];
19
- package: Package[];
20
- namespace: Namespace[];
18
+ include?: GirInclude[];
19
+ "c:include": GirCInclude[];
20
+ package: GirPackage[];
21
+ namespace?: GirNamespace[];
21
22
  }
22
- export interface Namespace {
23
- $: InfoAttrs & {
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?: AliasElement[];
32
- class?: ClassElement[];
33
- interface?: InterfaceElement[];
34
- record?: RecordElement[];
35
- enumeration?: EnumElement[];
36
- function?: FunctionElement[];
37
- union?: UnionElement[];
38
- bitfield?: BitfieldElement[];
39
- callback?: CallbackElement[];
40
- constant?: ConstantElement[];
41
- annotation?: Annotation[];
42
- ["glib:boxed"]?: BoxedElement[];
43
- }
44
- export interface Annotation {
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 CInclude {
51
+ export interface GirCInclude {
51
52
  $: {
52
53
  name: string;
53
54
  };
54
55
  }
55
- export interface Include {
56
+ export interface GirInclude {
56
57
  $: {
57
58
  name: string;
58
59
  version?: string;
59
60
  };
60
61
  }
61
- export interface Package {
62
+ export interface GirPackage {
62
63
  $: {
63
64
  name: string;
64
65
  };
65
66
  }
66
- export interface AliasElement extends InfoElements {
67
- $: InfoAttrs & {
67
+ export interface GirAliasElement extends GirInfoElements {
68
+ $: GirInfoAttrs & {
68
69
  name: string;
69
- "c:type": string;
70
+ "c:type"?: string;
70
71
  };
71
- type: Type[];
72
+ type?: GirType[];
72
73
  }
73
- export interface InterfaceElement extends InfoElements {
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?: Prerequisite[];
83
- implements?: Implements[];
84
- function?: FunctionElement[];
85
- constructors?: ConstructorElement[];
86
- method?: MethodElement[];
87
- "virtual-method"?: VirtualMethodElement[];
88
- field?: FieldElement[];
89
- property?: PropertyElement[];
90
- signal?: SignalElement[];
91
- callback?: CallbackElement[];
92
- constant?: ConstantElement[];
93
- }
94
- export interface ClassElement extends InfoElements {
95
- $: InfoAttrs & {
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?: BinaryOption | BinaryOption;
108
- "glib:fundamental"?: BinaryOption | BinaryOption;
109
+ abstract?: GirBoolean;
110
+ "glib:fundamental"?: GirBoolean;
111
+ final: GirBoolean;
109
112
  };
110
- implements?: Implements[];
111
- "constructor"?: ConstructorElement[];
112
- method?: MethodElement[];
113
- function?: FunctionElement[];
114
- "virtual-method"?: VirtualMethodElement[];
115
- field?: FieldElement[];
116
- property?: PropertyElement[];
117
- signal?: SignalElement[];
118
- union?: UnionElement[];
119
- constant?: ConstantElement[];
120
- record?: RecordElement[];
121
- callback?: CallbackElement[];
122
- }
123
- export interface BoxedElement {
124
- $: InfoAttrs & {
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?: FunctionElement[];
134
+ function?: GirFunctionElement[];
131
135
  }
132
- export interface RecordElement extends InfoElements {
133
- $: InfoAttrs & {
136
+ export interface GirRecordElement extends GirInfoElements {
137
+ $: GirInfoAttrs & {
134
138
  name: string;
135
139
  "c:type"?: string;
136
- disguised?: BinaryOption | BinaryOption;
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?: BinaryOption | BinaryOption;
146
+ foreign?: GirBoolean;
141
147
  "glib:is-gtype-struct-for"?: string;
142
148
  };
143
- field?: FieldElement[];
144
- function?: FunctionElement[];
145
- union?: UnionElement[];
146
- method?: MethodElement[];
147
- "constructor"?: ConstructorElement[];
148
- property?: PropertyElement[];
149
- }
150
- export interface InfoAttrs {
151
- introspectable?: BinaryOption | BinaryOption;
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 DocElement {
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 InfoElements extends DocElement {
206
- annotation: Annotation[];
211
+ export interface GirInfoElements extends GirDocElement {
212
+ annotation: GirAnnotation[];
207
213
  }
208
- export interface ConstantElement extends InfoElements, AnyType {
209
- $: InfoAttrs & {
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 PropertyElement extends InfoElements, AnyType {
217
- $: InfoAttrs & {
222
+ export interface GirPropertyElement extends GirInfoElements, GirAnyType {
223
+ $: GirInfoAttrs & {
218
224
  name: string;
219
- writable?: BinaryOption | BinaryOption;
220
- readable?: BinaryOption | BinaryOption;
221
- construct?: BinaryOption | BinaryOption;
222
- "construct-only"?: BinaryOption | BinaryOption;
223
- TransferOwnership?: any;
224
- };
225
- }
226
- export interface SignalElement extends InfoElements {
227
- $: InfoAttrs & {
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?: BinaryOption | BinaryOption;
237
+ detailed?: GirBoolean;
230
238
  when?: "first" | "last" | "cleanup";
231
- action?: BinaryOption | BinaryOption;
232
- "no-hooks"?: BinaryOption | BinaryOption;
233
- "no-recurse"?: BinaryOption | BinaryOption;
239
+ action?: GirBoolean;
240
+ "no-hooks"?: GirBoolean;
241
+ "no-recurse"?: GirBoolean;
234
242
  };
235
- parameters?: [CallableParams];
236
- "return-value"?: CallableReturn[];
243
+ parameters?: [GirCallableParams];
244
+ "return-value"?: GirCallableReturn[];
237
245
  }
238
- export interface FieldElement extends InfoElements, AnyType {
239
- $: InfoAttrs & {
246
+ export interface GirFieldElement extends GirInfoElements, GirAnyType {
247
+ $: GirInfoAttrs & {
240
248
  name: string;
241
- writable?: BinaryOption | BinaryOption;
242
- readable?: BinaryOption | BinaryOption;
243
- private?: BinaryOption | BinaryOption;
244
- bits?: UnparsedNumber;
249
+ writable?: GirBoolean;
250
+ readable?: GirBoolean;
251
+ private?: GirBoolean;
252
+ bits?: GirUnparsedNumber;
245
253
  };
246
- callback?: CallbackElement[];
254
+ callback?: GirCallbackElement[];
247
255
  }
248
- export interface CallbackElement extends InfoElements {
249
- $: InfoAttrs & {
256
+ export interface GirCallbackElement extends GirInfoElements {
257
+ $: GirInfoAttrs & {
250
258
  name: string;
251
259
  "c:type"?: string;
252
- throws?: BinaryOption | BinaryOption;
260
+ throws?: GirBoolean;
261
+ "glib:type-name"?: string;
253
262
  };
254
- parameters?: [CallableParams];
255
- "return-value"?: CallableReturn[];
263
+ parameters?: [GirCallableParams];
264
+ "return-value"?: GirCallableReturn[];
256
265
  }
257
- export interface Implements {
258
- $: InfoAttrs & {
266
+ export interface GirImplements {
267
+ $: GirInfoAttrs & {
259
268
  name: string;
260
269
  };
261
270
  }
262
- export interface Prerequisite {
263
- $: InfoAttrs & {
264
- name: string;
271
+ export interface GirPrerequisite {
272
+ $: {
273
+ name?: string;
265
274
  };
266
275
  }
267
- export interface AnyType {
268
- type?: Type[];
269
- array?: ArrayType[];
276
+ export interface GirAnyType {
277
+ type?: GirType[];
278
+ array?: GirArrayType[];
270
279
  }
271
- export interface Type extends DocElement {
272
- $: InfoAttrs & {
280
+ export interface GirType extends GirDocElement {
281
+ $: GirInfoAttrs & {
273
282
  name?: string;
274
283
  "c:type"?: string;
275
- introspectable?: BinaryOption | BinaryOption;
284
+ introspectable?: GirBoolean;
276
285
  };
277
- array?: ArrayType[];
278
- type: Type[];
286
+ array?: GirArrayType[];
287
+ type: GirType[];
279
288
  }
280
- export interface ArrayType {
281
- $: InfoAttrs & {
289
+ export interface GirArrayType {
290
+ $: GirInfoAttrs & {
282
291
  name?: string;
283
- "zero-terminated"?: BinaryOption | BinaryOption;
284
- "fixed-size"?: UnparsedNumber;
285
- introspectable?: BinaryOption | BinaryOption;
286
- length?: UnparsedNumber;
292
+ "zero-terminated"?: GirBoolean;
293
+ "fixed-size"?: GirUnparsedNumber;
294
+ introspectable?: GirBoolean;
295
+ length?: GirUnparsedNumber;
287
296
  "c:type"?: string;
288
297
  };
289
- array?: ArrayType[];
290
- type?: Type[];
298
+ array?: GirArrayType[];
299
+ type?: GirType[];
291
300
  }
292
- export declare enum TransferOwnershipType {
301
+ export declare enum GirTransferOwnershipType {
293
302
  Container = "container",
294
303
  Full = "full",
295
304
  None = "none"
296
305
  }
297
- export interface TransferOwnership {
298
- "transfer-ownership": TransferOwnershipType;
306
+ export interface GirTransferOwnership {
307
+ "transfer-ownership": GirTransferOwnershipType;
299
308
  }
300
- export interface ConstructorElement {
301
- $: InfoAttrs & CallableAttrs;
302
- parameters?: [CallableParams];
303
- "return-value"?: CallableReturn[];
309
+ export interface GirConstructorElement {
310
+ $: GirInfoAttrs & GirCallableAttrs;
311
+ parameters?: [GirCallableParams];
312
+ "return-value"?: GirCallableReturn[];
304
313
  }
305
- export interface CallableAttrs {
314
+ export interface GirCallableAttrs {
306
315
  name: string;
307
316
  "c:identifier"?: string;
308
317
  "shadowed-by"?: string;
309
318
  shadows?: string;
310
- throws?: BinaryOption | BinaryOption;
319
+ throws?: GirBoolean;
311
320
  "moved-to"?: string[];
312
321
  }
313
- export interface VarArgs {
314
- $: InfoAttrs;
322
+ export interface GirVarArgs {
323
+ $: GirInfoAttrs;
315
324
  }
316
- export interface CallableParamElement extends DocElement, AnyType {
317
- $: InfoAttrs & Partial<TransferOwnership> & {
325
+ export interface GirCallableParamElement extends GirDocElement, GirAnyType {
326
+ $: GirInfoAttrs & Partial<GirTransferOwnership> & {
318
327
  name?: string;
319
- nullable?: BinaryOption | BinaryOption;
320
- "allow-none"?: BinaryOption | BinaryOption;
321
- introspectable?: BinaryOption | BinaryOption;
322
- closure?: UnparsedNumber;
323
- destroy?: UnparsedNumber;
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?: Direction;
326
- "caller-allocates"?: BinaryOption | BinaryOption;
327
- optional?: BinaryOption | BinaryOption;
328
- skip?: BinaryOption | BinaryOption;
335
+ direction?: GirDirection;
336
+ "caller-allocates"?: GirBoolean;
337
+ optional?: GirBoolean;
338
+ skip?: GirBoolean;
329
339
  };
330
- varargs?: VarArgs[];
331
- }
332
- export interface CallableParams {
333
- parameter: CallableParamElement[];
334
- "instance-parameter"?: AnyType & {
335
- $: Partial<{
336
- name: string;
337
- nullable?: BinaryOption | BinaryOption;
338
- "allow-none"?: BinaryOption | BinaryOption;
339
- direction?: Direction;
340
- "caller-allocates"?: BinaryOption | BinaryOption;
341
- }> & Partial<TransferOwnership>;
342
- }[];
343
- }
344
- export interface CallableReturn extends AnyType, DocElement {
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
- introspectable?: BinaryOption | BinaryOption;
347
- nullable?: BinaryOption | BinaryOption;
348
- closure?: UnparsedNumber;
359
+ name?: string;
360
+ introspectable?: GirBoolean;
361
+ nullable?: GirBoolean;
362
+ closure?: GirUnparsedNumber;
349
363
  scope?: "notified" | "async" | "call";
350
- destroy?: UnparsedNumber;
351
- skip?: BinaryOption | BinaryOption;
352
- "allow-none"?: BinaryOption | BinaryOption;
353
- } & Partial<TransferOwnership>;
354
- }
355
- export interface FunctionElement extends DocElement {
356
- $: InfoAttrs & CallableAttrs;
357
- parameters?: [CallableParams];
358
- "return-value"?: CallableReturn[];
359
- }
360
- export interface MethodElement extends DocElement {
361
- $: InfoAttrs & CallableAttrs;
362
- parameters?: [CallableParams];
363
- "return-value"?: CallableReturn[];
364
- }
365
- export interface VirtualMethodElement extends DocElement {
366
- $: InfoAttrs & CallableAttrs & {
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?: [CallableParams];
370
- "return-value"?: CallableReturn[];
386
+ parameters?: [GirCallableParams];
387
+ "return-value"?: GirCallableReturn[];
371
388
  }
372
- export interface UnionElement extends InfoElements {
373
- $: InfoAttrs & {
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?: FieldElement[];
381
- "constructor"?: ConstructorElement[];
382
- method?: MethodElement[];
383
- function?: FunctionElement[];
384
- record?: RecordElement[];
385
- }
386
- export interface BitfieldElement extends InfoElements {
387
- $: InfoAttrs & {
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: MemberElement[];
394
- function: FunctionElement[];
410
+ member: GirMemberElement[];
411
+ function: GirFunctionElement[];
395
412
  }
396
- export interface EnumElement extends InfoElements {
397
- $: InfoAttrs & {
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?: MemberElement[];
405
- function?: FunctionElement[];
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 MemberElement extends InfoElements {
408
- $: InfoAttrs & {
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 Direction;
2
- (function (Direction) {
3
- Direction["In"] = "in";
4
- Direction["Inout"] = "inout";
5
- Direction["Out"] = "out";
6
- })(Direction || (Direction = {}));
7
- export var TransferOwnershipType;
8
- (function (TransferOwnershipType) {
9
- TransferOwnershipType["Container"] = "container";
10
- TransferOwnershipType["Full"] = "full";
11
- TransferOwnershipType["None"] = "none";
12
- })(TransferOwnershipType || (TransferOwnershipType = {}));
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-alpha.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.17.5"
31
+ "fast-xml-parser": "^4.3.5"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/xml2js": "^0.4.4",
35
- "typescript": "5.1.3"
36
- },
37
- "gitHead": "18a5d3b74bec68a3530016e2c1dd69d7f235a1e0"
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
+ }