@mikrojs/native 0.21.1-next.20260927212749 → 0.22.0

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.
@@ -1,43 +0,0 @@
1
- #include <quickjs.h>
2
-
3
- #include "mikrojs/private.h"
4
- #include "mikrojs/utils.h"
5
-
6
- int mik__eval_bytecode(JSContext* ctx, const uint8_t* buf, size_t buf_len, bool check_promise) {
7
- JSValue obj = JS_ReadObject(ctx, buf, buf_len, JS_READ_OBJ_BYTECODE);
8
-
9
- if (JS_IsException(obj)) {
10
- mik_dump_error(ctx);
11
- return -1;
12
- }
13
-
14
- if (JS_VALUE_GET_TAG(obj) == JS_TAG_MODULE) {
15
- if (JS_ResolveModule(ctx, obj) < 0) {
16
- JS_FreeValue(ctx, obj);
17
- mik_dump_error(ctx);
18
- return -1;
19
- }
20
- }
21
-
22
- mik__blocking_begin(MIK_GetRuntime(ctx));
23
- JSValue val = JS_EvalFunction(ctx, obj);
24
- if (JS_IsException(val)) {
25
- mik_dump_error(ctx);
26
- return -1;
27
- }
28
-
29
- if (check_promise) {
30
- JSPromiseStateEnum promise_state = JS_PromiseState(ctx, val);
31
- if (promise_state != (JSPromiseStateEnum)-1) {
32
- if (promise_state == JS_PROMISE_REJECTED) {
33
- JSValue res = JS_PromiseResult(ctx, val);
34
- JS_FreeValue(ctx, res);
35
- JS_FreeValue(ctx, val);
36
- return -1;
37
- }
38
- }
39
- }
40
-
41
- JS_FreeValue(ctx, val);
42
- return 0;
43
- }