@girs/appstreamcompose-1.0 4.1.0 → 4.3.0
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 +8 -8
- package/appstreamcompose-1.0.d.ts +18 -2
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -5,25 +5,25 @@
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
GJS TypeScript type definitions for AppStreamCompose-1.0
|
|
8
|
+
GJS TypeScript type definitions for AppStreamCompose-1.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.3.0.
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Install the type definitions with npm:
|
|
13
13
|
```bash
|
|
14
14
|
npm install @girs/appstreamcompose-1.0
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Import it like any other module:
|
|
20
20
|
```ts
|
|
21
21
|
import AppStreamCompose from '@girs/appstreamcompose-1.0';
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
### Ambient Modules
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
[Ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) let you write the same import you would in plain JavaScript.
|
|
27
27
|
For this you need to include `@girs/appstreamcompose-1.0` or `@girs/appstreamcompose-1.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
28
28
|
|
|
29
29
|
`index.ts`:
|
|
@@ -42,7 +42,7 @@ import '@girs/appstreamcompose-1.0'
|
|
|
42
42
|
}
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
The ambient module now resolves with types:
|
|
46
46
|
|
|
47
47
|
```ts
|
|
48
48
|
import AppStreamCompose from 'gi://AppStreamCompose?version=1.0';
|
|
@@ -50,7 +50,7 @@ import AppStreamCompose from 'gi://AppStreamCompose?version=1.0';
|
|
|
50
50
|
|
|
51
51
|
### Global import
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
GJS's global `imports.gi` works too, with types.
|
|
54
54
|
For this you need to include `@girs/appstreamcompose-1.0` or `@girs/appstreamcompose-1.0/import` in your `tsconfig` or entry point Typescript file:
|
|
55
55
|
|
|
56
56
|
`index.ts`:
|
|
@@ -69,7 +69,7 @@ import '@girs/appstreamcompose-1.0'
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
That form carries types as well:
|
|
73
73
|
|
|
74
74
|
```ts
|
|
75
75
|
const AppStreamCompose = imports.gi.AppStreamCompose;
|
|
@@ -77,7 +77,7 @@ const AppStreamCompose = imports.gi.AppStreamCompose;
|
|
|
77
77
|
|
|
78
78
|
### Bundle
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
Most projects want a bundler. [esbuild](https://esbuild.github.io/) is the smallest thing that works; the [examples directory](https://github.com/gjsify/ts-for-gir/tree/main/examples) has setups for several others.
|
|
81
81
|
|
|
82
82
|
## Other packages
|
|
83
83
|
|
|
@@ -159,14 +159,15 @@ export namespace AppStreamCompose {
|
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
161
|
* Builds a global component ID from a component-id
|
|
162
|
-
* and a (usually
|
|
162
|
+
* and a checksum (usually Blake3) generated from the component data.
|
|
163
163
|
*
|
|
164
164
|
* The global-id is used as a global, unique identifier for a component.
|
|
165
165
|
* (while the component-ID is local, e.g. for one source).
|
|
166
166
|
* Its primary usecase is to identify a media directory on the filesystem which is
|
|
167
167
|
* associated with this component.
|
|
168
168
|
* @param component_id an AppStream component ID.
|
|
169
|
-
* @param checksum a
|
|
169
|
+
* @param checksum a checksum as string generated from the component's combined metadata.
|
|
170
|
+
* @returns The new global ID. Free with %g_free.
|
|
170
171
|
*/
|
|
171
172
|
function build_component_global_id(component_id: string, checksum: string): string;
|
|
172
173
|
|
|
@@ -175,6 +176,18 @@ export namespace AppStreamCompose {
|
|
|
175
176
|
*/
|
|
176
177
|
function compose_error_quark(): GLib.Quark;
|
|
177
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Compute a checksum for the given content.
|
|
181
|
+
*
|
|
182
|
+
* The output of this function is intended to be used with %asc_build_component_global_id
|
|
183
|
+
* to form a unique global ID. The generated checksum is intended to be used as content-ID.
|
|
184
|
+
* Do not assume it is cryptographically secure or has a certain length!
|
|
185
|
+
* @param data The data to hash.
|
|
186
|
+
* @param length Length of `data`.
|
|
187
|
+
* @returns The hash as hexadecimal string. Free with %g_free
|
|
188
|
+
*/
|
|
189
|
+
function compute_content_checksum_for_data(data: string, length: bigint | number): string;
|
|
190
|
+
|
|
178
191
|
/**
|
|
179
192
|
* Generate a filename from a web-URL that can be used to store the
|
|
180
193
|
* file on disk after download.
|
|
@@ -683,6 +696,9 @@ export namespace AppStreamCompose {
|
|
|
683
696
|
* This may be useful in case a special language pack layout is used,
|
|
684
697
|
* but is generally not necessary to be set explicitly, as locale
|
|
685
698
|
* will be found in the unit where the metadata is by default.
|
|
699
|
+
*
|
|
700
|
+
* Do not forget to open the locale unit, before running compose
|
|
701
|
+
* actions with it!
|
|
686
702
|
* @param locale_unit the unit used for locale processing.
|
|
687
703
|
*/
|
|
688
704
|
set_locale_unit(locale_unit: Unit): void;
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@girs/appstreamcompose-1.0",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"
|
|
5
|
-
"description": "GJS TypeScript type definitions for AppStreamCompose-1.0, generated from library version 1.0.0",
|
|
3
|
+
"version": "4.3.0",
|
|
4
|
+
"description": "GJS TypeScript type definitions for AppStreamCompose-1.0",
|
|
6
5
|
"type": "module",
|
|
7
6
|
"module": "appstreamcompose-1.0.js",
|
|
8
7
|
"main": "appstreamcompose-1.0.js",
|
|
@@ -32,12 +31,12 @@
|
|
|
32
31
|
"test": "tsc --project tsconfig.json"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@girs/gjs": "^4.
|
|
36
|
-
"@girs/gio-2.0": "^4.
|
|
37
|
-
"@girs/gobject-2.0": "^4.
|
|
38
|
-
"@girs/glib-2.0": "^4.
|
|
39
|
-
"@girs/gmodule-2.0": "^4.
|
|
40
|
-
"@girs/appstream-1.0": "^4.
|
|
34
|
+
"@girs/gjs": "^4.3.0",
|
|
35
|
+
"@girs/gio-2.0": "^4.3.0",
|
|
36
|
+
"@girs/gobject-2.0": "^4.3.0",
|
|
37
|
+
"@girs/glib-2.0": "^4.3.0",
|
|
38
|
+
"@girs/gmodule-2.0": "^4.3.0",
|
|
39
|
+
"@girs/appstream-1.0": "^4.3.0" },
|
|
41
40
|
"devDependencies": {
|
|
42
41
|
"typescript": "*"
|
|
43
42
|
},
|