nodegui / qodejs

Qode is a lightly modified fork of Node.js that allows injecting a third party event loop alongside Node's event loop. It is designed to be used together with `@nodegui/nodegui` and Qt
https://nodegui.org/
Other
31 stars 11 forks source link
nodejs qode qt

Node.js

=======

Qode

Qode is a lightly modified fork of Node.js that allows Node's event loop to be merged with Qt's or any other Gui event loop. It is designed to be used together with @nodegui/nodegui. Qode achieves this by allowing message loop injection via a NodeJS addon.

logo

Changes in v18.12.1

Upgrade to Node v18.12.1. No other changes.

Changes in v16.x

From version 16.x - qode will have the same version number as that of underlying node.

This is a complete restructure of qode's source code.

It makes it easier to support all the architectures supported by nodejs

Qode source code is now much more closer to node's source code. Making it easier to upgrade node.js.

No breaking changes.

Changes in v2.0

In version 2.0, Qode no longer depends on Qt as a dependency.

This makes it easier to upgrade Qt and also allows devs to use their own version of Qt. Technically this means its possible to integrate with another Gui system (not Qt) aswell.

Another benefit is that it helps in avoiding issues with 3rd party plugin development because of qt version mismatch.

Now, Qode essentially becomes nodejs + <some code changes to allow message loop injection via an addon>

Note:

Qode is published as a NPM module as @nodegui/qode. For more details on the npm module visit: qode/npm/README.md The changes to node.js are visible in the commit name qode patch in this branch

Changes to Node.js

Currently only 64bit OS's are supported.

Steps for Windows

====================

Use Powershell in windows (possibly with git bash or similar installed)

  1. Do a git clone for this repo

  2. Install Visual Studio Community 2019. Download the Visual studio Installer and install Visual Studio Community 2019. Make sure to choose "Desktop development with C++ " workload and install it.

  3. Building Qode. Run node ./qode/build.js

Steps for Linux

==================

  1. Do a git clone for this repo

  2. Install GTK headers and patchelf:

sudo apt install libgtk-3-dev patchelf
  1. Building Qode. Run node ./qode/build.js

Steps for MacOS

==================

  1. Do a git clone for this repo

  2. Building Qode. Run node ./qode/build.js

If you want to build for Apple Silicon Macs Make sure you have python 3.8.10 installed

node ./qode/build.js

Common build errors:

  1. if you get an error similar to:

    fatal error: gtk/gtk.h: No such file or directory
    #include <gtk/gtk.h>

    Make sure you have installed gtk headers as mentioned above.

  2. If you get an error similar to: ./qode: error while loading shared libraries: cannot open shared object file: No such file or directory.

    Check the shared libraries used by qode by running ldd ./qode. Then you can provide the path where qode could find the libraries like this:

    LD_LIBRARY_PATH=<path_to_lib>:$LD_LIBRARY_PATH ./qode

And make sure you have installed gtk3 headers also for time being.

  1. Yoga crashes when using with Qode. Make sure that node version you are using to compile nodegui is binary compatible with node version of Qode. or make sure you compile addons with Qode instead of Node.

Usage

The prebuilt binaries can be found in the Releases page, modules installed by npm can be used directly in qode. Qode can also be installed via npm.

Note that it is strong recommended to install the official Node.js with the same version of qode, otherwise native modules installed by npm may not work correctly in qode.

Build

TARGET_ARCH=[x64|ia32] HOST_ARCH=[x64|ia32] node ./qode/build.js

or

`cmd /C "set TARGET_ARCH=[x64|ia32] && set HOST_ARCH=[x64|ia32] && node ./qode/build.js"`

PS: I havent tested ia32 builds

The output of the build will be present at node/out/Release/qode

Configurations (Available from qode v1.0.3)

Additional configurations can be done via a qode.json file in the same directory as that of the qode binary.

qode.json

{
  distPath: "./dist/index.js"; // This will try to load the index.js inside dist folder when qode.exe is run.
}

Message Loop injection api

The NodeGui core addon uses the following api exposed by qode binary to inject Qt's event loop into nodejs

https://github.com/nodegui/node/blob/43e31129fc27f738b171dca3d744a0e4245dcc6d/src/qode_shared.h#L12

