koffi-cream 2.11.0 → 2.12.1
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 +38 -24
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# koffi-cream
|
|
3
2
|
A lighter packaging of Niels Martignène's excellent [Koffi](https://koffi.dev).
|
|
4
3
|
|
|
5
4
|
Just `npm install koffi-cream` instead of `koffi` and use it like the real thing:
|
|
@@ -8,13 +7,16 @@ Just `npm install koffi-cream` instead of `koffi` and use it like the real thing
|
|
|
8
7
|
import koffi from 'koffi-cream'
|
|
9
8
|
|
|
10
9
|
const lib = koffi.lib('some_lib')
|
|
11
|
-
const
|
|
10
|
+
const some_func = lib.func('int some_func(int a, int b)')
|
|
12
11
|
// etc.
|
|
13
12
|
```
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
> [!IMPORTANT]
|
|
15
|
+
> **This package is neither a fork nor a patch. It *is* the original Koffi**, only packaged differently to avoid downloading a megalithic[^1] package bloated with unnecessary files[^2].
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
## The why and the how
|
|
19
|
+
The discussion at https://github.com/Koromix/koffi/issues/201 explains why I decided to create `koffi-cream`.
|
|
18
20
|
|
|
19
21
|
`koffi-cream` repackages Koffi using the same strategy as many popular packages in the JavaScript community like `esbuild` or `swc`: by leveraging the `optionalDependencies`, `os`, `cpu` and `libc` properties in `package.json`.
|
|
20
22
|
|
|
@@ -24,36 +26,48 @@ This way, when you install `koffi-cream`, your package manager will only downloa
|
|
|
24
26
|
|
|
25
27
|
**That's 97% off compared to the original Koffi package!**
|
|
26
28
|
|
|
27
|
-
[
|
|
28
|
-
|
|
29
|
+
> [!NOTE]
|
|
30
|
+
> The `os` and `cpu` are standard properties, supported by all package managers. But the `libc` property, used to distinguish Linux distros between gnu and musl, is newer and only supported by `npm 10.4.0` and later, `pnpm 7.1.0` and later, and `yarn 3.2.0` and later.
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
[^1]: As of 2.11.0, Koffi weights 15 MB compressed and 75 MB uncompressed!
|
|
33
|
+
[^2]: Koffi's package includes 17 natives binaries (of which 16 are not compatible with your platform), the build tools and the full source code!
|
|
31
34
|
|
|
32
|
-
`koffi-cream` only offers a subset of Koffi's 16 builds:
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
## Available packages
|
|
37
|
+
`koffi-cream` only offers a subset of Koffi's 17 native builds:
|
|
38
|
+
|
|
39
|
+
| Koffi binary | koffi-cream package |
|
|
40
|
+
|---------------|--------------------------------------------------------------------------------------------|
|
|
41
|
+
| darwin-arm64 | [@septh/koffi-darwin-arm64](https://www.npmjs.com/package/@septh/koffi-darwin-arm64) |
|
|
42
|
+
| darwin-x64 | [@septh/koffi-darwin-x64](https://www.npmjs.com/package/@septh/koffi-darwin-x64) |
|
|
43
|
+
| freebsd-arm64 | [@septh/koffi-freebsd-arm64](https://www.npmjs.com/package/@septh/koffi-freebsd-arm64) |
|
|
44
|
+
| freebsd-ia32 | ❌ |
|
|
45
|
+
| freebsd-x64 | [@septh/koffi-freebsd-x64](https://www.npmjs.com/package/@septh/koffi-freebsd-x64) |
|
|
46
|
+
| linux-arm64 | [@septh/koffi-linux-arm64](https://www.npmjs.com/package/@septh/koffi-linux-arm64) |
|
|
47
|
+
| linux-armhf | ❌ |
|
|
48
|
+
| linux-ia32 | ❌ |
|
|
49
|
+
| linux-loong64 | [@septh/koffi-linux-loong64](https://www.npmjs.com/package/@septh/koffi-linux-loong64) |
|
|
50
|
+
| linux-riscv64 | [@septh/koffi-linux-riscv64](https://www.npmjs.com/package/@septh/koffi-linux-riscv64) |
|
|
51
|
+
| linux-x64 | [@septh/koffi-linux-x64-glibc](https://www.npmjs.com/package/@septh/koffi-linux-x64-glibc) |
|
|
52
|
+
| musl-x64 | [@septh/koffi-linux-x64-musl](https://www.npmjs.com/package/@septh/koffi-linux-x64-musl) |
|
|
53
|
+
| openbsd-ia32 | ❌ |
|
|
54
|
+
| openbsd-x64 | [@septh/koffi-openbsd-x64](https://www.npmjs.com/package/@septh/koffi-openbsd-x64) |
|
|
55
|
+
| win32-arm64 | [@septh/koffi-win32-arm64](https://www.npmjs.com/package/@septh/koffi-win32-arm64) |
|
|
56
|
+
| win32-ia32 | ❌ |
|
|
57
|
+
| win32-x64 | [@septh/koffi-win32-x64](https://www.npmjs.com/package/@septh/koffi-win32-x64) |
|
|
58
|
+
|
|
59
|
+
I do not plan to add the missing builds. If you need one of these, you'll have to stick with Koffi.
|
|
45
60
|
|
|
46
|
-
I do not plan to add other builds, especially not the 32 bit binaries. If you need these, stick with Koffi.
|
|
47
61
|
|
|
48
62
|
## Version numbering
|
|
49
|
-
|
|
50
63
|
To make things easy on the user, `koffi-cream`'s version number will always be aligned with Koffi's.
|
|
51
64
|
|
|
52
|
-
Hence,
|
|
65
|
+
Hence, there is no `koffi-cream` 1.x or 2.0; the first version published is 2.11.0 which ships with Koffi's 2.11.0 binaries.
|
|
66
|
+
|
|
53
67
|
|
|
54
68
|
## Related
|
|
69
|
+
- [libwin32](https://github.com/Septh/libwin32#readme): Node bindings to native Win32 DLLs through ~~Koffi~~ koffi-cream.
|
|
55
70
|
|
|
56
|
-
- The discussion at https://github.com/Koromix/koffi/issues/201 explains why I decided to create `koffi-cream` myself.
|
|
57
71
|
|
|
58
72
|
## License
|
|
59
73
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koffi-cream",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.1",
|
|
4
4
|
"description": "A lighter packaging for Koffi, the fast and simple C FFI (foreign function interface) for Node.js",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Stephan 'Septh' Schreiber",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"napi",
|
|
25
25
|
"koffi"
|
|
26
26
|
],
|
|
27
|
-
"homepage": "https://github.com/Septh/koffi-cream
|
|
27
|
+
"homepage": "https://github.com/Septh/koffi-cream/tree/main/packages/koffi-cream",
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
30
|
"url": "git+https://github.com/Septh/koffi-cream.git",
|
|
@@ -41,16 +41,17 @@
|
|
|
41
41
|
"main": "index.js",
|
|
42
42
|
"types": "index.d.ts",
|
|
43
43
|
"optionalDependencies": {
|
|
44
|
-
"@septh/koffi-darwin-arm64": "2.
|
|
45
|
-
"@septh/koffi-darwin-x64": "2.
|
|
46
|
-
"@septh/koffi-freebsd-arm64": "2.
|
|
47
|
-
"@septh/koffi-freebsd-x64": "2.
|
|
48
|
-
"@septh/koffi-linux-arm64": "2.
|
|
49
|
-
"@septh/koffi-linux-
|
|
50
|
-
"@septh/koffi-linux-
|
|
51
|
-
"@septh/koffi-linux-x64-
|
|
52
|
-
"@septh/koffi-
|
|
53
|
-
"@septh/koffi-
|
|
54
|
-
"@septh/koffi-win32-
|
|
44
|
+
"@septh/koffi-darwin-arm64": "2.12.1",
|
|
45
|
+
"@septh/koffi-darwin-x64": "2.12.1",
|
|
46
|
+
"@septh/koffi-freebsd-arm64": "2.12.1",
|
|
47
|
+
"@septh/koffi-freebsd-x64": "2.12.1",
|
|
48
|
+
"@septh/koffi-linux-arm64": "2.12.1",
|
|
49
|
+
"@septh/koffi-linux-loong64": "2.12.1",
|
|
50
|
+
"@septh/koffi-linux-riscv64": "2.12.1",
|
|
51
|
+
"@septh/koffi-linux-x64-glibc": "2.12.1",
|
|
52
|
+
"@septh/koffi-linux-x64-musl": "2.12.1",
|
|
53
|
+
"@septh/koffi-openbsd-x64": "2.12.1",
|
|
54
|
+
"@septh/koffi-win32-arm64": "2.12.1",
|
|
55
|
+
"@septh/koffi-win32-x64": "2.12.1"
|
|
55
56
|
}
|
|
56
57
|
}
|