@gtkx/gir 0.1.10 → 0.1.12

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/parser.ts +41 -35
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/gir",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "GObject Introspection file parser for GTKX",
5
5
  "keywords": [
6
6
  "gtk",
package/src/parser.ts CHANGED
@@ -162,53 +162,59 @@ export class GirParser {
162
162
  if (!methods || !Array.isArray(methods)) {
163
163
  return [];
164
164
  }
165
- return methods.map((method) => ({
166
- name: String(method["@_name"] ?? ""),
167
- cIdentifier: String(method["@_c:identifier"] ?? ""),
168
- returnType: this.parseReturnType(method["return-value"] as Record<string, unknown> | undefined),
169
- parameters: this.parseParameters(
170
- (method.parameters && typeof method.parameters === "object" && method.parameters !== null
171
- ? method.parameters
172
- : {}) as Record<string, unknown>,
173
- ),
174
- throws: method["@_throws"] === "1",
175
- doc: extractDoc(method),
176
- }));
165
+ return methods
166
+ .filter((method) => method["@_introspectable"] !== "0")
167
+ .map((method) => ({
168
+ name: String(method["@_name"] ?? ""),
169
+ cIdentifier: String(method["@_c:identifier"] ?? ""),
170
+ returnType: this.parseReturnType(method["return-value"] as Record<string, unknown> | undefined),
171
+ parameters: this.parseParameters(
172
+ (method.parameters && typeof method.parameters === "object" && method.parameters !== null
173
+ ? method.parameters
174
+ : {}) as Record<string, unknown>,
175
+ ),
176
+ throws: method["@_throws"] === "1",
177
+ doc: extractDoc(method),
178
+ }));
177
179
  }
178
180
 
179
181
  private parseConstructors(constructors: Record<string, unknown>[]): GirConstructor[] {
180
182
  if (!constructors || !Array.isArray(constructors)) {
181
183
  return [];
182
184
  }
183
- return constructors.map((ctor) => ({
184
- name: String(ctor["@_name"] ?? ""),
185
- cIdentifier: String(ctor["@_c:identifier"] ?? ""),
186
- returnType: this.parseReturnType(ctor["return-value"] as Record<string, unknown> | undefined),
187
- parameters: this.parseParameters(
188
- (ctor.parameters && typeof ctor.parameters === "object" && ctor.parameters !== null
189
- ? ctor.parameters
190
- : {}) as Record<string, unknown>,
191
- ),
192
- doc: extractDoc(ctor),
193
- }));
185
+ return constructors
186
+ .filter((ctor) => ctor["@_introspectable"] !== "0")
187
+ .map((ctor) => ({
188
+ name: String(ctor["@_name"] ?? ""),
189
+ cIdentifier: String(ctor["@_c:identifier"] ?? ""),
190
+ returnType: this.parseReturnType(ctor["return-value"] as Record<string, unknown> | undefined),
191
+ parameters: this.parseParameters(
192
+ (ctor.parameters && typeof ctor.parameters === "object" && ctor.parameters !== null
193
+ ? ctor.parameters
194
+ : {}) as Record<string, unknown>,
195
+ ),
196
+ doc: extractDoc(ctor),
197
+ }));
194
198
  }
195
199
 
196
200
  private parseFunctions(functions: Record<string, unknown>[]): GirFunction[] {
197
201
  if (!functions || !Array.isArray(functions)) {
198
202
  return [];
199
203
  }
200
- return functions.map((func) => ({
201
- name: String(func["@_name"] ?? ""),
202
- cIdentifier: String(func["@_c:identifier"] ?? ""),
203
- returnType: this.parseReturnType(func["return-value"] as Record<string, unknown> | undefined),
204
- parameters: this.parseParameters(
205
- (func.parameters && typeof func.parameters === "object" && func.parameters !== null
206
- ? func.parameters
207
- : {}) as Record<string, unknown>,
208
- ),
209
- throws: func["@_throws"] === "1",
210
- doc: extractDoc(func),
211
- }));
204
+ return functions
205
+ .filter((func) => func["@_introspectable"] !== "0")
206
+ .map((func) => ({
207
+ name: String(func["@_name"] ?? ""),
208
+ cIdentifier: String(func["@_c:identifier"] ?? ""),
209
+ returnType: this.parseReturnType(func["return-value"] as Record<string, unknown> | undefined),
210
+ parameters: this.parseParameters(
211
+ (func.parameters && typeof func.parameters === "object" && func.parameters !== null
212
+ ? func.parameters
213
+ : {}) as Record<string, unknown>,
214
+ ),
215
+ throws: func["@_throws"] === "1",
216
+ doc: extractDoc(func),
217
+ }));
212
218
  }
213
219
 
214
220
  private parseParameters(parametersNode: Record<string, unknown>): GirParameter[] {