#pragma once
// From Qode headers
namespace qode {
    extern int qode_argc;
    extern char **qode_argv;
    typedef int (*QodeCustomRunLoopFunc)();
    extern void InjectCustomRunLoop(QodeCustomRunLoopFunc customRunLoop);
}  // namespace qode

Building for M1 Mac

In order to build for M1 mac

Make sure you have python 3.8.10 installed

and then do:

node ./qode/build.js

License

The MIT license.

Thanks

The idea of Qode is derived from yode and electron. Infact Qode is a heavily modified fork of yode. I thank Cheng Zhao for yode and many of the ideas behind integration of GUI based libraries with NodeJS.

Qode - Node version table

Qode Node
v2.1.0 v14.2.0
v2.1.1 v14.17.0
v16.4.0 v16.4.0
v18.12.1 v18.12.1

Node.js README


Node.js

Node.js is an open-source, cross-platform JavaScript runtime environment.

For information on using Node.js, see the Node.js website.

The Node.js project uses an open governance model. The OpenJS Foundation provides support for the project.

This project has a Code of Conduct.

Table of contents

Support

Looking for help? Check out the instructions for getting support.

Release types

Current and LTS releases follow semantic versioning. A member of the Release Team signs each Current and LTS release. For more information, see the Release README.

Download

Binaries, installers, and source tarballs are available at https://nodejs.org/en/download/.

Current and LTS releases

https://nodejs.org/download/release/

The latest directory is an alias for the latest Current release. The latest-codename directory is an alias for the latest release from an LTS line. For example, the latest-fermium directory contains the latest Fermium (Node.js 14) release.

Nightly releases

https://nodejs.org/download/nightly/

Each directory name and filename contains a date (in UTC) and the commit SHA at the HEAD of the release.

API documentation

Documentation for the latest Current release is at https://nodejs.org/api/. Version-specific documentation is available in each release directory in the docs subdirectory. Version-specific documentation is also at https://nodejs.org/download/docs/.

Verifying binaries

Download directories contain a SHASUMS256.txt file with SHA checksums for the files.

To download SHASUMS256.txt using curl:

$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt

To check that a downloaded file matches the checksum, run it through sha256sum with a command such as:

$ grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c -

For Current and LTS, the GPG detached signature of SHASUMS256.txt is in SHASUMS256.txt.sig. You can use it with gpg to verify the integrity of SHASUMS256.txt. You will first need to import the GPG keys of individuals authorized to create releases. To import the keys:

$ gpg --keyserver hkps://keys.openpgp.org --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C

See Release keys for a script to import active release keys.

Next, download the SHASUMS256.txt.sig for the release:

$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt.sig

Then use gpg --verify SHASUMS256.txt.sig SHASUMS256.txt to verify the file's signature.

Building Node.js

See BUILDING.md for instructions on how to build Node.js from source and a list of supported platforms.

Security

For information on reporting security vulnerabilities in Node.js, see SECURITY.md.

Contributing to Node.js

Current project team members

For information about the governance of the Node.js project, see GOVERNANCE.md.

TSC (Technical Steering Committee)

