@ts-for-gir/cli 4.0.0-beta.35 → 4.0.0-beta.36

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/README.md CHANGED
@@ -125,7 +125,7 @@ Examples:
125
125
  ts-for-gir generate Run 'ts-for-gir generate' in your gjs
126
126
  project to generate typings for your
127
127
  project, pass the gir modules you need
128
- ts-for-gir generate Gtk* You can also use wild cards
128
+ ts-for-gir generate 'Gtk*' You can also use wild cards
129
129
  ts-for-gir generate '*' If you want to parse all of your locally
130
130
  installed gir modules run
131
131
  ts-for-gir generate --configName='.ts-for-gir.gtk4.rc.js' Use a special config file
package/bin/ts-for-gir CHANGED
@@ -8502,10 +8502,17 @@ var DependencyManager = class _DependencyManager {
8502
8502
  await this.get("cairo", "1.0")
8503
8503
  ];
8504
8504
  }
8505
- createImportProperties(namespace, packageName, version) {
8505
+ createImportProperties(namespace, packageName, version, libraryVersion) {
8506
8506
  const importPath = this.createImportPath(packageName, namespace, version);
8507
8507
  const importDef = this.createImportDef(namespace, importPath);
8508
- const packageJsonImport = this.createPackageJsonImport(importPath);
8508
+ let effectiveLibraryVersion = libraryVersion;
8509
+ if ((namespace === "GObject" || namespace === "Gio") && this._cache["GLib-2.0"]) {
8510
+ const glibDep = this._cache["GLib-2.0"];
8511
+ if (glibDep.libraryVersion.toString() !== "0.0.0") {
8512
+ effectiveLibraryVersion = glibDep.libraryVersion;
8513
+ }
8514
+ }
8515
+ const packageJsonImport = this.createPackageJsonImport(importPath, effectiveLibraryVersion);
8509
8516
  return {
8510
8517
  importPath,
8511
8518
  importDef,
@@ -8523,8 +8530,15 @@ var DependencyManager = class _DependencyManager {
8523
8530
  createImportDef(namespace, importPath) {
8524
8531
  return this.config.noNamespace ? `import type * as ${namespace} from '${importPath}'` : `import type ${namespace} from '${importPath}';`;
8525
8532
  }
8526
- createPackageJsonImport(importPath) {
8527
- const depVersion = this.config.workspace ? "workspace:^" : "*";
8533
+ createPackageJsonImport(importPath, libraryVersion) {
8534
+ let depVersion;
8535
+ if (this.config.workspace) {
8536
+ depVersion = "workspace:^";
8537
+ } else if (libraryVersion) {
8538
+ depVersion = `${libraryVersion.toString()}-${APP_VERSION}`;
8539
+ } else {
8540
+ depVersion = APP_VERSION;
8541
+ }
8528
8542
  return `"${importPath}": "${depVersion}"`;
8529
8543
  }
8530
8544
  async parseGir(path) {
@@ -8604,7 +8618,7 @@ var DependencyManager = class _DependencyManager {
8604
8618
  version,
8605
8619
  libraryVersion,
8606
8620
  girXML,
8607
- ...this.createImportProperties(namespace, packageName, version)
8621
+ ...this.createImportProperties(namespace, packageName, version, libraryVersion)
8608
8622
  };
8609
8623
  if (!noOverride && namespace === "cairo" && version === "1.0") {
8610
8624
  dependency.importDef = this.createImportDef("cairo", "cairo");
@@ -20082,7 +20096,7 @@ var examples4 = [
20082
20096
  `${APP_NAME} generate`,
20083
20097
  `Run '${APP_NAME} generate' in your gjs project to generate typings for your project, pass the gir modules you need for your project`
20084
20098
  ],
20085
- [`${APP_NAME} generate Gtk*`, "You can also use wild cards"],
20099
+ [`${APP_NAME} generate 'Gtk*'`, "You can also use wild cards"],
20086
20100
  [`${APP_NAME} generate '*'`, "If you want to parse all of your locally installed gir modules run"],
20087
20101
  [`${APP_NAME} generate --configName='.ts-for-gir.gtk4.rc.js`, "Use a special config file"],
20088
20102
  [`${APP_NAME} generate --ignore=Gtk-4.0 xrandr-1.3`, "Generate .d.ts. files but not for Gtk-4.0 and xrandr-1.3"]
@@ -20143,7 +20157,7 @@ var description5 = "Generates JSON representation from GIR files for analysis an
20143
20157
  var logger7 = new Logger(true, "JsonCommand");
20144
20158
  var examples5 = [
20145
20159
  [`${APP_NAME} json`, `Run '${APP_NAME} json' in your gjs project to generate JSON files for your project`],
20146
- [`${APP_NAME} json Gtk*`, "You can also use wild cards"],
20160
+ [`${APP_NAME} json 'Gtk*'`, "You can also use wild cards"],
20147
20161
  [`${APP_NAME} json '*'`, "If you want to parse all of your locally installed gir modules run"],
20148
20162
  [`${APP_NAME} json --configName='.ts-for-gir.gtk4.rc.js`, "Use a special config file"],
20149
20163
  [`${APP_NAME} json --ignore=Gtk-4.0 xrandr-1.3`, "Generate JSON files but not for Gtk-4.0 and xrandr-1.3"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-for-gir/cli",
3
- "version": "4.0.0-beta.35",
3
+ "version": "4.0.0-beta.36",
4
4
  "description": "TypeScript type definition generator for GObject introspection GIR files",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -53,13 +53,13 @@
53
53
  ".": "./src/index.ts"
54
54
  },
55
55
  "devDependencies": {
56
- "@gi.ts/parser": "^4.0.0-beta.35",
57
- "@ts-for-gir/generator-base": "^4.0.0-beta.35",
58
- "@ts-for-gir/generator-html-doc": "^4.0.0-beta.35",
59
- "@ts-for-gir/generator-json": "^4.0.0-beta.35",
60
- "@ts-for-gir/generator-typescript": "^4.0.0-beta.35",
61
- "@ts-for-gir/lib": "^4.0.0-beta.35",
62
- "@ts-for-gir/reporter": "^4.0.0-beta.35",
56
+ "@gi.ts/parser": "^4.0.0-beta.36",
57
+ "@ts-for-gir/generator-base": "^4.0.0-beta.36",
58
+ "@ts-for-gir/generator-html-doc": "^4.0.0-beta.36",
59
+ "@ts-for-gir/generator-json": "^4.0.0-beta.36",
60
+ "@ts-for-gir/generator-typescript": "^4.0.0-beta.36",
61
+ "@ts-for-gir/lib": "^4.0.0-beta.36",
62
+ "@ts-for-gir/reporter": "^4.0.0-beta.36",
63
63
  "@types/ejs": "^3.1.5",
64
64
  "@types/inquirer": "^9.0.9",
65
65
  "@types/node": "^24.2.1",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "@inquirer/prompts": "^7.8.2",
73
- "@ts-for-gir/templates": "^4.0.0-beta.35",
73
+ "@ts-for-gir/templates": "^4.0.0-beta.36",
74
74
  "colorette": "^2.0.20",
75
75
  "cosmiconfig": "^9.0.0",
76
76
  "ejs": "^3.1.10",
@@ -32,7 +32,7 @@ const examples: ReadonlyArray<[string, string?]> = [
32
32
  `${APP_NAME} generate`,
33
33
  `Run '${APP_NAME} generate' in your gjs project to generate typings for your project, pass the gir modules you need for your project`,
34
34
  ],
35
- [`${APP_NAME} generate Gtk*`, "You can also use wild cards"],
35
+ [`${APP_NAME} generate 'Gtk*'`, "You can also use wild cards"],
36
36
  [`${APP_NAME} generate '*'`, "If you want to parse all of your locally installed gir modules run"],
37
37
  [`${APP_NAME} generate --configName='.ts-for-gir.gtk4.rc.js`, "Use a special config file"],
38
38
  [`${APP_NAME} generate --ignore=Gtk-4.0 xrandr-1.3`, "Generate .d.ts. files but not for Gtk-4.0 and xrandr-1.3"],
@@ -28,7 +28,7 @@ const logger = new Logger(true, "JsonCommand");
28
28
 
29
29
  const examples: ReadonlyArray<[string, string?]> = [
30
30
  [`${APP_NAME} json`, `Run '${APP_NAME} json' in your gjs project to generate JSON files for your project`],
31
- [`${APP_NAME} json Gtk*`, "You can also use wild cards"],
31
+ [`${APP_NAME} json 'Gtk*'`, "You can also use wild cards"],
32
32
  [`${APP_NAME} json '*'`, "If you want to parse all of your locally installed gir modules run"],
33
33
  [`${APP_NAME} json --configName='.ts-for-gir.gtk4.rc.js`, "Use a special config file"],
34
34
  [`${APP_NAME} json --ignore=Gtk-4.0 xrandr-1.3`, "Generate JSON files but not for Gtk-4.0 and xrandr-1.3"],
@@ -235,6 +235,8 @@ export class ModuleLoader {
235
235
  const GObject = await this.dependencyManager.get("GObject", "2.0");
236
236
  const Cairo = await this.dependencyManager.get("cairo", "1.0");
237
237
 
238
+ // Update library versions for GObject and Gio to use GLib's version
239
+
238
240
  const dependencies = await this.fileFinder.girFilePathToDependencies(girFiles);
239
241
 
240
242
  const { loaded, failed } = await this.loadGirModules(