Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xan105/node-nodert
NodeRT but precompiled (use WinRT API directly from node)
https://github.com/xan105/node-nodert
node-gyp nodejs nodert precompiled winrt
Last synced: 3 months ago
JSON representation
NodeRT but precompiled (use WinRT API directly from node)
- Host: GitHub
- URL: https://github.com/xan105/node-nodert
- Owner: xan105
- License: other
- Created: 2022-10-22T09:00:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-07T04:43:44.000Z (5 months ago)
- Last Synced: 2024-11-10T07:41:29.560Z (3 months ago)
- Topics: node-gyp, nodejs, nodert, precompiled, winrt
- Language: JavaScript
- Homepage:
- Size: 1.76 MB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
About
=====NodeRT but precompiled (use WinRT API directly from node).
Usage is similar to the original NodeRT package(s).
For more details on NodeRT, please kindly see the corresponding NodeRT package.đĻ Scoped `@xan105` packages are for my own personal use but feel free to use them.
Example
=======Dummy toast notification
```js
import * as winRT from "@xan105/nodert";
const xml = new winRT.data.xml.dom.XmlDocument();
xml.loadXml(xmlString);const toast = new winRT.ui.notifications.ToastNotification(xml);
const toaster = winRT.ui.notifications.ToastNotificationManager.createToastNotifier(appID);
toaster.show(toast);setTimeout(() => {}, 100); //Keep alive
```đĄ Interested in toast notification ? check out [powertoast](https://www.npmjs.com/package/powertoast).
Install
=======```
npm i @xan105/nodert
```An internet connection is required to download the prebuilt binaries. They are [hosted on github](https://github.com/xan105/node-nodeRT/releases).
By default every NodeRT bindings will be installed.
Similar to [nodert-npm](https://github.com/NodeRT/nodert-npm/) you can choose to only keep the NodeRT bindings you _do_ need by:- passing a comma separated list of modules as argument
```
npm i @xan105/nodert --modules="windows.ui.notifications, windows.data.xml.dom"
```- or by adding a list of modules in your package.json file under the `_nodert/modules` path
For example, having the following section in your package.json will result with the installation of the "windows.devices.geolocation" and "windows.devices.sensors" modules:
```json
"_nodert" : {
"modules" : [
"windows.devices.geolocation",
"windows.device.sensors"
]
},
```NodeRT scope used as a base is [nodert-win11-22h2](https://www.npmjs.com/search?q=@nodert-win11-22h2).
`XAML` and `*.preview` WinRT namespaces are removed.
Some namespaces have been kept back to `win10-rs4` due to compilation failure (regression).List of namespaces can be found [here](https://github.com/xan105/node-nodeRT/tree/main/packages) (GitHub).
### ABI
NodeRT packages are not using [n-api](https://nodejs.org/api/n-api.html#node-api) they must be compiled for every ABI.
Unless exception, expect prebuilds for current and previous Node.js LTS releases (x64 / ARM64).
â ī¸ Due to the fast Electron release cycle, do not expect this package to always keep up with the latest.List of provided ABI can be found [here](https://github.com/xan105/node-nodeRT/blob/main/integrity.json) (GitHub) or in the corresponding GitHub release.
âšī¸ You may want to check previous versions of this package if you are still using an older version of Node or Electron.
Older versions are dropped over time due to usage of new features and the like.### Electron
Switching to Electron ABI instead of Node can be done by adding the `--electron` flag or the env. variable `npm_config_runtime` set to `electron`.
Alternatively in your package.json file under the `_nodert` path:
```json
"_nodert" : {
"runtime": "electron",
"modules" : [
"windows.devices.geolocation",
"windows.device.sensors"
]
},
```âšī¸ Electron's `packages.json` file will be read to determine Electron's ABI _(I recommend you install it first to avoid any surprise)_.
đĄ In case npm mutes the output of the install script; You can check inside `node_modules/@xan105/nodeRT/prebuilds` which runtime was downloaded: `node` or `electron`.
â ī¸ NodeRT should be loaded in the main process [NodeRT#158](https://github.com/NodeRT/NodeRT/issues/158)
API
===> Please see the [NodeRT](https://github.com/NodeRT/NodeRT#using-nodert-modules) and [Microsoft](https://learn.microsoft.com/en-us/uwp/api/) docs for more details.
â ī¸ This module is only available as an ECMAScript module (ESM).
WinRT namespaces are also exported under their respective namespace:
```js
import { ui } from "@xan105/nodert"
const toast = new ui.notifications.ToastNotification(xml);import { notifications } from "@xan105/nodert/ui"
const toast = new notifications.ToastNotification(xml);
```â ī¸ Please be warned that in case of missing bindings the corresponding exports will be **undefined**.
They are a couple of them due to compilation failure.đ NB: Provided types are those from NodeRT packages. I know they have some errors but I haven't the courage to fix them up by hand.
Build Env
=========đ Visual Studio 2022:
+ Visual Studio Installer:
- C++ core features
- MSVC v143 - VS 2022 C++ x86/x64 build tools (latest)
- MSVC v140 - VS 2015 C++ build tools (v14.00) //VS2015 build tools
- C++ ATL for latest v143 (x86 & x64)
- C++ MFC for latest v143 (x86 & x64)
- MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (latest)
- C++ ATL for latest v143 (ARM64/ARM64EC)
- C++ MFC for latest v143 (ARM64/ARM64EC)
- Windows 11 SDK 22h2 (10.0.22621.0)
+ Manual:
- [Windows 10 SDK rs4 (10.0.17134.0)](https://go.microsoft.com/fwlink/p/?linkid=870807)âŦĸ Node.js native addon:
- Node.js v20.12.2
- npm v10.5.0
- node-gyp v10.1.0
- nan v2.19.0
- Python3 v3.11.3