@ts-for-gir/lib 4.0.3 → 4.1.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/package.json CHANGED
@@ -1,60 +1,60 @@
1
1
  {
2
- "name": "@ts-for-gir/lib",
3
- "version": "4.0.3",
4
- "description": "Typescript .d.ts generator from GIR for gjs",
5
- "main": "src/index.ts",
6
- "module": "src/index.ts",
7
- "type": "module",
8
- "engines": {
9
- "node": ">=18"
10
- },
11
- "exports": {
12
- ".": "./src/index.ts"
13
- },
14
- "scripts": {
15
- "check": "tsc --noEmit"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/gjsify/ts-for-gir.git"
20
- },
21
- "author": "Pascal Garber <pascal@mailfreun.de>",
22
- "files": [
23
- "src"
24
- ],
25
- "license": "Apache-2.0",
26
- "bugs": {
27
- "url": "https://github.com/gjsify/ts-for-gir/issues"
28
- },
29
- "homepage": "https://github.com/gjsify/ts-for-gir#readme",
30
- "keywords": [
31
- "gjs",
32
- "typescript",
33
- "generate",
34
- "gir",
35
- "gobject-introspection",
36
- "gnome",
37
- "gtk",
38
- "glib",
39
- "gobject",
40
- "dts",
41
- "type definitions"
42
- ],
43
- "devDependencies": {
44
- "@ts-for-gir/tsconfig": "^4.0.3",
45
- "@types/ejs": "^3.1.5",
46
- "@types/lodash": "^4.17.24",
47
- "@types/node": "^25.6.2",
48
- "rimraf": "^6.1.3",
49
- "typescript": "^6.0.3"
50
- },
51
- "dependencies": {
52
- "@gi.ts/parser": "^4.0.3",
53
- "@ts-for-gir/reporter": "^4.0.3",
54
- "@ts-for-gir/templates": "^4.0.3",
55
- "colorette": "^2.0.20",
56
- "ejs": "^5.0.2",
57
- "glob": "^13.0.6",
58
- "lodash": "4.18.1"
59
- }
2
+ "name": "@ts-for-gir/lib",
3
+ "version": "4.1.0",
4
+ "description": "Typescript .d.ts generator from GIR for gjs",
5
+ "main": "src/index.ts",
6
+ "module": "src/index.ts",
7
+ "type": "module",
8
+ "engines": {
9
+ "node": ">=18"
10
+ },
11
+ "exports": {
12
+ ".": "./src/index.ts"
13
+ },
14
+ "scripts": {
15
+ "check": "tsc --noEmit"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/gjsify/ts-for-gir.git"
20
+ },
21
+ "author": "Pascal Garber <pascal@mailfreun.de>",
22
+ "files": [
23
+ "src"
24
+ ],
25
+ "license": "Apache-2.0",
26
+ "bugs": {
27
+ "url": "https://github.com/gjsify/ts-for-gir/issues"
28
+ },
29
+ "homepage": "https://github.com/gjsify/ts-for-gir#readme",
30
+ "keywords": [
31
+ "gjs",
32
+ "typescript",
33
+ "generate",
34
+ "gir",
35
+ "gobject-introspection",
36
+ "gnome",
37
+ "gtk",
38
+ "glib",
39
+ "gobject",
40
+ "dts",
41
+ "type definitions"
42
+ ],
43
+ "devDependencies": {
44
+ "@ts-for-gir/tsconfig": "^4.1.0",
45
+ "@types/ejs": "^3.1.5",
46
+ "@types/lodash": "^4.17.24",
47
+ "@types/node": "^25.6.2",
48
+ "rimraf": "^6.1.3",
49
+ "typescript": "^6.0.3"
50
+ },
51
+ "dependencies": {
52
+ "@gi.ts/parser": "^4.1.0",
53
+ "@ts-for-gir/reporter": "^4.1.0",
54
+ "@ts-for-gir/templates": "^4.1.0",
55
+ "colorette": "^2.0.20",
56
+ "ejs": "^6.0.1",
57
+ "glob": "^13.0.6",
58
+ "lodash": "4.18.1"
59
+ }
60
60
  }
@@ -110,20 +110,10 @@ export class DependencyManager {
110
110
  ];
111
111
  }
112
112
 
113
- createImportProperties(namespace: string, packageName: string, version: string, libraryVersion?: LibraryVersion) {
113
+ createImportProperties(namespace: string, packageName: string, version: string) {
114
114
  const importPath = this.createImportPath(packageName, namespace, version);
115
115
  const importDef = this.createImportDef(namespace, importPath);
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
+ const packageJsonImport = this.createPackageJsonImport(importPath);
127
117
  return {
128
118
  importPath,
129
119
  importDef,
@@ -155,9 +145,18 @@ export class DependencyManager {
155
145
  : `import type ${namespace} from '${importPath}';`;
156
146
  }
157
147
 
158
- createPackageJsonImport(importPath: string, libraryVersion?: LibraryVersion): string {
159
- const pinnedVersion = libraryVersion ? `${libraryVersion.toString()}-${APP_VERSION}` : APP_VERSION;
160
- const format = this.config.depVersionFormat ?? (this.config.workspace ? "workspace" : "exact");
148
+ createPackageJsonImport(importPath: string): string {
149
+ // @girs/* package versions are the ts-for-gir release version alone (e.g. `4.0.5`); the
150
+ // targeted library version lives in each package's `libraryVersion` field, not in the
151
+ // version string. It used to couple both as `<lib>-<app>` (e.g. `2.88.0-4.0.4`), which made
152
+ // the ts-for-gir version a semver PRERELEASE tag — so exact pins could not dedupe (any drift
153
+ // nested a second `@girs/gobject-2.0`: the "Incompatible GObject type" error, #431) and
154
+ // caret ranges floated onto rc/beta. With a plain release version the non-workspace default
155
+ // is `caret`: `^4.0.5` dedupes stable patches across ts-for-gir releases AND excludes
156
+ // prereleases. `--depVersionFormat=exact` stays as the strict-pin opt-in; `--workspace`
157
+ // still emits `workspace:^`.
158
+ const pinnedVersion = APP_VERSION;
159
+ const format = this.config.depVersionFormat ?? (this.config.workspace ? "workspace" : "caret");
161
160
  let depVersion: string;
162
161
  switch (format) {
163
162
  case "workspace":
@@ -294,7 +293,7 @@ export class DependencyManager {
294
293
  version,
295
294
  libraryVersion,
296
295
  girXML,
297
- ...this.createImportProperties(namespace, packageName, version, libraryVersion),
296
+ ...this.createImportProperties(namespace, packageName, version),
298
297
  };
299
298
 
300
299
  // Special case for Cairo