Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
JumpLink committed Feb 18, 2024
1 parent 5be3ecf commit 657aa2d
Show file tree
Hide file tree
Showing 446 changed files with 1,358,223 additions and 4,724 deletions.
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[submodule "test/girs/vala-girs"]
path = vala-girs
url = https://github.com/nemequ/vala-girs.git
branch = master
[submodule "types"]
path = types
url = https://github.com/gjsify/types
branch = main
2 changes: 1 addition & 1 deletion .ts-for-gir.gtk4.rc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
environments: ['gjs'],
modules: ['Gtk-4.0'],
modules: ['Gtk-4.0', 'Adw-1.0'],
girDirectories: ['./vala-girs/gir-1.0'],
ignore: [],
ignoreVersionConflicts: true,
Expand Down
23 changes: 16 additions & 7 deletions .ts-for-gir.packages-all.rc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
export default {
outdir: './types',
outdir: './types-next',
environments: ['gjs'],
modules: ['*'],
girDirectories: [
// General gir files in this repository
'./vala-girs/gir-1.0',
'./girs',

// General gir files installed on the system
"/usr/local/share/gir-1.0",
"/usr/share/gir-1.0",
Expand All @@ -23,18 +27,23 @@ export default {
// GNOME Shell gir file dependencies on Fedora Workstation 39 (package: mutter)
'/usr/lib64/mutter-13',

// GNOME Shell gir file dependencies on Ubuntu 22.04 (package: libmutter-10-dev)
// Wait for release...
'/usr/lib64/mutter-14',

// GNOME Shell gir file dependencies on Ubuntu 22.04 (package: libmutter-10-dev)
'/usr/lib/x86_64-linux-gnu/mutter-10',

// GNOME Shell gir file dependencies on Ubuntu 22.10 (package: libmutter-11-dev)
// GNOME Shell gir file dependencies on Ubuntu 22.10 (package: libmutter-11-dev)
'/usr/lib/x86_64-linux-gnu/mutter-11',

// GNOME Shell gir file dependencies on Ubuntu 23.04 (package: libmutter-12-dev)
// GNOME Shell gir file dependencies on Ubuntu 23.04 (package: libmutter-12-dev)
'/usr/lib/x86_64-linux-gnu/mutter-12',

// General gir files in this repository
'./vala-girs/gir-1.0',
'./girs',
// GNOME Shell gir file dependencies on Ubuntu 23.10 (package: libmutter-13-dev)
'/usr/lib/x86_64-linux-gnu/mutter-13',

// Wait for release...
'/usr/lib/x86_64-linux-gnu/mutter-14',
],
ignore: [
'Colorhug-1.0', // Duplicate of ColorHug-1.0
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"deno.enable": false,
"editor.tabSize": 4,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"typescript"
Expand Down
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.1.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.1.cjs
yarnPath: .yarn/releases/yarn-4.1.0.cjs
54 changes: 37 additions & 17 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Install GObject Introspection Repository files:

```bash
# Ubuntu 22.04
# Ubuntu
sudo apt-get update && sudo apt-get install \
libappindicator3-dev \
libgda-5.0-dev \
Expand All @@ -15,14 +15,9 @@ sudo apt-get update && sudo apt-get install \
libsoup2.4-dev \
libsoup-3.0-dev \
libwebkit2gtk-4.0-dev \
libadwaita-1-dev \
# The following are for GNOME Shell types
gnome-shell-common \
libmutter-10-dev \
libgcr-3-dev \
libgnome-desktop-3-dev # GnomeDesktop-3.0.gir

# Fedora 37
libadwaita-1-dev

# Fedora
sudo dnf update && sudo dnf install \
libappindicator-gtk3-devel \
libgda-devel \
Expand All @@ -34,27 +29,52 @@ sudo dnf update && sudo dnf install \
libnotify-devel \
libsoup-devel \
webkit2gtk3-devel \
libadwaita-devel \
# The following are for GNOME Shell types
gnome-shell \
gcr-devel \
gnome-desktop3-devel # GnomeDesktop-3.0.gir
libadwaita-devel
```

## GNOME Shell types

```bash

# Ubuntu
sudo apt-get install gnome-shell-common libmutter-10-dev libgcr-3-dev libgnome-desktop-3-dev

# Fedora
sudo dnf install gnome-shell gcr-devel gnome-desktop3-devel
```

## Other GNOME types

```bash
# Fedora
sudo dnf install gnome-bluetooth-libs-devel
```

Checkout this repository:

```bash
git clone --recurse-submodules [email protected]:gjsify/ts-for-gir.git
cd ts-for-gir
```

Checkout this repository, install the dependencies and build:
Alternatively, you can fetch the submodules after cloning the repository:

```bash
git clone https://github.com/gjsify/ts-for-gir
cd ts-for-gir
git submodule update --init
```

Install the dependencies and build:

```bash
yarn install
yarn run build
```

Generate example type definitions:

```bash
yarn run test:girs:gtk4
yarn run test:girs:gjs:gtk4
```

## Gir XML Format
Expand Down
33 changes: 33 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,39 @@
- Create a Reporter to create a text or json file with warnings like unknown types, renaming, etc and a summary of all that (e.g. 5 type conflicts resolved, 8 unknown types of *gint)
- Update types for GJS v1.75.2, see https://gitlab.gnome.org/GNOME/gjs/-/commit/666755b3b09d765e43d415e76105b828517b5509

# 3.2.8
- Upgrade dependencies
- Update examples and removed deprecated function calls like `byteArray.toString()`
- Add `dom.js`, `ambient.js` and `node-ambient.js` to allow importing there type definitions in the codebase with a bundler
- Update TSDoc documentation for `system`
- node-gtk: Add new `gtk-4-application` example
- node-gtk: Uses snake_case for property names at constructor, fixes #131

## Breaking Changes

- Removed support for additional `underscore` properties (next to `lowerCamelCase`) in the generated types, if this causes problems please let us know, then we will undo it again

# 3.2.7
- Upgrade dependencies
- Add type for import.meta.url, see 142
- C type `const` is readonly in typescript
- Constants are not nullable, fixes #141

# 3.2.6
- Upgrade dependencies
- Generate camel cased property accessors, see #138
- Add `runAsync` override for `GLib.MainLoop`, see #130

# 3.2.5
- Upgrade dependencies
- Allow ambient modules without version for NPM packages, see #139
- Add information about ESM and CommonJS modules to README.md for NPM packages

# 3.2.4
- Upgrade dependencies
- Add instruction to install `GnomeBluetooth-3.0.gir` on Fedora
- Add more *.gir files to `./girs` directory

# 3.2.3
- Upgrade dependencies
- Upgrade gir files
Expand Down
13 changes: 11 additions & 2 deletions examples/gjs/adw-1-hello/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Adw from './@types/adw-1.js';
const loop = GLib.MainLoop.new(null, false)

const app = new Adw.Application({
application_id: 'com.github.jumplink.gjs.adw-1-hello',
applicationId: 'com.github.jumplink.gjs.adw-1-hello',
flags: Gio.ApplicationFlags.FLAGS_NONE
});

Expand All @@ -22,10 +22,19 @@ const onQuit = () => {
}

const onActivate = (app: Adw.Application) => {
// Should support both camelCase and default property names, see https://github.com/gjsify/ts-for-gir/issues/138
const label = new Gtk.Label({
label: "Hello World"
label: "Hello World",
marginBottom: 11,
marginTop: 11,
})

label.marginTop = 12
label.marginBottom = 12

log(`label.marginTop: ${label.marginTop}`)
log(`label.marginBottom: ${label.marginBottom}`)

const window = new Gtk.ApplicationWindow(app)
window.set_title('Hello')
window.set_default_size(200, 200)
Expand Down
10 changes: 5 additions & 5 deletions examples/gjs/adw-1-hello/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-for-gir-adw-1-hello-example",
"version": "3.2.3",
"version": "3.2.8",
"description": "Simple GJS Typescript hello-world example using Libadwaita",
"main": "index.js",
"type": "module",
Expand All @@ -21,11 +21,11 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/core": "^7.23.9",
"@rollup/plugin-babel": "^6.0.4",
"@ts-for-gir/cli": "workspace:^",
"rollup": "^4.2.0",
"typescript": "^5.2.2",
"vite": "^4.5.0"
"rollup": "^4.11.0",
"typescript": "5.2.2",
"vite": "^5.1.3"
}
}
2 changes: 1 addition & 1 deletion examples/gjs/gio-2-cat-alias/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ await build({
// target: "firefox91", // Since GJS 1.71.1
format: 'esm',
// platform: 'node',
external: ['gi://*'],
external: ['gi://*', 'resource://*', 'gettext', 'system', 'cairo'],
})
4 changes: 2 additions & 2 deletions examples/gjs/gio-2-cat-alias/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import GLib from "gi://GLib?version=2.0";
import Gio from "gi://Gio?version=2.0";

const ByteArray = imports.byteArray;
const textDecoder = new TextDecoder()
const loop = GLib.MainLoop.new(null, false);

function cat(filename: string) {
Expand All @@ -24,7 +24,7 @@ function cat(filename: string) {
loop.quit();
return;
}
print(ByteArray.toString(contents));
print(textDecoder.decode(contents));
loop.quit();
});

Expand Down
6 changes: 3 additions & 3 deletions examples/gjs/gio-2-cat-alias/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-for-gir-gio-2-cat-alias-example",
"version": "3.2.3",
"version": "3.2.8",
"description": "Simple GJS Gtk 3 example app that shows how you can translate strings with gettext",
"main": "index.js",
"type": "module",
Expand All @@ -22,7 +22,7 @@
"license": "MIT",
"devDependencies": {
"@ts-for-gir/cli": "workspace:^",
"esbuild": "^0.19.5",
"typescript": "^5.2.2"
"esbuild": "^0.20.0",
"typescript": "5.2.2"
}
}
2 changes: 1 addition & 1 deletion examples/gjs/gio-2-cat-alias/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"module": "ESNext",
"moduleResolution": "node",
},
"include": ["@types/gjs.d.ts"],
"include": ["@types/gjs.d.ts", "@types/dom.d.ts"],
"files": [
"main.ts",
]
Expand Down
2 changes: 1 addition & 1 deletion examples/gjs/gio-2-cat-packages/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ await build({
// target: firefox102 // Since GJS 1.73.2
format: 'esm',
// platform: 'node',
external: ['gi://*', 'gettext', 'system', 'cairo'],
external: ['gi://*', 'resource://*', 'gettext', 'system', 'cairo'],
})
6 changes: 4 additions & 2 deletions examples/gjs/gio-2-cat-packages/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@
*/

