@zappdev/cli 0.1.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.
Files changed (209) hide show
  1. package/README.md +55 -0
  2. package/dist/zapp-cli.js +9471 -0
  3. package/native/src/app/app.zc +490 -0
  4. package/native/src/event/event.zc +24 -0
  5. package/native/src/event/events.zc +70 -0
  6. package/native/src/platform/darwin/backend.zc +923 -0
  7. package/native/src/platform/darwin/backend_bootstrap.zc +9 -0
  8. package/native/src/platform/darwin/bootstrap.zc +9 -0
  9. package/native/src/platform/darwin/engine_jsc.zc +86 -0
  10. package/native/src/platform/darwin/engine_qjs.zc +92 -0
  11. package/native/src/platform/darwin/platform.zc +156 -0
  12. package/native/src/platform/darwin/webview.zc +550 -0
  13. package/native/src/platform/darwin/webview_bootstrap.zc +9 -0
  14. package/native/src/platform/darwin/window.zc +1223 -0
  15. package/native/src/platform/darwin/worker/common.zc +223 -0
  16. package/native/src/platform/darwin/worker/core/base64_core.zc +29 -0
  17. package/native/src/platform/darwin/worker/core/crypto_core.zc +19 -0
  18. package/native/src/platform/darwin/worker/core/encoding_core.zc +32 -0
  19. package/native/src/platform/darwin/worker/core/fetch_core.zc +145 -0
  20. package/native/src/platform/darwin/worker/core/url_core.zc +69 -0
  21. package/native/src/platform/darwin/worker/core/websocket_core.zc +179 -0
  22. package/native/src/platform/darwin/worker/dispatch.zc +55 -0
  23. package/native/src/platform/darwin/worker/jsc/base64_jsc.zc +39 -0
  24. package/native/src/platform/darwin/worker/jsc/crypto_jsc.zc +49 -0
  25. package/native/src/platform/darwin/worker/jsc/encoding_jsc.zc +86 -0
  26. package/native/src/platform/darwin/worker/jsc/fetch_jsc.zc +149 -0
  27. package/native/src/platform/darwin/worker/jsc/url_jsc.zc +54 -0
  28. package/native/src/platform/darwin/worker/jsc/websocket_jsc.zc +127 -0
  29. package/native/src/platform/darwin/worker/jsc.zc +670 -0
  30. package/native/src/platform/darwin/worker/mod.zc +30 -0
  31. package/native/src/platform/darwin/worker/qjs/fetch_qjs.zc +233 -0
  32. package/native/src/platform/darwin/worker/qjs/qjs_macros.zc +23 -0
  33. package/native/src/platform/darwin/worker/qjs/websocket_qjs.zc +223 -0
  34. package/native/src/platform/darwin/worker/qjs.zc +1053 -0
  35. package/native/src/platform/darwin/worker/timers.zc +149 -0
  36. package/native/src/platform/darwin/worker/timers_qjs.zc +209 -0
  37. package/native/src/platform/platform.zc +64 -0
  38. package/native/src/platform/shared/log.zc +156 -0
  39. package/native/src/platform/shared/worker/qjs/base64_qjs.zc +38 -0
  40. package/native/src/platform/shared/worker/qjs/crypto_qjs.zc +44 -0
  41. package/native/src/platform/shared/worker/qjs/encoding_qjs.zc +95 -0
  42. package/native/src/platform/shared/worker/qjs/url_qjs.zc +65 -0
  43. package/native/src/platform/shared/worker_registry.zc +206 -0
  44. package/native/src/platform/window.zc +446 -0
  45. package/native/src/platform/windows/backend.zc +452 -0
  46. package/native/src/platform/windows/backend_bootstrap.zc +9 -0
  47. package/native/src/platform/windows/bootstrap.zc +9 -0
  48. package/native/src/platform/windows/engine_qjs.zc +60 -0
  49. package/native/src/platform/windows/platform.zc +387 -0
  50. package/native/src/platform/windows/webview.zc +1175 -0
  51. package/native/src/platform/windows/webview_bootstrap.zc +9 -0
  52. package/native/src/platform/windows/window.zc +1271 -0
  53. package/native/src/platform/windows/worker/common.zc +409 -0
  54. package/native/src/platform/windows/worker/core/base64_core.zc +52 -0
  55. package/native/src/platform/windows/worker/core/crypto_core.zc +34 -0
  56. package/native/src/platform/windows/worker/core/encoding_core.zc +60 -0
  57. package/native/src/platform/windows/worker/core/fetch_core.zc +274 -0
  58. package/native/src/platform/windows/worker/core/url_core.zc +216 -0
  59. package/native/src/platform/windows/worker/core/websocket_core.zc +343 -0
  60. package/native/src/platform/windows/worker/dispatch.zc +34 -0
  61. package/native/src/platform/windows/worker/mod.zc +46 -0
  62. package/native/src/platform/windows/worker/qjs/fetch_qjs.zc +255 -0
  63. package/native/src/platform/windows/worker/qjs/websocket_qjs.zc +263 -0
  64. package/native/src/platform/windows/worker/qjs.zc +1049 -0
  65. package/native/src/platform/windows/worker/timers_qjs.zc +288 -0
  66. package/native/src/platform/worker.zc +8 -0
  67. package/native/src/service/service.zc +228 -0
  68. package/native/vendor/quickjs-ng/.gitattributes +4 -0
  69. package/native/vendor/quickjs-ng/.github/dependabot.yml +7 -0
  70. package/native/vendor/quickjs-ng/.github/workflows/ci.yml +812 -0
  71. package/native/vendor/quickjs-ng/.github/workflows/docs.yml +49 -0
  72. package/native/vendor/quickjs-ng/.github/workflows/release.yml +162 -0
  73. package/native/vendor/quickjs-ng/.github/workflows/test-docs.yml +23 -0
  74. package/native/vendor/quickjs-ng/.github/workflows/tsan.yml +32 -0
  75. package/native/vendor/quickjs-ng/.github/workflows/valgrind.yml +33 -0
  76. package/native/vendor/quickjs-ng/.gitmodules +5 -0
  77. package/native/vendor/quickjs-ng/CMakeLists.txt +553 -0
  78. package/native/vendor/quickjs-ng/LICENSE +24 -0
  79. package/native/vendor/quickjs-ng/Makefile +149 -0
  80. package/native/vendor/quickjs-ng/amalgam.js +53 -0
  81. package/native/vendor/quickjs-ng/api-test.c +927 -0
  82. package/native/vendor/quickjs-ng/builtin-array-fromasync.h +119 -0
  83. package/native/vendor/quickjs-ng/builtin-array-fromasync.js +36 -0
  84. package/native/vendor/quickjs-ng/builtin-iterator-zip-keyed.h +332 -0
  85. package/native/vendor/quickjs-ng/builtin-iterator-zip-keyed.js +194 -0
  86. package/native/vendor/quickjs-ng/builtin-iterator-zip.h +337 -0
  87. package/native/vendor/quickjs-ng/builtin-iterator-zip.js +210 -0
  88. package/native/vendor/quickjs-ng/ctest.c +17 -0
  89. package/native/vendor/quickjs-ng/cutils.h +2013 -0
  90. package/native/vendor/quickjs-ng/cxxtest.cc +2 -0
  91. package/native/vendor/quickjs-ng/dtoa.c +1619 -0
  92. package/native/vendor/quickjs-ng/dtoa.h +87 -0
  93. package/native/vendor/quickjs-ng/examples/fib.c +67 -0
  94. package/native/vendor/quickjs-ng/examples/fib_module.js +10 -0
  95. package/native/vendor/quickjs-ng/examples/hello.js +1 -0
  96. package/native/vendor/quickjs-ng/examples/hello_module.js +6 -0
  97. package/native/vendor/quickjs-ng/examples/meson.build +17 -0
  98. package/native/vendor/quickjs-ng/examples/pi_bigint.js +118 -0
  99. package/native/vendor/quickjs-ng/examples/point.c +154 -0
  100. package/native/vendor/quickjs-ng/examples/test_fib.js +8 -0
  101. package/native/vendor/quickjs-ng/examples/test_point.js +43 -0
  102. package/native/vendor/quickjs-ng/fuzz.c +51 -0
  103. package/native/vendor/quickjs-ng/gen/function_source.c +81 -0
  104. package/native/vendor/quickjs-ng/gen/hello.c +53 -0
  105. package/native/vendor/quickjs-ng/gen/hello_module.c +106 -0
  106. package/native/vendor/quickjs-ng/gen/repl.c +3053 -0
  107. package/native/vendor/quickjs-ng/gen/standalone.c +324 -0
  108. package/native/vendor/quickjs-ng/gen/test_fib.c +81 -0
  109. package/native/vendor/quickjs-ng/libregexp-opcode.h +58 -0
  110. package/native/vendor/quickjs-ng/libregexp.c +2687 -0
  111. package/native/vendor/quickjs-ng/libregexp.h +98 -0
  112. package/native/vendor/quickjs-ng/libunicode-table.h +4707 -0
  113. package/native/vendor/quickjs-ng/libunicode.c +1746 -0
  114. package/native/vendor/quickjs-ng/libunicode.h +126 -0
  115. package/native/vendor/quickjs-ng/list.h +107 -0
  116. package/native/vendor/quickjs-ng/lre-test.c +73 -0
  117. package/native/vendor/quickjs-ng/meson.build +684 -0
  118. package/native/vendor/quickjs-ng/meson_options.txt +6 -0
  119. package/native/vendor/quickjs-ng/qjs-wasi-reactor.c +208 -0
  120. package/native/vendor/quickjs-ng/qjs.c +748 -0
  121. package/native/vendor/quickjs-ng/qjsc.c +673 -0
  122. package/native/vendor/quickjs-ng/quickjs-atom.h +267 -0
  123. package/native/vendor/quickjs-ng/quickjs-c-atomics.h +54 -0
  124. package/native/vendor/quickjs-ng/quickjs-libc.c +4986 -0
  125. package/native/vendor/quickjs-ng/quickjs-libc.h +79 -0
  126. package/native/vendor/quickjs-ng/quickjs-opcode.h +369 -0
  127. package/native/vendor/quickjs-ng/quickjs.c +60259 -0
  128. package/native/vendor/quickjs-ng/quickjs.h +1419 -0
  129. package/native/vendor/quickjs-ng/repl.js +1927 -0
  130. package/native/vendor/quickjs-ng/run-test262.c +2417 -0
  131. package/native/vendor/quickjs-ng/standalone.js +129 -0
  132. package/native/vendor/quickjs-ng/tests/assert.js +49 -0
  133. package/native/vendor/quickjs-ng/tests/bug1221.js +16 -0
  134. package/native/vendor/quickjs-ng/tests/bug1296.js +12 -0
  135. package/native/vendor/quickjs-ng/tests/bug1297.js +22 -0
  136. package/native/vendor/quickjs-ng/tests/bug1301.js +21 -0
  137. package/native/vendor/quickjs-ng/tests/bug1302.js +24 -0
  138. package/native/vendor/quickjs-ng/tests/bug1305.js +26 -0
  139. package/native/vendor/quickjs-ng/tests/bug1318.js +54 -0
  140. package/native/vendor/quickjs-ng/tests/bug1352.js +8 -0
  141. package/native/vendor/quickjs-ng/tests/bug1354.js +6 -0
  142. package/native/vendor/quickjs-ng/tests/bug1355.js +58 -0
  143. package/native/vendor/quickjs-ng/tests/bug1368.js +9 -0
  144. package/native/vendor/quickjs-ng/tests/bug39/1.js +6 -0
  145. package/native/vendor/quickjs-ng/tests/bug39/2.js +6 -0
  146. package/native/vendor/quickjs-ng/tests/bug39/3.js +7 -0
  147. package/native/vendor/quickjs-ng/tests/bug488-upstream.js +7 -0
  148. package/native/vendor/quickjs-ng/tests/bug633/0.js +7 -0
  149. package/native/vendor/quickjs-ng/tests/bug633/1.js +4 -0
  150. package/native/vendor/quickjs-ng/tests/bug633/2.js +4 -0
  151. package/native/vendor/quickjs-ng/tests/bug633/3.js +4 -0
  152. package/native/vendor/quickjs-ng/tests/bug645/0.js +4 -0
  153. package/native/vendor/quickjs-ng/tests/bug645/1.js +9 -0
  154. package/native/vendor/quickjs-ng/tests/bug645/2.js +7 -0
  155. package/native/vendor/quickjs-ng/tests/bug648.js +13 -0
  156. package/native/vendor/quickjs-ng/tests/bug652.js +4 -0
  157. package/native/vendor/quickjs-ng/tests/bug741.js +19 -0
  158. package/native/vendor/quickjs-ng/tests/bug775.js +7 -0
  159. package/native/vendor/quickjs-ng/tests/bug776.js +7 -0
  160. package/native/vendor/quickjs-ng/tests/bug832.js +2 -0
  161. package/native/vendor/quickjs-ng/tests/bug858.js +26 -0
  162. package/native/vendor/quickjs-ng/tests/bug904.js +6 -0
  163. package/native/vendor/quickjs-ng/tests/bug988.js +7 -0
  164. package/native/vendor/quickjs-ng/tests/bug999.js +3 -0
  165. package/native/vendor/quickjs-ng/tests/destructured-export.js +8 -0
  166. package/native/vendor/quickjs-ng/tests/detect_module/0.js +1 -0
  167. package/native/vendor/quickjs-ng/tests/detect_module/1.js +2 -0
  168. package/native/vendor/quickjs-ng/tests/detect_module/2.js +1 -0
  169. package/native/vendor/quickjs-ng/tests/detect_module/3.js +8 -0
  170. package/native/vendor/quickjs-ng/tests/detect_module/4.js +3 -0
  171. package/native/vendor/quickjs-ng/tests/empty.js +0 -0
  172. package/native/vendor/quickjs-ng/tests/fixture_cyclic_import.js +2 -0
  173. package/native/vendor/quickjs-ng/tests/fixture_string_exports.js +12 -0
  174. package/native/vendor/quickjs-ng/tests/function_source.js +14 -0
  175. package/native/vendor/quickjs-ng/tests/microbench.js +1267 -0
  176. package/native/vendor/quickjs-ng/tests/null_or_undefined.js +38 -0
  177. package/native/vendor/quickjs-ng/tests/str-pad-leak.js +5 -0
  178. package/native/vendor/quickjs-ng/tests/test_bigint.js +107 -0
  179. package/native/vendor/quickjs-ng/tests/test_bjson.js +366 -0
  180. package/native/vendor/quickjs-ng/tests/test_builtin.js +1314 -0
  181. package/native/vendor/quickjs-ng/tests/test_closure.js +220 -0
  182. package/native/vendor/quickjs-ng/tests/test_cyclic_import.js +12 -0
  183. package/native/vendor/quickjs-ng/tests/test_domexception.js +35 -0
  184. package/native/vendor/quickjs-ng/tests/test_language.js +755 -0
  185. package/native/vendor/quickjs-ng/tests/test_loop.js +367 -0
  186. package/native/vendor/quickjs-ng/tests/test_queue_microtask.js +39 -0
  187. package/native/vendor/quickjs-ng/tests/test_std.js +340 -0
  188. package/native/vendor/quickjs-ng/tests/test_string_exports.js +25 -0
  189. package/native/vendor/quickjs-ng/tests/test_worker.js +43 -0
  190. package/native/vendor/quickjs-ng/tests/test_worker_module.js +30 -0
  191. package/native/vendor/quickjs-ng/tests.conf +14 -0
  192. package/native/vendor/quickjs-ng/unicode_download.sh +19 -0
  193. package/native/vendor/quickjs-ng/unicode_gen.c +3108 -0
  194. package/native/vendor/quickjs-ng/unicode_gen_def.h +310 -0
  195. package/native/vendor/quickjs-ng/update-version.sh +32 -0
  196. package/native/vendor/webview2/include/WebView2.h +60636 -0
  197. package/native/vendor/webview2/include/WebView2EnvironmentOptions.h +406 -0
  198. package/package.json +33 -0
  199. package/src/backend.ts +139 -0
  200. package/src/build-config.ts +87 -0
  201. package/src/build.ts +276 -0
  202. package/src/common.ts +195 -0
  203. package/src/config.ts +89 -0
  204. package/src/dev.ts +164 -0
  205. package/src/generate.ts +200 -0
  206. package/src/icons.ts +116 -0
  207. package/src/init.ts +190 -0
  208. package/src/package.ts +150 -0
  209. package/src/zapp-cli.ts +263 -0
