@ts-for-gir/lib 4.0.0-beta.43 → 4.0.0-beta.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-for-gir/lib",
3
- "version": "4.0.0-beta.43",
3
+ "version": "4.0.0-beta.44",
4
4
  "description": "Typescript .d.ts generator from GIR for gjs",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -41,7 +41,7 @@
41
41
  "type definitions"
42
42
  ],
43
43
  "devDependencies": {
44
- "@ts-for-gir/tsconfig": "^4.0.0-beta.43",
44
+ "@ts-for-gir/tsconfig": "^4.0.0-beta.44",
45
45
  "@types/ejs": "^3.1.5",
46
46
  "@types/lodash": "^4.17.24",
47
47
  "@types/node": "^24.12.0",
@@ -49,12 +49,12 @@
49
49
  "typescript": "^6.0.2"
50
50
  },
51
51
  "dependencies": {
52
- "@gi.ts/parser": "^4.0.0-beta.43",
53
- "@ts-for-gir/reporter": "^4.0.0-beta.43",
54
- "@ts-for-gir/templates": "^4.0.0-beta.43",
52
+ "@gi.ts/parser": "^4.0.0-beta.44",
53
+ "@ts-for-gir/reporter": "^4.0.0-beta.44",
54
+ "@ts-for-gir/templates": "^4.0.0-beta.44",
55
55
  "colorette": "^2.0.20",
56
56
  "ejs": "^5.0.1",
57
57
  "glob": "^13.0.6",
58
- "lodash": "^4.17.23"
58
+ "lodash": "4.17.21"
59
59
  }
60
60
  }
@@ -66,7 +66,7 @@ export const clutter10 = createClutterTemplate("10");
66
66
  export const clutter11 = createClutterTemplate("11");
67
67
  export const clutter12 = createClutterTemplate("12");
68
68
  export const clutter13 = createClutterTemplate("13");
69
- /** Clutter-14 was introduced with GNOME 45 */
69
+ /** Clutter-14 was introduced with GNOME 46 */
70
70
  export const clutter14 = createClutterTemplate("14");
71
71
  /** Clutter-15 was introduced with GNOME 47 */
72
72
  export const clutter15 = createClutterTemplate("15");
@@ -74,7 +74,8 @@ export const clutter15 = createClutterTemplate("15");
74
74
  export const clutter16 = createClutterTemplate("16");
75
75
  /** Clutter-17 was introduced with GNOME 49 */
76
76
  export const clutter17 = createClutterTemplate("17");
77
- // Possibly future versions, adjust if necessary
77
+ /** Clutter-18 was introduced with GNOME 50 */
78
78
  export const clutter18 = createClutterTemplate("18");
79
+ // Possibly future versions, adjust if necessary
79
80
  export const clutter19 = createClutterTemplate("19");
80
81
  export const clutter20 = createClutterTemplate("20");
@@ -36,7 +36,7 @@ export const meta10 = createMetaTemplate("10");
36
36
  export const meta11 = createMetaTemplate("11");
37
37
  export const meta12 = createMetaTemplate("12");
38
38
  export const meta13 = createMetaTemplate("13");
39
- /** Meta-14 was introduced with GNOME 45 */
39
+ /** Meta-14 was introduced with GNOME 46 */
40
40
  export const meta14 = createMetaTemplate("14");
41
41
  /** Meta-15 was introduced with GNOME 47 */
42
42
  export const meta15 = createMetaTemplate("15");
@@ -44,7 +44,8 @@ export const meta15 = createMetaTemplate("15");
44
44
  export const meta16 = createMetaTemplate("16");
45
45
  /** Meta-17 was introduced with GNOME 49 */
46
46
  export const meta17 = createMetaTemplate("17");
47
- // Possibly future versions, adjust if necessary
47
+ /** Meta-18 was introduced with GNOME 50 */
48
48
  export const meta18 = createMetaTemplate("18");
49
+ // Possibly future versions, adjust if necessary
49
50
  export const meta19 = createMetaTemplate("19");
50
51
  export const meta20 = createMetaTemplate("20");
