koffi 3.0.0-alpha.4 → 3.0.0-alpha.6
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/{build → bin}/koffi/darwin_arm64/koffi.node +0 -0
- package/bin/koffi/darwin_x64/koffi.node +0 -0
- package/bin/koffi/freebsd_arm64/koffi.node +0 -0
- package/bin/koffi/freebsd_ia32/koffi.node +0 -0
- package/bin/koffi/freebsd_x64/koffi.node +0 -0
- package/{build → bin}/koffi/linux_arm64/koffi.node +0 -0
- package/{build → bin}/koffi/linux_ia32/koffi.node +0 -0
- package/bin/koffi/linux_x64/koffi.node +0 -0
- package/{build → bin}/koffi/musl_arm64/koffi.node +0 -0
- package/{build → bin}/koffi/musl_x64/koffi.node +0 -0
- package/bin/koffi/openbsd_ia32/koffi.node +0 -0
- package/bin/koffi/openbsd_x64/koffi.node +0 -0
- package/{build → bin}/koffi/win32_ia32/koffi.exp +0 -0
- package/{build → bin}/koffi/win32_ia32/koffi.node +0 -0
- package/{build → bin}/koffi/win32_x64/koffi.exp +0 -0
- package/{build → bin}/koffi/win32_x64/koffi.node +0 -0
- package/doc/contribute.md +4 -2
- package/doc/packaging.md +1 -1
- package/index.d.ts +0 -2
- package/index.js +1 -1
- package/indirect.js +1 -1
- package/package.json +15 -4
- package/src/koffi/index.cjs +145 -285
- package/src/koffi/index.js +26 -143
- package/src/koffi/indirect.cjs +144 -284
- package/src/koffi/indirect.js +12 -129
- package/src/koffi/src/abi/arm64.cc +3 -0
- package/src/koffi/src/abi/x64win.cc +3 -0
- package/src/koffi/src/abi/x86.cc +3 -0
- package/src/koffi/src/call.cc +59 -30
- package/src/koffi/src/call.hh +1 -1
- package/src/koffi/src/ffi.cc +0 -16
- package/src/koffi/src/ffi.hh +2 -3
- package/src/koffi/src/util.cc +0 -26
- package/src/koffi/src/util.hh +43 -13
- package/build/koffi/darwin_x64/koffi.node +0 -0
- package/build/koffi/freebsd_arm64/koffi.node +0 -0
- package/build/koffi/freebsd_ia32/koffi.node +0 -0
- package/build/koffi/freebsd_x64/koffi.node +0 -0
- package/build/koffi/linux_x64/koffi.node +0 -0
- package/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/build/koffi/openbsd_x64/koffi.node +0 -0
- /package/{build → bin}/koffi/win32_ia32/koffi.lib +0 -0
- /package/{build → bin}/koffi/win32_x64/koffi.lib +0 -0
- /package/{src/build.js → build.js} +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/doc/contribute.md
CHANGED
|
@@ -145,8 +145,10 @@ cd src/koffi
|
|
|
145
145
|
node tools/brew.js test # If not done before
|
|
146
146
|
node tools/brew.js build
|
|
147
147
|
|
|
148
|
-
cd ../../bin/
|
|
149
|
-
|
|
148
|
+
cd ../../bin/koffi/packages
|
|
149
|
+
|
|
150
|
+
./prepare.sh
|
|
151
|
+
./publish.sh
|
|
150
152
|
```
|
|
151
153
|
|
|
152
154
|
Some platforms are emulated so this can take a few minutes until the pre-built binaries are ready. Go grab a cup of coffee, come back and execute the `npm publish` command!
|
package/doc/packaging.md
CHANGED
|
@@ -11,7 +11,7 @@ Koffi uses native modules to work. The NPM package contains binaries for various
|
|
|
11
11
|
|
|
12
12
|
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.
|
|
13
13
|
|
|
14
|
-
If that is not the case, you can manually arrange to copy the `node_modules/koffi/
|
|
14
|
+
If that is not the case, you can manually arrange to copy the `node_modules/koffi/bin/koffi` directory next to your bundled script.
|
|
15
15
|
|
|
16
16
|
Here is an example that would work:
|
|
17
17
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default } from "./src/koffi/index.js";
|
package/indirect.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default } from "./src/koffi/indirect.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koffi",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.6",
|
|
4
4
|
"description": "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foreign",
|
|
@@ -21,18 +21,29 @@
|
|
|
21
21
|
"email": "niels.martignene@protonmail.com",
|
|
22
22
|
"url": "https://koromix.dev/"
|
|
23
23
|
},
|
|
24
|
-
"module": "./index.js",
|
|
25
24
|
"scripts": {
|
|
26
|
-
"install": "node
|
|
25
|
+
"install": "node ./build.js -P . -D src/koffi --prebuild --release"
|
|
27
26
|
},
|
|
28
27
|
"license": "MIT",
|
|
29
28
|
"cnoke": {
|
|
30
29
|
"api": "../../vendor/node-api-headers",
|
|
31
|
-
"output": "
|
|
30
|
+
"output": "bin/koffi/{{ toolchain }}",
|
|
32
31
|
"node": 16,
|
|
33
32
|
"napi": 8
|
|
34
33
|
},
|
|
35
34
|
"funding": "https://liberapay.com/Koromix",
|
|
35
|
+
"type": "module",
|
|
36
36
|
"main": "./index.cjs",
|
|
37
|
+
"module": "./index.js",
|
|
38
|
+
"exports": {
|
|
39
|
+
".": {
|
|
40
|
+
"import": "./index.js",
|
|
41
|
+
"require": "./index.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./indirect": {
|
|
44
|
+
"import": "./indirect.js",
|
|
45
|
+
"require": "./indirect.cjs"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
37
48
|
"types": "./index.d.ts"
|
|
38
49
|
}
|
package/src/koffi/index.cjs
CHANGED
|
@@ -4,6 +4,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __esm = (fn, res) => function __init() {
|
|
8
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
+
};
|
|
7
10
|
var __commonJS = (cb, mod) => function __require() {
|
|
8
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
12
|
};
|
|
@@ -29,154 +32,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
32
|
));
|
|
30
33
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
34
|
|
|
32
|
-
// src/static.js
|
|
33
|
-
var require_static = __commonJS({
|
|
34
|
-
"src/static.js"(exports2, module2) {
|
|
35
|
-
var { createRequire: createRequire2 } = require("node:module");
|
|
36
|
-
var requireNative2 = createRequire2(__dirname);
|
|
37
|
-
function loadStatic2(pkg2) {
|
|
38
|
-
let native2 = null;
|
|
39
|
-
if (native2 == null && pkg2 == "linux-arm64") {
|
|
40
|
-
try {
|
|
41
|
-
native2 = requireNative2("../../build/koffi/linux_arm64/koffi.node");
|
|
42
|
-
} catch (err) {
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (native2 == null && pkg2 == "linux-arm64") {
|
|
46
|
-
try {
|
|
47
|
-
native2 = requireNative2("../../build/koffi/musl_arm64/koffi.node");
|
|
48
|
-
} catch (err) {
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (native2 == null && pkg2 == "linux-ia32") {
|
|
52
|
-
try {
|
|
53
|
-
native2 = requireNative2("../../build/koffi/linux_ia32/koffi.node");
|
|
54
|
-
} catch (err) {
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (native2 == null && pkg2 == "linux-x64") {
|
|
58
|
-
try {
|
|
59
|
-
native2 = requireNative2("../../build/koffi/linux_x64/koffi.node");
|
|
60
|
-
} catch (err) {
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (native2 == null && pkg2 == "linux-x64") {
|
|
64
|
-
try {
|
|
65
|
-
native2 = requireNative2("../../build/koffi/musl_x64/koffi.node");
|
|
66
|
-
} catch (err) {
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (native2 == null && pkg2 == "freebsd-ia32") {
|
|
70
|
-
try {
|
|
71
|
-
native2 = requireNative2("../../build/koffi/freebsd_ia32/koffi.node");
|
|
72
|
-
} catch (err) {
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (native2 == null && pkg2 == "freebsd-x64") {
|
|
76
|
-
try {
|
|
77
|
-
native2 = requireNative2("../../build/koffi/freebsd_x64/koffi.node");
|
|
78
|
-
} catch (err) {
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (native2 == null && pkg2 == "freebsd-arm64") {
|
|
82
|
-
try {
|
|
83
|
-
native2 = requireNative2("../../build/koffi/freebsd_arm64/koffi.node");
|
|
84
|
-
} catch (err) {
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (native2 == null && pkg2 == "openbsd-ia32") {
|
|
88
|
-
try {
|
|
89
|
-
native2 = requireNative2("../../build/koffi/openbsd_ia32/koffi.node");
|
|
90
|
-
} catch (err) {
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (native2 == null && pkg2 == "openbsd-x64") {
|
|
94
|
-
try {
|
|
95
|
-
native2 = requireNative2("../../build/koffi/openbsd_x64/koffi.node");
|
|
96
|
-
} catch (err) {
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (native2 == null && pkg2 == "win32-ia32") {
|
|
100
|
-
try {
|
|
101
|
-
native2 = requireNative2("../../build/koffi/win32_ia32/koffi.node");
|
|
102
|
-
} catch (err) {
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (native2 == null && pkg2 == "win32-x64") {
|
|
106
|
-
try {
|
|
107
|
-
native2 = requireNative2("../../build/koffi/win32_x64/koffi.node");
|
|
108
|
-
} catch (err) {
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (native2 == null && pkg2 == "darwin-x64") {
|
|
112
|
-
try {
|
|
113
|
-
native2 = requireNative2("../../build/koffi/darwin_x64/koffi.node");
|
|
114
|
-
} catch (err) {
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (native2 == null && pkg2 == "darwin-arm64") {
|
|
118
|
-
try {
|
|
119
|
-
native2 = requireNative2("../../build/koffi/darwin_arm64/koffi.node");
|
|
120
|
-
} catch (err) {
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return native2;
|
|
124
|
-
}
|
|
125
|
-
module2.exports = { loadStatic: loadStatic2 };
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
// index.js
|
|
130
|
-
var index_exports = {};
|
|
131
|
-
__export(index_exports, {
|
|
132
|
-
Union: () => _Union,
|
|
133
|
-
address: () => _address,
|
|
134
|
-
alias: () => _alias,
|
|
135
|
-
alignof: () => _alignof,
|
|
136
|
-
alloc: () => _alloc,
|
|
137
|
-
array: () => _array,
|
|
138
|
-
as: () => _as,
|
|
139
|
-
call: () => _call,
|
|
140
|
-
config: () => _config,
|
|
141
|
-
decode: () => _decode,
|
|
142
|
-
disposable: () => _disposable,
|
|
143
|
-
encode: () => _encode,
|
|
144
|
-
errno: () => _errno,
|
|
145
|
-
extension: () => _extension,
|
|
146
|
-
free: () => _free,
|
|
147
|
-
in: () => _in,
|
|
148
|
-
inout: () => _inout,
|
|
149
|
-
introspect: () => _introspect,
|
|
150
|
-
load: () => _load,
|
|
151
|
-
node: () => _node,
|
|
152
|
-
offsetof: () => _offsetof,
|
|
153
|
-
opaque: () => _opaque,
|
|
154
|
-
os: () => _os,
|
|
155
|
-
out: () => _out,
|
|
156
|
-
pack: () => _pack,
|
|
157
|
-
pointer: () => _pointer,
|
|
158
|
-
proto: () => _proto,
|
|
159
|
-
register: () => _register,
|
|
160
|
-
reset: () => _reset,
|
|
161
|
-
resolve: () => _resolve,
|
|
162
|
-
sizeof: () => _sizeof,
|
|
163
|
-
stats: () => _stats,
|
|
164
|
-
struct: () => _struct,
|
|
165
|
-
types: () => _types,
|
|
166
|
-
union: () => _union,
|
|
167
|
-
unregister: () => _unregister,
|
|
168
|
-
version: () => _version,
|
|
169
|
-
view: () => _view
|
|
170
|
-
});
|
|
171
|
-
module.exports = __toCommonJS(index_exports);
|
|
172
|
-
|
|
173
|
-
// src/init.js
|
|
174
|
-
var import_util = __toESM(require("util"));
|
|
175
|
-
var import_fs2 = __toESM(require("fs"));
|
|
176
|
-
var import_node_module = require("node:module");
|
|
177
|
-
|
|
178
35
|
// ../cnoke/src/abi.js
|
|
179
|
-
var import_fs = __toESM(require("fs"), 1);
|
|
180
36
|
function determineAbi() {
|
|
181
37
|
let abi = process.arch;
|
|
182
38
|
if (abi == "riscv32" || abi == "riscv64") {
|
|
@@ -264,52 +120,28 @@ function decodeElfHeader(buf) {
|
|
|
264
120
|
}
|
|
265
121
|
return header;
|
|
266
122
|
}
|
|
123
|
+
var import_fs;
|
|
124
|
+
var init_abi = __esm({
|
|
125
|
+
"../cnoke/src/abi.js"() {
|
|
126
|
+
import_fs = __toESM(require("fs"), 1);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
267
129
|
|
|
268
130
|
// package.json
|
|
269
|
-
var package_default
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
"function",
|
|
276
|
-
"interface",
|
|
277
|
-
"ffi",
|
|
278
|
-
"binding",
|
|
279
|
-
"c",
|
|
280
|
-
"napi"
|
|
281
|
-
],
|
|
282
|
-
repository: {
|
|
283
|
-
type: "git",
|
|
284
|
-
url: "https://github.com/Koromix/koffi"
|
|
285
|
-
},
|
|
286
|
-
homepage: "https://koffi.dev/",
|
|
287
|
-
author: {
|
|
288
|
-
name: "Niels Martign\xE8ne",
|
|
289
|
-
email: "niels.martignene@protonmail.com",
|
|
290
|
-
url: "https://koromix.dev/"
|
|
291
|
-
},
|
|
292
|
-
main: "./index.cjs",
|
|
293
|
-
module: "./index.js",
|
|
294
|
-
types: "./index.d.ts",
|
|
295
|
-
scripts: {
|
|
296
|
-
test: "node tools/brew.js test",
|
|
297
|
-
prepack: `echo 'Use "npm run package" instead' && false`,
|
|
298
|
-
prepublishOnly: `echo 'Use "npm run package" instead' && false`,
|
|
299
|
-
package: "node tools/brew.js build"
|
|
300
|
-
},
|
|
301
|
-
license: "MIT",
|
|
302
|
-
cnoke: {
|
|
303
|
-
api: "../../vendor/node-api-headers",
|
|
304
|
-
output: "../../bin/Koffi/{{ toolchain }}",
|
|
305
|
-
node: 16,
|
|
306
|
-
napi: 8
|
|
307
|
-
},
|
|
308
|
-
funding: "https://liberapay.com/Koromix"
|
|
309
|
-
};
|
|
131
|
+
var package_default;
|
|
132
|
+
var init_package = __esm({
|
|
133
|
+
"package.json"() {
|
|
134
|
+
package_default = { name: "koffi", version: "3.0.0-alpha.6", cnoke: { api: "../../vendor/node-api-headers", output: "../../bin/koffi/{{ toolchain }}", node: 16, napi: 8 } };
|
|
135
|
+
}
|
|
136
|
+
});
|
|
310
137
|
|
|
311
138
|
// src/init.js
|
|
312
|
-
var
|
|
139
|
+
var init_exports = {};
|
|
140
|
+
__export(init_exports, {
|
|
141
|
+
detectPlatform: () => detectPlatform,
|
|
142
|
+
loadDynamic: () => loadDynamic,
|
|
143
|
+
wrapNative: () => wrapNative
|
|
144
|
+
});
|
|
313
145
|
function detectPlatform() {
|
|
314
146
|
if (process.versions.napi == null || process.versions.napi < package_default.cnoke.napi) {
|
|
315
147
|
let major = parseInt(process.versions.node, 10);
|
|
@@ -326,19 +158,17 @@ function loadDynamic(root, pkg2, triplets2) {
|
|
|
326
158
|
let roots = [root];
|
|
327
159
|
let native2 = null;
|
|
328
160
|
let err = null;
|
|
329
|
-
if (process.resourcesPath != null)
|
|
161
|
+
if (process.resourcesPath != null) {
|
|
330
162
|
roots.push(process.resourcesPath);
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
`${dir}
|
|
336
|
-
]
|
|
337
|
-
for (let
|
|
338
|
-
if (!import_fs2.default.existsSync(filename))
|
|
339
|
-
continue;
|
|
163
|
+
roots.push(process.resourcesPath + "/node_modules/koffi");
|
|
164
|
+
}
|
|
165
|
+
let names = [
|
|
166
|
+
`@koromix/koffi-${pkg2}`,
|
|
167
|
+
...triplets2.flatMap((triplet) => roots.map((dir) => `${dir}/bin/koffi/${triplet}/koffi.node`))
|
|
168
|
+
];
|
|
169
|
+
for (let name of names) {
|
|
340
170
|
try {
|
|
341
|
-
native2 = requireNative(
|
|
171
|
+
native2 = requireNative(name);
|
|
342
172
|
break;
|
|
343
173
|
} catch (e) {
|
|
344
174
|
err ??= e;
|
|
@@ -361,93 +191,123 @@ function wrapNative(native2) {
|
|
|
361
191
|
return lib;
|
|
362
192
|
};
|
|
363
193
|
}
|
|
194
|
+
var import_util, import_node_module, requireNative;
|
|
195
|
+
var init_init = __esm({
|
|
196
|
+
"src/init.js"() {
|
|
197
|
+
import_util = __toESM(require("util"));
|
|
198
|
+
import_node_module = require("node:module");
|
|
199
|
+
init_abi();
|
|
200
|
+
init_package();
|
|
201
|
+
requireNative = (0, import_node_module.createRequire)(__dirname);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// src/static.js
|
|
206
|
+
var require_static = __commonJS({
|
|
207
|
+
"src/static.js"(exports2, module2) {
|
|
208
|
+
var { createRequire: createRequire2 } = require("node:module");
|
|
209
|
+
var requireNative2 = createRequire2(__dirname);
|
|
210
|
+
function loadStatic2(pkg2) {
|
|
211
|
+
let native2 = null;
|
|
212
|
+
if (native2 == null && pkg2 == "linux-arm64") {
|
|
213
|
+
try {
|
|
214
|
+
native2 = requireNative2("../../bin/koffi/linux_arm64/koffi.node");
|
|
215
|
+
} catch (err) {
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (native2 == null && pkg2 == "linux-arm64") {
|
|
219
|
+
try {
|
|
220
|
+
native2 = requireNative2("../../bin/koffi/musl_arm64/koffi.node");
|
|
221
|
+
} catch (err) {
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (native2 == null && pkg2 == "linux-ia32") {
|
|
225
|
+
try {
|
|
226
|
+
native2 = requireNative2("../../bin/koffi/linux_ia32/koffi.node");
|
|
227
|
+
} catch (err) {
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (native2 == null && pkg2 == "linux-x64") {
|
|
231
|
+
try {
|
|
232
|
+
native2 = requireNative2("../../bin/koffi/linux_x64/koffi.node");
|
|
233
|
+
} catch (err) {
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (native2 == null && pkg2 == "linux-x64") {
|
|
237
|
+
try {
|
|
238
|
+
native2 = requireNative2("../../bin/koffi/musl_x64/koffi.node");
|
|
239
|
+
} catch (err) {
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (native2 == null && pkg2 == "freebsd-ia32") {
|
|
243
|
+
try {
|
|
244
|
+
native2 = requireNative2("../../bin/koffi/freebsd_ia32/koffi.node");
|
|
245
|
+
} catch (err) {
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (native2 == null && pkg2 == "freebsd-x64") {
|
|
249
|
+
try {
|
|
250
|
+
native2 = requireNative2("../../bin/koffi/freebsd_x64/koffi.node");
|
|
251
|
+
} catch (err) {
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (native2 == null && pkg2 == "freebsd-arm64") {
|
|
255
|
+
try {
|
|
256
|
+
native2 = requireNative2("../../bin/koffi/freebsd_arm64/koffi.node");
|
|
257
|
+
} catch (err) {
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (native2 == null && pkg2 == "openbsd-ia32") {
|
|
261
|
+
try {
|
|
262
|
+
native2 = requireNative2("../../bin/koffi/openbsd_ia32/koffi.node");
|
|
263
|
+
} catch (err) {
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (native2 == null && pkg2 == "openbsd-x64") {
|
|
267
|
+
try {
|
|
268
|
+
native2 = requireNative2("../../bin/koffi/openbsd_x64/koffi.node");
|
|
269
|
+
} catch (err) {
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (native2 == null && pkg2 == "win32-ia32") {
|
|
273
|
+
try {
|
|
274
|
+
native2 = requireNative2("../../bin/koffi/win32_ia32/koffi.node");
|
|
275
|
+
} catch (err) {
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (native2 == null && pkg2 == "win32-x64") {
|
|
279
|
+
try {
|
|
280
|
+
native2 = requireNative2("../../bin/koffi/win32_x64/koffi.node");
|
|
281
|
+
} catch (err) {
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (native2 == null && pkg2 == "darwin-x64") {
|
|
285
|
+
try {
|
|
286
|
+
native2 = requireNative2("../../bin/koffi/darwin_x64/koffi.node");
|
|
287
|
+
} catch (err) {
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (native2 == null && pkg2 == "darwin-arm64") {
|
|
291
|
+
try {
|
|
292
|
+
native2 = requireNative2("../../bin/koffi/darwin_arm64/koffi.node");
|
|
293
|
+
} catch (err) {
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return native2;
|
|
297
|
+
}
|
|
298
|
+
module2.exports = { loadStatic: loadStatic2 };
|
|
299
|
+
}
|
|
300
|
+
});
|
|
364
301
|
|
|
365
|
-
// index.
|
|
366
|
-
var
|
|
367
|
-
var
|
|
302
|
+
// index.cjs
|
|
303
|
+
var { detectPlatform: detectPlatform2, loadDynamic: loadDynamic2, wrapNative: wrapNative2 } = (init_init(), __toCommonJS(init_exports));
|
|
304
|
+
var { loadStatic } = require_static();
|
|
305
|
+
var [version, pkg, triplets] = detectPlatform2();
|
|
368
306
|
var native = null;
|
|
369
|
-
STATIC: native =
|
|
307
|
+
STATIC: native = loadStatic(pkg);
|
|
370
308
|
if (native == null)
|
|
371
|
-
native =
|
|
309
|
+
native = loadDynamic2(__dirname + "/../..", pkg, triplets);
|
|
372
310
|
if (native.version != version)
|
|
373
311
|
throw new Error("Mismatched native Koffi modules");
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
var _stats = native.stats;
|
|
377
|
-
var _struct = native.struct;
|
|
378
|
-
var _pack = native.pack;
|
|
379
|
-
var _union = native.union;
|
|
380
|
-
var _Union = native.Union;
|
|
381
|
-
var _opaque = native.opaque;
|
|
382
|
-
var _pointer = native.pointer;
|
|
383
|
-
var _array = native.array;
|
|
384
|
-
var _proto = native.proto;
|
|
385
|
-
var _alias = native.alias;
|
|
386
|
-
var _sizeof = native.sizeof;
|
|
387
|
-
var _alignof = native.alignof;
|
|
388
|
-
var _offsetof = native.offsetof;
|
|
389
|
-
var _resolve = native.resolve;
|
|
390
|
-
var _introspect = native.introspect;
|
|
391
|
-
var _load = native.load;
|
|
392
|
-
var _in = native.in;
|
|
393
|
-
var _out = native.out;
|
|
394
|
-
var _inout = native.inout;
|
|
395
|
-
var _disposable = native.disposable;
|
|
396
|
-
var _alloc = native.alloc;
|
|
397
|
-
var _free = native.free;
|
|
398
|
-
var _register = native.register;
|
|
399
|
-
var _unregister = native.unregister;
|
|
400
|
-
var _as = native.as;
|
|
401
|
-
var _decode = native.decode;
|
|
402
|
-
var _address = native.address;
|
|
403
|
-
var _call = native.call;
|
|
404
|
-
var _encode = native.encode;
|
|
405
|
-
var _view = native.view;
|
|
406
|
-
var _reset = native.reset;
|
|
407
|
-
var _errno = native.errno;
|
|
408
|
-
var _os = native.os;
|
|
409
|
-
var _extension = native.extension;
|
|
410
|
-
var _types = native.types;
|
|
411
|
-
var _node = native.node;
|
|
412
|
-
var _version = native.version;
|
|
413
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
414
|
-
0 && (module.exports = {
|
|
415
|
-
Union,
|
|
416
|
-
address,
|
|
417
|
-
alias,
|
|
418
|
-
alignof,
|
|
419
|
-
alloc,
|
|
420
|
-
array,
|
|
421
|
-
as,
|
|
422
|
-
call,
|
|
423
|
-
config,
|
|
424
|
-
decode,
|
|
425
|
-
disposable,
|
|
426
|
-
encode,
|
|
427
|
-
errno,
|
|
428
|
-
extension,
|
|
429
|
-
free,
|
|
430
|
-
in: null,
|
|
431
|
-
inout,
|
|
432
|
-
introspect,
|
|
433
|
-
load,
|
|
434
|
-
node,
|
|
435
|
-
offsetof,
|
|
436
|
-
opaque,
|
|
437
|
-
os,
|
|
438
|
-
out,
|
|
439
|
-
pack,
|
|
440
|
-
pointer,
|
|
441
|
-
proto,
|
|
442
|
-
register,
|
|
443
|
-
reset,
|
|
444
|
-
resolve,
|
|
445
|
-
sizeof,
|
|
446
|
-
stats,
|
|
447
|
-
struct,
|
|
448
|
-
types,
|
|
449
|
-
union,
|
|
450
|
-
unregister,
|
|
451
|
-
version,
|
|
452
|
-
view
|
|
453
|
-
});
|
|
312
|
+
wrapNative2(native);
|
|
313
|
+
module.exports = native;
|