koffi 2.5.8 → 2.5.9

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +11 -99
  2. package/build/{2.5.8 → koffi}/darwin_arm64/koffi.node +0 -0
  3. package/build/{2.5.8 → koffi}/darwin_x64/koffi.node +0 -0
  4. package/build/{2.5.8 → koffi}/freebsd_arm64/koffi.node +0 -0
  5. package/build/{2.5.8 → koffi}/freebsd_ia32/koffi.node +0 -0
  6. package/build/{2.5.8 → koffi}/freebsd_x64/koffi.node +0 -0
  7. package/build/koffi/linux_arm32hf/koffi.node +0 -0
  8. package/build/{2.5.8 → koffi}/linux_arm64/koffi.node +0 -0
  9. package/build/{2.5.8 → koffi}/linux_ia32/koffi.node +0 -0
  10. package/build/{2.5.8 → koffi}/linux_riscv64hf64/koffi.node +0 -0
  11. package/build/{2.5.8 → koffi}/linux_x64/koffi.node +0 -0
  12. package/build/{2.5.8 → koffi}/openbsd_ia32/koffi.node +0 -0
  13. package/build/{2.5.8 → koffi}/openbsd_x64/koffi.node +0 -0
  14. package/build/{2.5.8 → koffi}/win32_arm64/koffi.node +0 -0
  15. package/build/{2.5.8 → koffi}/win32_ia32/koffi.node +0 -0
  16. package/build/{2.5.8 → koffi}/win32_x64/koffi.node +0 -0
  17. package/doc/conf.py +2 -1
  18. package/doc/index.rst +1 -0
  19. package/doc/packaging.md +60 -0
  20. package/doc/start.md +1 -36
  21. package/package.json +2 -2
  22. package/src/cnoke/assets/FindCNoke.cmake +16 -0
  23. package/src/index.d.ts +4 -0
  24. package/src/index.js +50 -21
  25. package/src/koffi/CMakeLists.txt +6 -0
  26. package/src/koffi/examples/electron-builder/README.md +23 -0
  27. package/src/koffi/examples/electron-builder/package.json +21 -0
  28. package/src/koffi/examples/electron-builder/src/app.js +20 -0
  29. package/src/koffi/examples/electron-builder/src/index.html +143 -0
  30. package/src/koffi/examples/electron-builder/src/preload.js +5 -0
  31. package/src/koffi/examples/electron-forge/README.md +25 -0
  32. package/src/koffi/examples/electron-forge/forge.config.js +43 -0
  33. package/src/koffi/examples/electron-forge/package.json +37 -0
  34. package/src/koffi/examples/electron-forge/src/index.css +7 -0
  35. package/src/koffi/examples/electron-forge/src/index.html +143 -0
  36. package/src/koffi/examples/electron-forge/src/main.js +52 -0
  37. package/src/koffi/examples/electron-forge/src/preload.js +5 -0
  38. package/src/koffi/examples/electron-forge/src/renderer.js +31 -0
  39. package/src/koffi/examples/electron-forge/webpack.main.config.js +11 -0
  40. package/src/koffi/examples/electron-forge/webpack.renderer.config.js +13 -0
  41. package/src/koffi/examples/electron-forge/webpack.rules.js +35 -0
  42. package/src/koffi/examples/nwjs/README.md +20 -0
  43. package/src/koffi/examples/nwjs/package.json +11 -0
  44. package/src/koffi/examples/nwjs/src/index.html +145 -0
  45. package/src/koffi/examples/nwjs/src/package.json +9 -0
  46. package/src/koffi/src/ffi.cc +1 -0
  47. package/build/2.5.8/linux_arm32hf/koffi.node +0 -0
  48. /package/build/{2.5.8 → koffi}/win32_arm64/koffi.exp +0 -0
  49. /package/build/{2.5.8 → koffi}/win32_arm64/koffi.lib +0 -0
  50. /package/build/{2.5.8 → koffi}/win32_ia32/koffi.exp +0 -0
  51. /package/build/{2.5.8 → koffi}/win32_ia32/koffi.lib +0 -0
  52. /package/build/{2.5.8 → koffi}/win32_x64/koffi.exp +0 -0
  53. /package/build/{2.5.8 → koffi}/win32_x64/koffi.lib +0 -0
