Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koffi

Package Overview
Dependencies
Maintainers
1
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koffi - npm Package Compare versions

Comparing version 2.5.9 to 2.5.10

src/koffi/examples/node-esbuild/index.js

4

CHANGELOG.md

@@ -7,2 +7,6 @@ # Changelog

#### Koffi 2.5.10
- Fix CMake regression when client has to build Koffi
#### Koffi 2.5.9

@@ -9,0 +13,0 @@

49

doc/packaging.md

@@ -9,3 +9,3 @@ # Packaging

In theory, the bundlers should be able to find recorgnize all native modules because they are explictly listed in the Javascript file, as static strings.
In theory, the **packagers/bundlers should be able to find all native modules** because they are explictly listed in the Javascript file (as static strings) and package them somehow.

@@ -17,9 +17,9 @@ If that is not the case, you can manually arrange to copy the `node_modules/koffi/build/koffi` directory next to your bundled script.

```
koffi/
win32_x64/
koffi.node
linux_x64/
koffi.node
...
MyBundle.js
koffi/
win32_x64/
koffi.node
linux_x64/
koffi.node
...
MyBundle.js
```

@@ -30,10 +30,11 @@

```
locales/
resources/
koffi/
darwin_arm64/
koffi.node
darwin_x64/
koffi.node
MyApp.exe
locales/
resources/
koffi/
win32_ia32/
koffi.node
win32_x64/
koffi.node
...
MyApp.exe
```

@@ -45,5 +46,5 @@

Packaging with electron-builder should work as-is:
Packaging with electron-builder should work as-is.
You can also go take a look at the full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/electron-builder).
Take a look at the full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/electron-builder).

@@ -58,3 +59,3 @@ ### Electron Forge

You can also go take a look at the full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/electron-forge).
Take a look at the full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/electron-forge).

@@ -66,1 +67,11 @@ ### NW.js

You can find a full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/nwjs).
### Node.js and esbuild
You can easily tell esbuild to copy the native files with the copy loader and things should just work. Use something like:
```sh
esbuild index.js --platform=node --bundle --loader:.node=copy --outdir=dist/
```
You can find a full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/node-esbuild).
{
"name": "koffi",
"version": "2.5.9",
"stable": "2.5.9",
"version": "2.5.10",
"stable": "2.5.10",
"description": "Fast and simple C FFI (foreign function interface) for Node.js",

@@ -6,0 +6,0 @@ "keywords": [

@@ -24,5 +24,5 @@ // Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>

const cnoke = require('./cnoke/src/index.js');
const util = require('util');
const fs = require('fs');
const { get_napi_version, determine_arch } = require('./cnoke/src/tools.js');
const pkg = require('../package.json');

@@ -32,3 +32,3 @@

let major = parseInt(process.versions.node, 10);
let required = cnoke.get_napi_version(pkg.cnoke.napi, major);
let required = get_napi_version(pkg.cnoke.napi, major);

@@ -42,3 +42,3 @@ if (required != null) {

let arch = cnoke.determine_arch();
let arch = determine_arch();
let triplet = `${process.platform}_${arch}`;

@@ -45,0 +45,0 @@

@@ -50,3 +50,7 @@ # Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>

file(READ ${CMAKE_CURRENT_SOURCE_DIR}/package.json PKG)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/package.json)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/package.json PKG)
else()
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../../package.json PKG)
endif()
string(REGEX MATCH "\"version\": \"([^\"]+)\"" XX "${PKG}")

@@ -53,0 +57,0 @@ set(KOFFI_VERSION ${CMAKE_MATCH_1})

{
"name": "Koffi Config",
"name": "KoffiConfig",
"version": "1.0.0",

@@ -19,4 +19,4 @@ "description": "Koffi Electron Example",

"dependencies": {
"koffi": "^2.5.8"
"koffi": "^2.5.9"
}
}

@@ -6,14 +6,2 @@ This is a simple example shows:

One of the important piece for the packaging is in `package.json`, specifically this part:
```json
"build": {
"extraResources": [
{ "from": "node_modules/koffi/build", "to": "koffi" }
]
}
```
This instructs electron-builder to copy the native koffi modules to a place where your application will find them.
Use the following commands to package the app for your system:

@@ -20,0 +8,0 @@

{
"name": "Koffi Config",
"name": "KoffiConfig",
"version": "1.0.0",

@@ -35,4 +35,4 @@ "description": "Koffi Electron Example",

"electron-squirrel-startup": "^1.0.0",
"koffi": "^2.5.8"
"koffi": "^2.5.9"
}
}

@@ -24,3 +24,3 @@ const { app, BrowserWindow, ipcMain } = require('electron');

// Open the DevTools.
mainWindow.webContents.openDevTools();
// mainWindow.webContents.openDevTools();
};

@@ -27,0 +27,0 @@

{
"name": "Koffi Config",
"name": "KoffiConfig",
"version": "1.0.0",
"main": "index.html",

@@ -7,4 +8,4 @@ "author": "Niels Martignène <niels.martignene@protonmail.com>",

"dependencies": {
"koffi": "^2.5.8"
"koffi": "^2.5.9"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc