@ts-for-gir/cli 3.0.0-beta.5 → 3.0.0-beta.7

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 (73) hide show
  1. package/README.md +15 -6
  2. package/lib/config.js +40 -48
  3. package/lib/config.js.map +1 -1
  4. package/lib/conflict-resolver.js +9 -3
  5. package/lib/conflict-resolver.js.map +1 -1
  6. package/lib/gir-factory.d.ts +1 -0
  7. package/lib/gir-factory.js +7 -0
  8. package/lib/gir-factory.js.map +1 -1
  9. package/lib/injection/classes/gjs/GLib-2.0.js +110 -0
  10. package/lib/injection/classes/gjs/GLib-2.0.js.map +1 -1
  11. package/lib/injection/injector.js +3 -0
  12. package/lib/injection/injector.js.map +1 -1
  13. package/lib/module-loader.d.ts +1 -1
  14. package/lib/module-loader.js +7 -2
  15. package/lib/module-loader.js.map +1 -1
  16. package/lib/template-processor.js +1 -1
  17. package/lib/template-processor.js.map +1 -1
  18. package/lib/type-definition-generator.d.ts +0 -1
  19. package/lib/type-definition-generator.js +8 -13
  20. package/lib/type-definition-generator.js.map +1 -1
  21. package/lib/types/build-type.d.ts +1 -1
  22. package/lib/types/construct-name.d.ts +1 -1
  23. package/lib/types/environment.d.ts +1 -1
  24. package/lib/types/gir-any-element.d.ts +1 -1
  25. package/lib/types/gir-boolean.d.ts +1 -1
  26. package/lib/types/gir-unparsed-number.d.ts +1 -1
  27. package/lib/types/injection-class.d.ts +2 -1
  28. package/lib/types/injection-generic-parameter.d.ts +1 -1
  29. package/lib/types/injection-instance-parameter.d.ts +1 -1
  30. package/lib/types/injection-type.d.ts +1 -1
  31. package/lib/types/local-name-type.d.ts +1 -1
  32. package/lib/types/module-type.d.ts +1 -1
  33. package/lib/types/transformation-case.d.ts +1 -1
  34. package/lib/types/ts-method.d.ts +1 -1
  35. package/lib/types/ts-type-name.d.ts +1 -1
  36. package/lib/types/ts-type-separator.d.ts +1 -1
  37. package/lib/types/type-gir-alias.d.ts +1 -1
  38. package/lib/types/type-gir-class.d.ts +1 -1
  39. package/lib/types/type-gir-element.d.ts +1 -1
  40. package/lib/types/type-gir-enumeration-member.d.ts +1 -1
  41. package/lib/types/type-gir-enumeration.d.ts +1 -1
  42. package/lib/types/type-gir-function.d.ts +1 -1
  43. package/lib/types/type-gir-interface.d.ts +1 -1
  44. package/lib/types/type-gir-method.d.ts +1 -1
  45. package/lib/types/type-gir-parameter.d.ts +1 -1
  46. package/lib/types/type-gir-property.d.ts +1 -1
  47. package/lib/types/type-gir-variable.d.ts +1 -1
  48. package/lib/types/type-ts-element.d.ts +1 -1
  49. package/lib/types/type-ts-enumeration-member.d.ts +1 -1
  50. package/lib/types/type-ts-function.d.ts +1 -1
  51. package/lib/types/type-ts-property.d.ts +1 -1
  52. package/lib/utils.d.ts +10 -3
  53. package/lib/utils.js +4 -6
  54. package/lib/utils.js.map +1 -1
  55. package/package.json +20 -19
  56. package/src/config.ts +42 -59
  57. package/src/conflict-resolver.ts +11 -3
  58. package/src/gir-factory.ts +11 -0
  59. package/src/injection/classes/gjs/GLib-2.0.ts +110 -0
  60. package/src/injection/injector.ts +5 -0
  61. package/src/module-loader.ts +6 -2
  62. package/src/template-processor.ts +1 -1
  63. package/src/type-definition-generator.ts +8 -14
  64. package/src/types/injection-class.ts +2 -2
  65. package/src/utils.ts +5 -10
  66. package/templates/Gjs/Gjs.d.ts +3 -1
  67. package/templates/Gjs/GnomeShell.d.ts +118 -0
  68. package/templates/Gjs/GnomeShell.js +10 -0
  69. package/templates/Gjs/index.d.ts +17 -13
  70. package/templates/Gjs/index.js +1 -1
  71. package/templates/Gjs/misc/extensionUtils.d.ts +99 -0
  72. package/templates/Gjs/misc/extensionUtils.js +6 -0
  73. package/templates/Gjs/cast.ts +0 -52
