@gi.ts/parser 1.4.0 → 1.5.10

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/lib.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/parser.js CHANGED
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseGir = void 0;
4
4
  const fast_xml_parser_1 = require("fast-xml-parser");
5
5
  function parseGir(contents) {
6
- return fast_xml_parser_1.parse(contents, {
6
+ return (0, fast_xml_parser_1.parse)(contents, {
7
7
  attributeNamePrefix: "",
8
8
  attrNodeName: "$",
9
+ textNodeName: "_",
9
10
  ignoreAttributes: false,
10
11
  ignoreNameSpace: false,
11
12
  allowBooleanAttributes: true,
package/dist/xml.d.ts CHANGED
@@ -1,494 +1,415 @@
1
- declare type Version = string;
2
- declare type ParameterContainer<T> = [
3
- {
4
- parameter?: T[];
5
- }
6
- ];
7
- export declare type binary = "0" | "1";
8
- export declare type Element<T> = {
9
- $: T & {
10
- introspectable?: binary;
11
- };
12
- };
1
+ export declare enum Direction {
2
+ In = "in",
3
+ Inout = "inout",
4
+ Out = "out"
5
+ }
13
6
  export interface GirXML {
14
7
  repository: Repository[];
15
8
  }
16
- export interface SourcePositionElement extends Element<SourcePosition> {
17
- }
18
- export interface CIncludeElement extends Element<CInclude> {
9
+ declare type UnparsedNumber = string;
10
+ declare type BinaryOption = "0" | "1";
11
+ export interface Repository {
12
+ $: {
13
+ version?: string;
14
+ "c:identifier-prefixes"?: string;
15
+ "c:symbol-prefixes"?: string;
16
+ };
17
+ include: Include[];
18
+ "c:include": CInclude[];
19
+ package: Package[];
20
+ namespace: Namespace[];
19
21
  }
20
- export interface Repository extends Element<RepositoryMeta> {
21
- include: Element<Include>[];
22
- package: CIncludeElement[];
23
- "c:include": CIncludeElement[];
24
- namespace: NamespaceElement[];
22
+ export interface Namespace {
23
+ $: InfoAttrs & {
24
+ name: string;
25
+ version: string;
26
+ "c:identifier-prefixes"?: string;
27
+ "c:symbol-prefixes"?: string;
28
+ "c:prefix"?: string;
29
+ "shared-library"?: string;
30
+ };
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 {
45
+ $: {
46
+ name: string;
47
+ value: string[];
48
+ };
25
49
  }
26
50
  export interface CInclude {
27
- name: string;
28
- }
29
- export interface RepositoryMeta {
30
- version: string;
31
- xmlns: string;
32
- "xmlns:c": string;
33
- "xmlns:glib": string;
51
+ $: {
52
+ name: string;
53
+ };
34
54
  }
35
55
  export interface Include {
36
- name: string;
37
- version: string;
38
- }
39
- export interface NamespaceElement extends Element<Namespace> {
40
- alias: AliasElement[];
41
- class: ClassElement[];
42
- record: RecordElement[];
43
- union: RecordElement[];
44
- bitfield: BitfieldElement[];
45
- callback: Callback[];
46
- interface: InterfaceElement[];
47
- enumeration: Enumeration[];
48
- constant: ConstantElement[];
49
- function: Function[];
50
- ["glib:boxed"]: GLibBoxedElement[];
51
- }
52
- export interface GLibBoxedElement extends Element<GLibBoxed> {
53
- }
54
- export interface GLibBoxed {
55
- "glib:name": string;
56
- "c:symbol-prefix"?: string;
57
- "glib:type-name"?: string;
58
- "glib:get-type"?: string;
59
- }
60
- export interface Namespace {
61
- name: string;
62
- version: Version;
63
- "shared-library": string;
64
- "c:identifier-prefixes": string;
65
- "c:symbol-prefixes": string;
66
- }
67
- export interface AliasElement extends Element<Alias> {
68
- doc?: DocElement[];
69
- "source-position": SourcePositionElement[];
70
- type: AliasType[];
71
- }
72
- export interface Alias {
73
- name?: string;
74
- "c:type"?: string;
75
- }
76
- export interface DocElement extends Element<Doc> {
77
- _: string;
78
- }
79
- export interface Doc {
80
- "xml:space": XMLSpace;
81
- filename: string;
82
- line: string;
83
- }
84
- export declare enum XMLSpace {
85
- Preserve = "preserve"
86
- }
87
- export interface SourcePosition {
88
- filename: string;
89
- line: string;
90
- }
91
- export interface AliasType extends Element<Alias> {
56
+ $: {
57
+ name: string;
58
+ version?: string;
59
+ };
92
60
  }
93
- export interface BitfieldElement extends Element<Bitfield> {
94
- doc?: DocElement[];
95
- member: MemberElement[];
61
+ export interface Package {
62
+ $: {
63
+ name: string;
64
+ };
96
65
  }
97
- export interface Bitfield {
98
- name: string;
99
- "glib:type-name": string;
100
- "glib:get-type": string;
101
- "c:type": string;
102
- version?: Version;
66
+ export interface AliasElement extends InfoElements {
67
+ $: InfoAttrs & {
68
+ name: string;
69
+ "c:type": string;
70
+ };
71
+ type: Type[];
72
+ }
73
+ export interface InterfaceElement extends InfoElements {
74
+ $: {
75
+ name: string;
76
+ "glib:type-name": string;
77
+ "glib:get-type": string;
78
+ "c:symbol-prefix"?: string;
79
+ "c:type"?: string;
80
+ "glib:type-struct"?: string;
81
+ };
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 & {
96
+ name: string;
97
+ "glib:type-name": string;
98
+ "glib:get-type": string;
99
+ parent?: string;
100
+ "glib:type-struct"?: string;
101
+ "glib:ref-func"?: string;
102
+ "glib:unref-func"?: string;
103
+ "glib:set-value-func"?: string;
104
+ "glib:get-value-func"?: string;
105
+ "c:type"?: string;
106
+ "c:symbol-prefix"?: string;
107
+ abstract?: BinaryOption | BinaryOption;
108
+ "glib:fundamental"?: BinaryOption | BinaryOption;
109
+ };
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 & {
125
+ "glib:name": string;
126
+ "c:symbol-prefix"?: string;
127
+ "glib:type-name"?: string;
128
+ "glib:get-type"?: string;
129
+ };
130
+ function?: FunctionElement[];
131
+ }
132
+ export interface RecordElement extends InfoElements {
133
+ $: InfoAttrs & {
134
+ name: string;
135
+ "c:type"?: string;
136
+ disguised?: BinaryOption | BinaryOption;
137
+ "glib:type-name"?: string;
138
+ "glib:get-type"?: string;
139
+ "c:symbol-prefix"?: string;
140
+ foreign?: BinaryOption | BinaryOption;
141
+ "glib:is-gtype-struct-for"?: string;
142
+ };
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;
103
152
  deprecated?: string;
104
- "deprecated-version"?: Version;
105
- "glib:error-domain"?: string;
153
+ "deprecated-version"?: string;
154
+ version?: string;
155
+ stability?: string[];
156
+ }
157
+ export interface DocElement {
158
+ "doc-version"?: [
159
+ {
160
+ $: {
161
+ "xml:space"?: "preserve";
162
+ "xml:whitespace"?: "preserve";
163
+ };
164
+ _: string;
165
+ }
166
+ ];
167
+ "doc-stability"?: [
168
+ {
169
+ $: {
170
+ "xml:space"?: "preserve";
171
+ "xml:whitespace"?: "preserve";
172
+ };
173
+ _: string;
174
+ }
175
+ ];
176
+ doc: [
177
+ {
178
+ $: {
179
+ "xml:space"?: "preserve";
180
+ "xml:whitespace"?: "preserve";
181
+ filename: string;
182
+ line: string;
183
+ column: string;
184
+ };
185
+ _: string;
186
+ }
187
+ ];
188
+ "doc-deprecated": [
189
+ {
190
+ $: {
191
+ "xml:space"?: "preserve";
192
+ "xml:whitespace"?: "preserve";
193
+ };
194
+ _: string;
195
+ }
196
+ ];
197
+ "source-position": [
198
+ {
199
+ filename: string;
200
+ line: string;
201
+ column: string[];
202
+ }
203
+ ];
204
+ }
205
+ export interface InfoElements extends DocElement {
206
+ annotation: Annotation[];
207
+ }
208
+ export interface ConstantElement extends InfoElements, AnyType {
209
+ $: InfoAttrs & {
210
+ name: string;
211
+ value: string;
212
+ "c:type"?: string;
213
+ "c:identifier"?: string;
214
+ };
106
215
  }
107
- export interface MemberElement extends Element<Member> {
108
- doc?: DocElement[];
216
+ export interface PropertyElement extends InfoElements, AnyType {
217
+ $: InfoAttrs & {
218
+ name: string;
219
+ writable?: BinaryOption | BinaryOption;
220
+ readable?: BinaryOption | BinaryOption;
221
+ construct?: BinaryOption | BinaryOption;
222
+ "construct-only"?: BinaryOption | BinaryOption;
223
+ TransferOwnership?: any;
224
+ };
109
225
  }
110
- export interface Member {
111
- name: string;
112
- value: string;
113
- "c:identifier": string;
114
- "glib:nick": string;
115
- }
116
- export interface Callback extends Element<Constant> {
117
- "source-position": SourcePositionElement[];
118
- "return-value": FunctionReturnValue[];
119
- parameters: ParameterContainer<CallbackParameter>;
120
- doc?: DocElement[];
121
- "doc-deprecated"?: DocDeprecatedElement[];
122
- }
123
- export interface Constant {
124
- name: string;
125
- "c:type": string;
126
- version?: Version;
127
- deprecated?: string;
128
- "deprecated-version"?: Version;
129
- throws?: string;
130
- value?: string;
226
+ export interface SignalElement extends InfoElements {
227
+ $: InfoAttrs & {
228
+ name: string;
229
+ detailed?: BinaryOption | BinaryOption;
230
+ when?: "first" | "last" | "cleanup";
231
+ action?: BinaryOption | BinaryOption;
232
+ "no-hooks"?: BinaryOption | BinaryOption;
233
+ "no-recurse"?: BinaryOption | BinaryOption;
234
+ };
235
+ parameters?: [CallableParams];
236
+ "return-value"?: CallableReturn[];
237
+ }
238
+ export interface FieldElement extends InfoElements, AnyType {
239
+ $: InfoAttrs & {
240
+ name: string;
241
+ writable?: BinaryOption | BinaryOption;
242
+ readable?: BinaryOption | BinaryOption;
243
+ private?: BinaryOption | BinaryOption;
244
+ bits?: UnparsedNumber;
245
+ };
246
+ callback?: CallbackElement[];
131
247
  }
132
- export interface CallbackParameter extends Element<Parameter> {
133
- type?: AliasType[];
134
- doc?: DocElement[];
135
- array?: Arrays[];
248
+ export interface CallbackElement extends InfoElements {
249
+ $: InfoAttrs & {
250
+ name: string;
251
+ "c:type"?: string;
252
+ throws?: BinaryOption | BinaryOption;
253
+ };
254
+ parameters?: [CallableParams];
255
+ "return-value"?: CallableReturn[];
136
256
  }
137
- export interface Parameter {
138
- name: string;
139
- "transfer-ownership": TransferOwnership;
140
- nullable?: string;
141
- "allow-none"?: string;
142
- closure?: string;
143
- direction?: Direction;
144
- "caller-allocates"?: string;
145
- scope?: Scope;
146
- optional?: string;
147
- destroy?: string;
257
+ export interface Implements {
258
+ $: InfoAttrs & {
259
+ name: string;
260
+ };
148
261
  }
149
- export declare enum Direction {
150
- In = "in",
151
- Inout = "inout",
152
- Out = "out"
262
+ export interface Prerequisite {
263
+ $: InfoAttrs & {
264
+ name: string;
265
+ };
153
266
  }
154
- export declare enum Scope {
155
- Async = "async",
156
- Call = "call",
157
- Notified = "notified"
267
+ export interface AnyType {
268
+ type?: Type[];
269
+ array?: ArrayType[];
158
270
  }
159
- export declare enum TransferOwnership {
271
+ export interface Type extends DocElement {
272
+ $: InfoAttrs & {
273
+ name?: string;
274
+ "c:type"?: string;
275
+ introspectable?: BinaryOption | BinaryOption;
276
+ };
277
+ array?: ArrayType[];
278
+ type: Type[];
279
+ }
280
+ export interface ArrayType {
281
+ $: InfoAttrs & {
282
+ name?: string;
283
+ "zero-terminated"?: BinaryOption | BinaryOption;
284
+ "fixed-size"?: UnparsedNumber;
285
+ introspectable?: BinaryOption | BinaryOption;
286
+ length?: UnparsedNumber;
287
+ "c:type"?: string;
288
+ };
289
+ array?: ArrayType[];
290
+ type?: Type[];
291
+ }
292
+ export declare enum TransferOwnershipType {
160
293
  Container = "container",
161
294
  Full = "full",
162
295
  None = "none"
163
296
  }
164
- export interface Arrays extends Element<XmlArray> {
165
- type: AliasType[];
166
- array?: Arrays[];
167
- }
168
- export interface XmlArray {
169
- length?: string;
170
- "zero-terminated"?: string;
171
- "c:type": string;
172
- }
173
- export interface FunctionReturnValueMeta {
174
- "transfer-ownership"?: TransferOwnership;
175
- nullable?: string;
176
- }
177
- export interface InterfaceElement extends Element<Class> {
178
- doc?: DocElement[];
179
- "source-position"?: SourcePositionElement[];
180
- prerequisite?: CIncludeElement[];
181
- "virtual-method"?: VirtualMethod[];
182
- method: Method[];
183
- property?: InterfaceProperty[];
184
- "glib:signal"?: InterfaceGLibSignal[];
185
- function?: Function[];
186
- callback?: Callback[];
187
- }
188
- export interface ClassElement extends Element<Class> {
189
- doc?: DocElement[];
190
- "source-position"?: SourcePositionElement[];
191
- implements?: CIncludeElement[];
192
- "constructor"?: ClassConstructor[];
193
- "virtual-method"?: VirtualMethod[];
194
- method?: Method[];
195
- property?: ClassProperty[];
196
- field?: ClassField[];
197
- "glib:signal"?: ClassGLibSignalElement[];
198
- function?: Function[];
199
- callback?: Callback[];
200
- }
201
- export interface Class {
202
- name: string;
203
- "c:symbol-prefix": string;
204
- "c:type"?: string;
205
- parent?: string;
206
- "glib:type-name": string;
207
- "glib:get-type": string;
208
- "glib:type-struct"?: string;
209
- abstract?: string;
210
- version?: Version;
211
- }
212
- export interface ClassConstructor extends Element<FunctionMeta> {
213
- doc?: DocElement[];
214
- "source-position": SourcePositionElement[];
215
- "return-value": ReturnValue[];
216
- parameters?: ParameterContainer<ClassConstructorParameter>;
217
- "doc-deprecated"?: DocDeprecatedElement[];
218
- }
219
- export interface FunctionMeta {
297
+ export interface TransferOwnership {
298
+ "transfer-ownership": TransferOwnershipType;
299
+ }
300
+ export interface ConstructorElement {
301
+ $: InfoAttrs & CallableAttrs;
302
+ parameters?: [CallableParams];
303
+ "return-value"?: CallableReturn[];
304
+ }
305
+ export interface CallableAttrs {
220
306
  name: string;
221
307
  "c:identifier"?: string;
222
- version?: Version;
223
- deprecated?: string;
224
- "deprecated-version"?: Version;
225
308
  "shadowed-by"?: string;
226
309
  shadows?: string;
227
- throws?: string;
228
- "moved-to"?: string;
229
- invoker?: string;
230
- }
231
- export interface DocDeprecatedElement extends Element<DocDeprecated> {
232
- _: string;
233
- }
234
- export interface DocDeprecated {
235
- "xml:space": XMLSpace;
236
- }
237
- export interface ClassConstructorParameter extends ClassMethodParameter {
238
- doc?: DocElement[];
239
- type?: ParameterType[];
240
- varargs?: string[];
241
- array?: Arrays[];
242
- }
243
- export interface ConstructorMeta {
244
- name: string;
245
- "transfer-ownership": TransferOwnership;
246
- nullable?: string;
247
- "allow-none"?: string;
248
- }
249
- export interface ParameterType extends Element<Alias> {
250
- type?: CIncludeElement[];
251
- }
252
- export interface ClassField extends Element<FieldMeta> {
253
- type?: ClassFieldType[];
254
- doc?: DocElement[];
255
- array?: ClassFieldArray[];
256
- }
257
- export interface ClassFieldArray {
258
- $: ClassFieldArrayMeta;
259
- type: AliasType[];
260
- }
261
- export interface ClassFieldArrayMeta {
262
- "zero-terminated"?: string;
263
- "fixed-size"?: string;
264
- name?: string;
265
- "c:type"?: string;
266
- length?: string;
267
- }
268
- export interface ClassFieldType {
269
- $: Alias;
270
- type?: AliasType[];
271
- }
272
- export interface FunctionReturnValue {
273
- $?: FunctionReturnValueMeta;
274
- doc?: DocElement[];
275
- type?: ParameterType[];
276
- array?: FunctionReturnValueArray[];
277
- }
278
- export interface FunctionReturnValueArray {
279
- $: FunctionReturnValueMeta;
280
- type: AliasType[];
281
- }
282
- export interface FunctionReturnValueMeta {
283
- "c:type": string;
284
- length?: string;
285
- "zero-terminated"?: string;
286
- name?: string;
287
- }
288
- export interface ClassGLibSignalElement extends Element<ClassGLibSignal> {
289
- $: ClassGLibSignal;
290
- doc?: DocElement[];
291
- "return-value": ReturnValue[];
292
- parameters?: MethodParameterContainer[];
293
- "doc-deprecated"?: DocDeprecatedElement[];
294
- }
295
- export interface ClassGLibSignal {
296
- name: string;
297
- when?: When;
298
- version?: Version;
299
- detailed?: string;
300
- "no-recurse"?: string;
301
- deprecated?: string;
302
- "deprecated-version"?: Version;
303
- action?: string;
304
- "no-hooks"?: string;
305
- }
306
- export declare enum When {
307
- Cleanup = "cleanup",
308
- First = "first",
309
- Last = "last"
310
- }
311
- export interface MethodParameterContainer {
312
- "instance-parameter": ClassMethodInstanceParameter[];
313
- parameter?: ClassMethodParameter[];
314
- }
315
- export interface ClassMethodInstanceParameter extends Element<ConstructorMeta> {
316
- doc?: DocElement[];
317
- type: AliasType[];
318
- }
319
- export interface ClassMethodParameter extends Element<Parameter> {
320
- doc?: DocElement[];
321
- type?: ParameterType[];
322
- array?: Arrays[];
323
- varargs?: string[];
324
- }
325
- export interface ReturnValue {
326
- $?: FunctionReturnValueMeta;
327
- type?: ParameterType[];
328
- doc?: DocElement[];
329
- array?: Arrays[];
330
- }
331
- export interface ClassProperty extends Element<Property> {
332
- doc?: DocElement[];
333
- array?: PropertyArray[];
334
- type?: ParameterType[];
335
- "doc-deprecated"?: DocDeprecatedElement[];
336
- }
337
- export interface Property {
338
- name: string;
339
- version?: Version;
340
- writable?: binary;
341
- "transfer-ownership"?: TransferOwnership;
342
- deprecated?: string;
343
- "deprecated-version"?: Version;
344
- construct?: string;
345
- "construct-only"?: string;
346
- readable?: string;
347
- }
348
- export interface PropertyArray {
349
- type: CIncludeElement[];
350
- }
351
- export interface VirtualMethod extends Method {
352
- "source-position": SourcePositionElement[];
353
- "return-value": FunctionReturnValue[];
354
- parameters: MethodParameterContainer[];
355
- doc?: DocElement[];
356
- "doc-deprecated"?: DocDeprecatedElement[];
357
- }
358
- export interface ConstantElement extends Element<Constant> {
359
- doc?: DocElement[];
360
- "source-position": SourcePositionElement[];
361
- type: AliasType[];
362
- "doc-deprecated"?: DocDeprecatedElement[];
363
- }
364
- export interface Enumeration extends Element<Bitfield> {
365
- doc?: DocElement[];
310
+ throws?: BinaryOption | BinaryOption;
311
+ "moved-to"?: string[];
312
+ }
313
+ export interface VarArgs {
314
+ $: InfoAttrs;
315
+ }
316
+ export interface CallableParamElement extends DocElement, AnyType {
317
+ $: InfoAttrs & Partial<TransferOwnership> & {
318
+ name?: string;
319
+ nullable?: BinaryOption | BinaryOption;
320
+ "allow-none"?: BinaryOption | BinaryOption;
321
+ introspectable?: BinaryOption | BinaryOption;
322
+ closure?: UnparsedNumber;
323
+ destroy?: UnparsedNumber;
324
+ scope?: "notified" | "async" | "call";
325
+ direction?: Direction;
326
+ "caller-allocates"?: BinaryOption | BinaryOption;
327
+ optional?: BinaryOption | BinaryOption;
328
+ skip?: BinaryOption | BinaryOption;
329
+ };
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 {
345
+ $: {
346
+ introspectable?: BinaryOption | BinaryOption;
347
+ nullable?: BinaryOption | BinaryOption;
348
+ closure?: UnparsedNumber;
349
+ 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 & {
367
+ invoker?: string;
368
+ };
369
+ parameters?: [CallableParams];
370
+ "return-value"?: CallableReturn[];
371
+ }
372
+ export interface UnionElement extends InfoElements {
373
+ $: InfoAttrs & {
374
+ name?: string;
375
+ "c:type"?: string;
376
+ "c:symbol-prefix"?: string;
377
+ "glib:type-name"?: string;
378
+ "glib:get-type"?: string;
379
+ };
380
+ field?: FieldElement[];
381
+ "constructor"?: ConstructorElement[];
382
+ method?: MethodElement[];
383
+ function?: FunctionElement[];
384
+ record?: RecordElement[];
385
+ }
386
+ export interface BitfieldElement extends InfoElements {
387
+ $: InfoAttrs & {
388
+ name: string;
389
+ "c:type": string;
390
+ "glib:type-name"?: string;
391
+ "glib:get-type"?: string;
392
+ };
366
393
  member: MemberElement[];
367
- function?: Function[];
368
- "doc-deprecated"?: DocDeprecatedElement[];
369
- }
370
- export interface Function extends Element<FunctionMeta> {
371
- doc?: DocElement[];
372
- "source-position"?: SourcePositionElement[];
373
- "return-value": ReturnValue[];
374
- parameters?: ParameterContainer<ClassMethodParameter>;
375
- "doc-deprecated"?: DocDeprecatedElement[];
376
- }
377
- export interface InterfaceGLibSignal extends Element<InterfaceGLibSignalMeta> {
378
- doc: DocElement[];
379
- "return-value": ReturnValue[];
380
- parameters?: ParameterContainer<ClassMethodParameter>;
381
- }
382
- export interface InterfaceGLibSignalMeta {
383
- name: string;
384
- when?: When;
385
- version?: Version;
386
- introspectable?: string;
387
- "c:identifier"?: string;
388
- }
389
- export interface InterfaceProperty extends Element<Property> {
390
- type: AliasType[];
391
- doc?: DocElement[];
392
- }
393
- export interface RecordElement extends Element<Record> {
394
- "source-position": SourcePositionElement[];
395
- field?: RecordField[];
396
- doc?: DocElement[];
397
- union?: Union[];
398
- function?: RecordFunction[];
399
- method?: Method[];
400
- "constructor"?: RecordConstructor[];
401
- }
402
- export interface Record {
403
- foreign: binary;
404
- name: string;
405
- "c:type": string;
406
- "glib:is-gtype-struct-for"?: string;
407
- disguised?: string;
408
- deprecated?: string;
409
- "deprecated-version"?: Version;
410
- version?: Version;
411
- "glib:type-name"?: string;
412
- "glib:get-type"?: string;
413
- "c:symbol-prefix"?: string;
414
- }
415
- export interface RecordConstructor extends Element<FunctionMeta> {
416
- doc: DocElement[];
417
- "source-position": SourcePositionElement[];
418
- "return-value": ReturnValue[];
419
- "doc-deprecated"?: DocDeprecatedElement[];
420
- parameters?: ParameterContainer<RecordConstructorParameter>;
421
- }
422
- export interface RecordConstructorParameter extends Element<ConstructorMeta> {
423
- doc: DocElement[];
424
- type?: AliasType[];
425
- array?: Arrays[];
426
- varargs?: string[];
427
- }
428
- export interface RecordField extends Element<FieldMeta> {
429
- type?: ClassFieldType[];
430
- callback?: FieldCallback[];
431
- doc?: DocElement[];
432
- array?: ClassFieldArray[];
433
- }
434
- export interface FieldMeta {
435
- name: string;
436
- writable?: string;
437
- bits?: string;
438
- readable?: string;
439
- private?: string;
440
- }
441
- export interface FieldCallback {
442
- $: FieldCallbackMeta;
443
- "source-position": SourcePositionElement[];
444
- "return-value": ReturnValue[];
445
- parameters?: ParameterContainer<CallbackParameter>;
446
- }
447
- export interface FieldCallbackMeta {
448
- name: string;
449
- introspectable?: string;
450
- throws?: string;
451
- }
452
- export interface RecordFunction extends Element<InterfaceGLibSignalMeta> {
453
- doc: DocElement[];
454
- "source-position": SourcePositionElement[];
455
- "return-value": ReturnValue[];
456
- parameters?: ParameterContainer<RecordFunctionParameter>;
457
- }
458
- export interface RecordFunctionParameter extends Element<ConstructorMeta> {
459
- doc: DocElement[];
460
- type?: ParameterType[];
461
- varargs?: string[];
462
- array?: StickyArrayElement[];
463
- }
464
- export interface StickyArrayElement extends Element<StickyArray> {
465
- type: AliasType[];
466
- }
467
- export interface StickyArray {
468
- "zero-terminated": string;
469
- "c:type": string;
470
- }
471
- export interface Method extends Element<FunctionMeta> {
472
- doc?: DocElement[];
473
- "source-position": SourcePositionElement[];
474
- "return-value": ReturnValue[];
475
- parameters: MethodParameterContainer[];
476
- "doc-deprecated"?: DocDeprecatedElement[];
477
- }
478
- export interface Union {
479
- $?: Alias;
480
- "source-position": SourcePositionElement[];
481
- field: UnionField[];
482
- }
483
- export interface UnionField extends Element<FieldMeta> {
484
- type?: AliasType[];
485
- array?: UnionArrayElement[];
486
- }
487
- export interface UnionArrayElement extends Element<UnionArray> {
488
- type: AliasType[];
489
- }
490
- export interface UnionArray {
491
- "zero-terminated": string;
492
- "fixed-size": string;
394
+ function: FunctionElement[];
395
+ }
396
+ export interface EnumElement extends InfoElements {
397
+ $: InfoAttrs & {
398
+ name: string;
399
+ "c:type": string;
400
+ "glib:type-name"?: string;
401
+ "glib:get-type"?: string;
402
+ "glib:error-domain"?: string;
403
+ };
404
+ member?: MemberElement[];
405
+ function?: FunctionElement[];
406
+ }
407
+ export interface MemberElement extends InfoElements {
408
+ $: InfoAttrs & {
409
+ name: string;
410
+ value: string;
411
+ "c:identifier": string;
412
+ "glib:nick"?: string;
413
+ };
493
414
  }
494
415
  export {};
package/dist/xml.js CHANGED
@@ -1,31 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.When = exports.TransferOwnership = exports.Scope = exports.Direction = exports.XMLSpace = void 0;
4
- var XMLSpace;
5
- (function (XMLSpace) {
6
- XMLSpace["Preserve"] = "preserve";
7
- })(XMLSpace = exports.XMLSpace || (exports.XMLSpace = {}));
3
+ exports.TransferOwnershipType = exports.Direction = void 0;
8
4
  var Direction;
9
5
  (function (Direction) {
10
6
  Direction["In"] = "in";
11
7
  Direction["Inout"] = "inout";
12
8
  Direction["Out"] = "out";
13
9
  })(Direction = exports.Direction || (exports.Direction = {}));
14
- var Scope;
15
- (function (Scope) {
16
- Scope["Async"] = "async";
17
- Scope["Call"] = "call";
18
- Scope["Notified"] = "notified";
19
- })(Scope = exports.Scope || (exports.Scope = {}));
20
- var TransferOwnership;
21
- (function (TransferOwnership) {
22
- TransferOwnership["Container"] = "container";
23
- TransferOwnership["Full"] = "full";
24
- TransferOwnership["None"] = "none";
25
- })(TransferOwnership = exports.TransferOwnership || (exports.TransferOwnership = {}));
26
- var When;
27
- (function (When) {
28
- When["Cleanup"] = "cleanup";
29
- When["First"] = "first";
30
- When["Last"] = "last";
31
- })(When = exports.When || (exports.When = {}));
10
+ var TransferOwnershipType;
11
+ (function (TransferOwnershipType) {
12
+ TransferOwnershipType["Container"] = "container";
13
+ TransferOwnershipType["Full"] = "full";
14
+ TransferOwnershipType["None"] = "none";
15
+ })(TransferOwnershipType = exports.TransferOwnershipType || (exports.TransferOwnershipType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gi.ts/parser",
3
- "version": "1.4.0",
3
+ "version": "1.5.10",
4
4
  "main": "dist/lib.js",
5
5
  "types": "dist/lib.d.ts",
6
6
  "files": [
@@ -17,14 +17,15 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "scripts": {
20
- "build": "tsc"
20
+ "build": "tsc",
21
+ "prepack": "rm -rf dist && yarn build"
21
22
  },
22
23
  "dependencies": {
23
24
  "fast-xml-parser": "^3.17.5"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@types/xml2js": "^0.4.4",
27
- "typescript": "^4.1.0"
28
+ "typescript": "^4.7.4"
28
29
  },
29
- "gitHead": "a94a1cd0c94d8c42b284a57fe2a6c712dd2caace"
30
+ "gitHead": "34aef45adc10d018a33f82db6f50fd61a512cdce"
30
31
  }