@ts-for-gir/generator-typescript 4.0.0-beta.7 → 4.0.0-beta.8
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 +3 -3
- package/templates/gjs/gjs.d.ts +165 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-for-gir/generator-typescript",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.8",
|
|
4
4
|
"description": "TypeScript type definition generator for ts-for-gir",
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"typescript": "^5.5.3"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@ts-for-gir/generator-base": "^4.0.0-beta.
|
|
58
|
-
"@ts-for-gir/lib": "^4.0.0-beta.
|
|
57
|
+
"@ts-for-gir/generator-base": "^4.0.0-beta.8",
|
|
58
|
+
"@ts-for-gir/lib": "^4.0.0-beta.8",
|
|
59
59
|
"ejs": "^3.1.10",
|
|
60
60
|
"xml2js": "^0.6.2"
|
|
61
61
|
}
|
package/templates/gjs/gjs.d.ts
CHANGED
|
@@ -40,33 +40,168 @@ declare namespace package {
|
|
|
40
40
|
* and all the other have their values derived from them.
|
|
41
41
|
*/
|
|
42
42
|
interface PackageInitParams {
|
|
43
|
+
/** The base name of the entry point (eg. org.foo.Bar.App) */
|
|
43
44
|
name: string
|
|
45
|
+
/** The version of the package */
|
|
44
46
|
version: string
|
|
47
|
+
/** The prefix of the package */
|
|
45
48
|
prefix: string
|
|
49
|
+
/**
|
|
50
|
+
* The final datadir and libdir when installed;
|
|
51
|
+
* usually, these would be prefix + '/share' and
|
|
52
|
+
* and prefix + '/lib' (or '/lib64')
|
|
53
|
+
*/
|
|
46
54
|
libdir: string
|
|
55
|
+
/**
|
|
56
|
+
* The final datadir and libdir when installed;
|
|
57
|
+
* usually, these would be prefix + '/share' and
|
|
58
|
+
* and prefix + '/lib' (or '/lib64')
|
|
59
|
+
*/
|
|
60
|
+
datadir?: string
|
|
47
61
|
}
|
|
48
62
|
|
|
63
|
+
/** The base name of the entry point (eg. org.foo.Bar.App) */
|
|
49
64
|
export const name: string | undefined
|
|
65
|
+
/** The version of the package */
|
|
50
66
|
export const version: string | undefined
|
|
67
|
+
/** The prefix of the package */
|
|
51
68
|
export const prefix: string | undefined
|
|
69
|
+
/** The final datadir when installed; usually, these would be prefix + '/share' */
|
|
52
70
|
export const datadir: string | undefined
|
|
71
|
+
/** The final libdir when installed; usually, these would be prefix + '/lib' (or '/lib64') */
|
|
53
72
|
export const libdir: string | undefined
|
|
73
|
+
/** The final pkgdatadir when installed; usually, this would be prefix + '/share' */
|
|
54
74
|
export const pkgdatadir: string | undefined
|
|
75
|
+
/** The final pkglibdir when installed; usually, this would be prefix + '/lib' (or '/lib64') */
|
|
55
76
|
export const pkglibdir: string | undefined
|
|
77
|
+
/** The final moduledir when installed; usually, this would be prefix + '/lib' (or '/lib64') */
|
|
56
78
|
export const moduledir: string | undefined
|
|
79
|
+
/** The directory containing gettext translation files; this will be datadir + '/locale' when installed and './po' in the source tree */
|
|
57
80
|
export const localedir: string | undefined
|
|
58
81
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Initialize directories and global variables. Must be called
|
|
84
|
+
* before any of other API in Package is used.
|
|
85
|
+
* `params` must be an object with at least the following keys:
|
|
86
|
+
* - name: the package name ($(PACKAGE_NAME) in autotools,
|
|
87
|
+
* eg. org.foo.Bar)
|
|
88
|
+
* - version: the package version
|
|
89
|
+
* - prefix: the installation prefix
|
|
90
|
+
*
|
|
91
|
+
* init() will take care to check if the program is running from
|
|
92
|
+
* the source directory or not, by looking for a 'src' directory.
|
|
93
|
+
*
|
|
94
|
+
* At the end, the global variable 'pkg' will contain the
|
|
95
|
+
* Package module (imports.package). Additionally, the following
|
|
96
|
+
* module variables will be available:
|
|
97
|
+
* - name: the base name of the entry point (eg. org.foo.Bar.App)
|
|
98
|
+
* - version: same as in @params
|
|
99
|
+
* - prefix: the installation prefix (as passed in @params)
|
|
100
|
+
* - datadir, libdir: the final datadir and libdir when installed;
|
|
101
|
+
* usually, these would be prefix + '/share' and
|
|
102
|
+
* and prefix + '/lib' (or '/lib64')
|
|
103
|
+
* - pkgdatadir: the directory to look for private data files, such as
|
|
104
|
+
* images, stylesheets and UI definitions;
|
|
105
|
+
* this will be datadir + name when installed and
|
|
106
|
+
* './data' when running from the source tree
|
|
107
|
+
* - pkglibdir: the directory to look for private typelibs and C
|
|
108
|
+
* libraries;
|
|
109
|
+
* this will be libdir + name when installed and
|
|
110
|
+
* './lib' when running from the source tree
|
|
111
|
+
* - moduledir: the directory to look for JS modules;
|
|
112
|
+
* this will be pkglibdir when installed and
|
|
113
|
+
* './src' when running from the source tree
|
|
114
|
+
* - localedir: the directory containing gettext translation files;
|
|
115
|
+
* this will be datadir + '/locale' when installed
|
|
116
|
+
* and './po' in the source tree
|
|
117
|
+
*
|
|
118
|
+
* All paths are absolute and will not end with '/'.
|
|
119
|
+
*
|
|
120
|
+
* As a side effect, init() calls GLib.set_prgname().
|
|
121
|
+
*
|
|
122
|
+
* @param {object} params package parameters
|
|
123
|
+
*/
|
|
124
|
+
export function init(params: PackageInitParams): void;
|
|
125
|
+
/**
|
|
126
|
+
* This is the function to use if you want to have multiple
|
|
127
|
+
* entry points in one package.
|
|
128
|
+
* You must define a main(ARGV) function inside the passed
|
|
129
|
+
* in module, and then the launcher would be
|
|
130
|
+
*
|
|
131
|
+
* imports.package.init(...);
|
|
132
|
+
* imports.package.run(imports.entrypoint);
|
|
133
|
+
*
|
|
134
|
+
* @param module the module to run
|
|
135
|
+
* @returns the exit code of the module's main() function
|
|
136
|
+
*/
|
|
137
|
+
export function run(module: { main: (argv: string[]) => void }): number | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* This is a convenience function if your package has a
|
|
140
|
+
* single entry point.
|
|
141
|
+
* You must define a main(ARGV) function inside a main.js
|
|
142
|
+
* module in moduledir.
|
|
143
|
+
*
|
|
144
|
+
* @param params see init()
|
|
145
|
+
*/
|
|
146
|
+
export function start(params: PackageInitParams): void;
|
|
147
|
+
/**
|
|
148
|
+
* Mark a dependency on a specific version of one or more
|
|
149
|
+
* external GI typelibs.
|
|
150
|
+
* `libs` must be an object whose keys are a typelib name,
|
|
151
|
+
* and values are the respective version. The empty string
|
|
152
|
+
* indicates any version.
|
|
153
|
+
* @param deps The external dependencies to import
|
|
154
|
+
*/
|
|
155
|
+
export function require(deps: Record<string, string>): void;
|
|
156
|
+
/**
|
|
157
|
+
* As checkSymbol(), but exit with an error if the
|
|
158
|
+
* dependency cannot be satisfied.
|
|
159
|
+
*
|
|
160
|
+
* @param lib an external dependency to import
|
|
161
|
+
* @param ver version of the dependency
|
|
162
|
+
* @param symbol symbol to check for
|
|
163
|
+
*/
|
|
164
|
+
export function requireSymbol(lib: string, ver?: string, symbol?: string): void;
|
|
165
|
+
/**
|
|
166
|
+
* Check whether an external GI typelib can be imported
|
|
167
|
+
* and provides @symbol.
|
|
168
|
+
*
|
|
169
|
+
* Symbols may refer to
|
|
170
|
+
* - global functions ('main_quit')
|
|
171
|
+
* - classes ('Window')
|
|
172
|
+
* - class / instance methods ('IconTheme.get_default' / 'IconTheme.has_icon')
|
|
173
|
+
* - GObject properties ('Window.default_height')
|
|
174
|
+
*
|
|
175
|
+
* @param lib an external dependency to import
|
|
176
|
+
* @param ver version of the dependency
|
|
177
|
+
* @param symbol symbol to check for
|
|
178
|
+
* @returns true if `lib` can be imported and provides `symbol`, false
|
|
179
|
+
* otherwise
|
|
180
|
+
*/
|
|
181
|
+
export function checkSymbol(lib: string, ver: string, symbol: string): boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Initialize `gettext`.
|
|
184
|
+
* After calling this method `globalThis._`, `globalThis.C_` and `globalThis.N_` will be available.
|
|
185
|
+
*/
|
|
186
|
+
export function initGettext(): void;
|
|
187
|
+
/**
|
|
188
|
+
* @deprecated Use JS string interpolation
|
|
189
|
+
*/
|
|
190
|
+
export function initFormat(): void;
|
|
191
|
+
/**
|
|
192
|
+
* As checkSymbol(), but exit with an error if the
|
|
193
|
+
* dependency cannot be satisfied.
|
|
194
|
+
*
|
|
195
|
+
* @param lib an external dependency to import
|
|
196
|
+
* @param ver version of the dependency
|
|
197
|
+
* @param symbol symbol to check for
|
|
198
|
+
*/
|
|
199
|
+
export function initSubmodule(lib: string, ver?: string, symbol?: string): void;
|
|
200
|
+
/**
|
|
201
|
+
* Load and register a GResource named @name. @name is optional and defaults to ${package-name}
|
|
202
|
+
* @param name The name of the GResource to load
|
|
203
|
+
*/
|
|
204
|
+
export function loadResource(name?: string): void;
|
|
70
205
|
}
|
|
71
206
|
|
|
72
207
|
declare namespace byteArray {
|
|
@@ -447,9 +582,27 @@ declare global {
|
|
|
447
582
|
cairo: typeof cairo
|
|
448
583
|
}
|
|
449
584
|
|
|
585
|
+
// Overwrites, see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/script/package.js
|
|
586
|
+
/**
|
|
587
|
+
* Run `pkg.initGettext()` before using this.
|
|
588
|
+
* See {@link gettext.gettext}
|
|
589
|
+
*/
|
|
590
|
+
const _: undefined | typeof gettext.gettext
|
|
591
|
+
/**
|
|
592
|
+
* Run `pkg.initGettext()` before using this.
|
|
593
|
+
* See {@link gettext.pgettext}
|
|
594
|
+
*/
|
|
595
|
+
const C_: undefined | typeof gettext.pgettext
|
|
596
|
+
/**
|
|
597
|
+
* Run `pkg.initGettext()` before using this.
|
|
598
|
+
* Currently not implemented.
|
|
599
|
+
*/
|
|
600
|
+
const N_: undefined | ((x: string) => string)
|
|
601
|
+
|
|
450
602
|
function print(...args: any[]): void
|
|
451
603
|
function printerr(...args: any[]): void
|
|
452
|
-
function log(
|
|
604
|
+
function log(obj: object, others?: object[]): void;
|
|
605
|
+
function log(msg: string, substitutions?: any[]): void;
|
|
453
606
|
function logError(exception: object, message?: any): void
|
|
454
607
|
function logError(message?: any): void
|
|
455
608
|
|