@ts-for-gir/lib 4.0.0-beta.35 → 4.0.0-beta.37
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.
|
|
3
|
+
"version": "4.0.0-beta.37",
|
|
4
4
|
"description": "Typescript .d.ts generator from GIR for gjs",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"module": "src/index.ts",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/ejs": "^3.1.5",
|
|
45
45
|
"@types/lodash": "^4.17.20",
|
|
46
|
-
"@types/node": "^24.2
|
|
46
|
+
"@types/node": "^24.5.2",
|
|
47
47
|
"rimraf": "^6.0.1",
|
|
48
48
|
"typescript": "^5.9.2"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@gi.ts/parser": "^4.0.0-beta.
|
|
52
|
-
"@ts-for-gir/reporter": "^4.0.0-beta.
|
|
53
|
-
"@ts-for-gir/templates": "^4.0.0-beta.
|
|
51
|
+
"@gi.ts/parser": "^4.0.0-beta.37",
|
|
52
|
+
"@ts-for-gir/reporter": "^4.0.0-beta.37",
|
|
53
|
+
"@ts-for-gir/templates": "^4.0.0-beta.37",
|
|
54
54
|
"colorette": "^2.0.20",
|
|
55
55
|
"ejs": "^3.1.10",
|
|
56
56
|
"glob": "^11.0.3",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { type GirInclude, type GirNamespace, type GirRepository, type GirXML, parser } from "@gi.ts/parser";
|
|
3
|
+
import { APP_VERSION } from "./constants.ts";
|
|
3
4
|
import type { GirModule } from "./gir-module.ts";
|
|
4
5
|
import { LibraryVersion } from "./library-version.ts";
|
|
5
6
|
import { Logger } from "./logger.ts";
|
|
@@ -109,10 +110,20 @@ export class DependencyManager {
|
|
|
109
110
|
];
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
createImportProperties(namespace: string, packageName: string, version: string) {
|
|
113
|
+
createImportProperties(namespace: string, packageName: string, version: string, libraryVersion?: LibraryVersion) {
|
|
113
114
|
const importPath = this.createImportPath(packageName, namespace, version);
|
|
114
115
|
const importDef = this.createImportDef(namespace, importPath);
|
|
115
|
-
|
|
116
|
+
|
|
117
|
+
// For GObject and Gio, use GLib's library version if available
|
|
118
|
+
let effectiveLibraryVersion = libraryVersion;
|
|
119
|
+
if ((namespace === "GObject" || namespace === "Gio") && this._cache["GLib-2.0"]) {
|
|
120
|
+
const glibDep = this._cache["GLib-2.0"];
|
|
121
|
+
if (glibDep.libraryVersion.toString() !== "0.0.0") {
|
|
122
|
+
effectiveLibraryVersion = glibDep.libraryVersion;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const packageJsonImport = this.createPackageJsonImport(importPath, effectiveLibraryVersion);
|
|
116
127
|
return {
|
|
117
128
|
importPath,
|
|
118
129
|
importDef,
|
|
@@ -135,8 +146,15 @@ export class DependencyManager {
|
|
|
135
146
|
: `import type ${namespace} from '${importPath}';`;
|
|
136
147
|
}
|
|
137
148
|
|
|
138
|
-
createPackageJsonImport(importPath: string): string {
|
|
139
|
-
|
|
149
|
+
createPackageJsonImport(importPath: string, libraryVersion?: LibraryVersion): string {
|
|
150
|
+
let depVersion: string;
|
|
151
|
+
if (this.config.workspace) {
|
|
152
|
+
depVersion = "workspace:^";
|
|
153
|
+
} else if (libraryVersion) {
|
|
154
|
+
depVersion = `${libraryVersion.toString()}-${APP_VERSION}`;
|
|
155
|
+
} else {
|
|
156
|
+
depVersion = APP_VERSION;
|
|
157
|
+
}
|
|
140
158
|
return `"${importPath}": "${depVersion}"`;
|
|
141
159
|
}
|
|
142
160
|
|
|
@@ -258,7 +276,7 @@ export class DependencyManager {
|
|
|
258
276
|
version,
|
|
259
277
|
libraryVersion,
|
|
260
278
|
girXML,
|
|
261
|
-
...this.createImportProperties(namespace, packageName, version),
|
|
279
|
+
...this.createImportProperties(namespace, packageName, version, libraryVersion),
|
|
262
280
|
};
|
|
263
281
|
|
|
264
282
|
// Special case for Cairo
|
package/src/generics/clutter.ts
CHANGED
|
@@ -66,6 +66,15 @@ 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
70
|
export const clutter14 = createClutterTemplate("14");
|
|
71
|
+
/** Clutter-15 was introduced with GNOME 47 */
|
|
70
72
|
export const clutter15 = createClutterTemplate("15");
|
|
73
|
+
/** Clutter-16 was introduced with GNOME 48 */
|
|
71
74
|
export const clutter16 = createClutterTemplate("16");
|
|
75
|
+
/** Clutter-17 was introduced with GNOME 49 */
|
|
76
|
+
export const clutter17 = createClutterTemplate("17");
|
|
77
|
+
// Possibly future versions, adjust if necessary
|
|
78
|
+
export const clutter18 = createClutterTemplate("18");
|
|
79
|
+
export const clutter19 = createClutterTemplate("19");
|
|
80
|
+
export const clutter20 = createClutterTemplate("20");
|
package/src/generics/generify.ts
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import type { NSRegistry } from "../gir/registry.ts";
|
|
2
2
|
import type { NamespaceDefinition } from "../types/generics-config.ts";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
clutter10,
|
|
5
|
+
clutter11,
|
|
6
|
+
clutter12,
|
|
7
|
+
clutter13,
|
|
8
|
+
clutter14,
|
|
9
|
+
clutter15,
|
|
10
|
+
clutter16,
|
|
11
|
+
clutter17,
|
|
12
|
+
clutter18,
|
|
13
|
+
clutter19,
|
|
14
|
+
clutter20,
|
|
15
|
+
} from "./clutter.ts";
|
|
4
16
|
import gio from "./gio.ts";
|
|
5
17
|
import glib from "./glib.ts";
|
|
6
18
|
import gtk from "./gtk.ts";
|
|
7
|
-
import { meta10, meta11, meta12, meta13, meta14, meta15 } from "./meta.ts";
|
|
8
|
-
import { st1, st12, st13, st14, st15 } from "./st.ts";
|
|
19
|
+
import { meta10, meta11, meta12, meta13, meta14, meta15, meta16, meta17, meta18, meta19, meta20 } from "./meta.ts";
|
|
20
|
+
import { st1, st12, st13, st14, st15, st16, st17, st18, st19, st20 } from "./st.ts";
|
|
9
21
|
import { GenericVisitor } from "./visitor.ts";
|
|
10
22
|
|
|
11
23
|
// Core namespace definitions that are required
|
|
@@ -20,17 +32,32 @@ const OPTIONAL_DEFINITIONS: NamespaceDefinition[] = [
|
|
|
20
32
|
clutter13,
|
|
21
33
|
clutter14,
|
|
22
34
|
clutter15,
|
|
35
|
+
clutter16,
|
|
36
|
+
clutter17,
|
|
37
|
+
clutter18,
|
|
38
|
+
clutter19,
|
|
39
|
+
clutter20,
|
|
23
40
|
st1,
|
|
24
41
|
st12,
|
|
25
42
|
st13,
|
|
26
43
|
st14,
|
|
27
44
|
st15,
|
|
45
|
+
st16,
|
|
46
|
+
st17,
|
|
47
|
+
st18,
|
|
48
|
+
st19,
|
|
49
|
+
st20,
|
|
28
50
|
meta10,
|
|
29
51
|
meta11,
|
|
30
52
|
meta12,
|
|
31
53
|
meta13,
|
|
32
54
|
meta14,
|
|
33
55
|
meta15,
|
|
56
|
+
meta16,
|
|
57
|
+
meta17,
|
|
58
|
+
meta18,
|
|
59
|
+
meta19,
|
|
60
|
+
meta20,
|
|
34
61
|
];
|
|
35
62
|
|
|
36
63
|
function createDefinitionProcessor(registry: NSRegistry, inferGenerics: boolean, required: boolean = true) {
|
package/src/generics/meta.ts
CHANGED
|
@@ -36,6 +36,15 @@ 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
40
|
export const meta14 = createMetaTemplate("14");
|
|
41
|
+
/** Meta-15 was introduced with GNOME 47 */
|
|
40
42
|
export const meta15 = createMetaTemplate("15");
|
|
43
|
+
/** Meta-16 was introduced with GNOME 48 */
|
|
41
44
|
export const meta16 = createMetaTemplate("16");
|
|
45
|
+
/** Meta-17 was introduced with GNOME 49 */
|
|
46
|
+
export const meta17 = createMetaTemplate("17");
|
|
47
|
+
// Possibly future versions, adjust if necessary
|
|
48
|
+
export const meta18 = createMetaTemplate("18");
|
|
49
|
+
export const meta19 = createMetaTemplate("19");
|
|
50
|
+
export const meta20 = createMetaTemplate("20");
|
package/src/generics/st.ts
CHANGED
|
@@ -192,6 +192,15 @@ 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
196
|
export const st14 = createStTemplate("14");
|
|
197
|
+
/** St-15 was introduced with GNOME 47 */
|
|
196
198
|
export const st15 = createStTemplate("15");
|
|
199
|
+
/** St-16 was introduced with GNOME 48 */
|
|
197
200
|
export const st16 = createStTemplate("16");
|
|
201
|
+
/** St-17 was introduced with GNOME 49 */
|
|
202
|
+
export const st17 = createStTemplate("17");
|
|
203
|
+
// Possibly future versions, adjust if necessary
|
|
204
|
+
export const st18 = createStTemplate("18");
|
|
205
|
+
export const st19 = createStTemplate("19");
|
|
206
|
+
export const st20 = createStTemplate("20");
|
package/src/injections/inject.ts
CHANGED
|
@@ -6,7 +6,7 @@ import gio from "./gio.ts";
|
|
|
6
6
|
import glib from "./glib.ts";
|
|
7
7
|
import gobject from "./gobject.ts";
|
|
8
8
|
import gtk4 from "./gtk4.ts";
|
|
9
|
-
import { shell14, shell15 } from "./shell.ts";
|
|
9
|
+
import { shell14, shell15, shell16, shell17, shell18, shell19, shell20 } from "./shell.ts";
|
|
10
10
|
import tracker1 from "./tracker1.ts";
|
|
11
11
|
|
|
12
12
|
export type NamespaceInjection = (namespace: IntrospectedNamespace, registry: NSRegistry) => void;
|
|
@@ -41,4 +41,9 @@ export function inject(registry: NSRegistry) {
|
|
|
41
41
|
$_(gtk4);
|
|
42
42
|
$_(shell14);
|
|
43
43
|
$_(shell15);
|
|
44
|
+
$_(shell16);
|
|
45
|
+
$_(shell17);
|
|
46
|
+
$_(shell18);
|
|
47
|
+
$_(shell19);
|
|
48
|
+
$_(shell20);
|
|
44
49
|
}
|
package/src/injections/shell.ts
CHANGED
|
@@ -37,9 +37,13 @@ const shellTemplate = (version: string) => ({
|
|
|
37
37
|
|
|
38
38
|
/** Shell 14 was introduced with GNOME 45 */
|
|
39
39
|
export const shell14 = shellTemplate("14");
|
|
40
|
-
|
|
41
40
|
/** Shell 15 was introduced with GNOME 47 */
|
|
42
41
|
export const shell15 = shellTemplate("15");
|
|
43
|
-
|
|
44
42
|
/** Shell 16 was introduced with GNOME 48 */
|
|
45
43
|
export const shell16 = shellTemplate("16");
|
|
44
|
+
/** Shell 17 was introduced with GNOME 49 */
|
|
45
|
+
export const shell17 = shellTemplate("17");
|
|
46
|
+
// Possibly future versions, adjust if necessary
|
|
47
|
+
export const shell18 = shellTemplate("18");
|
|
48
|
+
export const shell19 = shellTemplate("19");
|
|
49
|
+
export const shell20 = shellTemplate("20");
|