@@ -1,2 +1,2 @@
1
1
  import type { TsType } from './ts-type.js';
2
- export declare type InjectionType = Partial<TsType>;
2
+ export type InjectionType = Partial<TsType>;
@@ -1 +1 @@
1
- export declare type LocalNameType = 'method' | 'property' | 'field';
1
+ export type LocalNameType = 'method' | 'property' | 'field';
@@ -1 +1 @@
1
- export declare type ModuleType = 'esm' | 'commonjs';
1
+ export type ModuleType = 'esm' | 'commonjs';
@@ -1 +1 @@
1
- export declare type TransformationCase = 'original' | 'lowerCamelCase' | 'upperCamelCase' | 'upperCase' | 'lowerCase' | 'underscores';
1
+ export type TransformationCase = 'original' | 'lowerCamelCase' | 'upperCamelCase' | 'upperCase' | 'lowerCase' | 'underscores';
@@ -2,4 +2,4 @@ import { TsFunction } from './index.js';
2
2
  /**
3
3
  * Holds the data to generate a method in/for Typescript
4
4
  */
5
- export declare type TsMethod = TsFunction;
5
+ export type TsMethod = TsFunction;
@@ -1 +1 @@
1
- export declare type TsTypeName = 'function' | 'method' | 'static-function' | 'interface' | 'event-methods' | 'constructor';
1
+ export type TsTypeName = 'function' | 'method' | 'static-function' | 'interface' | 'event-methods' | 'constructor';
@@ -1 +1 @@
1
- export declare type TsTypeSeparator = '&' | '|';
1
+ export type TsTypeSeparator = '&' | '|';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript `type` */
2
- export declare type TypeGirAlias = 'alias';
2
+ export type TypeGirAlias = 'alias';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript class */
2
- export declare type TypeGirClass = 'class' | 'record' | 'interface' | 'union';
2
+ export type TypeGirClass = 'class' | 'record' | 'interface' | 'union';
@@ -1,3 +1,3 @@
1
1
  import { TypeGirClass, TypeGirMethod, TypeGirVariable, TypeGirAlias, TypeGirEnumeration, TypeGirEnumerationMember, TypeGirInterface, TypeGirParameter, TypeGirProperty, TypeGirFunction } from './index.js';
2
2
  /** Any gir element type */
3
- export declare type TypeGirElement = TypeGirClass | TypeGirMethod | TypeGirVariable | TypeGirAlias | TypeGirEnumeration | TypeGirEnumerationMember | TypeGirInterface | TypeGirParameter | TypeGirProperty | TypeGirFunction;
3
+ export type TypeGirElement = TypeGirClass | TypeGirMethod | TypeGirVariable | TypeGirAlias | TypeGirEnumeration | TypeGirEnumerationMember | TypeGirInterface | TypeGirParameter | TypeGirProperty | TypeGirFunction;
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript enumeration */
2
- export declare type TypeGirEnumerationMember = 'enum-member' | 'bitfield-member';
2
+ export type TypeGirEnumerationMember = 'enum-member' | 'bitfield-member';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript enumeration */
2
- export declare type TypeGirEnumeration = 'enum' | 'bitfield';
2
+ export type TypeGirEnumeration = 'enum' | 'bitfield';
@@ -1 +1 @@
1
- export declare type TypeGirFunction = 'constructor' | 'function' | 'method' | 'static-function' | 'signal' | 'virtual' | 'callback';
1
+ export type TypeGirFunction = 'constructor' | 'function' | 'method' | 'static-function' | 'signal' | 'virtual' | 'callback';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript interface */
2
- export declare type TypeGirInterface = 'callback';
2
+ export type TypeGirInterface = 'callback';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript method (or static function) of a class */
2
- export declare type TypeGirMethod = 'virtual' | 'signal' | 'method' | 'constructor' | 'function' | 'static';
2
+ export type TypeGirMethod = 'virtual' | 'signal' | 'method' | 'constructor' | 'function' | 'static';
@@ -1 +1 @@
1
- export declare type TypeGirParameter = 'callable-param';
1
+ export type TypeGirParameter = 'callable-param';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript field / property */
2
- export declare type TypeGirProperty = 'property' | 'field' | 'constant';
2
+ export type TypeGirProperty = 'property' | 'field' | 'constant';
@@ -1 +1 @@
1
- export declare type TypeGirVariable = 'constant';
1
+ export type TypeGirVariable = 'constant';
@@ -1,3 +1,3 @@
1
1
  import { TypeTsFunction, TypeTsProperty } from './index.js';