Emeriti ### TSC emeriti * [addaleax](https://github.com/addaleax) - **Anna Henningsen** <> (she/her) * [bnoordhuis](https://github.com/bnoordhuis) - **Ben Noordhuis** <> * [chrisdickinson](https://github.com/chrisdickinson) - **Chris Dickinson** <> * [codebytere](https://github.com/codebytere) - **Shelley Vohr** <> (she/her) * [danbev](https://github.com/danbev) - **Daniel Bevenius** <> (he/him) * [evanlucas](https://github.com/evanlucas) - **Evan Lucas** <> (he/him) * [Fishrock123](https://github.com/Fishrock123) - **Jeremiah Senkpiel** <> (he/they) * [gabrielschulhof](https://github.com/gabrielschulhof) - **Gabriel Schulhof** <> * [gibfahn](https://github.com/gibfahn) - **Gibson Fahnestock** <> (he/him) * [indutny](https://github.com/indutny) - **Fedor Indutny** <> * [isaacs](https://github.com/isaacs) - **Isaac Z. Schlueter** <> * [joshgav](https://github.com/joshgav) - **Josh Gavant** <> * [mmarchini](https://github.com/mmarchini) - **Mary Marchini** <> (she/her) * [mscdex](https://github.com/mscdex) - **Brian White** <> * [MylesBorins](https://github.com/MylesBorins) - **Myles Borins** <> (he/him) * [nebrius](https://github.com/nebrius) - **Bryan Hughes** <> * [ofrobots](https://github.com/ofrobots) - **Ali Ijaz Sheikh** <> (he/him) * [orangemocha](https://github.com/orangemocha) - **Alexis Campailla** <> * [piscisaureus](https://github.com/piscisaureus) - **Bert Belder** <> * [rvagg](https://github.com/rvagg) - **Rod Vagg** <> * [sam-github](https://github.com/sam-github) - **Sam Roberts** <> * [shigeki](https://github.com/shigeki) - **Shigeki Ohtsu** <> (he/him) * [thefourtheye](https://github.com/thefourtheye) - **Sakthipriyan Vairamani** <> (he/him) * [TimothyGu](https://github.com/TimothyGu) - **Tiancheng "Timothy" Gu** <> (he/him) * [trevnorris](https://github.com/trevnorris) - **Trevor Norris** <>

Collaborators

