@girs/gjs 3.2.7 → 3.2.9

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.2.7.
7
+ GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.2.9.
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/ambient.js ADDED
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+
package/dom.js ADDED
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@girs/gjs",
3
- "version": "3.2.7",
3
+ "version": "3.2.9",
4
4
  "description": "GJS TypeScript type definitions for Gjs",
5
5
  "type": "module",
6
6
  "module": "gjs.js",
7
7
  "main": "gjs.js",
8
8
  "exports": {
9
- "./ambient": "./ambient.d.ts",
9
+ "./ambient": {
10
+ "types": "./ambient.d.ts",
11
+ "default": "./ambient.js"
12
+ },
10
13
  "./gettext": {
11
14
  "import": {
12
15
  "types": "./gettext.d.ts",
@@ -37,7 +40,10 @@
37
40
  "default": "./cairo.cjs"
38
41
  }
39
42
  },
40
- "./dom": "./dom.d.ts",
43
+ "./dom": {
44
+ "types": "./dom.d.ts",
45
+ "default": "./dom.js"
46
+ },
41
47
  ".": {
42
48
  "import": {
43
49
  "types": "./gjs.d.ts",
@@ -55,8 +61,8 @@
55
61
  "test:cjs": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gjs.d.cts"
56
62
  },
57
63
  "dependencies": {
58
- "@girs/glib-2.0": "^2.78.0-3.2.7",
59
- "@girs/gobject-2.0": "^2.78.0-3.2.7"
64
+ "@girs/glib-2.0": "^2.78.0-3.2.9",
65
+ "@girs/gobject-2.0": "^2.78.0-3.2.9"
60
66
  },
61
67
  "devDependencies": {
62
68
  "typescript": "*"
@@ -73,7 +79,7 @@
73
79
  "license": "MIT",
74
80
  "repository": {
75
81
  "type": "git",
76
- "url": "git+https://github.com/gjsify/types.git"
82
+ "url": "git+https://github.com/gjsify/ts-for-gir.git"
77
83
  },
78
84
  "bugs": {
79
85
  "url": "https://github.com/gjsify/ts-for-gir/issues"
package/system.d.cts CHANGED
@@ -1,31 +1,174 @@
1
1
  import type GObject from '@girs/gobject-2.0';
2
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
+ */
3
10
  export const programInvocationName: string
11
+
12
+ /**
13
+ * This property contains version information about GJS.
14
+ */
4
15
  export const version: number
16
+
17
+ /**
18
+ * The full path of the executed program.
19
+ * @version Gjs 1.68
20
+ */
5
21
  export const programPath: string | null
6
- /** Equal to ARGV */
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
+ */
7
29
  export const programArgs: string[]
8
- export function exit(code: number): void
9
- export function addressOfGObject(o: GObject.Object): object
10
- export function addressOf(o: any): object
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
+
11
92
  /** Runs the garbage collector */
12
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
+ */
13
100
  export function refcount(o: GObject.Object): number
14
- export function dumpHeap(path: string): void
15
- export function dumpMemoryInfo(path: string): void
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
16
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
+ */
17
158
  declare const System: {
18
159
  programInvocationName: typeof programInvocationName,
19
160
  version: typeof version,
20
161
  programPath: typeof programPath,
21
162
  programArgs: typeof programArgs,
22
- exit: typeof exit,
23
- addressOfGObject: typeof addressOfGObject,
24
163
  addressOf: typeof addressOf,
164
+ addressOfGObject: typeof addressOfGObject,
165
+ breakpoint: typeof breakpoint,
166
+ clearDateCaches: typeof clearDateCaches,
25
167
  gc: typeof gc,
26
168
  refcount: typeof refcount,
27
169
  dumpHeap: typeof dumpHeap,
28
170
  dumpMemoryInfo: typeof dumpMemoryInfo,
171
+ exit: typeof exit,
29
172
  }
30
173
 
31
174
  export default System
package/system.d.ts CHANGED
@@ -1,31 +1,174 @@
1
1
  import type GObject from '@girs/gobject-2.0';
2
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
+ */
3
10
  export const programInvocationName: string
11
+
12
+ /**
13
+ * This property contains version information about GJS.
14
+ */
4
15
  export const version: number
16
+
17
+ /**
18
+ * The full path of the executed program.
19
+ * @version Gjs 1.68
20
+ */
5
21
  export const programPath: string | null
6
- /** Equal to ARGV */
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
+ */
7
29
  export const programArgs: string[]
8
- export function exit(code: number): void
9
- export function addressOfGObject(o: GObject.Object): object
10
- export function addressOf(o: any): object
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
+
11
92
  /** Runs the garbage collector */
12
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
+ */
13
100
  export function refcount(o: GObject.Object): number
14
- export function dumpHeap(path: string): void
15
- export function dumpMemoryInfo(path: string): void
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
16
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
+ */
17
158
  declare const System: {
18
159
  programInvocationName: typeof programInvocationName,
19
160
  version: typeof version,
20
161
  programPath: typeof programPath,
21
162
  programArgs: typeof programArgs,
22
- exit: typeof exit,
23
- addressOfGObject: typeof addressOfGObject,
24
163
  addressOf: typeof addressOf,
164
+ addressOfGObject: typeof addressOfGObject,
165
+ breakpoint: typeof breakpoint,
166
+ clearDateCaches: typeof clearDateCaches,
25
167
  gc: typeof gc,
26
168
  refcount: typeof refcount,
27
169
  dumpHeap: typeof dumpHeap,
28
170
  dumpMemoryInfo: typeof dumpMemoryInfo,
171
+ exit: typeof exit,
29
172
  }
30
173
 
31
174
  export default System