@finogeeks2026/finshield-opencode 0.0.0-stage → 0.11.50
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/DESIGN.md +593 -0
- package/LICENSE.rtf +28 -0
- package/README.md +132 -2
- package/THIRD-PARTY-NOTICES.md +3131 -0
- package/bin/node.exe +4 -0
- package/dist/gui-experimental.cjs +96 -0
- package/dist/updater/server.js +1046 -0
- package/install/download-source.json +3 -0
- package/install/runtime.js +60 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/LICENSE.rtf +28 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/README.md +116 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/bin/finsafe_native.dll +0 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/native-build.json +5 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/@koromix/koffi-win32-x64/README.md +6 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/@koromix/koffi-win32-x64/index.js +12 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/@koromix/koffi-win32-x64/package.json +24 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/@koromix/koffi-win32-x64/win32_x64/koffi.lib +0 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/@koromix/koffi-win32-x64/win32_x64/koffi.node +0 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/CHANGELOG.md +1183 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/LICENSE.txt +22 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/README.md +42 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/cnoke.cjs +816 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/benchmarks.md +80 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/callbacks.md +182 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/composites.md +549 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/contribute.md +163 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/index.md +46 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/load.md +191 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/migration.md +256 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/misc.md +76 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/output.md +299 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/pointers.md +385 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/primitives.md +151 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/start.md +110 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/types.md +88 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/unions.md +0 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/doc/values.md +134 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/index.cjs +1 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/index.d.ts +389 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/index.js +2 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/indirect.cjs +1 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/indirect.js +2 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/lib/native/base/base.cc +11064 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/lib/native/base/base.hh +5951 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/lib/native/base/unicode.inc +408 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/package.json +68 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/CMakeLists.txt +249 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/index.cjs +296 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/index.js +281 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/indirect.cjs +295 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/indirect.js +280 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/arm64.cc +1408 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/arm64_asm.S +216 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/arm64_asm.asm +181 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/loong64.cc +5 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/loong64_asm.S +200 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/riscv64.cc +1345 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/riscv64_asm.S +200 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/x64sysv.cc +1434 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/x64sysv_asm.S +224 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/x64win.cc +1086 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/x64win_asm.S +162 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/x64win_asm.asm +189 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/x86.cc +1185 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/x86_asm.S +217 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/abi/x86_asm.asm +174 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/call.cc +2094 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/call.hh +179 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/errno.inc +462 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/ffi.cc +3009 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/ffi.hh +461 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/parser.cc +218 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/parser.hh +54 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/primitives.inc +36 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/static.cjs +130 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/static.js +133 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/trampolines.cjs +77 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/type.cc +725 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/type.hh +71 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/util.cc +1040 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/util.hh +493 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/uv.cc +214 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/uv.def +11 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/uv.hh +112 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/win32.cc +198 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/win32.hh +148 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-addon-api/LICENSE.md +9 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-addon-api/README.md +95 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-addon-api/napi-inl.deprecated.h +186 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-addon-api/napi-inl.h +7211 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-addon-api/napi.h +3421 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-api-headers/LICENSE +21 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-api-headers/README.md +95 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-api-headers/def/js_native_api.def +125 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-api-headers/def/node_api.def +157 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-api-headers/include/js_native_api.h +591 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-api-headers/include/js_native_api_types.h +210 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-api-headers/include/node_api.h +265 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/vendor/node-api-headers/include/node_api_types.h +58 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/package.json +36 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/release.json +4 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/src/native.js +85 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/src/shell.js +20 -0
- package/node_modules/@finogeeks2026/finsafe-sdk/src/status.js +57 -0
- package/package.json +47 -4
- package/policy/candidate.yaml +347 -0
- package/release.json +4 -0
- package/src/activation.js +2 -0
- package/src/attachment.js +34 -0
- package/src/connector.js +91 -0
- package/src/contract.js +8 -0
- package/src/desktop-contract.js +4 -0
- package/src/desktop.js +25 -0
- package/src/gui.tsx +58 -0
- package/src/host.js +38 -0
- package/src/index.js +12 -0
- package/src/instance-settings.js +27 -0
- package/src/known-folders.js +22 -0
- package/src/management.js +17 -0
- package/src/preparation.js +18 -0
- package/src/presentation.js +153 -0
- package/src/settings.js +18 -0
- package/ui/feedback.cjs +45 -0
- package/ui/page.cjs +225 -0
- package/ui/state.cjs +44 -0
- package/updater/bootstrap.js +41 -0
- package/updater/common/activation.js +81 -0
- package/updater/common/coordinator.js +329 -0
- package/updater/common/download.js +57 -0
- package/updater/common/index.js +12 -0
- package/updater/common/package.js +53 -0
- package/updater/common/protocol.js +38 -0
- package/updater/common/transport.js +65 -0
- package/updater/coordinator.js +2 -0
- package/updater/launch.js +40 -0
- package/updater/management.js +9 -0
- package/updater/native.js +18 -0
- package/updater/operations.js +45 -0
- package/updater/protocol.js +1 -0
- package/updater/server.js +100 -0
- package/updater/transport.js +10 -0
- package/updater/windows-launch-reader.js +40 -0
- package/updater/windows-launch.js +96 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// SPDX-FileCopyrightText: 2026 Niels Martignène <niels.martignene@protonmail.com>
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include "lib/native/base/base.hh"
|
|
7
|
+
#include "util.hh"
|
|
8
|
+
|
|
9
|
+
#include <napi.h>
|
|
10
|
+
|
|
11
|
+
namespace K {
|
|
12
|
+
|
|
13
|
+
struct InstanceData;
|
|
14
|
+
struct TypeInfo;
|
|
15
|
+
struct FunctionInfo;
|
|
16
|
+
|
|
17
|
+
class PrototypeParser {
|
|
18
|
+
Napi::Env env;
|
|
19
|
+
InstanceData *instance;
|
|
20
|
+
|
|
21
|
+
// All these members are relevant to the current parse only, and get resetted each time
|
|
22
|
+
HeapArray<Span<const char>> tokens;
|
|
23
|
+
Size offset;
|
|
24
|
+
bool valid;
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
PrototypeParser(InstanceData *instance) : env(instance->env), instance(instance) {}
|
|
28
|
+
|
|
29
|
+
bool Parse(const char *str, bool concrete, FunctionInfo *out_func);
|
|
30
|
+
|
|
31
|
+
private:
|
|
32
|
+
void Tokenize(const char *str);
|
|
33
|
+
|
|
34
|
+
const TypeInfo *ParseType(int *out_directions);
|
|
35
|
+
|
|
36
|
+
bool Consume(const char *expect);
|
|
37
|
+
bool Match(const char *expect);
|
|
38
|
+
|
|
39
|
+
bool IsIdentifier(Span<const char> tok) const;
|
|
40
|
+
|
|
41
|
+
template <typename... Args>
|
|
42
|
+
void MarkError(const char *fmt, Args... args)
|
|
43
|
+
{
|
|
44
|
+
if (valid) {
|
|
45
|
+
ThrowError<Napi::Error>(env, fmt, args...);
|
|
46
|
+
valid = false;
|
|
47
|
+
}
|
|
48
|
+
valid = false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
bool ParsePrototype(InstanceData *instance, const char *str, bool concrete, FunctionInfo *out_func);
|
|
53
|
+
|
|
54
|
+
}
|
package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/primitives.inc
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// SPDX-FileCopyrightText: 2026 Niels Martignène <niels.martignene@protonmail.com>
|
|
3
|
+
|
|
4
|
+
#if !defined(PRIMITIVE)
|
|
5
|
+
#error Please define PRIMITIVE() before including primitives.inc
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
PRIMITIVE(Void)
|
|
9
|
+
PRIMITIVE(Bool)
|
|
10
|
+
PRIMITIVE(Int8)
|
|
11
|
+
PRIMITIVE(UInt8)
|
|
12
|
+
PRIMITIVE(Int16)
|
|
13
|
+
PRIMITIVE(Int16S) // Keep behind Int16
|
|
14
|
+
PRIMITIVE(UInt16)
|
|
15
|
+
PRIMITIVE(UInt16S) // Keep behind UInt16
|
|
16
|
+
PRIMITIVE(Int32)
|
|
17
|
+
PRIMITIVE(Int32S) // Keep behind Int32
|
|
18
|
+
PRIMITIVE(UInt32)
|
|
19
|
+
PRIMITIVE(UInt32S) // Keep behind UInt32
|
|
20
|
+
PRIMITIVE(Int64)
|
|
21
|
+
PRIMITIVE(Int64S) // Keep behind Int64
|
|
22
|
+
PRIMITIVE(UInt64)
|
|
23
|
+
PRIMITIVE(UInt64S) // Keep behind UInt64
|
|
24
|
+
PRIMITIVE(String)
|
|
25
|
+
PRIMITIVE(String16)
|
|
26
|
+
PRIMITIVE(String32)
|
|
27
|
+
PRIMITIVE(Pointer)
|
|
28
|
+
PRIMITIVE(Record)
|
|
29
|
+
PRIMITIVE(Union)
|
|
30
|
+
PRIMITIVE(Array)
|
|
31
|
+
PRIMITIVE(Float32)
|
|
32
|
+
PRIMITIVE(Float64)
|
|
33
|
+
PRIMITIVE(Callback)
|
|
34
|
+
PRIMITIVE(Prototype)
|
|
35
|
+
|
|
36
|
+
#undef PRIMITIVE
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// SPDX-FileCopyrightText: 2026 Niels Martignène <niels.martignene@protonmail.com>
|
|
3
|
+
|
|
4
|
+
function loadStatic(pkg) {
|
|
5
|
+
let native = null;
|
|
6
|
+
|
|
7
|
+
if (pkg == 'linux-arm64') {
|
|
8
|
+
try {
|
|
9
|
+
native = require('@koromix/koffi-linux-arm64');
|
|
10
|
+
} catch (err) {
|
|
11
|
+
// Go on
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (pkg == 'linux-ia32') {
|
|
16
|
+
try {
|
|
17
|
+
native = require('@koromix/koffi-linux-ia32');
|
|
18
|
+
} catch (err) {
|
|
19
|
+
// Go on
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (pkg == 'linux-x64') {
|
|
24
|
+
try {
|
|
25
|
+
native = require('@koromix/koffi-linux-x64');
|
|
26
|
+
} catch (err) {
|
|
27
|
+
// Go on
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (pkg == 'linux-riscv64') {
|
|
32
|
+
try {
|
|
33
|
+
native = require('@koromix/koffi-linux-riscv64');
|
|
34
|
+
} catch (err) {
|
|
35
|
+
// Go on
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (pkg == 'freebsd-ia32') {
|
|
40
|
+
try {
|
|
41
|
+
native = require('@koromix/koffi-freebsd-ia32');
|
|
42
|
+
} catch (err) {
|
|
43
|
+
// Go on
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (pkg == 'freebsd-x64') {
|
|
48
|
+
try {
|
|
49
|
+
native = require('@koromix/koffi-freebsd-x64');
|
|
50
|
+
} catch (err) {
|
|
51
|
+
// Go on
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (pkg == 'freebsd-arm64') {
|
|
56
|
+
try {
|
|
57
|
+
native = require('@koromix/koffi-freebsd-arm64');
|
|
58
|
+
} catch (err) {
|
|
59
|
+
// Go on
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (pkg == 'openbsd-ia32') {
|
|
64
|
+
try {
|
|
65
|
+
native = require('@koromix/koffi-openbsd-ia32');
|
|
66
|
+
} catch (err) {
|
|
67
|
+
// Go on
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (pkg == 'openbsd-x64') {
|
|
72
|
+
try {
|
|
73
|
+
native = require('@koromix/koffi-openbsd-x64');
|
|
74
|
+
} catch (err) {
|
|
75
|
+
// Go on
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (pkg == 'win32-ia32') {
|
|
80
|
+
try {
|
|
81
|
+
native = require('@koromix/koffi-win32-ia32');
|
|
82
|
+
} catch (err) {
|
|
83
|
+
// Go on
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (pkg == 'win32-x64') {
|
|
88
|
+
try {
|
|
89
|
+
native = require('@koromix/koffi-win32-x64');
|
|
90
|
+
} catch (err) {
|
|
91
|
+
// Go on
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (pkg == 'win32-arm64') {
|
|
96
|
+
try {
|
|
97
|
+
native = require('@koromix/koffi-win32-arm64');
|
|
98
|
+
} catch (err) {
|
|
99
|
+
// Go on
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (pkg == 'darwin-x64') {
|
|
104
|
+
try {
|
|
105
|
+
native = require('@koromix/koffi-darwin-x64');
|
|
106
|
+
} catch (err) {
|
|
107
|
+
// Go on
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (pkg == 'darwin-arm64') {
|
|
112
|
+
try {
|
|
113
|
+
native = require('@koromix/koffi-darwin-arm64');
|
|
114
|
+
} catch (err) {
|
|
115
|
+
// Go on
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (pkg == 'linux-loong64') {
|
|
120
|
+
try {
|
|
121
|
+
native = require('@koromix/koffi-linux-loong64');
|
|
122
|
+
} catch (err) {
|
|
123
|
+
// Go on
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return native;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
module.exports = { loadStatic };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// SPDX-FileCopyrightText: 2026 Niels Martignène <niels.martignene@protonmail.com>
|
|
3
|
+
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
function loadStatic(pkg) {
|
|
8
|
+
let native = null;
|
|
9
|
+
|
|
10
|
+
if (pkg == 'linux-arm64') {
|
|
11
|
+
try {
|
|
12
|
+
native = require('@koromix/koffi-linux-arm64');
|
|
13
|
+
} catch (err) {
|
|
14
|
+
// Go on
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (pkg == 'linux-ia32') {
|
|
19
|
+
try {
|
|
20
|
+
native = require('@koromix/koffi-linux-ia32');
|
|
21
|
+
} catch (err) {
|
|
22
|
+
// Go on
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (pkg == 'linux-x64') {
|
|
27
|
+
try {
|
|
28
|
+
native = require('@koromix/koffi-linux-x64');
|
|
29
|
+
} catch (err) {
|
|
30
|
+
// Go on
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (pkg == 'linux-riscv64') {
|
|
35
|
+
try {
|
|
36
|
+
native = require('@koromix/koffi-linux-riscv64');
|
|
37
|
+
} catch (err) {
|
|
38
|
+
// Go on
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (pkg == 'freebsd-ia32') {
|
|
43
|
+
try {
|
|
44
|
+
native = require('@koromix/koffi-freebsd-ia32');
|
|
45
|
+
} catch (err) {
|
|
46
|
+
// Go on
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (pkg == 'freebsd-x64') {
|
|
51
|
+
try {
|
|
52
|
+
native = require('@koromix/koffi-freebsd-x64');
|
|
53
|
+
} catch (err) {
|
|
54
|
+
// Go on
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (pkg == 'freebsd-arm64') {
|
|
59
|
+
try {
|
|
60
|
+
native = require('@koromix/koffi-freebsd-arm64');
|
|
61
|
+
} catch (err) {
|
|
62
|
+
// Go on
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (pkg == 'openbsd-ia32') {
|
|
67
|
+
try {
|
|
68
|
+
native = require('@koromix/koffi-openbsd-ia32');
|
|
69
|
+
} catch (err) {
|
|
70
|
+
// Go on
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (pkg == 'openbsd-x64') {
|
|
75
|
+
try {
|
|
76
|
+
native = require('@koromix/koffi-openbsd-x64');
|
|
77
|
+
} catch (err) {
|
|
78
|
+
// Go on
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (pkg == 'win32-ia32') {
|
|
83
|
+
try {
|
|
84
|
+
native = require('@koromix/koffi-win32-ia32');
|
|
85
|
+
} catch (err) {
|
|
86
|
+
// Go on
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (pkg == 'win32-x64') {
|
|
91
|
+
try {
|
|
92
|
+
native = require('@koromix/koffi-win32-x64');
|
|
93
|
+
} catch (err) {
|
|
94
|
+
// Go on
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (pkg == 'win32-arm64') {
|
|
99
|
+
try {
|
|
100
|
+
native = require('@koromix/koffi-win32-arm64');
|
|
101
|
+
} catch (err) {
|
|
102
|
+
// Go on
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (pkg == 'darwin-x64') {
|
|
107
|
+
try {
|
|
108
|
+
native = require('@koromix/koffi-darwin-x64');
|
|
109
|
+
} catch (err) {
|
|
110
|
+
// Go on
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (pkg == 'darwin-arm64') {
|
|
115
|
+
try {
|
|
116
|
+
native = require('@koromix/koffi-darwin-arm64');
|
|
117
|
+
} catch (err) {
|
|
118
|
+
// Go on
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (pkg == 'linux-loong64') {
|
|
123
|
+
try {
|
|
124
|
+
native = require('@koromix/koffi-linux-loong64');
|
|
125
|
+
} catch (err) {
|
|
126
|
+
// Go on
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return native;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { loadStatic }
|
package/node_modules/@finogeeks2026/finsafe-sdk/node_modules/koffi/src/koffi/src/trampolines.cjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: 2026 Niels Martignène <niels.martignene@protonmail.com>
|
|
4
|
+
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
|
|
8
|
+
main();
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
try {
|
|
12
|
+
await run();
|
|
13
|
+
} catch (err) {
|
|
14
|
+
console.error(err);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function run() {
|
|
20
|
+
let args = process.argv.slice(2);
|
|
21
|
+
|
|
22
|
+
if (args.length < 2)
|
|
23
|
+
throw new Error('Usage: trampolines.cjs DIRECTORY N');
|
|
24
|
+
|
|
25
|
+
let dest_dir = args[0]?.trim?.();
|
|
26
|
+
let n = parseInt(args[1], 10);
|
|
27
|
+
|
|
28
|
+
if (!dest_dir)
|
|
29
|
+
throw new Error('Destination directory is empty');
|
|
30
|
+
if (Number.isNaN(n))
|
|
31
|
+
throw new Error('N must be an integer');
|
|
32
|
+
|
|
33
|
+
if (!fs.existsSync(dest_dir))
|
|
34
|
+
fs.mkdirSync(dest_dir);
|
|
35
|
+
|
|
36
|
+
writeAsmTrampolines(path.join(dest_dir, 'gnu.inc'), n,
|
|
37
|
+
i => `.global SYMBOL(Trampoline${i})`,
|
|
38
|
+
i => `SYMBOL(Trampoline${i}):\n trampoline ${i}`
|
|
39
|
+
);
|
|
40
|
+
writeAsmTrampolines(path.join(dest_dir, 'armasm.inc'), n,
|
|
41
|
+
i => ` EXPORT Trampoline${i}`,
|
|
42
|
+
i => `Trampoline${i} PROC\n trampoline ${i}\n ENDP`,
|
|
43
|
+
` END`
|
|
44
|
+
);
|
|
45
|
+
writeAsmTrampolines(path.join(dest_dir, 'masm64.inc'), n,
|
|
46
|
+
i => `public Trampoline${i}`,
|
|
47
|
+
i => `Trampoline${i} proc frame\n trampoline ${i}\nTrampoline${i} endp`
|
|
48
|
+
);
|
|
49
|
+
writeAsmTrampolines(path.join(dest_dir, 'masm32.inc'), n,
|
|
50
|
+
i => `public Trampoline${i}`,
|
|
51
|
+
i => `Trampoline${i} proc\n trampoline ${i}\nTrampoline${i} endp`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function writeAsmTrampolines(filename, n, fmt_export, fmt_proc, end = null) {
|
|
56
|
+
let lines = [];
|
|
57
|
+
|
|
58
|
+
for (let i = 0; i < n; i++) {
|
|
59
|
+
let line = fmt_export(i);
|
|
60
|
+
lines.push(line);
|
|
61
|
+
}
|
|
62
|
+
lines.push('');
|
|
63
|
+
|
|
64
|
+
for (let i = 0; i < n; i++) {
|
|
65
|
+
let line = fmt_proc(i);
|
|
66
|
+
lines.push(line);
|
|
67
|
+
}
|
|
68
|
+
lines.push('');
|
|
69
|
+
|
|
70
|
+
if (end !== null) {
|
|
71
|
+
lines.push(end);
|
|
72
|
+
lines.push('');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let content = lines.join('\n');
|
|
76
|
+
fs.writeFileSync(filename, content);
|
|
77
|
+
}
|