@girs/gjs 3.3.0 → 4.0.0-beta.2

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
@@ -4,7 +4,7 @@
4
4
  ![version](https://img.shields.io/npm/v/@girs/gjs)
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/gjs)
6
6
 
7
- GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.3.0.
7
+ GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.2.
8
8
 
9
9
  [GJS](https://gitlab.gnome.org/GNOME/gjs) is a JavaScript runtime for the GNOME ecosystem. Using GJS and the type definitions in this NPM package, you can build GTK applications in JavaScript or TypeScript with type checking, better autocompletion and inline documentations.
10
10
 
package/cairo.d.ts CHANGED
@@ -4,5 +4,3 @@ declare const Cairo: any;
4
4
  export default Cairo;
5
5
 
6
6
 
7
-
8
-
package/cairo.js CHANGED
@@ -1,8 +1,6 @@
1
-
2
1
  import Cairo from 'cairo';
3
2
 
4
3
  // cairo doesn't have named exports, see https://gitlab.gnome.org/GNOME/gjs/-/blob/c2a714f348d6848037f072063e0a914fd537c4f4/installed-tests/js/testCairoModule.js#L14
5
4
  export default Cairo;
6
5
 
7
6
 
8
-
package/gettext.js CHANGED
@@ -1,8 +1,6 @@
1
-
2
1
  import Gettext, { setlocale, textdomain, bindtextdomain, gettext, dgettext, dcgettext, ngettext, dngettext, pgettext, dpgettext, domain } from 'gettext';
3
2
 
4
3
  export { setlocale, textdomain, bindtextdomain, gettext, dgettext, dcgettext, ngettext, dngettext, pgettext, dpgettext, domain }
5
4
  export default Gettext;
6
5
 
7
6
 
8
-
package/gjs.js CHANGED
@@ -2,5 +2,5 @@ const imports = globalThis.imports || {};
2
2
 
3
3
  export { imports }
4
4
  export default imports;
5
-
5
+
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/gjs",
3
- "version": "3.3.0",
3
+ "version": "4.0.0-beta.2",
4
4
  "description": "GJS TypeScript type definitions for Gjs",
5
5
  "type": "module",
6
6
  "module": "gjs.js",
@@ -8,61 +8,41 @@
8
8
  "exports": {
9
9
  "./ambient": {
10
10
  "types": "./ambient.d.ts",
11
+ "import": "./ambient.js",
11
12
  "default": "./ambient.js"
12
13
  },
14
+ "./dom": {
15
+ "types": "./dom.d.ts",
16
+ "import": "./dom.js",
17
+ "default": "./dom.js"
18
+ },
13
19
  "./gettext": {
14
- "import": {
15
- "types": "./gettext.d.ts",
16
- "default": "./gettext.js"
17
- },
18
- "require": {
19
- "types": "./gettext.d.cts",
20
- "default": "./gettext.cjs"
21
- }
20
+ "types": "./gettext.d.ts",
21
+ "import": "./gettext.js",
22
+ "default": "./gettext.js"
22
23
  },
23
24
  "./system": {
24
- "import": {
25
- "types": "./system.d.ts",
26
- "default": "./system.js"
27
- },
28
- "require": {
29
- "types": "./system.d.cts",
30
- "default": "./system.cjs"
31
- }
25
+ "types": "./system.d.ts",
26
+ "import": "./system.js",
27
+ "default": "./system.js"
32
28
  },
33
29
  "./cairo": {
34
- "import": {
35
- "types": "./cairo.d.ts",
36
- "default": "./cairo.js"
37
- },
38
- "require": {
39
- "types": "./cairo.d.cts",
40
- "default": "./cairo.cjs"
41
- }
42
- },
43
- "./dom": {
44
- "types": "./dom.d.ts",
45
- "default": "./dom.js"
30
+ "types": "./cairo.d.ts",
31
+ "import": "./cairo.js",
32
+ "default": "./cairo.js"
46
33
  },
47
34
  ".": {
48
- "import": {
49
- "types": "./gjs.d.ts",
50
- "default": "./gjs.js"
51
- },
52
- "require": {
53
- "types": "./gjs.d.cts",
54
- "default": "./gjs.cjs"
55
- }
35
+ "types": "./gjs.d.ts",
36
+ "import": "./gjs.js",
37
+ "default": "./gjs.js"
56
38
  }
57
39
  },
58
40
  "scripts": {
59
- "test": "yarn test:esm && yarn test:cjs",
60
- "test:esm": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gjs.d.ts",
61
- "test:cjs": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gjs.d.cts"
41
+ "test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gjs.d.ts"
62
42
  },
63
43
  "dependencies": {
64
- "@girs/glib-2.0": "^2.78.0-3.3.0",
65
- "@girs/gobject-2.0": "^2.78.0-3.3.0"
44
+ "@girs/glib-2.0": "^2.80.0-4.0.0-beta.2",
45
+ "@girs/gobject-2.0": "^2.80.0-4.0.0-beta.2"
66
46
  },
67
47
  "devDependencies": {
68
48
  "typescript": "*"
package/system.js CHANGED
@@ -1,7 +1,5 @@
1
-
2
1
  import System, { programInvocationName, version, programPath, programArgs, exit, addressOfGObject, addressOf, gc, refcount, dumpHeap, dumpMemoryInfo } from 'system';
3
2
 
4
3
  export { programInvocationName, version, programPath, programArgs, exit, addressOfGObject, addressOf, gc, refcount, dumpHeap, dumpMemoryInfo };
5
4
  export default System;
6
5
 
7
-
package/cairo.cjs DELETED
@@ -1,8 +0,0 @@
1
-
2
- const Cairo = imports.cairo;
3
-
4
- module.exports = Cairo;
5
- exports.default = Cairo;
6
-
7
-
8
-
package/cairo.d.cts DELETED
@@ -1,10 +0,0 @@
1
- // TODO: See ./cairo-1.0.d.ts
2
- declare const Cairo: any;
3
-
4
- export default Cairo;
5
-
6
-
7
- // TODO declare named exports here, cairo doesn't have named exports for its esm module but for cjs we can use `const { Context } = imports.cairo` for that, see `./cairo.js`
8
-
9
-
10
-
package/gettext.cjs DELETED
@@ -1,8 +0,0 @@
1
-
2
- const Gettext = imports.gettext;
3
-
4
- module.exports = Gettext;
5
- exports.default = Gettext;
6
-
7
-
8
-
package/gettext.d.cts DELETED
@@ -1,42 +0,0 @@
1
- export enum LocaleCategory {
2
- ALL,
3
- COLLATE,
4
- CTYPE,
5
- MESSAGES,
6
- MONETARY,
7
- NUMERIC,
8
- TIME,
9
- }
10
- export function setlocale(category: number, locale: string | null): string
11
- export function textdomain(domainname: string | null): string
12
- export function bindtextdomain(domainname: string, dirname: string | null): string
13
- export function gettext(msgid: string): string
14
- export function dgettext(domainname: string | null, msgid: string): string
15
- export function dcgettext(domainname: string | null, msgid: string, category: number): string
16
- export function ngettext(msgid: string, msgid_plural: string, n: number): string
17
- export function dngettext(domainname: string, msgid: string, msgid_plural: string, n: number): string
18
- export function pgettext(context: string, msgid: string): string
19
- export function dpgettext(dom: string | null, context: string, msgid: string): string
20
- export function domain(domainName: string): {
21
- gettext: (msgid: string) => string
22
- ngettext: (msgid: string, msgid_plural: string, n: number) => string
23
- pgettext: (context: string, msgid: string) => string
24
- }
25
-
26
- declare const Gettext: {
27
- LocaleCategory: typeof LocaleCategory,
28
- setlocale: typeof setlocale,
29
- textdomain: typeof textdomain,
30
- bindtextdomain: typeof bindtextdomain,
31
- gettext: typeof gettext,
32
- dgettext: typeof dgettext,
33
- dcgettext: typeof dcgettext,
34
- ngettext: typeof ngettext,
35
- dngettext: typeof dngettext,
36
- pgettext: typeof pgettext,
37
- dpgettext: typeof dpgettext,
38
- domain: typeof domain,
39
- }
40
-
41
- export default Gettext
42
-
package/gjs.cjs DELETED
@@ -1,6 +0,0 @@
1
- const imports = globalThis.imports || {};
2
-
3
- module.exports = imports;
4
- exports.default = imports;
5
-
6
-
package/gjs.d.cts DELETED
@@ -1,459 +0,0 @@
1
- /*
2
- * Type Definitions for Gjs (https://gjs.guide/)
3
- *
4
- * These type definitions are automatically generated, do not edit them by hand.
5
- * If you found a bug fix it in ts-for-gir itself or create a bug report on https://github.com/gjsify/ts-for-gir
6
- */
7
- import './ambient.d.ts';
8
-
9
- import type GObject from '@girs/gobject-2.0';
10
- import type GLib from '@girs/glib-2.0';
11
- import gettext from './gettext.js';
12
- import system from './system.js';
13
- import cairo from './cairo.js';
14
-
15
- // https://gitlab.gnome.org/GNOME/gjs/-/blob/1.72.0/modules/script/package.js
16
- declare namespace package {
17
- /**
18
- * Although there are references in the documentation of more properties that
19
- * this object should accepts, only the following are actually used in the init code,
20
- * and all the other have their values derived from them.
21
- */
22
- interface PackageInitParams {
23
- name: string
24
- version: string
25
- prefix: string
26
- libdir: string
27
- }
28
-
29
- export const name: string | undefined
30
- export const version: string | undefined
31
- export const prefix: string | undefined
32
- export const datadir: string | undefined
33
- export const libdir: string | undefined
34
- export const pkgdatadir: string | undefined
35
- export const pkglibdir: string | undefined
36
- export const moduledir: string | undefined
37
- export const localedir: string | undefined
38
-
39
- export function init(params: PackageInitParams): void
40
- export function run(module: { main: (argv: string[]) => void }): void
41
- /** shortcut to init+run */
42
- export function start(params: PackageInitParams): void
43
- export function require(libs: Record<string, string>): void
44
- export function requireSymbol(lib: string, ver: string, symbol: string): void
45
- export function checkSymbol(lib: string, ver: string, symbol: string): void
46
- export function initGettext(): void
47
- /** @deprecated Use JS string interpolation */
48
- export function initFormat(): void
49
- export function initSubmodule(module: string): void
50
- }
51
-
52
- declare namespace byteArray {
53
- export class ByteArray {
54
- static get(target: any, property: string, receiver: any): any
55
- static set(target: any, property: string, value: any, receiver: any): boolean
56
-
57
- length: number
58
- protected _array: Uint8Array
59
-
60
- constructor(x: Uint8Array | number)
61
- toString(encoding?: TextDecoderEncoding): string
62
- fromString(input: string, encoding?: TextDecoderEncoding): ByteArray
63
- toGBytes(): GLib.Bytes
64
- }
65
-
66
- /** @deprecated Use {@link TextEncoder.encode} instead */
67
- export function fromString(input: string, encoding?: TextDecoderEncoding): Uint8Array
68
-
69
- /** @deprecated Use {@link GLib.Bytes.toArray} instead */
70
- export function fromGBytes(input: GLib.Bytes): Uint8Array
71
-
72
- /** @deprecated Use {@link TextDecoder.decode} instead */
73
- export function toString(x: Uint8Array, encoding?: TextDecoderEncoding): string
74
-
75
- /** @deprecated Use {@link GLib.Bytes new GLib.Bytes() } instead */
76
- export function toGBytes(x: Uint8Array): GLib.Bytes
77
-
78
- /** @deprecated Use {@link ByteArray new ByteArray()} instead */
79
- export function fromArray(array: Iterable<number>): ByteArray
80
- }
81
-
82
- declare namespace lang {
83
- // TODO: There is a lot more in Lang
84
- export function Class(props: any): void
85
- }
86
-
87
- declare namespace format {
88
- export function vprintf(str: string, args: string[]): string
89
- export function printf(fmt: string, ...args: any[]): void
90
- // Following docs from gjs/modules/format.js
91
- /**
92
- * This function is intended to extend the String object and provide
93
- * an String.format API for string formatting.
94
- * It has to be set up using String.prototype.format = Format.format;
95
- * Usage:
96
- * "somestring %s %d".format('hello', 5);
97
- * It supports %s, %d, %x and %f, for %f it also support precisions like
98
- * "%.2f".format(1.526). All specifiers can be prefixed with a minimum
99
- * field width, e.g. "%5s".format("foo"). Unless the width is prefixed
100
- * with '0', the formatted string will be padded with spaces.
101
- */
102
- export function format(fmt: string, ...args: any[]): string
103
- }
104
-
105
- declare namespace mainloop {
106
- export function quit(name: string): void
107
- export function idle_source(handler: any, priority?: number): any
108
- export function idle_add(handler: any, priority?: number): any
109
- export function timeout_source(timeout: any, handler: any, priority?: number): any
110
- export function timeout_seconds_source(timeout: any, handler: any, priority?: number): any
111
- export function timeout_add(timeout: any, handler: any, priority?: number): any
112
- export function timeout_add_seconds(timeout: any, handler: any, priority?: number): any
113
- export function source_remove(id: any): any
114
- export function run(name: string): void
115
- }
116
-
117
- /**
118
- * You can use the `Signals.addSignalMethods` method to apply the `Signals` convenience methods to an `Object`.
119
- * Generally, this is called on an object prototype, but may also be called on an object instance.
120
- * You can use this Interface for this object or prototype to make the methods in typescript known
121
- * @example
122
- * ```ts
123
- * const Signals = imports.signals;
124
- *
125
- * // Define an interface with the same name of your class to make the methods known
126
- * interface Events extends Signals.Methods {}
127
- *
128
- * class Events {}
129
- * Signals.addSignalMethods(Events.prototype);
130
- *
131
- * const events = new Events();
132
- *
133
- * // Typescript will not complain here
134
- * events.emit("test-signal", "test argument");
135
- * ```
136
- */
137
- export interface SignalMethods {
138
- /**
139
- * Connects a callback to a signal for an object. Pass the returned ID to
140
- * `disconnect()` to remove the handler.
141
- *
142
- * If `callback` returns `true`, emission will stop and no other handlers will be
143
- * invoked.
144
- *
145
- * > Warning: Unlike GObject signals, `this` within a signal callback will always
146
- * > refer to the global object (ie. `globalThis`).
147
- *
148
- * @param sigName A signal name
149
- * @param callback A callback function
150
- * @returns A handler ID
151
- */
152
- connect(sigName: string, callback: (self: any, ...args: any[]) => void): number;
153
- /**
154
- * Emits a signal for an object. Emission stops if a signal handler returns `true`.
155
- *
156
- * Unlike GObject signals, it is not necessary to declare signals or define their
157
- * signature. Simply call `emit()` with whatever signal name you wish, with
158
- * whatever arguments you wish.
159
- * @param sigName A signal name
160
- * @param args Any number of arguments, of any type
161
- */
162
- emit(sigName: string, ...args: any[]): void;
163
- /**
164
- * Disconnects a handler for a signal.
165
- * @param id The ID of the handler to be disconnected
166
- */
167
- disconnect(id: number): void;
168
- /**
169
- * Disconnects all signal handlers for an object.
170
- */
171
- disconnectAll(): void
172
- /**
173
- * Checks if a handler ID is connected.
174
- * @param id The ID of the handler to be disconnected
175
- * @returns `true` if connected, or `false` if not
176
- */
177
- signalHandlerIsConnected(id: number): boolean;
178
- }
179
-
180
- declare namespace signals {
181
- export function addSignalMethods<T = any>(proto: T): proto is T & SignalMethods;
182
- }
183
-
184
- declare global {
185
-
186
- // https://gitlab.gnome.org/GNOME/gjs/-/blob/1.73.2/modules/esm/_encoding/encodingMap.js#L7-232
187
- type TextDecoderEncoding =
188
- | 'unicode-1-1-utf-8'
189
- | 'unicode11utf8'
190
- | 'unicode20utf8'
191
- | 'utf-8'
192
- | 'utf8'
193
- | 'x-unicode20utf8'
194
- | '866'
195
- | 'cp866'
196
- | 'csibm866'
197
- | 'ibm866'
198
- | 'csisolatin2'
199
- | 'iso-8859-2'
200
- | 'iso-ir-101'
201
- | 'iso8859-2'
202
- | 'iso88592'
203
- | 'iso_8859-2'
204
- | 'iso_8859-2:1987'
205
- | 'l2'
206
- | 'latin2'
207
- | 'csisolatin3'
208
- | 'iso-8859-3'
209
- | 'iso-ir-109'
210
- | 'iso8859-3'
211
- | 'iso88593'
212
- | 'iso_8859-3'
213
- | 'iso_8859-3:1988'
214
- | 'l3'
215
- | 'latin3'
216
- | 'csisolatin4'
217
- | 'iso-8859-4'
218
- | 'iso-ir-110'
219
- | 'iso8859-4'
220
- | 'iso88594'
221
- | 'iso_8859-4'
222
- | 'iso_8859-4:1988'
223
- | 'l4'
224
- | 'latin4'
225
- | 'csisolatincyrillic'
226
- | 'cyrillic'
227
- | 'iso-8859-5'
228
- | 'iso-ir-144'
229
- | 'iso8859-5'
230
- | 'iso88595'
231
- | 'iso_8859-5'
232
- | 'iso_8859-5:1988'
233
- | 'arabic'
234
- | 'asmo-708'
235
- | 'csiso88596e'
236
- | 'csiso88596i'
237
- | 'csisolatinarabic'
238
- | 'ecma-114'
239
- | 'iso-8859-6'
240
- | 'iso-8859-6-e'
241
- | 'iso-8859-6-i'
242
- | 'iso-ir-127'
243
- | 'iso8859-6'
244
- | 'iso88596'
245
- | 'iso_8859-6'
246
- | 'iso_8859-6:1987'
247
- | 'csisolatingreek'
248
- | 'ecma-118'
249
- | 'elot_928'
250
- | 'greek'
251
- | 'greek8'
252
- | 'iso-8859-7'
253
- | 'iso-ir-126'
254
- | 'iso8859-7'
255
- | 'iso88597'
256
- | 'iso_8859-7'
257
- | 'iso_8859-7:1987'
258
- | 'sun_eu_greek'
259
- | 'csiso88598e'
260
- | 'csisolatinhebrew'
261
- | 'hebrew'
262
- | 'iso-8859-8'
263
- | 'iso-8859-8-e'
264
- | 'iso-ir-138'
265
- | 'iso8859-8'
266
- | 'iso88598'
267
- | 'iso_8859-8'
268
- | 'iso_8859-8:1988'
269
- | 'visual'
270
- | 'csiso88598i'
271
- | 'iso-8859-8-i'
272
- | 'logical'
273
- | 'csisolatin6'
274
- | 'iso-8859-10'
275
- | 'iso-ir-157'
276
- | 'iso8859-10'
277
- | 'iso885910'
278
- | 'l6'
279
- | 'latin6'
280
- | 'iso-8859-13'
281
- | 'iso8859-13'
282
- | 'iso885913'
283
- | 'iso-8859-14'
284
- | 'iso8859-14'
285
- | 'iso885914'
286
- | 'csisolatin9'
287
- | 'iso-8859-15'
288
- | 'iso8859-15'
289
- | 'iso885915'
290
- | 'iso_8859-15'
291
- | 'l9'
292
- | 'iso-8859-16'
293
- | 'cskoi8r'
294
- | 'koi'
295
- | 'koi8'
296
- | 'koi8-r'
297
- | 'koi8_r'
298
- | 'koi8-ru'
299
- | 'koi8-u'
300
- | 'csmacintosh'
301
- | 'mac'
302
- | 'macintosh'
303
- | 'x-mac-roman'
304
- | 'dos-874'
305
- | 'iso-8859-11'
306
- | 'iso8859-11'
307
- | 'iso885911'
308
- | 'tis-620'
309
- | 'windows-874'
310
- | 'cp1250'
311
- | 'windows-1250'
312
- | 'x-cp1250'
313
- | 'cp1251'
314
- | 'windows-1251'
315
- | 'x-cp1251'
316
- | 'ansi_x3.4-1968'
317
- | 'ascii'
318
- | 'cp1252'
319
- | 'cp819'
320
- | 'csisolatin1'
321
- | 'ibm819'
322
- | 'iso-8859-1'
323
- | 'iso-ir-100'
324
- | 'iso8859-1'
325
- | 'iso88591'
326
- | 'iso_8859-1'
327
- | 'iso_8859-1:1987'
328
- | 'l1'
329
- | 'latin1'
330
- | 'us-ascii'
331
- | 'windows-1252'
332
- | 'x-cp1252'
333
- | 'cp1253'
334
- | 'windows-1253'
335
- | 'x-cp1253'
336
- | 'cp1254'
337
- | 'csisolatin5'
338
- | 'iso-8859-9'
339
- | 'iso-ir-148'
340
- | 'iso8859-9'
341
- | 'iso88599'
342
- | 'iso_8859-9'
343
- | 'iso_8859-9:1989'
344
- | 'l5'
345
- | 'latin5'
346
- | 'windows-1254'
347
- | 'x-cp1254'
348
- | 'cp1255'
349
- | 'windows-1255'
350
- | 'x-cp1255'
351
- | 'cp1256'
352
- | 'windows-1256'
353
- | 'x-cp1256'
354
- | 'cp1257'
355
- | 'windows-1257'
356
- | 'x-cp1257'
357
- | 'cp1258'
358
- | 'windows-1258'
359
- | 'x-cp1258'
360
- | 'x-mac-cyrillic'
361
- | 'x-mac-ukrainian'
362
- | 'chinese'
363
- | 'csgb2312'
364
- | 'csiso58gb231280'
365
- | 'gb2312'
366
- | 'gb_2312'
367
- | 'gb_2312-80'
368
- | 'gbk'
369
- | 'iso-ir-58'
370
- | 'x-gbk'
371
- | 'gb18030'
372
- | 'big5'
373
- | 'cn-big5'
374
- | 'csbig5'
375
- | 'x-x-big5'
376
- | 'cseucpkdfmtjapanese'
377
- | 'euc-jp'
378
- | 'x-euc-jp'
379
- | 'csiso2022jp'
380
- | 'iso-2022-jp'
381
- | 'csshiftjis'
382
- | 'ms932'
383
- | 'ms_kanji'
384
- | 'shift-jis'
385
- | 'shift_jis'
386
- | 'sjis'
387
- | 'windows-31j'
388
- | 'x-sjis'
389
- | 'cseuckr'
390
- | 'csksc56011987'
391
- | 'euc-kr'
392
- | 'iso-ir-149'
393
- | 'korean'
394
- | 'ks_c_5601-1987'
395
- | 'ks_c_5601-1989'
396
- | 'ksc5601'
397
- | 'ksc_5601'
398
- | 'windows-949'
399
- | 'unicodefffe'
400
- | 'utf-16be'
401
- | 'csunicode'
402
- | 'iso-10646-ucs-2'
403
- | 'ucs-2'
404
- | 'unicode'
405
- | 'unicodefeff'
406
- | 'utf-16'
407
- | 'utf-16le'
408
-
409
- interface GjsGiImports {
410
- // Will be extended by the import of more gir types
411
- versions: {
412
- [namespace: string]: string
413
- }
414
- }
415
-
416
- interface GjsImports {
417
- gi: GjsGiImports
418
- lang: typeof lang
419
- system: typeof system
420
- signals: typeof signals
421
- package: typeof package
422
- mainloop: typeof mainloop
423
- searchPath: string[]
424
- gettext: typeof gettext
425
- byteArray: typeof byteArray
426
- format: typeof format
427
- cairo: typeof cairo
428
- }
429
-
430
- function print(...args: any[]): void
431
- function printerr(...args: any[]): void
432
- function log(message: any): void
433
- function logError(exception: object, message?: any): void
434
- function logError(message?: any): void
435
-
436
- const pkg: typeof package
437
-
438
- interface BooleanConstructor {
439
- $gtype: GObject.GType<boolean>
440
- }
441
-
442
- interface NumberConstructor {
443
- $gtype: GObject.GType<number>
444
- }
445
-
446
- interface StringConstructor {
447
- $gtype: GObject.GType<string>
448
- }
449
-
450
- const imports: GjsImports
451
-
452
- const ARGV: string[]
453
- }
454
-
455
- declare const _imports: GjsImports
456
- export default _imports
457
- export { _imports as imports }
458
-
459
-
package/system.cjs DELETED
@@ -1,7 +0,0 @@
1
-
2
- const System = imports.system;
3
-
4
- module.exports = System;
5
- exports.default = System;
6
-
7
-
package/system.d.cts DELETED
@@ -1,175 +0,0 @@
1
- import type GObject from '@girs/gobject-2.0';
2
-
3
- /**
4
- * This property contains the name of the script as it was invoked from the command
5
- * line. In C and other languages, this information is contained in the first element of
6
- * the platform's equivalent of argv, but GJS's ARGV only contains the
7
- * subsequent command-line arguments. In other words, `ARGV[0]` in GJS is the same as `argv[1]` in C.
8
- * @version Gjs 1.68
9
- */
10
- export const programInvocationName: string
11
-
12
- /**
13
- * This property contains version information about GJS.
14
- */
15
- export const version: number
16
-
17
- /**
18
- * The full path of the executed program.
19
- * @version Gjs 1.68
20
- */
21
- export const programPath: string | null
22
-
23
- /**
24
- * A list of arguments passed to the current process.
25
- * This is effectively an alias for the global `ARGV`, which is misleading in that
26
- * it is not equivalent to the platform'`s` argv.
27
- * @version Gjs 1.68
28
- */
29
- export const programArgs: string[]
30
-
31
- /**
32
- * Return the memory address of any object as a string.
33
- * This is the address of memory being managed by the JavaScript engine, which may
34
- * represent a wrapper around memory elsewhere.
35
- * **Caution**, don't use this as a unique identifier!
36
- * JavaScript's garbage collector can move objects around in memory, or
37
- * deduplicate identical objects, so this value may change during the execution
38
- * of a program.
39
- * @param o Any Object
40
- * @returns A hexadecimal string (e.g. `0xb4f170f0`)
41
- */
42
- export function addressOf(o: any): string
43
-
44
- /**
45
- * Return the memory address of any GObject as a string.
46
- * See also {@link addressOf}
47
- * @param o Any {@link GObject.Object}-derived instance
48
- * @returns A hexadecimal string (e.g. `0xb4f170f0`)
49
- * @version Gjs 1.58
50
- */
51
- export function addressOfGObject(o: GObject.Object): string
52
-
53
- /**
54
- * Inserts a breakpoint instruction into the code.
55
- * **Warning**: Using this function in code run outside of GDB will abort the process.
56
- * With `System.breakpoint()` calls in your code, a GJS program can be debugged by
57
- * running it in GDB:
58
- * ```bash
59
- * gdb --args gjs script.js
60
- * ```
61
- * Once GDB has started, you can start the program with run. When the debugger
62
- * hits a breakpoint it will pause execution of the process and return to the
63
- * prompt. You can then use the standard `backtrace` command to print a C++ stack
64
- * trace, or use `call gjs_dumpstack()` to print a JavaScript stack trace:
65
- * ```bash
66
- * (gdb) run
67
- * tarting program: /usr/bin/gjs -m script.js
68
- * ...
69
- * Thread 1 "gjs" received signal SIGTRAP, Trace/breakpoint trap.
70
- * (gdb) call gjs_dumpstack()
71
- * == Stack trace for context 0x5555555b7180 ==
72
- * #0 555555640548 i file:///path/to/script.js:4 (394b8c3cc060 @ 12)
73
- * #1 5555556404c8 i file:///path/to/script.js:7 (394b8c3cc0b0 @ 6)
74
- * #2 7fffffffd3a0 b self-hosted:2408 (394b8c3a9650 @ 753)
75
- * #3 5555556403e8 i self-hosted:2355 (394b8c3a9600 @ 375)
76
- * (gdb)
77
- * ```
78
- * To continue executing the program, you can use the `continue` (or `cont`) to
79
- * resume the process and debug further.
80
- * Remember that if you run the program outside of GDB, it will abort at the
81
- * breakpoint, so make sure to remove any calls to `System.breakpoint()` when
82
- * you're done debugging.
83
- */
84
- export function breakpoint(): void
85
-
86
- /**
87
- * Clears the timezone cache.
88
- * This is a workaround for SpiderMonkey Bug [#1004706](https://bugzilla.mozilla.org/show_bug.cgi?id=1004706).
89
- */
90
- export function clearDateCaches(): void
91
-
92
- /** Runs the garbage collector */
93
- export function gc(): void
94
-
95
- /**
96
- * Return the reference count of any GObject-derived type. When an object's
97
- * reference count is zero, it is cleaned up and erased from memory.
98
- * @param o A {@link GObject.Object}
99
- */
100
- export function refcount(o: GObject.Object): number
101
- /**
102
- * See also: The [heapgraph](https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/tools/heapgraph.md) utility in the GJS repository.
103
- * Dump a representation of internal heap memory. If `path` is not given, GJS will
104
- * write the contents to `stdout`.
105
- * @param path Optional file path
106
- */
107
- export function dumpHeap(path?: string): void
108
-
109
- /**
110
- * Dump internal garbage collector statistics. If `path` is not given, GJS will
111
- * write the contents to `stdout`.
112
- * @param path Optional file path
113
- * @version Gjs 1.70
114
- * @example Output:
115
- * ```json
116
- * {
117
- * "gcBytes": 794624,
118
- * "gcMaxBytes": 4294967295,
119
- * "mallocBytes": 224459,
120
- * "gcIsHighFrequencyMode": true,
121
- * "gcNumber": 1,
122
- * "majorGCCount": 1,
123
- * "minorGCCount": 1,
124
- * "sliceCount": 1,
125
- * "zone": {
126
- * "gcBytes": 323584,
127
- * "gcTriggerBytes": 42467328,
128
- * "gcAllocTrigger": 36097228.8,
129
- * "mallocBytes": 120432,
130
- * "mallocTriggerBytes": 59768832,
131
- * "gcNumber": 1
132
- * }
133
- * }
134
- * ```
135
- *
136
- */
137
- export function dumpMemoryInfo(path?: string): void
138
-
139
- /**
140
- * This works the same as C's exit() function; exits the program, passing a
141
- * certain error code to the shell. The shell expects the error code to be zero if
142
- * there was no error, or non-zero (any value you please) to indicate an error.
143
- *
144
- * This value is used by other tools such as `make`; if `make` calls a program that
145
- * returns a non-zero error code, then `make` aborts the build.
146
- * @param code An exit code
147
- */
148
- export function exit(code: number): void
149
-
150
- /**
151
- * The System module provides common low-level facilities such as access to
152
- * process arguments and exit(), as well as a number of useful functions and
153
- * properties for debugging.
154
- *
155
- * Note that the majority of the functions and properties in this module should not
156
- * be used in normal operation of a GJS application.
157
- */
158
- declare const System: {
159
- programInvocationName: typeof programInvocationName,
160
- version: typeof version,
161
- programPath: typeof programPath,
162
- programArgs: typeof programArgs,
163
- addressOf: typeof addressOf,
164
- addressOfGObject: typeof addressOfGObject,
165
- breakpoint: typeof breakpoint,
166
- clearDateCaches: typeof clearDateCaches,
167
- gc: typeof gc,
168
- refcount: typeof refcount,
169
- dumpHeap: typeof dumpHeap,
170
- dumpMemoryInfo: typeof dumpMemoryInfo,
171
- exit: typeof exit,
172
- }
173
-
174
- export default System
175
-