Emeriti ### Collaborator emeriti * [ak239](https://github.com/ak239) - **Aleksei Koziatinskii** <> * [andrasq](https://github.com/andrasq) - **Andras** <> * [AnnaMag](https://github.com/AnnaMag) - **Anna M. Kedzierska** <> * [AndreasMadsen](https://github.com/AndreasMadsen) - **Andreas Madsen** <> (he/him) * [aqrln](https://github.com/aqrln) - **Alexey Orlenko** <> (he/him) * [bmeurer](https://github.com/bmeurer) - **Benedikt Meurer** <> * [boneskull](https://github.com/boneskull) - **Christopher Hiller** <> (he/him) * [brendanashworth](https://github.com/brendanashworth) - **Brendan Ashworth** <> * [bzoz](https://github.com/bzoz) - **Bartosz Sosnowski** <> * [calvinmetcalf](https://github.com/calvinmetcalf) - **Calvin Metcalf** <> * [chrisdickinson](https://github.com/chrisdickinson) - **Chris Dickinson** <> * [claudiorodriguez](https://github.com/claudiorodriguez) - **Claudio Rodriguez** <> * [DavidCai1993](https://github.com/DavidCai1993) - **David Cai** <> (he/him) * [davisjam](https://github.com/davisjam) - **Jamie Davis** <> (he/him) * [digitalinfinity](https://github.com/digitalinfinity) - **Hitesh Kanwathirtha** <> (he/him) * [dnlup](https://github.com/dnlup) **dnlup** <> * [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) - **Robert Jefe Lindstaedt** <> * [estliberitas](https://github.com/estliberitas) - **Alexander Makarenko** <> * [eugeneo](https://github.com/eugeneo) - **Eugene Ostroukhov** <> * [firedfox](https://github.com/firedfox) - **Daniel Wang** <> * [Fishrock123](https://github.com/Fishrock123) - **Jeremiah Senkpiel** <> (he/they) * [gdams](https://github.com/gdams) - **George Adams** <> (he/him) * [geek](https://github.com/geek) - **Wyatt Preul** <> * [gibfahn](https://github.com/gibfahn) - **Gibson Fahnestock** <> (he/him) * [glentiki](https://github.com/glentiki) - **Glen Keane** <> (he/him) * [hashseed](https://github.com/hashseed) - **Yang Guo** <> (he/him) * [hiroppy](https://github.com/hiroppy) - **Yuta Hiroto** <> (he/him) * [iarna](https://github.com/iarna) - **Rebecca Turner** <> * [imran-iq](https://github.com/imran-iq) - **Imran Iqbal** <> * [imyller](https://github.com/imyller) - **Ilkka Myller** <> * [isaacs](https://github.com/isaacs) - **Isaac Z. Schlueter** <> * [italoacasas](https://github.com/italoacasas) - **Italo A. Casas** <> (he/him) * [jasongin](https://github.com/jasongin) - **Jason Ginchereau** <> * [jbergstroem](https://github.com/jbergstroem) - **Johan Bergström** <> * [jdalton](https://github.com/jdalton) - **John-David Dalton** <> * [jhamhader](https://github.com/jhamhader) - **Yuval Brik** <> * [joaocgreis](https://github.com/joaocgreis) - **João Reis** <> * [joshgav](https://github.com/joshgav) - **Josh Gavant** <> * [julianduque](https://github.com/julianduque) - **Julian Duque** <> (he/him) * [kfarnung](https://github.com/kfarnung) - **Kyle Farnung** <> (he/him) * [kunalspathak](https://github.com/kunalspathak) - **Kunal Pathak** <> * [lance](https://github.com/lance) - **Lance Ball** <> (he/him) * [lucamaraschi](https://github.com/lucamaraschi) - **Luca Maraschi** <> (he/him) * [lundibundi](https://github.com/lundibundi) - **Denys Otrishko** <> (he/him) * [lxe](https://github.com/lxe) - **Aleksey Smolenchuk** <> * [maclover7](https://github.com/maclover7) - **Jon Moss** <> (he/him) * [mafintosh](https://github.com/mafintosh) - **Mathias Buus** <> (he/him) * [matthewloring](https://github.com/matthewloring) - **Matthew Loring** <> * [micnic](https://github.com/micnic) - **Nicu Micleușanu** <> (he/him) * [mikeal](https://github.com/mikeal) - **Mikeal Rogers** <> * [misterdjules](https://github.com/misterdjules) - **Julien Gilli** <> * [mmarchini](https://github.com/mmarchini) - **Mary Marchini** <> (she/her) * [monsanto](https://github.com/monsanto) - **Christopher Monsanto** <> * [MoonBall](https://github.com/MoonBall) - **Chen Gang** <> * [not-an-aardvark](https://github.com/not-an-aardvark) - **Teddy Katz** <> (he/him) * [ofrobots](https://github.com/ofrobots) - **Ali Ijaz Sheikh** <> (he/him) * [Olegas](https://github.com/Olegas) - **Oleg Elifantiev** <> * [orangemocha](https://github.com/orangemocha) - **Alexis Campailla** <> * [othiym23](https://github.com/othiym23) - **Forrest L Norvell** <> (they/them/themself) * [petkaantonov](https://github.com/petkaantonov) - **Petka Antonov** <> * [phillipj](https://github.com/phillipj) - **Phillip Johnsen** <> * [piscisaureus](https://github.com/piscisaureus) - **Bert Belder** <> * [pmq20](https://github.com/pmq20) - **Minqi Pan** <> * [princejwesley](https://github.com/princejwesley) - **Prince John Wesley** <> * [psmarshall](https://github.com/psmarshall) - **Peter Marshall** <> (he/him) * [refack](https://github.com/refack) - **Refael Ackermann (רפאל פלחי)** <> (he/him/הוא/אתה) * [rexagod](https://github.com/rexagod) - **Pranshu Srivastava** <> (he/him) * [rlidwka](https://github.com/rlidwka) - **Alex Kocharin** <> * [rmg](https://github.com/rmg) - **Ryan Graham** <> * [robertkowalski](https://github.com/robertkowalski) - **Robert Kowalski** <> * [romankl](https://github.com/romankl) - **Roman Klauke** <> * [ronkorving](https://github.com/ronkorving) - **Ron Korving** <> * [RReverser](https://github.com/RReverser) - **Ingvar Stepanyan** <> * [rubys](https://github.com/rubys) - **Sam Ruby** <> * [saghul](https://github.com/saghul) - **Saúl Ibarra Corretgé** <> * [sam-github](https://github.com/sam-github) - **Sam Roberts** <> * [sebdeckers](https://github.com/sebdeckers) - **Sebastiaan Deckers** <> * [seishun](https://github.com/seishun) - **Nikolai Vavilov** <> * [shigeki](https://github.com/shigeki) - **Shigeki Ohtsu** <> (he/him) * [silverwind](https://github.com/silverwind) - **Roman Reiss** <> * [stefanmb](https://github.com/stefanmb) - **Stefan Budeanu** <> * [tellnes](https://github.com/tellnes) - **Christian Tellnes** <> * [thefourtheye](https://github.com/thefourtheye) - **Sakthipriyan Vairamani** <> (he/him) * [thlorenz](https://github.com/thlorenz) - **Thorsten Lorenz** <> * [trevnorris](https://github.com/trevnorris) - **Trevor Norris** <> * [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe** <> * [vkurchatkin](https://github.com/vkurchatkin) - **Vladimir Kurchatkin** <> * [vsemozhetbyt](https://github.com/vsemozhetbyt) - **Vse Mozhet Byt** <> (he/him) * [watson](https://github.com/watson) - **Thomas Watson** <> * [whitlockjc](https://github.com/whitlockjc) - **Jeremy Whitlock** <> * [yhwang](https://github.com/yhwang) - **Yihong Wang** <> * [yorkie](https://github.com/yorkie) - **Yorkie Liu** <> * [yosuke-furukawa](https://github.com/yosuke-furukawa) - **Yosuke Furukawa** <>