@@ -0,0 +1,145 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Koffi Configuration</title>
6
+
7
+ <style>
8
+ html {
9
+ height: 100%;
10
+ }
11
+ body {
12
+ font-family: 'Open Sans', sans-serif;
13
+ display: flex;
14
+ min-height: calc(100% - 17px);
15
+ align-items: center;
16
+ justify-content: center;
17
+ font-size: 14px;
18
+ }
19
+
20
+ #error {
21
+ position: fixed;
22
+ top: 50px;
23
+ left: calc(50% - 200px);
24
+ width: 400px;
25
+ padding: 8px;
26
+ background: #db0a0a;
27
+ color: white;
28
+ box-shadow: 1px 1px rgba(0, 0, 0, 0.5);
29
+ text-align: center;
30
+ }
31
+ #error:empty { display: none; }
32
+
33
+ #config {
34
+ background: #f8f8f8;
35
+ border-radius: 8px;
36
+ padding: 1em;
37
+ font-size: 1.2em;
38
+ }
39
+ form {
40
+ display: flex;
41
+ flex-direction: column;
42
+ gap: 0.5em;
43
+ }
44
+ label {
45
+ display: flex;
46
+ gap: 12px;
47
+ }
48
+ label > span { width: 200px; }
49
+ label > :not(span) { flex: 1; }
50
+ button {
51
+ margin-top: 1em;
52
+ background: white;
53
+ border: white;
54
+ border-radius: 6px;
55
+ padding: 6px;
56
+ cursor: pointer;
57
+ }
58
+ button:hover { background: #ededed; }
59
+ </style>
60
+ </head>
61
+
62
+ <body>
63
+ <div id="error"></div>
64
+ <div id="config"></div>
65
+
66
+ <script>
67
+ const koffi = require('koffi');
68
+
69
+ update();
70
+
71
+ function update() {
72
+ let config = koffi.config();
73
+
74
+ let container = document.querySelector('#config');
75
+ let form = document.createElement('form');
76
+
77
+ form.addEventListener('submit', e => { e.preventDefault(); apply(e.target.elements); });
78
+
79
+ for (let key in config) {
80
+ let value = config[key];
81
+
82
+ if (typeof value != 'number')
83
+ continue;
84
+
85
+ let label = document.createElement('label');
86
+ let span = document.createElement('span');
87
+ let input = document.createElement('input');
88
+
89
+ span.textContent = key;
90
+ input.name = key;
91
+ input.type = 'number';
92
+ input.value = config[key];
93
+
94
+ label.appendChild(span);
95
+ label.appendChild(input);
96
+ form.appendChild(label);
97
+ }
98
+
99
+ let button = document.createElement('button');
100
+ button.textContent = 'Modifier';
101
+ button.type = 'submit';
102
+
103
+ form.appendChild(button);
104
+
105
+ window.requestAnimationFrame(() => {
106
+ container.innerHTML = '';
107
+ container.appendChild(form);
108
+ });
109
+ }
110
+
111
+ async function apply(elements) {
112
+ let config = koffi.config();
113
+
114
+ for (let key in elements) {
115
+ if (!config.hasOwnProperty(key))
116
+ continue;
117
+
118
+ let value = elements[key].valueAsNumber;
119
+
120
+ if (typeof value == 'number')
121
+ config[key] = value;
122
+ }
123
+
124
+ try {
125
+ koffi.config(config);
126
+ } catch (err) {
127
+ console.error(err);
128
+ flashError(err.message);
129
+ }
130
+
131
+ update();
132
+ }
133
+
134
+ function flashError(msg) {
135
+ let div = document.querySelector('#error');
136
+
137
+ if (flashError.timer != null)
138
+ clearTimeout(flashError.timer);
139
+ flashError.timer = setTimeout(() => { div.textContent = '' }, 4000);
140
+
141
+ div.textContent = msg;
142
+ }
143
+ </script>
144
+ </body>
145
+ </html>
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "Koffi Config",
3
+ "main": "index.html",
4
+ "author": "Niels Martignène <niels.martignene@protonmail.com>",
5
+ "license": "MIT",
6
+ "dependencies": {
7
+ "koffi": "^2.5.8"
8
+ }
9
+ }
@@ -2168,6 +2168,7 @@ static Napi::Object InitModule(Napi::Env env, Napi::Object exports)
2168
2168
  exports.Set("types", types);
2169
2169
 
2170
2170
  exports.Set("internal", Napi::Boolean::New(env, false));
2171
+ exports.Set("version", Napi::String::New(env, RG_STRINGIFY(VERSION)));
2171
2172
 
2172
2173
  return exports;
2173
2174
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes