koffi-cream 2.12.0 → 2.12.2

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 CHANGED
@@ -1,4 +1,4 @@
1
- # Koffi-Cream
1
+ # koffi-cream
2
2
  A lighter packaging of Niels Martignène's excellent [Koffi](https://koffi.dev).
3
3
 
4
4
  Just `npm install koffi-cream` instead of `koffi` and use it like the real thing:
@@ -16,6 +16,8 @@ const some_func = lib.func('int some_func(int a, int b)')
16
16
 
17
17
 
18
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`.
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
 
21
23
  This way, when you install `koffi-cream`, your package manager will only download and install the build that is right for your platform. For example, on Windows AMD/Intel 64 bit, your package manager will install:
@@ -28,11 +30,11 @@ This way, when you install `koffi-cream`, your package manager will only downloa
28
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!
31
- [^2]: Koffi's package includes 16 natives binaries (of which 15 are not compatible with your platform), the build tools and the full source code!
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!
32
34
 
33
35
 
34
36
  ## Available packages
35
- `koffi-cream` only offers a subset of Koffi's 16 native builds:
37
+ `koffi-cream` only offers a subset of Koffi's 17 native builds:
36
38
 
37
39
  | Koffi binary | koffi-cream package |
38
40
  |---------------|--------------------------------------------------------------------------------------------|
@@ -44,6 +46,7 @@ This way, when you install `koffi-cream`, your package manager will only downloa
44
46
  | linux-arm64 | [@septh/koffi-linux-arm64](https://www.npmjs.com/package/@septh/koffi-linux-arm64) |
45
47
  | linux-armhf | ❌ |
46
48
  | linux-ia32 | ❌ |
49
+ | linux-loong64 | [@septh/koffi-linux-loong64](https://www.npmjs.com/package/@septh/koffi-linux-loong64) |
47
50
  | linux-riscv64 | [@septh/koffi-linux-riscv64](https://www.npmjs.com/package/@septh/koffi-linux-riscv64) |
48
51
  | linux-x64 | [@septh/koffi-linux-x64-glibc](https://www.npmjs.com/package/@septh/koffi-linux-x64-glibc) |
49
52
  | musl-x64 | [@septh/koffi-linux-x64-musl](https://www.npmjs.com/package/@septh/koffi-linux-x64-musl) |
@@ -63,7 +66,6 @@ Hence, there is no `koffi-cream` 1.x or 2.0; the first version published is 2.11
63
66
 
64
67
 
65
68
  ## Related
66
- - The discussion at https://github.com/Koromix/koffi/issues/201 explains why I decided to create `koffi-cream`.
67
69
  - [libwin32](https://github.com/Septh/libwin32#readme): Node bindings to native Win32 DLLs through ~~Koffi~~ koffi-cream.
68
70
 
69
71
 
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- // Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ // Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  //
3
3
  // Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- // this software and associated documentation files (the “Software”), to deal in
4
+ // this software and associated documentation files (the “Software”), to deal in
5
5
  // the Software without restriction, including without limitation the rights to use,
6
6
  // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  // Software, and to permit persons to whom the Software is furnished to do so,
package/index.js CHANGED
@@ -24,12 +24,12 @@ const { platform, arch } = require('node:process')
24
24
  const { deprecate } = require('node:util')
25
25
 
26
26
  let native
27
- if (platform === 'linux' && arch === 'x64') {
27
+ if (platform === 'linux' && (arch === 'x64' || arch === 'arm64')) {
28
28
  try {
29
- native = require(`@septh/koffi-linux-x64-glibc`)
29
+ native = require(`@septh/koffi-linux-${arch}-glibc`)
30
30
  }
31
31
  catch {
32
- native = require(`@septh/koffi-linux-x64-musl`)
32
+ native = require(`@septh/koffi-linux-${arch}-musl`)
33
33
  }
34
34
  }
35
35
  else native = require(`@septh/koffi-${platform}-${arch}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koffi-cream",
3
- "version": "2.12.0",
3
+ "version": "2.12.2",
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#readme",
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,17 +41,18 @@
41
41
  "main": "index.js",
42
42
  "types": "index.d.ts",
43
43
  "optionalDependencies": {
44
- "@septh/koffi-darwin-arm64": "2.12.0",
45
- "@septh/koffi-darwin-x64": "2.12.0",
46
- "@septh/koffi-freebsd-arm64": "2.12.0",
47
- "@septh/koffi-freebsd-x64": "2.12.0",
48
- "@septh/koffi-linux-arm64": "2.12.0",
49
- "@septh/koffi-linux-riscv64": "2.12.0",
50
- "@septh/koffi-linux-x64-glibc": "2.12.0",
51
- "@septh/koffi-linux-x64-musl": "2.12.0",
52
- "@septh/koffi-linux-loong64": "2.12.0",
53
- "@septh/koffi-openbsd-x64": "2.12.0",
54
- "@septh/koffi-win32-arm64": "2.12.0",
55
- "@septh/koffi-win32-x64": "2.12.0"
44
+ "@septh/koffi-darwin-arm64": "2.12.2",
45
+ "@septh/koffi-darwin-x64": "2.12.2",
46
+ "@septh/koffi-linux-arm64-glibc": "2.12.2",
47
+ "@septh/koffi-linux-arm64-musl": "2.12.2",
48
+ "@septh/koffi-linux-x64-glibc": "2.12.2",
49
+ "@septh/koffi-linux-x64-musl": "2.12.2",
50
+ "@septh/koffi-linux-loong64": "2.12.2",
51
+ "@septh/koffi-linux-riscv64": "2.12.2",
52
+ "@septh/koffi-win32-arm64": "2.12.2",
53
+ "@septh/koffi-win32-x64": "2.12.2",
54
+ "@septh/koffi-freebsd-arm64": "2.12.2",
55
+ "@septh/koffi-freebsd-x64": "2.12.2",
56
+ "@septh/koffi-openbsd-x64": "2.12.2"
56
57
  }
57
58
  }