@@ -192,7 +192,7 @@ function updatePropertyType(
192
192
  export const st1 = createStTemplate("1.0");
193
193
  export const st12 = createStTemplate("12");
194
194
  export const st13 = createStTemplate("13");
195
- /** St-14 was introduced with GNOME 45 */
195
+ /** St-14 was introduced with GNOME 46 */
196
196
  export const st14 = createStTemplate("14");
197
197
  /** St-15 was introduced with GNOME 47 */
198
198
  export const st15 = createStTemplate("15");
@@ -200,7 +200,8 @@ export const st15 = createStTemplate("15");
200
200
  export const st16 = createStTemplate("16");
201
201
  /** St-17 was introduced with GNOME 49 */
202
202
  export const st17 = createStTemplate("17");
203
- // Possibly future versions, adjust if necessary
203
+ /** St-18 was introduced with GNOME 50 */
204
204
  export const st18 = createStTemplate("18");
205
+ // Possibly future versions, adjust if necessary
205
206
  export const st19 = createStTemplate("19");
206
207
  export const st20 = createStTemplate("20");
@@ -35,7 +35,7 @@ const shellTemplate = (version: string) => ({
35
35
  },
36
36
  });
37
37
 
38
- /** Shell 14 was introduced with GNOME 45 */
38
+ /** Shell 14 was introduced with GNOME 46 */
39
39
  export const shell14 = shellTemplate("14");
40
40
  /** Shell 15 was introduced with GNOME 47 */
41
41
  export const shell15 = shellTemplate("15");
@@ -43,7 +43,8 @@ export const shell15 = shellTemplate("15");
43
43
  export const shell16 = shellTemplate("16");
44
44
  /** Shell 17 was introduced with GNOME 49 */
45
45
  export const shell17 = shellTemplate("17");
46
- // Possibly future versions, adjust if necessary
46
+ /** Shell 18 was introduced with GNOME 50 */
47
47
  export const shell18 = shellTemplate("18");
48
+ // Possibly future versions, adjust if necessary
48
49
  export const shell19 = shellTemplate("19");
49
50
  export const shell20 = shellTemplate("20");
package/src/utils/girs.ts CHANGED
@@ -106,8 +106,7 @@ export const printGirDocComment = (tsDoc: TsDoc, config: { noComments: boolean }
106
106
  return desc.join("\n");
107
107
  };
108
108
 
109
- export const isIntrospectable = (e: { $?: GirInfoAttrs }) =>
110
- !e || !e.$ || !e.$.introspectable || e.$.introspectable === "1";
109
+ export const isIntrospectable = (e: { $?: GirInfoAttrs }) => !e?.$?.introspectable || e.$.introspectable === "1";
111
110
  export const isDeprecated = (e: { $: GirInfoAttrs }) => e?.$ && e.$.deprecated === "1";
112
111
  export const deprecatedVersion = (e: { $: GirInfoAttrs }) => e?.$?.["deprecated-version"];
113
112
  export const introducedVersion = (e: { $: GirInfoAttrs }) => e?.$?.version;
@@ -7,12 +7,23 @@ import { AnyType, NativeType, TypeIdentifier } from "../gir.ts";
7
7
  import { resolveTypeIdentifier } from "../utils/type-resolution.ts";
8
8
  import { GirVisitor } from "../visitor.ts";
9
9
 
10
+ // These methods are often marked introspectable="0" in GIR because the C signatures
11
+ // involve gpointer types, but GJS exposes them at runtime regardless. Their signatures are
12
+ // always trivial (no params, return self or void) so they are safe to keep.
13
+ // Only exempt on records — classes have deep inheritance hierarchies where return types
14
+ // at different levels conflict (e.g. GObject.Object.ref() vs Gtk.Widget.ref()).
15
+ const INTROSPECTABLE_EXEMPT_METHODS = new Set(["ref", "unref", "copy", "free", "destroy"]);
16
+
10
17
  const filterIntrospectableClassMembers = <T extends IntrospectedBaseClass>(node: T): T => {
11
18
  node.fields = node.fields.filter((field) => field.isIntrospectable);
12
19
  node.props = node.props.filter((prop) => prop.isIntrospectable);
13
20
  node.callbacks = node.callbacks.filter((prop) => prop.isIntrospectable);
14
21
  node.constructors = node.constructors.filter((prop) => prop.isIntrospectable);
15
- node.members = node.members.filter((prop) => prop.isIntrospectable);
22
+
23
+ const isRecord = node instanceof IntrospectedRecord;
24
+ node.members = node.members.filter(
25
+ (member) => member.isIntrospectable || (isRecord && INTROSPECTABLE_EXEMPT_METHODS.has(member.name)),
26
+ );
16
27
 
17
28
  return node;
18
29
  };