@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.
- package/README.md +15 -6
- package/lib/config.js +40 -48
- package/lib/config.js.map +1 -1
- package/lib/conflict-resolver.js +9 -3
- package/lib/conflict-resolver.js.map +1 -1
- package/lib/gir-factory.d.ts +1 -0
- package/lib/gir-factory.js +7 -0
- package/lib/gir-factory.js.map +1 -1
- package/lib/injection/classes/gjs/GLib-2.0.js +110 -0
- package/lib/injection/classes/gjs/GLib-2.0.js.map +1 -1
- package/lib/injection/injector.js +3 -0
- package/lib/injection/injector.js.map +1 -1
- package/lib/module-loader.d.ts +1 -1
- package/lib/module-loader.js +7 -2
- package/lib/module-loader.js.map +1 -1
- package/lib/template-processor.js +1 -1
- package/lib/template-processor.js.map +1 -1
- package/lib/type-definition-generator.d.ts +0 -1
- package/lib/type-definition-generator.js +8 -13
- package/lib/type-definition-generator.js.map +1 -1
- package/lib/types/build-type.d.ts +1 -1
- package/lib/types/construct-name.d.ts +1 -1
- package/lib/types/environment.d.ts +1 -1
- package/lib/types/gir-any-element.d.ts +1 -1
- package/lib/types/gir-boolean.d.ts +1 -1
- package/lib/types/gir-unparsed-number.d.ts +1 -1
- package/lib/types/injection-class.d.ts +2 -1
- package/lib/types/injection-generic-parameter.d.ts +1 -1
- package/lib/types/injection-instance-parameter.d.ts +1 -1
- package/lib/types/injection-type.d.ts +1 -1
- package/lib/types/local-name-type.d.ts +1 -1
- package/lib/types/module-type.d.ts +1 -1
- package/lib/types/transformation-case.d.ts +1 -1
- package/lib/types/ts-method.d.ts +1 -1
- package/lib/types/ts-type-name.d.ts +1 -1
- package/lib/types/ts-type-separator.d.ts +1 -1
- package/lib/types/type-gir-alias.d.ts +1 -1
- package/lib/types/type-gir-class.d.ts +1 -1
- package/lib/types/type-gir-element.d.ts +1 -1
- package/lib/types/type-gir-enumeration-member.d.ts +1 -1
- package/lib/types/type-gir-enumeration.d.ts +1 -1
- package/lib/types/type-gir-function.d.ts +1 -1
- package/lib/types/type-gir-interface.d.ts +1 -1
- package/lib/types/type-gir-method.d.ts +1 -1
- package/lib/types/type-gir-parameter.d.ts +1 -1
- package/lib/types/type-gir-property.d.ts +1 -1
- package/lib/types/type-gir-variable.d.ts +1 -1
- package/lib/types/type-ts-element.d.ts +1 -1
- package/lib/types/type-ts-enumeration-member.d.ts +1 -1
- package/lib/types/type-ts-function.d.ts +1 -1
- package/lib/types/type-ts-property.d.ts +1 -1
- package/lib/utils.d.ts +10 -3
- package/lib/utils.js +4 -6
- package/lib/utils.js.map +1 -1
- package/package.json +20 -19
- package/src/config.ts +42 -59
- package/src/conflict-resolver.ts +11 -3
- package/src/gir-factory.ts +11 -0
- package/src/injection/classes/gjs/GLib-2.0.ts +110 -0
- package/src/injection/injector.ts +5 -0
- package/src/module-loader.ts +6 -2
- package/src/template-processor.ts +1 -1
- package/src/type-definition-generator.ts +8 -14
- package/src/types/injection-class.ts +2 -2
- package/src/utils.ts +5 -10
- package/templates/Gjs/Gjs.d.ts +3 -1
- package/templates/Gjs/GnomeShell.d.ts +118 -0
- package/templates/Gjs/GnomeShell.js +10 -0
- package/templates/Gjs/index.d.ts +17 -13
- package/templates/Gjs/index.js +1 -1
- package/templates/Gjs/misc/extensionUtils.d.ts +99 -0
- package/templates/Gjs/misc/extensionUtils.js +6 -0
- package/templates/Gjs/cast.ts +0 -52
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { TsType } from './ts-type.js';
|
|
2
|
-
export
|
|
2
|
+
export type InjectionType = Partial<TsType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type LocalNameType = 'method' | 'property' | 'field';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ModuleType = 'esm' | 'commonjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type TransformationCase = 'original' | 'lowerCamelCase' | 'upperCamelCase' | 'upperCase' | 'lowerCase' | 'underscores';
|
package/lib/types/ts-method.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type TsTypeName = 'function' | 'method' | 'static-function' | 'interface' | 'event-methods' | 'constructor';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type TsTypeSeparator = '&' | '|';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** All gir elements which can be a typescript `type` */
|
|
2
|
-
export
|
|
2
|
+
export type TypeGirAlias = 'alias';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** All gir elements which can be a typescript class */
|
|
2
|
-
export
|
|
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
|
|
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
|
|
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
|
|
2
|
+
export type TypeGirEnumeration = 'enum' | 'bitfield';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
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
|
|
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
|
|
2
|
+
export type TypeGirMethod = 'virtual' | 'signal' | 'method' | 'constructor' | 'function' | 'static';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type TypeGirParameter = 'callable-param';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** All gir elements which can be a typescript field / property */
|
|
2
|
-
export
|
|
2
|
+
export type TypeGirProperty = 'property' | 'field' | 'constant';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
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
|
|
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
|
|
2
|
+
export type TypeTsEnumerationMember = 'enum-member';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type TypeTsFunction = 'static-function' | 'constructor' | 'function' | 'method' | 'event-methods' | 'interface';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
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):
|
|
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
|
|
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 =
|
|
193
|
-
if (
|
|
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
|
|
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,
|
|
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,WAAW,EAAwB,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA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I;QACA,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;QACxC,IAAI,MAAM;YAAE,OAAO,MAAM,CAAA;KAC5B;IAAC,MAAM;QACJ,UAAU;KACb;IACD,OAAO,IAAI,CAAA;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACvC,IAAI,MAAM,GAAwC,IAAI,CAAA;IACtD,IAAI,QAAQ,GAAG,EAAE,CAAA;IACjB,IAAI,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACpC,OAAO,CAAC,MAAM,IAAI,WAAW,KAAK,QAAQ,EAAE;QACxC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAA;QAC5D,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAA;QAC5D,MAAM;YACF,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,yBAAyB,CAAC,YAAY,CAAC,CAAC;gBACxE,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,yBAAyB,CAAC,YAAY,CAAC,CAAC,CAAA;QAC5E,QAAQ,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.
|
|
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
|
|
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.
|
|
44
|
-
"@types/inquirer": "^9.0.
|
|
45
|
-
"@types/lodash": "^4.14.
|
|
46
|
-
"@types/node": "^18.
|
|
47
|
-
"@types/prettier": "^2.7.
|
|
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.
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
51
|
-
"@typescript-eslint/parser": "^5.
|
|
52
|
-
"eslint": "^8.
|
|
53
|
-
"eslint-config-prettier": "^8.
|
|
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": "^
|
|
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": "^
|
|
61
|
+
"cosmiconfig": "^8.0.0",
|
|
61
62
|
"ejs": "^3.1.8",
|
|
62
63
|
"events": "^3.3.0",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
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.
|
|
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.
|
|
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:
|
|
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
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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.
|
|
386
|
-
config.environments = configFile.
|
|
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.
|
|
390
|
-
config.buildType = configFile.
|
|
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.
|
|
394
|
-
config.moduleType = configFile.
|
|
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.
|
|
398
|
-
config.verbose = configFile.
|
|
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.
|
|
392
|
+
typeof configFile.ignoreVersionConflicts === 'boolean'
|
|
404
393
|
) {
|
|
405
|
-
config.ignoreVersionConflicts = configFile.
|
|
394
|
+
config.ignoreVersionConflicts = configFile.ignoreVersionConflicts
|
|
406
395
|
}
|
|
407
396
|
// pretty
|
|
408
|
-
if (config.pretty === Config.options.pretty.default && typeof configFile.
|
|
409
|
-
config.pretty = configFile.
|
|
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.
|
|
413
|
-
config.print = configFile.
|
|
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.
|
|
417
|
-
config.outdir = config.print ? null : configFile.
|
|
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.
|
|
421
|
-
config.girDirectories = configFile.
|
|
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.
|
|
415
|
+
configFile.ignore
|
|
427
416
|
) {
|
|
428
|
-
config.ignore = configFile.
|
|
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.
|
|
422
|
+
configFile.modules
|
|
434
423
|
) {
|
|
435
|
-
config.modules = configFile.
|
|
424
|
+
config.modules = configFile.modules
|
|
436
425
|
}
|
|
437
426
|
// useNamespace
|
|
438
427
|
if (
|
|
439
428
|
config.useNamespace === Config.options.useNamespace.default &&
|
|
440
|
-
typeof configFile.
|
|
429
|
+
typeof configFile.useNamespace === 'boolean'
|
|
441
430
|
) {
|
|
442
|
-
config.useNamespace = configFile.
|
|
431
|
+
config.useNamespace = configFile.useNamespace
|
|
443
432
|
}
|
|
444
433
|
// noComments
|
|
445
|
-
if (
|
|
446
|
-
config.noComments
|
|
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.
|
|
440
|
+
typeof configFile.noDebugComments === 'boolean'
|
|
455
441
|
) {
|
|
456
|
-
config.noDebugComments = configFile.
|
|
442
|
+
config.noDebugComments = configFile.noDebugComments
|
|
457
443
|
}
|
|
458
444
|
// noCheck
|
|
459
|
-
if (config.noCheck === Config.options.noCheck.default && typeof configFile.
|
|
460
|
-
config.noCheck = configFile.
|
|
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.
|
|
451
|
+
typeof configFile.fixConflicts === 'boolean'
|
|
466
452
|
) {
|
|
467
|
-
config.fixConflicts = configFile.
|
|
453
|
+
config.fixConflicts = configFile.fixConflicts
|
|
468
454
|
}
|
|
469
455
|
// noDOMLib
|
|
470
|
-
if (
|
|
471
|
-
config.noDOMLib
|
|
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
|
|
package/src/conflict-resolver.ts
CHANGED
|
@@ -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 (
|
|
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
|
-
|
|
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
|
|
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
|
package/src/gir-factory.ts
CHANGED
|
@@ -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
|
]
|