2
2
  /** Any typescript element type */
3
- export declare type TypeTsElement = 'class' | 'interface' | 'enum' | 'enum-member' | 'constant' | 'event-methods' | 'type' | TypeTsFunction | TypeTsProperty;
3
+ export type TypeTsElement = 'class' | 'interface' | 'enum' | 'enum-member' | 'constant' | 'event-methods' | 'type' | TypeTsFunction | TypeTsProperty;
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript enumeration */
2
- export declare type TypeTsEnumerationMember = 'enum-member';
2
+ export type TypeTsEnumerationMember = 'enum-member';
@@ -1 +1 @@
1
- export declare type TypeTsFunction = 'static-function' | 'constructor' | 'function' | 'method' | 'event-methods' | 'interface';
1
+ export type TypeTsFunction = 'static-function' | 'constructor' | 'function' | 'method' | 'event-methods' | 'interface';
@@ -1 +1 @@
1
- export declare type TypeTsProperty = 'static-property' | 'property' | 'constructor-property';
1
+ export type TypeTsProperty = 'static-property' | 'property' | 'constructor-property';
package/lib/utils.d.ts CHANGED
@@ -88,9 +88,16 @@ export declare const girElementIsIntrospectable: (girElement?: {
88
88
  export declare const typeIsOptional: (types: TsType[]) => boolean;
89
89
  /**
90
90
  * Given an directory path search for a tsconfig.json or jsconfig.json file in it or any of its parent directories, then read the file and parse it as json.
91
- * @see {@link https://github.com/microsoft/TypeScript/blob/5f9c9a6ccf61fa131849797248438e292e7b496a/src/harness/compilerImpl.ts#L11-L35}
92
- * @see {@link https://github.com/microsoft/TypeScript/blob/3fd8a6e44341f14681aa9d303dc380020ccb2147/src/harness/vfsUtil.ts#L286-L316}
93
91
  *
94
92
  * @param path - The directory path to search for a tsconfig.json or jsconfig.json file
95
93
  */
96
- export declare function readTsJsConfig(path: string): Record<PropertyKey, unknown> | null;
94
+ export declare function readTsJsConfig(path: string): {
95
+ compilerOptions?: import("get-tsconfig").TsConfigJson.CompilerOptions | undefined;
96
+ watchOptions?: import("get-tsconfig").TsConfigJson.WatchOptions | undefined;
97
+ typeAcquisition?: import("get-tsconfig").TsConfigJson.TypeAcquisition | undefined;
98
+ compileOnSave?: boolean | undefined;
99
+ files?: string[] | undefined;
100
+ exclude?: string[] | undefined;
101
+ include?: string[] | undefined;
102
+ references?: import("get-tsconfig").TsConfigJson.References[] | undefined;
103
+ } | null;
package/lib/utils.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import lodash from 'lodash';
3
3
  import Path from 'path';
4
4
  import fs from 'fs';
5
- import ts from 'typescript';
5
+ import { getTsconfig } from 'get-tsconfig';
6
6
  import { fileURLToPath } from 'url';
7
7
  import { inspect } from 'util';
8
8
  import { Logger } from './logger.js';
@@ -189,8 +189,8 @@ export const typeIsOptional = (types) => {
189
189
  };
190
190
  function convertTsJsConfigToObject(path) {
191
191
  try {
192
- const config = ts.parseConfigFileTextToJson(Path.basename(path), fs.readFileSync(path, 'utf8').trim()).config;
193
- if (typeof config === 'object' && !Array.isArray(config))
192
+ const config = getTsconfig(path)?.config;
193
+ if (config)
194
194
  return config;
195
195
  }
196
196
  catch {
@@ -200,8 +200,6 @@ function convertTsJsConfigToObject(path) {
200
200
  }
201
201
  /**
202
202
  * Given an directory path search for a tsconfig.json or jsconfig.json file in it or any of its parent directories, then read the file and parse it as json.
203
- * @see {@link https://github.com/microsoft/TypeScript/blob/5f9c9a6ccf61fa131849797248438e292e7b496a/src/harness/compilerImpl.ts#L11-L35}
204
- * @see {@link https://github.com/microsoft/TypeScript/blob/3fd8a6e44341f14681aa9d303dc380020ccb2147/src/harness/vfsUtil.ts#L286-L316}
205
203
  *
206
204
  * @param path - The directory path to search for a tsconfig.json or jsconfig.json file
207
205
  */
@@ -218,6 +216,6 @@ export function readTsJsConfig(path) {
218
216
  lastPath = currentPath;
219
217
  currentPath = Path.dirname(currentPath);
220
218
  }
221
- return config === false ? null : config;
219
+ return config || null;
222
220
  }
223
221
  //# sourceMappingURL=utils.js.map
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,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AQ,GAAG,WAAW,CAAA;QACtB,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;KAC1C;IAED,OAAO,MAAM,IAAI,IAAI,CAAA;AACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-for-gir/cli",
3
- "version": "3.0.0-beta.5",
3
+ "version": "3.0.0-beta.7",
4
4
  "description": "Typescript .d.ts generator from GIR for gjs and node-gtk",
5
5
  "module": "lib/index.js",
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "scripts": {
14
14
  "start": "yarn node --max_old_space_size=9216 lib/start.js",
15
- "build": "yarn run clear:build && yarn run lint && yarn run build:ts && yarn run chmod",
15
+ "build": "yarn run lint && yarn run build:ts && yarn run chmod",
16
16
  "chmod": "chmod +x ./lib/start.js",
17
17
  "build:ts": "tsc",
18
18
  "clear": "yarn run clear:build",
@@ -40,33 +40,34 @@
40
40
  "@types/change-case": "^2.3.1",
41
41
  "@types/columnify": "^1.5.1",
42
42
  "@types/ejs": "^3.1.1",
43
- "@types/eslint": "8.4.6",
44
- "@types/inquirer": "^9.0.1",
45
- "@types/lodash": "^4.14.185",
46
- "@types/node": "^18.7.18",
47
- "@types/prettier": "^2.7.0",
43
+ "@types/eslint": "8.4.10",
44
+ "@types/inquirer": "^9.0.3",
45
+ "@types/lodash": "^4.14.191",
46
+ "@types/node": "^18.11.18",
47
+ "@types/prettier": "^2.7.2",
48
48
  "@types/xml2js": "^0.4.11",
49
- "@types/yargs": "^17.0.12",
50
- "@typescript-eslint/eslint-plugin": "^5.37.0",
51
- "@typescript-eslint/parser": "^5.37.0",
52
- "eslint": "^8.23.1",
53
- "eslint-config-prettier": "^8.5.0",
49
+ "@types/yargs": "^17.0.19",
50
+ "@typescript-eslint/eslint-plugin": "^5.48.2",
51
+ "@typescript-eslint/parser": "^5.48.2",
52
+ "eslint": "^8.32.0",
53
+ "eslint-config-prettier": "^8.6.0",
54
54
  "eslint-plugin-prettier": "^4.2.1",
55
- "rimraf": "^3.0.2"
55
+ "rimraf": "^4.1.0",
56
+ "typescript": "^4.9.4"
56
57
  },
57
58
  "dependencies": {
58
59
  "colorette": "^2.0.19",
59
60
  "columnify": "^1.6.0",
60
- "cosmiconfig": "^7.0.1",
61
+ "cosmiconfig": "^8.0.0",
61
62
  "ejs": "^3.1.8",
62
63
  "events": "^3.3.0",
63
- "globby": "^13.1.2",
64
- "inquirer": "^9.1.2",
64
+ "get-tsconfig": "^4.3.0",
65
+ "globby": "^13.1.3",
66
+ "inquirer": "^9.1.4",
65
67
  "lodash": "^4.17.21",
66
- "prettier": "^2.7.1",
68
+ "prettier": "^2.8.3",
67
69
  "tiny-glob": "^0.2.9",
68
- "typescript": "^4.8.3",
69
70
  "xml2js": "^0.4.23",
70
- "yargs": "^17.5.1"
71
+ "yargs": "^17.6.2"
71
72
  }
72
73
  }
package/src/config.ts CHANGED
@@ -35,7 +35,7 @@ export class Config {
35
35
  girDirectories: OS.platform() === 'darwin' ? ['/usr/local/share/gir-1.0'] : ['/usr/share/gir-1.0'],
36
36
  modules: ['*'],
37
37
  ignore: [],
38
- verbose: true,
38
+ verbose: false,
39
39
  ignoreVersionConflicts: false,
40
40
  useNamespace: false,
41
41
  buildType: 'lib',
@@ -295,23 +295,12 @@ export class Config {
295
295
  }
296
296
 
297
297
  protected static async validateTsConfig(config: UserConfig): Promise<UserConfig> {
298
- const tsConfig = config.outdir ? readTsJsConfig(config.outdir) : null
299
-
300
- const tsCompilerOptions = (
301
- tsConfig &&
302
- 'compilerOptions' in tsConfig &&
303
- typeof tsConfig.compilerOptions === 'object' &&
304
- tsConfig.compilerOptions != null
305
- ? tsConfig.compilerOptions
306
- : {}
307
- ) as Record<PropertyKey, unknown>
308
-
309
- const tsConfigHasDOMLib =
310
- 'noLib' in tsCompilerOptions && tsCompilerOptions.noLib
311
- ? false // NoLib makes typescript to ignore the lib property
312
- : 'lib' in tsCompilerOptions && Array.isArray(tsCompilerOptions.lib)
313
- ? tsCompilerOptions.lib.some((lib) => String(lib).toLowerCase().startsWith('dom'))
314
- : true // Typescript icludes DOM lib by default
298
+ const tsCompilerOptions = (config.outdir && readTsJsConfig(config.outdir)?.compilerOptions) || {}
299
+ const tsConfigHasDOMLib = tsCompilerOptions.noLib
300
+ ? false // NoLib makes typescript to ignore the lib property
301
+ : Array.isArray(tsCompilerOptions.lib)
302
+ ? tsCompilerOptions.lib.some((lib) => lib.toLowerCase().startsWith('dom'))
303
+ : true // Typescript icludes DOM lib by default
315
304
 
316
305
  if (config.environments.includes('gjs') && tsConfigHasDOMLib && !config.noDOMLib) {
317
306
  const answer = (
@@ -358,7 +347,7 @@ export class Config {
358
347
  * @param options
359
348
  */
360
349
  public static async load(options: ConfigFlags): Promise<UserConfig> {
361
- const configFile = await this.loadConfigFile(options.configName)
350
+ const configFile = (await this.loadConfigFile(options.configName))?.config || {}
362
351
 
363
352
  const config: UserConfig = {
364
353
  environments: options.environments,
@@ -382,96 +371,90 @@ export class Config {
382
371
 
383
372
  if (configFile) {
384
373
  // environments
385
- if (isEqual(config.environments, Config.defaults.environments) && configFile.config.environments) {
386
- config.environments = configFile.config.environments
374
+ if (isEqual(config.environments, Config.defaults.environments) && configFile.environments) {
375
+ config.environments = configFile.environments
387
376
  }
388
377
  // buildType
389
- if (config.buildType === Config.options.buildType.default && configFile.config.buildType) {
390
- config.buildType = configFile.config.buildType
378
+ if (config.buildType === Config.options.buildType.default && configFile.buildType) {
379
+ config.buildType = configFile.buildType
391
380
  }
392
381
  // moduleType
393
- if (config.moduleType === Config.options.moduleType.default && configFile.config.moduleType) {
394
- config.moduleType = configFile.config.moduleType
382
+ if (config.moduleType === Config.options.moduleType.default && configFile.moduleType) {
383
+ config.moduleType = configFile.moduleType
395
384
  }
396
385
  // verbose
397
- if (config.verbose === Config.options.verbose.default && typeof configFile.config.verbose === 'boolean') {
398
- config.verbose = configFile.config.verbose
386
+ if (config.verbose === Config.options.verbose.default && typeof configFile.verbose === 'boolean') {
387
+ config.verbose = configFile.verbose
399
388
  }
400
389
  // ignoreVersionConflicts
401
390
  if (
402
391
  config.ignoreVersionConflicts === Config.options.ignoreVersionConflicts.default &&
403
- typeof configFile.config.ignoreVersionConflicts === 'boolean'
392
+ typeof configFile.ignoreVersionConflicts === 'boolean'
404
393
  ) {
405
- config.ignoreVersionConflicts = configFile.config.ignoreVersionConflicts
394
+ config.ignoreVersionConflicts = configFile.ignoreVersionConflicts
406
395
  }
407
396
  // pretty
408
- if (config.pretty === Config.options.pretty.default && typeof configFile.config.pretty === 'boolean') {
409
- config.pretty = configFile.config.pretty
397
+ if (config.pretty === Config.options.pretty.default && typeof configFile.pretty === 'boolean') {
398
+ config.pretty = configFile.pretty
410
399
  }
411
400
  // print
412
- if (config.print === Config.options.print.default && typeof configFile.config.print === 'boolean') {
413
- config.print = configFile.config.print
401
+ if (config.print === Config.options.print.default && typeof configFile.print === 'boolean') {
402
+ config.print = configFile.print
414
403
  }
415
404
  // outdir
416
- if (config.outdir === Config.options.outdir.default && configFile.config.outdir) {
417
- config.outdir = config.print ? null : configFile.config.outdir
405
+ if (config.outdir === Config.options.outdir.default && configFile.outdir) {
406
+ config.outdir = config.print ? null : configFile.outdir
418
407
  }
419
408
  // girDirectories
420
- if (config.girDirectories === Config.options.girDirectories.default && configFile.config.girDirectories) {
421
- config.girDirectories = configFile.config.girDirectories
409
+ if (config.girDirectories === Config.options.girDirectories.default && configFile.girDirectories) {
410
+ config.girDirectories = configFile.girDirectories
422
411
  }
423
412
  // ignore
424
413
  if (
425
414
  (!config.ignore || config.ignore.length <= 0 || isEqual(config.ignore, Config.defaults.ignore)) &&
426
- configFile.config.ignore
415
+ configFile.ignore
427
416
  ) {
428
- config.ignore = configFile.config.ignore
417
+ config.ignore = configFile.ignore
429
418
  }
430
419
  // modules
431
420
  if (
432
421
  (config.modules.length <= 0 || isEqual(config.modules, Config.defaults.modules)) &&
433
- configFile.config.modules
422
+ configFile.modules
434
423
  ) {
435
- config.modules = configFile.config.modules
424
+ config.modules = configFile.modules
436
425
  }
437
426
  // useNamespace
438
427
  if (
439
428
  config.useNamespace === Config.options.useNamespace.default &&
440
- typeof configFile.config.useNamespace === 'boolean'
429
+ typeof configFile.useNamespace === 'boolean'
441
430
  ) {
442
- config.useNamespace = configFile.config.useNamespace
431
+ config.useNamespace = configFile.useNamespace
443
432
  }
444
433
  // noComments
445
- if (
446
- config.noComments === Config.options.noComments.default &&
447
- typeof configFile.config.noComments === 'boolean'
448
- ) {
449
- config.noComments = configFile.config.noComments
434
+ if (config.noComments === Config.options.noComments.default && typeof configFile.noComments === 'boolean') {
435
+ config.noComments = configFile.noComments
450
436
  }
451
437
  // noDebugComments
452
438
  if (
453
439
  config.noDebugComments === Config.options.noDebugComments.default &&
454
- typeof configFile.config.noDebugComments === 'boolean'
440
+ typeof configFile.noDebugComments === 'boolean'
455
441
  ) {
456
- config.noDebugComments = configFile.config.noDebugComments
442
+ config.noDebugComments = configFile.noDebugComments
457
443
  }
458
444
  // noCheck
459
- if (config.noCheck === Config.options.noCheck.default && typeof configFile.config.noCheck === 'boolean') {
460
- config.noCheck = configFile.config.noCheck
445
+ if (config.noCheck === Config.options.noCheck.default && typeof configFile.noCheck === 'boolean') {
446
+ config.noCheck = configFile.noCheck
461
447
  }
462
448
  // fixConflicts
463
449
  if (
464
450
  config.fixConflicts === Config.options.fixConflicts.default &&
465
- typeof configFile.config.fixConflicts === 'boolean'
451
+ typeof configFile.fixConflicts === 'boolean'
466
452
  ) {
467
- config.fixConflicts = configFile.config.fixConflicts
453
+ config.fixConflicts = configFile.fixConflicts
468
454
  }
469
455
  // noDOMLib
470
- if (
471
- config.noDOMLib === Config.options.noDOMLib.default &&
472
- typeof configFile.config.noDOMLib === 'boolean'
473
- ) {
474
- config.noDOMLib = configFile.config.noDOMLib
456
+ if (config.noDOMLib === Config.options.noDOMLib.default && typeof configFile.noDOMLib === 'boolean') {
457
+ config.noDOMLib = configFile.noDOMLib
475
458
  }
476
459
  }
477
460
 
@@ -978,7 +978,10 @@ export class ConflictResolver {
978
978
  )
979
979
 
980
980
  // Add a function to overload methods if there is not already a compatible version
981
- if (!this.getCompatibleTsFunction(baseFunc.overloads, bFunc)) {
981
+ if (
982
+ !baseFunc.overloads.includes(bFunc) &&
983
+ !this.getCompatibleTsFunction(baseFunc.overloads, bFunc)
984
+ ) {
982
985
  baseFunc.overloads.push(bFunc)
983
986
  }
984
987
  }
@@ -1007,7 +1010,7 @@ export class ConflictResolver {
1007
1010
  // Function vs. Signal
1008
1011
  else if (this.tsElementIsSignal(b.data)) {
1009
1012
  this.log.debug(`${className}.${name} Direct Function vs. Signal`)
1010
- baseFunc.hasUnresolvedConflict = true
1013
+ // Do nothing
1011
1014
  }
1012
1015
  }
1013
1016
 
@@ -1061,7 +1064,12 @@ export class ConflictResolver {
1061
1064
  // Signal vs. Function
1062
1065
  if (this.tsElementIsMethodOrFunction(b.data)) {
1063
1066
  this.log.debug(`${className}.${name} Direct Signal vs. Function`)
1064
- b.data.hasUnresolvedConflict = true
1067
+ const bFunc = b.data as TsFunction
1068
+ const baseSignal = base.data as TsFunction
1069
+ // Add parent class incompatible method as overload
1070
+ if (!this.getCompatibleTsFunction(baseSignal.overloads, bFunc)) {
1071
+ baseSignal.overloads.push(bFunc)
1072
+ }
1065
1073
  }
1066
1074
  }
1067
1075
  // If a element is a constructor
@@ -196,6 +196,17 @@ export class GirFactory {
196
196
  }
197
197
  }
198
198
 
199
+ newGirProperties(
200
+ InjectionProps: InjectionProperty[],
201
+ overrideToAll: Partial<InjectionProperty> = {},
202
+ ): GirPropertyElement[] {
203
+ const result: GirPropertyElement[] = []
204
+ for (const InjectionProp of InjectionProps) {
205
+ result.push(this.newGirProperty({ ...InjectionProp, ...overrideToAll }))
206
+ }
207
+ return result
208
+ }
209
+
199
210
  newTsFunction(tsData: InjectionFunction, parent: TsClass | null): TsFunction {
200
211
  const tsFunc: TsFunction & TsMethod = {
201
212
  ...tsData,
@@ -88,4 +88,114 @@ export const classesGLib20Gjs: InjectionClass[] = [
88
88
  },
89
89
  ],
90
90
  },
91
+ {
92
+ versions: ['2.0'],
93
+ qualifiedName: 'GLib.Error',
94
+ properties: [
95
+ // https://gitlab.gnome.org/GNOME/gjs/-/blob/d1cf26179322b2b87fb980e3b244b5e24dba8dd6/gi/gerror.cpp#L298-305
96
+ {
97
+ name: 'stack',
98
+ type: [{ type: 'string' }],
99
+ girTypeName: 'property',
100
+ doc: {
101
+ text: 'The stack trace of the error.',
102
+ tags: [
103
+ {
104
+ tagName: '@field',
105
+ paramName: '',
106
+ text: '',
107
+ },
108
+ ],
109
+ },
110
+ },
111
+ {
112
+ name: 'source',
113
+ type: [{ type: 'string' }],
114
+ girTypeName: 'property',
115
+ doc: {
116
+ text: 'The name of the file where is the source of the error.',
117
+ tags: [
118
+ {
119
+ tagName: '@field',
120
+ paramName: '',
121
+ text: '',
122
+ },
123
+ ],
124
+ },
125
+ },
126
+ {
127
+ name: 'line',
128
+ type: [{ type: 'number' }],
129
+ girTypeName: 'property',
130
+ doc: {
131
+ text: 'The line number of the source of the error.',
132
+ tags: [
133
+ {
134
+ tagName: '@field',
135
+ paramName: '',
136
+ text: '',
137
+ },
138
+ ],
139
+ },
140
+ },
141
+ {
142
+ name: 'column',
143
+ type: [{ type: 'number' }],
144
+ girTypeName: 'property',
145
+ doc: {
146
+ text: 'The column number of the source of the error.',
147
+ tags: [
148
+ {
149
+ tagName: '@field',
150
+ paramName: '',
151
+ text: '',
152
+ },
153
+ ],
154
+ },
155
+ },
156
+ ],
157
+ methods: [
158
+ // https://gitlab.gnome.org/GNOME/gjs/-/blob/33d58646d43b84d4c0ffc3681b89d125d5ccdfc6/installed-tests/js/testExceptions.js#L119-123
159
+ // https://gjs-docs.gnome.org/glib20~2.66.1/glib.error#constructor-new_literal
160
+ {
161
+ name: 'constructor',
162
+ isStatic: true,
163
+ returnTypes: [{ type: 'GLib.Error' }],
164
+ inParams: [
165
+ {
166
+ name: 'domain',
167
+ type: [{ type: 'GLib.Quark' }],
168
+ },
169
+ {
170
+ name: 'code',
171
+ type: [{ type: 'number' }],
172
+ },
173
+ {
174
+ name: 'message',
175
+ type: [{ type: 'string' }],
176
+ },
177
+ ],
178
+ girTypeName: 'constructor',
179
+ },
180
+ {
181
+ name: 'new',
182
+ returnTypes: [{ type: 'GLib.Error' }],
183
+ inParams: [
184
+ {
185
+ name: 'domain',
186
+ type: [{ type: 'GLib.Quark' }],
187
+ },
188
+ {
189
+ name: 'code',
190
+ type: [{ type: 'number' }],
191
+ },
192
+ {
193
+ name: 'message',
194
+ type: [{ type: 'string' }],
195
+ },
196
+ ],
197
+ girTypeName: 'constructor',
198
+ },
199
+ ],
200
+ },
91
201
  ]