koffi 3.0.0-alpha.4 → 3.0.0-alpha.5

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.
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/index.js CHANGED
@@ -1 +1 @@
1
- export koffi from "./src/koffi/index.js";
1
+ export { default } from "./src/koffi/index.js";
package/indirect.js CHANGED
@@ -1 +1 @@
1
- export koffi from "./src/koffi/indirect.js";
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.4",
3
+ "version": "3.0.0-alpha.5",
4
4
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
5
5
  "keywords": [
6
6
  "foreign",
@@ -4,8 +4,8 @@ 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 __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
9
  };
10
10
  var __export = (target, all) => {
11
11
  for (var name in all)
@@ -29,154 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  ));
30
30
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
31
 
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
32
  // ../cnoke/src/abi.js
179
- var import_fs = __toESM(require("fs"), 1);
180
33
  function determineAbi() {
181
34
  let abi = process.arch;
182
35
  if (abi == "riscv32" || abi == "riscv64") {
@@ -264,52 +117,68 @@ function decodeElfHeader(buf) {
264
117
  }
265
118
  return header;
266
119
  }
120
+ var import_fs;
121
+ var init_abi = __esm({
122
+ "../cnoke/src/abi.js"() {
123
+ import_fs = __toESM(require("fs"), 1);
124
+ }
125
+ });
267
126
 
268
127
  // package.json
269
- var package_default = {
270
- name: "koffi",
271
- version: "3.0.0-alpha.4",
272
- description: "Fast and simple C FFI (foreign function interface) for Node.js",
273
- keywords: [
274
- "foreign",
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
- };
128
+ var package_default;
129
+ var init_package = __esm({
130
+ "package.json"() {
131
+ package_default = {
132
+ name: "koffi",
133
+ version: "3.0.0-alpha.5",
134
+ description: "Fast and simple C FFI (foreign function interface) for Node.js",
135
+ keywords: [
136
+ "foreign",
137
+ "function",
138
+ "interface",
139
+ "ffi",
140
+ "binding",
141
+ "c",
142
+ "napi"
143
+ ],
144
+ repository: {
145
+ type: "git",
146
+ url: "https://github.com/Koromix/koffi"
147
+ },
148
+ homepage: "https://koffi.dev/",
149
+ author: {
150
+ name: "Niels Martign\xE8ne",
151
+ email: "niels.martignene@protonmail.com",
152
+ url: "https://koromix.dev/"
153
+ },
154
+ main: "./index.cjs",
155
+ module: "./index.js",
156
+ types: "./index.d.ts",
157
+ scripts: {
158
+ test: "node tools/brew.js test",
159
+ prepack: `echo 'Use "npm run package" instead' && false`,
160
+ prepublishOnly: `echo 'Use "npm run package" instead' && false`,
161
+ package: "node tools/brew.js build"
162
+ },
163
+ license: "MIT",
164
+ cnoke: {
165
+ api: "../../vendor/node-api-headers",
166
+ output: "../../bin/Koffi/{{ toolchain }}",
167
+ node: 16,
168
+ napi: 8
169
+ },
170
+ funding: "https://liberapay.com/Koromix"
171
+ };
172
+ }
173
+ });
310
174
 
311
175
  // src/init.js
312
- var requireNative = (0, import_node_module.createRequire)(__dirname);
176
+ var init_exports = {};
177
+ __export(init_exports, {
178
+ detectPlatform: () => detectPlatform,
179
+ loadDynamic: () => loadDynamic,
180
+ wrapNative: () => wrapNative
181
+ });
313
182
  function detectPlatform() {
314
183
  if (process.versions.napi == null || process.versions.napi < package_default.cnoke.napi) {
315
184
  let major = parseInt(process.versions.node, 10);
@@ -361,93 +230,23 @@ function wrapNative(native2) {
361
230
  return lib;
362
231
  };
363
232
  }
233
+ var import_util, import_fs2, import_node_module, requireNative;
234
+ var init_init = __esm({
235
+ "src/init.js"() {
236
+ import_util = __toESM(require("util"));
237
+ import_fs2 = __toESM(require("fs"));
238
+ import_node_module = require("node:module");
239
+ init_abi();
240
+ init_package();
241
+ requireNative = (0, import_node_module.createRequire)(__dirname);
242
+ }
243
+ });
364
244
 
365
- // index.js
366
- var import_static = __toESM(require_static());
367
- var [version, pkg, triplets] = detectPlatform();
368
- var native = null;
369
- STATIC: native = (0, import_static.loadStatic)(pkg);
370
- if (native == null)
371
- native = loadDynamic(__dirname + "/../..", pkg, triplets);
245
+ // index.cjs
246
+ var { detectPlatform: detectPlatform2, loadDynamic: loadDynamic2, wrapNative: wrapNative2 } = (init_init(), __toCommonJS(init_exports));
247
+ var [version, pkg, triplets] = detectPlatform2();
248
+ var native = loadDynamic2(__dirname + "/../..", pkg, triplets);
372
249
  if (native.version != version)
373
250
  throw new Error("Mismatched native Koffi modules");
374
- wrapNative(native);
375
- var _config = native.config;
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
- });
251
+ wrapNative2(native);
252
+ module.exports = native;
@@ -96,7 +96,7 @@ function decodeElfHeader(buf) {
96
96
  // package.json
97
97
  var package_default = {
98
98
  name: "koffi",
99
- version: "3.0.0-alpha.4",
99
+ version: "3.0.0-alpha.5",
100
100
  description: "Fast and simple C FFI (foreign function interface) for Node.js",
101
101
  keywords: [
102
102
  "foreign",
@@ -291,81 +291,7 @@ if (native == null)
291
291
  if (native.version != version)
292
292
  throw new Error("Mismatched native Koffi modules");
293
293
  wrapNative(native);
294
- var _config = native.config;
295
- var _stats = native.stats;
296
- var _struct = native.struct;
297
- var _pack = native.pack;
298
- var _union = native.union;
299
- var _Union = native.Union;
300
- var _opaque = native.opaque;
301
- var _pointer = native.pointer;
302
- var _array = native.array;
303
- var _proto = native.proto;
304
- var _alias = native.alias;
305
- var _sizeof = native.sizeof;
306
- var _alignof = native.alignof;
307
- var _offsetof = native.offsetof;
308
- var _resolve = native.resolve;
309
- var _introspect = native.introspect;
310
- var _load = native.load;
311
- var _in = native.in;
312
- var _out = native.out;
313
- var _inout = native.inout;
314
- var _disposable = native.disposable;
315
- var _alloc = native.alloc;
316
- var _free = native.free;
317
- var _register = native.register;
318
- var _unregister = native.unregister;
319
- var _as = native.as;
320
- var _decode = native.decode;
321
- var _address = native.address;
322
- var _call = native.call;
323
- var _encode = native.encode;
324
- var _view = native.view;
325
- var _reset = native.reset;
326
- var _errno = native.errno;
327
- var _os = native.os;
328
- var _extension = native.extension;
329
- var _types = native.types;
330
- var _node = native.node;
331
- var _version = native.version;
294
+ var index_default = native;
332
295
  export {
333
- _Union as Union,
334
- _address as address,
335
- _alias as alias,
336
- _alignof as alignof,
337
- _alloc as alloc,
338
- _array as array,
339
- _as as as,
340
- _call as call,
341
- _config as config,
342
- _decode as decode,
343
- _disposable as disposable,
344
- _encode as encode,
345
- _errno as errno,
346
- _extension as extension,
347
- _free as free,
348
- _in as in,
349
- _inout as inout,
350
- _introspect as introspect,
351
- _load as load,
352
- _node as node,
353
- _offsetof as offsetof,
354
- _opaque as opaque,
355
- _os as os,
356
- _out as out,
357
- _pack as pack,
358
- _pointer as pointer,
359
- _proto as proto,
360
- _register as register,
361
- _reset as reset,
362
- _resolve as resolve,
363
- _sizeof as sizeof,
364
- _stats as stats,
365
- _struct as struct,
366
- _types as types,
367
- _union as union,
368
- _unregister as unregister,
369
- _version as version,
370
- _view as view
296
+ index_default as default
371
297
  };
@@ -4,8 +4,8 @@ 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 __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
9
  };
10
10
  var __export = (target, all) => {
11
11
  for (var name in all)
@@ -29,154 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  ));
30
30
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
31
 
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
32
  // ../cnoke/src/abi.js
179
- var import_fs = __toESM(require("fs"), 1);
180
33
  function determineAbi() {
181
34
  let abi = process.arch;
182
35
  if (abi == "riscv32" || abi == "riscv64") {
@@ -264,52 +117,68 @@ function decodeElfHeader(buf) {
264
117
  }
265
118
  return header;
266
119
  }
120
+ var import_fs;
121
+ var init_abi = __esm({
122
+ "../cnoke/src/abi.js"() {
123
+ import_fs = __toESM(require("fs"), 1);
124
+ }
125
+ });
267
126
 
268
127
  // package.json
269
- var package_default = {
270
- name: "koffi",
271
- version: "3.0.0-alpha.4",
272
- description: "Fast and simple C FFI (foreign function interface) for Node.js",
273
- keywords: [
274
- "foreign",
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
- };
128
+ var package_default;
129
+ var init_package = __esm({
130
+ "package.json"() {
131
+ package_default = {
132
+ name: "koffi",
133
+ version: "3.0.0-alpha.5",
134
+ description: "Fast and simple C FFI (foreign function interface) for Node.js",
135
+ keywords: [
136
+ "foreign",
137
+ "function",
138
+ "interface",
139
+ "ffi",
140
+ "binding",
141
+ "c",
142
+ "napi"
143
+ ],
144
+ repository: {
145
+ type: "git",
146
+ url: "https://github.com/Koromix/koffi"
147
+ },
148
+ homepage: "https://koffi.dev/",
149
+ author: {
150
+ name: "Niels Martign\xE8ne",
151
+ email: "niels.martignene@protonmail.com",
152
+ url: "https://koromix.dev/"
153
+ },
154
+ main: "./index.cjs",
155
+ module: "./index.js",
156
+ types: "./index.d.ts",
157
+ scripts: {
158
+ test: "node tools/brew.js test",
159
+ prepack: `echo 'Use "npm run package" instead' && false`,
160
+ prepublishOnly: `echo 'Use "npm run package" instead' && false`,
161
+ package: "node tools/brew.js build"
162
+ },
163
+ license: "MIT",
164
+ cnoke: {
165
+ api: "../../vendor/node-api-headers",
166
+ output: "../../bin/Koffi/{{ toolchain }}",
167
+ node: 16,
168
+ napi: 8
169
+ },
170
+ funding: "https://liberapay.com/Koromix"
171
+ };
172
+ }
173
+ });
310
174
 
311
175
  // src/init.js
312
- var requireNative = (0, import_node_module.createRequire)(__dirname);
176
+ var init_exports = {};
177
+ __export(init_exports, {
178
+ detectPlatform: () => detectPlatform,
179
+ loadDynamic: () => loadDynamic,
180
+ wrapNative: () => wrapNative
181
+ });
313
182
  function detectPlatform() {
314
183
  if (process.versions.napi == null || process.versions.napi < package_default.cnoke.napi) {
315
184
  let major = parseInt(process.versions.node, 10);
@@ -361,92 +230,23 @@ function wrapNative(native2) {
361
230
  return lib;
362
231
  };
363
232
  }
233
+ var import_util, import_fs2, import_node_module, requireNative;
234
+ var init_init = __esm({
235
+ "src/init.js"() {
236
+ import_util = __toESM(require("util"));
237
+ import_fs2 = __toESM(require("fs"));
238
+ import_node_module = require("node:module");
239
+ init_abi();
240
+ init_package();
241
+ requireNative = (0, import_node_module.createRequire)(__dirname);
242
+ }
243
+ });
364
244
 
365
- // index.js
366
- var import_static = __toESM(require_static());
367
- var [version, pkg, triplets] = detectPlatform();
368
- var native = null;
369
- if (native == null)
370
- native = loadDynamic(__dirname + "/../..", pkg, triplets);
245
+ // index.cjs
246
+ var { detectPlatform: detectPlatform2, loadDynamic: loadDynamic2, wrapNative: wrapNative2 } = (init_init(), __toCommonJS(init_exports));
247
+ var [version, pkg, triplets] = detectPlatform2();
248
+ var native = loadDynamic2(__dirname + "/../..", pkg, triplets);
371
249
  if (native.version != version)
372
250
  throw new Error("Mismatched native Koffi modules");
373
- wrapNative(native);
374
- var _config = native.config;
375
- var _stats = native.stats;
376
- var _struct = native.struct;
377
- var _pack = native.pack;
378
- var _union = native.union;
379
- var _Union = native.Union;
380
- var _opaque = native.opaque;
381
- var _pointer = native.pointer;
382
- var _array = native.array;
383
- var _proto = native.proto;
384
- var _alias = native.alias;
385
- var _sizeof = native.sizeof;
386
- var _alignof = native.alignof;
387
- var _offsetof = native.offsetof;
388
- var _resolve = native.resolve;
389
- var _introspect = native.introspect;
390
- var _load = native.load;
391
- var _in = native.in;
392
- var _out = native.out;
393
- var _inout = native.inout;
394
- var _disposable = native.disposable;
395
- var _alloc = native.alloc;
396
- var _free = native.free;
397
- var _register = native.register;
398
- var _unregister = native.unregister;
399
- var _as = native.as;
400
- var _decode = native.decode;
401
- var _address = native.address;
402
- var _call = native.call;
403
- var _encode = native.encode;
404
- var _view = native.view;
405
- var _reset = native.reset;
406
- var _errno = native.errno;
407
- var _os = native.os;
408
- var _extension = native.extension;
409
- var _types = native.types;
410
- var _node = native.node;
411
- var _version = native.version;
412
- // Annotate the CommonJS export names for ESM import in node:
413
- 0 && (module.exports = {
414
- Union,
415
- address,
416
- alias,
417
- alignof,
418
- alloc,
419
- array,
420
- as,
421
- call,
422
- config,
423
- decode,
424
- disposable,
425
- encode,
426
- errno,
427
- extension,
428
- free,
429
- in: null,
430
- inout,
431
- introspect,
432
- load,
433
- node,
434
- offsetof,
435
- opaque,
436
- os,
437
- out,
438
- pack,
439
- pointer,
440
- proto,
441
- register,
442
- reset,
443
- resolve,
444
- sizeof,
445
- stats,
446
- struct,
447
- types,
448
- union,
449
- unregister,
450
- version,
451
- view
452
- });
251
+ wrapNative2(native);
252
+ module.exports = native;
@@ -96,7 +96,7 @@ function decodeElfHeader(buf) {
96
96
  // package.json
97
97
  var package_default = {
98
98
  name: "koffi",
99
- version: "3.0.0-alpha.4",
99
+ version: "3.0.0-alpha.5",
100
100
  description: "Fast and simple C FFI (foreign function interface) for Node.js",
101
101
  keywords: [
102
102
  "foreign",
@@ -202,81 +202,7 @@ if (native == null)
202
202
  if (native.version != version)
203
203
  throw new Error("Mismatched native Koffi modules");
204
204
  wrapNative(native);
205
- var _config = native.config;
206
- var _stats = native.stats;
207
- var _struct = native.struct;
208
- var _pack = native.pack;
209
- var _union = native.union;
210
- var _Union = native.Union;
211
- var _opaque = native.opaque;
212
- var _pointer = native.pointer;
213
- var _array = native.array;
214
- var _proto = native.proto;
215
- var _alias = native.alias;
216
- var _sizeof = native.sizeof;
217
- var _alignof = native.alignof;
218
- var _offsetof = native.offsetof;
219
- var _resolve = native.resolve;
220
- var _introspect = native.introspect;
221
- var _load = native.load;
222
- var _in = native.in;
223
- var _out = native.out;
224
- var _inout = native.inout;
225
- var _disposable = native.disposable;
226
- var _alloc = native.alloc;
227
- var _free = native.free;
228
- var _register = native.register;
229
- var _unregister = native.unregister;
230
- var _as = native.as;
231
- var _decode = native.decode;
232
- var _address = native.address;
233
- var _call = native.call;
234
- var _encode = native.encode;
235
- var _view = native.view;
236
- var _reset = native.reset;
237
- var _errno = native.errno;
238
- var _os = native.os;
239
- var _extension = native.extension;
240
- var _types = native.types;
241
- var _node = native.node;
242
- var _version = native.version;
205
+ var index_default = native;
243
206
  export {
244
- _Union as Union,
245
- _address as address,
246
- _alias as alias,
247
- _alignof as alignof,
248
- _alloc as alloc,
249
- _array as array,
250
- _as as as,
251
- _call as call,
252
- _config as config,
253
- _decode as decode,
254
- _disposable as disposable,
255
- _encode as encode,
256
- _errno as errno,
257
- _extension as extension,
258
- _free as free,
259
- _in as in,
260
- _inout as inout,
261
- _introspect as introspect,
262
- _load as load,
263
- _node as node,
264
- _offsetof as offsetof,
265
- _opaque as opaque,
266
- _os as os,
267
- _out as out,
268
- _pack as pack,
269
- _pointer as pointer,
270
- _proto as proto,
271
- _register as register,
272
- _reset as reset,
273
- _resolve as resolve,
274
- _sizeof as sizeof,
275
- _stats as stats,
276
- _struct as struct,
277
- _types as types,
278
- _union as union,
279
- _unregister as unregister,
280
- _version as version,
281
- _view as view
207
+ index_default as default
282
208
  };