@girs/gobject-2.0 2.77.0-3.2.2 → 2.78.0-3.2.5
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 +14 -1
- package/gobject-2.0-ambient.d.ts +0 -1
- package/gobject-2.0-import.d.ts +0 -1
- package/gobject-2.0.d.cts +4 -0
- package/gobject-2.0.d.ts +4 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
GJS TypeScript type definitions for GObject-2.0, generated from library version 2.
|
|
8
|
+
GJS TypeScript type definitions for GObject-2.0, generated from library version 2.78.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.2.5.
|
|
9
9
|
|
|
10
10
|
GObject provides the object system used for Pango and GTK+.
|
|
11
11
|
|
|
@@ -82,6 +82,19 @@ Now you have also type support for this, too:
|
|
|
82
82
|
const GObject = imports.gi.GObject;
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
|
|
86
|
+
### ESM vs. CommonJS
|
|
87
|
+
|
|
88
|
+
GJS supports two different import syntaxes. The new modern ESM syntax and the old global imports syntax.
|
|
89
|
+
|
|
90
|
+
In TypeScript projects for GJS and GNOME Shell extensions, you have the flexibility to use `ESM` syntax and then decide the import syntax for your bundled file. If your bundler is configured to use `CommonJS`, it will convert to the GJS-specific global imports syntax, like `const moduleName = imports.gi[moduleName]`. This is different from the traditional `require` syntax seen in Node.js. The global imports syntax is chosen because it aligns with the CommonJS format supported by NPM, which is used for the generated type definitions and this package.
|
|
91
|
+
|
|
92
|
+
On the other hand, if you configure your bundler to use ESM, it will retain the ESM import syntax. It's crucial to ensure that your bundler is set up to correctly translate and bundle these imports into either CommonJS or ESM format, depending on your project's requirements.
|
|
93
|
+
|
|
94
|
+
This approach is particularly important due to the `@girs` types, which include both `*.cjs `files, using the GJS global imports syntax, and `*.js` files, which utilize the ESM syntax. By appropriately setting up your bundler, you can control which syntax—CommonJS or ESM—is used in your project. The choice of CommonJS in this context is also due to the similarity between the GJS-specific global imports and CommonJS syntax, allowing for easier management and bundling in these specific types of projects.
|
|
95
|
+
|
|
96
|
+
Since GNOME Shell 45, you should only use ESM, even for GNOME Shell extensions. Before that, extensions had to use the global import syntax, unlike normal GJS applications, where ESM has been available for some time.
|
|
97
|
+
|
|
85
98
|
### Bundle
|
|
86
99
|
|
|
87
100
|
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
package/gobject-2.0-ambient.d.ts
CHANGED
package/gobject-2.0-import.d.ts
CHANGED
package/gobject-2.0.d.cts
CHANGED
|
@@ -1906,11 +1906,15 @@ export function type_parent(type: GType): GType
|
|
|
1906
1906
|
export function type_qname(type: GType): GLib.Quark
|
|
1907
1907
|
/**
|
|
1908
1908
|
* Queries the type system for information about a specific type.
|
|
1909
|
+
*
|
|
1909
1910
|
* This function will fill in a user-provided structure to hold
|
|
1910
1911
|
* type-specific information. If an invalid #GType is passed in, the
|
|
1911
1912
|
* `type` member of the #GTypeQuery is 0. All members filled into the
|
|
1912
1913
|
* #GTypeQuery structure should be considered constant and have to be
|
|
1913
1914
|
* left untouched.
|
|
1915
|
+
*
|
|
1916
|
+
* Since GLib 2.78, this function allows queries on dynamic types. Previously
|
|
1917
|
+
* it only supported static types.
|
|
1914
1918
|
* @param type #GType of a static, classed type
|
|
1915
1919
|
*/
|
|
1916
1920
|
export function type_query(type: GType): /* query */ TypeQuery
|
package/gobject-2.0.d.ts
CHANGED
|
@@ -1908,11 +1908,15 @@ function type_parent(type: GType): GType
|
|
|
1908
1908
|
function type_qname(type: GType): GLib.Quark
|
|
1909
1909
|
/**
|
|
1910
1910
|
* Queries the type system for information about a specific type.
|
|
1911
|
+
*
|
|
1911
1912
|
* This function will fill in a user-provided structure to hold
|
|
1912
1913
|
* type-specific information. If an invalid #GType is passed in, the
|
|
1913
1914
|
* `type` member of the #GTypeQuery is 0. All members filled into the
|
|
1914
1915
|
* #GTypeQuery structure should be considered constant and have to be
|
|
1915
1916
|
* left untouched.
|
|
1917
|
+
*
|
|
1918
|
+
* Since GLib 2.78, this function allows queries on dynamic types. Previously
|
|
1919
|
+
* it only supported static types.
|
|
1916
1920
|
* @param type #GType of a static, classed type
|
|
1917
1921
|
*/
|
|
1918
1922
|
function type_query(type: GType): /* query */ TypeQuery
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@girs/gobject-2.0",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "GJS TypeScript type definitions for GObject-2.0, generated from library version 2.
|
|
3
|
+
"version": "2.78.0-3.2.5",
|
|
4
|
+
"description": "GJS TypeScript type definitions for GObject-2.0, generated from library version 2.78.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "gobject-2.0.js",
|
|
7
7
|
"main": "gobject-2.0.js",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"test:cjs": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gobject-2.0.d.cts"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@girs/gjs": "^3.2.
|
|
29
|
-
"@girs/glib-2.0": "^2.
|
|
28
|
+
"@girs/gjs": "^3.2.5",
|
|
29
|
+
"@girs/glib-2.0": "^2.78.0-3.2.5"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"typescript": "*"
|