@@ -0,0 +1,53 @@
1
+ /* File generated automatically by the QuickJS-ng compiler. */
2
+
3
+ #include "quickjs-libc.h"
4
+
5
+ const uint32_t qjsc_hello_size = 108;
6
+
7
+ const uint8_t qjsc_hello[108] = {
8
+ 0x18, 0x78, 0x91, 0xc0, 0xa0, 0x04, 0x01, 0x22,
9
+ 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73,
10
+ 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x6a,
11
+ 0x73, 0x01, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
12
+ 0x6c, 0x65, 0x01, 0x06, 0x6c, 0x6f, 0x67, 0x01,
13
+ 0x16, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57,
14
+ 0x6f, 0x72, 0x6c, 0x64, 0x0d, 0xca, 0x03, 0x00,
15
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x0a, 0x01,
16
+ 0xa2, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
17
+ 0x00, 0x19, 0x00, 0x08, 0xea, 0x02, 0x29, 0x38,
18
+ 0xe6, 0x00, 0x00, 0x00, 0x41, 0xe7, 0x00, 0x00,
19
+ 0x00, 0x04, 0xe8, 0x00, 0x00, 0x00, 0x24, 0x01,
20
+ 0x00, 0x0e, 0x06, 0x2f, 0xca, 0x03, 0x01, 0x01,
21
+ 0x02, 0x48, 0x0e, 0x00,
22
+ };
23
+
24
+ static JSContext *JS_NewCustomContext(JSRuntime *rt)
25
+ {
26
+ JSContext *ctx = JS_NewContext(rt);
27
+ if (!ctx)
28
+ return NULL;
29
+ return ctx;
30
+ }
31
+
32
+ int main(int argc, char **argv)
33
+ {
34
+ int r;
35
+ JSRuntime *rt;
36
+ JSContext *ctx;
37
+ r = 0;
38
+ rt = JS_NewRuntime();
39
+ js_std_set_worker_new_context_func(JS_NewCustomContext);
40
+ js_std_init_handlers(rt);
41
+ JS_SetModuleLoaderFunc2(rt, NULL, js_module_loader, js_module_check_attributes, NULL);
42
+ ctx = JS_NewCustomContext(rt);
43
+ js_std_add_helpers(ctx, argc, argv);
44
+ js_std_eval_binary(ctx, qjsc_hello, qjsc_hello_size, 0);
45
+ r = js_std_loop(ctx);
46
+ if (r) {
47
+ js_std_dump_error(ctx);
48
+ }
49
+ js_std_free_handlers(rt);
50
+ JS_FreeContext(ctx);
51
+ JS_FreeRuntime(rt);
52
+ return r;
53
+ }
@@ -0,0 +1,106 @@
1
+ /* File generated automatically by the QuickJS-ng compiler. */
2
+
3
+ #include "quickjs-libc.h"
4
+
5
+ const uint32_t qjsc_fib_module_size = 296;
6
+
7
+ const uint8_t qjsc_fib_module[296] = {
8
+ 0x18, 0x85, 0x9c, 0x5a, 0x3c, 0x03, 0x01, 0x2c,
9
+ 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73,
10
+ 0x2f, 0x66, 0x69, 0x62, 0x5f, 0x6d, 0x6f, 0x64,
11
+ 0x75, 0x6c, 0x65, 0x2e, 0x6a, 0x73, 0x01, 0x06,
12
+ 0x66, 0x69, 0x62, 0x01, 0x02, 0x6e, 0x0d, 0xca,
13
+ 0x03, 0x00, 0x01, 0x00, 0x00, 0xcc, 0x03, 0x00,
14
+ 0x00, 0x00, 0x0c, 0x20, 0x0a, 0x01, 0xa2, 0x01,
15
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x09,
16
+ 0x00, 0xcc, 0x03, 0x00, 0x06, 0x0c, 0x43, 0x0a,
17
+ 0x01, 0xcc, 0x03, 0x01, 0x00, 0x01, 0x04, 0x00,
18
+ 0x01, 0x00, 0x1a, 0x01, 0xce, 0x03, 0x00, 0x01,
19
+ 0x00, 0xcc, 0x03, 0x00, 0x02, 0xd1, 0xb4, 0xa6,
20
+ 0xea, 0x03, 0xb4, 0x28, 0xd1, 0xb5, 0xab, 0xea,
21
+ 0x03, 0xb5, 0x28, 0xdd, 0xd1, 0xb5, 0x9d, 0xef,
22
+ 0xdd, 0xd1, 0xb6, 0x9d, 0xef, 0x9c, 0x28, 0xca,
23
+ 0x03, 0x02, 0x08, 0x0e, 0x09, 0x0c, 0x27, 0x0a,
24
+ 0x28, 0x02, 0x07, 0x08, 0x11, 0x0a, 0x07, 0x08,
25
+ 0x07, 0x08, 0x8d, 0x01, 0x66, 0x75, 0x6e, 0x63,
26
+ 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x69, 0x62,
27
+ 0x28, 0x6e, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20,
28
+ 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x20,
29
+ 0x3c, 0x3d, 0x20, 0x30, 0x29, 0x0a, 0x20, 0x20,
30
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
31
+ 0x74, 0x75, 0x72, 0x6e, 0x20, 0x30, 0x3b, 0x0a,
32
+ 0x20, 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65,
33
+ 0x20, 0x69, 0x66, 0x20, 0x28, 0x6e, 0x20, 0x3d,
34
+ 0x3d, 0x20, 0x31, 0x29, 0x0a, 0x20, 0x20, 0x20,
35
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74,
36
+ 0x75, 0x72, 0x6e, 0x20, 0x31, 0x3b, 0x0a, 0x20,
37
+ 0x20, 0x20, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x0a,
38
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
39
+ 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66,
40
+ 0x69, 0x62, 0x28, 0x6e, 0x20, 0x2d, 0x20, 0x31,
41
+ 0x29, 0x20, 0x2b, 0x20, 0x66, 0x69, 0x62, 0x28,
42
+ 0x6e, 0x20, 0x2d, 0x20, 0x32, 0x29, 0x3b, 0x0a,
43
+ 0x7d, 0x08, 0xea, 0x05, 0xbf, 0x00, 0xe1, 0x29,
44
+ 0x06, 0x2f, 0xca, 0x03, 0x01, 0x01, 0x00, 0x00,
45
+ };
46
+
47
+ const uint32_t qjsc_hello_module_size = 192;
48
+
49
+ const uint8_t qjsc_hello_module[192] = {
50
+ 0x18, 0xa8, 0x36, 0x8c, 0x99, 0x07, 0x01, 0x30,
51
+ 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73,
52
+ 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x5f, 0x6d,
53
+ 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x6a, 0x73,
54
+ 0x01, 0x1e, 0x2e, 0x2f, 0x66, 0x69, 0x62, 0x5f,
55
+ 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x6a,
56
+ 0x73, 0x01, 0x06, 0x66, 0x69, 0x62, 0x01, 0x0e,
57
+ 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x01,
58
+ 0x06, 0x6c, 0x6f, 0x67, 0x01, 0x16, 0x48, 0x65,
59
+ 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c,
60
+ 0x64, 0x01, 0x10, 0x66, 0x69, 0x62, 0x28, 0x31,
61
+ 0x30, 0x29, 0x3d, 0x0d, 0xca, 0x03, 0x01, 0xcc,
62
+ 0x03, 0x00, 0x00, 0x01, 0x00, 0xce, 0x03, 0x00,
63
+ 0x00, 0x0c, 0x20, 0x0a, 0x01, 0xa2, 0x01, 0x00,
64
+ 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x32, 0x00,
65
+ 0xce, 0x03, 0x00, 0x1f, 0x08, 0xea, 0x02, 0x29,
66
+ 0x38, 0xe8, 0x00, 0x00, 0x00, 0x41, 0xe9, 0x00,
67
+ 0x00, 0x00, 0x04, 0xea, 0x00, 0x00, 0x00, 0x24,
68
+ 0x01, 0x00, 0x0e, 0x38, 0xe8, 0x00, 0x00, 0x00,
69
+ 0x41, 0xe9, 0x00, 0x00, 0x00, 0x04, 0xeb, 0x00,
70
+ 0x00, 0x00, 0x64, 0x00, 0x00, 0xbc, 0x0a, 0xef,
71
+ 0x24, 0x02, 0x00, 0x0e, 0x06, 0x2f, 0xca, 0x03,
72
+ 0x01, 0x01, 0x0c, 0x00, 0x04, 0x08, 0x00, 0x34,
73
+ 0x10, 0x30, 0x0f, 0x34, 0x10, 0x2a, 0x20, 0x00,
74
+ };
75
+
76
+ static JSContext *JS_NewCustomContext(JSRuntime *rt)
77
+ {
78
+ JSContext *ctx = JS_NewContext(rt);
79
+ if (!ctx)
80
+ return NULL;
81
+ js_std_eval_binary(ctx, qjsc_fib_module, qjsc_fib_module_size, 1);
82
+ return ctx;
83
+ }
84
+
85
+ int main(int argc, char **argv)
86
+ {
87
+ int r;
88
+ JSRuntime *rt;
89
+ JSContext *ctx;
90
+ r = 0;
91
+ rt = JS_NewRuntime();
92
+ js_std_set_worker_new_context_func(JS_NewCustomContext);
93
+ js_std_init_handlers(rt);
94
+ JS_SetModuleLoaderFunc2(rt, NULL, js_module_loader, js_module_check_attributes, NULL);
95
+ ctx = JS_NewCustomContext(rt);
96
+ js_std_add_helpers(ctx, argc, argv);
97
+ js_std_eval_binary(ctx, qjsc_hello_module, qjsc_hello_module_size, 0);
98
+ r = js_std_loop(ctx);
99
+ if (r) {
100
+ js_std_dump_error(ctx);
101
+ }
102
+ js_std_free_handlers(rt);
103
+ JS_FreeContext(ctx);
104
+ JS_FreeRuntime(rt);
105
+ return r;
106
+ }