import '@girs/gjs';
import '@girs/gjs/dom';
import '@girs/gio-2.0';

import Gio from "gi://Gio?version=2.0";

const ByteArray = imports.byteArray;
const textDecoder = new TextDecoder()

Gio._promisify(Gio.File.prototype, 'load_contents_async', 'load_contents_finish');

async function cat(filename: string) {
const file = Gio.file_new_for_path(filename);

const [contents] = await file.load_contents_async(null);
print(ByteArray.toString(contents));

print(textDecoder.decode(contents));
}

if (ARGV.length !== 1)
Expand Down
6 changes: 3 additions & 3 deletions examples/gjs/gio-2-cat-packages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-for-gir-gio-2-cat-promisify-packages",
"version": "3.2.3",
"version": "3.2.8",
"description": "Simple GJS Gtk 3 example app that shows how you can translate strings with gettext",
"main": "index.js",
"type": "module",
Expand All @@ -19,7 +19,7 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"esbuild": "^0.19.5",
"typescript": "^5.2.2"
"esbuild": "^0.20.0",
"typescript": "5.2.2"
}
}
2 changes: 1 addition & 1 deletion examples/gjs/gio-2-cat-packages/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"module": "ESNext",
"moduleResolution": "node"
},
"include": ["@girs/gjs", "@girs/gjs/ambient"],
"include": ["@girs/gjs", "@girs/gjs/dom", "@girs/gjs/ambient"],
"files": [
"main.ts",
]
Expand Down
2 changes: 1 addition & 1 deletion examples/gjs/gio-2-cat-promisify/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ await build({
// target: firefox102 // Since GJS 1.73.2
format: 'esm',
// platform: 'node',
external: ['gi://*'],
external: ['gi://*', 'resource://*', 'gettext', 'system', 'cairo'],
})
4 changes: 2 additions & 2 deletions examples/gjs/gio-2-cat-promisify/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
*/

import Gio from "gi://Gio?version=2.0";
const ByteArray = imports.byteArray;
const textDecoder = new TextDecoder();

Gio._promisify(Gio.File.prototype, 'load_contents_async', 'load_contents_finish');

async function cat(filename: string) {
const file = Gio.file_new_for_path(filename);

const [contents] = await file.load_contents_async(null);
print(ByteArray.toString(contents));
print(textDecoder.decode(contents));
}

if (ARGV.length !== 1)
Expand Down
Loading

0 comments on commit 657aa2d

Please sign in to comment.