Collaborators follow the Collaborator Guide in maintaining the Node.js project.

Triagers

Release keys

Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys):

To import the full set of trusted release keys (including subkeys possibly used to sign releases):

gpg --keyserver hkps://keys.openpgp.org --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
gpg --keyserver hkps://keys.openpgp.org --recv-keys 141F07595B7B3FFE74309A937405533BE57C7D57
gpg --keyserver hkps://keys.openpgp.org --recv-keys 74F12602B6F1C4E913FAA37AD3A89613643B6201
gpg --keyserver hkps://keys.openpgp.org --recv-keys 61FC681DFB92A079F1685E77973F295594EC4689
gpg --keyserver hkps://keys.openpgp.org --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
gpg --keyserver hkps://keys.openpgp.org --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
gpg --keyserver hkps://keys.openpgp.org --recv-keys 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4
gpg --keyserver hkps://keys.openpgp.org --recv-keys C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C
gpg --keyserver hkps://keys.openpgp.org --recv-keys 108F52B48DB57BB0CC439B2997B01419BD92F80A

See Verifying binaries for how to use these keys to verify a downloaded file.

Other keys used to sign some previous releases * **Chris Dickinson** <> `9554F04D7259F04124DE6B476D5A82AC7E37093B` * **Colin Ihrig** <> `94AE36675C464D64BAFA68DD7434390BDBE9B9C5` * **Danielle Adams** <> `1C050899334244A8AF75E53792EF661D867B9DFA` * **Evan Lucas** <> `B9AE9905FFD7803F25714661B63B535A4C206CA9` * **Gibson Fahnestock** <> `77984A986EBC2AA786BC0F66B01FBB92821C587A` * **Isaac Z. Schlueter** <> `93C7E9E91B49E432C2F75674B0A78B0A6C481CF6` * **Italo A. Casas** <> `56730D5401028683275BD23C23EFEFE93C4CFFFE` * **James M Snell** <> `71DCFD284A79C3B38668286BC97EC7A07EDE3FC1` * **Jeremiah Senkpiel** <> `FD3A5288F042B6850C66B31F09FE44734EB7990E` * **Julien Gilli** <> `114F43EE0176B71C7BC219DD50A3051F888C628D` * **Rod Vagg** <> `DD8F2338BAE7501E3DD5AC78C273792F7D83545D` * **Ruben Bridgewater** <> `A48C2BEE680E841632CD4E44F07496B3EB3C1762` * **Shelley Vohr** <> `B9E2F5981AA6E0CD28160D9FF13993A75599653C` * **Timothy J Fontaine** <> `7937DFD2AB06298B2293C3187D33FF9D0246406D`

Security release stewards

When possible, the commitment to take slots in the security release steward rotation is made by companies in order to ensure individuals who act as security stewards have the support and recognition from their employer to be able to prioritize security releases. Security release stewards manage security releases on a rotation basis as outlined in the security release process.

License

Node.js is available under the MIT license. Node.js also includes external libraries that are available under a variety of licenses. See LICENSE for the full license text.