xbintsc 0.3.14 → 0.3.16

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 (201) hide show
  1. package/README.md +22 -22
  2. package/README.zh-CN.md +20 -19
  3. package/bin/xbintsc.js +1 -2
  4. package/dist/src/cli/main.js +8 -5
  5. package/dist/src/cli/main.js.map +1 -1
  6. package/dist/src/codegen/generator/state.js +8 -0
  7. package/dist/src/codegen/generator/state.js.map +1 -1
  8. package/dist/src/codegen/generator/tables.d.ts +5 -6
  9. package/dist/src/codegen/generator/tables.js +13 -6
  10. package/dist/src/codegen/generator/tables.js.map +1 -1
  11. package/dist/src/driver/bundler/graph.d.ts +8 -0
  12. package/dist/src/driver/bundler/graph.js +85 -0
  13. package/dist/src/driver/bundler/graph.js.map +1 -0
  14. package/dist/src/driver/bundler/merge.d.ts +11 -0
  15. package/dist/src/driver/bundler/merge.js +288 -0
  16. package/dist/src/driver/bundler/merge.js.map +1 -0
  17. package/dist/src/driver/bundler/resolve.d.ts +12 -0
  18. package/dist/src/driver/bundler/resolve.js +246 -0
  19. package/dist/src/driver/bundler/resolve.js.map +1 -0
  20. package/dist/src/driver/bundler/symbols.d.ts +15 -0
  21. package/dist/src/driver/bundler/symbols.js +51 -0
  22. package/dist/src/driver/bundler/symbols.js.map +1 -0
  23. package/dist/src/driver/bundler/types.d.ts +36 -0
  24. package/dist/src/driver/bundler/types.js +5 -0
  25. package/dist/src/driver/bundler/types.js.map +1 -0
  26. package/dist/src/driver/index.d.ts +1 -2
  27. package/dist/src/driver/index.js +1 -2
  28. package/dist/src/driver/index.js.map +1 -1
  29. package/dist/src/driver/modules.d.ts +9 -16
  30. package/dist/src/driver/modules.js +8 -644
  31. package/dist/src/driver/modules.js.map +1 -1
  32. package/dist/src/driver/paths.d.ts +0 -9
  33. package/dist/src/driver/paths.js +0 -31
  34. package/dist/src/driver/paths.js.map +1 -1
  35. package/dist/src/driver/toolchain-provider.d.ts +10 -10
  36. package/dist/src/driver/toolchain-provider.js +9 -38
  37. package/dist/src/driver/toolchain-provider.js.map +1 -1
  38. package/dist/src/driver/toolchain.js +8 -2
  39. package/dist/src/driver/toolchain.js.map +1 -1
  40. package/dist/src/extensions/catalog.js +2 -1
  41. package/dist/src/extensions/catalog.js.map +1 -1
  42. package/dist/src/extensions/gui/index.d.ts +24 -0
  43. package/dist/src/extensions/gui/index.js +101 -0
  44. package/dist/src/extensions/gui/index.js.map +1 -0
  45. package/dist/src/extensions/native.d.ts +2 -3
  46. package/dist/src/extensions/native.js +2 -3
  47. package/dist/src/extensions/native.js.map +1 -1
  48. package/dist/tests/driver/paths.test.js +1 -9
  49. package/dist/tests/driver/paths.test.js.map +1 -1
  50. package/dist/tests/driver/toolchain-provider.test.js +12 -79
  51. package/dist/tests/driver/toolchain-provider.test.js.map +1 -1
  52. package/dist/tests/e2e/compile-basics.test.d.ts +4 -0
  53. package/dist/tests/e2e/compile-basics.test.js +134 -0
  54. package/dist/tests/e2e/compile-basics.test.js.map +1 -0
  55. package/dist/tests/e2e/compile-builtins.test.d.ts +4 -0
  56. package/dist/tests/e2e/compile-builtins.test.js +191 -0
  57. package/dist/tests/e2e/compile-builtins.test.js.map +1 -0
  58. package/dist/tests/e2e/compile-control-flow.test.d.ts +4 -0
  59. package/dist/tests/e2e/compile-control-flow.test.js +190 -0
  60. package/dist/tests/e2e/compile-control-flow.test.js.map +1 -0
  61. package/dist/tests/e2e/compile-modules.test.d.ts +4 -0
  62. package/dist/tests/e2e/compile-modules.test.js +48 -0
  63. package/dist/tests/e2e/compile-modules.test.js.map +1 -0
  64. package/dist/tests/e2e/compile-objects-classes.test.d.ts +4 -0
  65. package/dist/tests/e2e/compile-objects-classes.test.js +362 -0
  66. package/dist/tests/e2e/compile-objects-classes.test.js.map +1 -0
  67. package/dist/tests/e2e/differential-helpers.d.ts +12 -0
  68. package/dist/tests/e2e/differential-helpers.js +16 -0
  69. package/dist/tests/e2e/differential-helpers.js.map +1 -0
  70. package/dist/tests/e2e/differential-language.test.d.ts +4 -0
  71. package/dist/tests/e2e/{differential.test.js → differential-language.test.js} +5 -287
  72. package/dist/tests/e2e/differential-language.test.js.map +1 -0
  73. package/dist/tests/e2e/differential-symbols.test.d.ts +4 -0
  74. package/dist/tests/e2e/differential-symbols.test.js +92 -0
  75. package/dist/tests/e2e/differential-symbols.test.js.map +1 -0
  76. package/dist/tests/e2e/differential-values.test.d.ts +4 -0
  77. package/dist/tests/e2e/differential-values.test.js +197 -0
  78. package/dist/tests/e2e/differential-values.test.js.map +1 -0
  79. package/dist/tests/e2e/gui.test.d.ts +12 -0
  80. package/dist/tests/e2e/gui.test.js +493 -0
  81. package/dist/tests/e2e/gui.test.js.map +1 -0
  82. package/dist/tests/e2e/native-extensions.test.d.ts +4 -5
  83. package/dist/tests/e2e/native-extensions.test.js +6 -7
  84. package/dist/tests/e2e/native-extensions.test.js.map +1 -1
  85. package/dist/tests/e2e/runtime-coverage-buffer.test.d.ts +4 -0
  86. package/dist/tests/e2e/runtime-coverage-buffer.test.js +97 -0
  87. package/dist/tests/e2e/runtime-coverage-buffer.test.js.map +1 -0
  88. package/dist/tests/e2e/runtime-coverage-globals.test.d.ts +4 -0
  89. package/dist/tests/e2e/runtime-coverage-globals.test.js +149 -0
  90. package/dist/tests/e2e/runtime-coverage-globals.test.js.map +1 -0
  91. package/dist/tests/e2e/runtime-coverage-node-modules.test.d.ts +4 -0
  92. package/dist/tests/e2e/runtime-coverage-node-modules.test.js +177 -0
  93. package/dist/tests/e2e/runtime-coverage-node-modules.test.js.map +1 -0
  94. package/dist/tests/e2e/runtime-coverage-streams.test.d.ts +4 -0
  95. package/dist/tests/e2e/runtime-coverage-streams.test.js +161 -0
  96. package/dist/tests/e2e/runtime-coverage-streams.test.js.map +1 -0
  97. package/dist/tests/e2e/runtime-coverage-system.test.d.ts +4 -0
  98. package/dist/tests/e2e/runtime-coverage-system.test.js +91 -0
  99. package/dist/tests/e2e/runtime-coverage-system.test.js.map +1 -0
  100. package/dist/tests/e2e/timers.test.d.ts +7 -0
  101. package/dist/tests/e2e/timers.test.js +63 -0
  102. package/dist/tests/e2e/timers.test.js.map +1 -0
  103. package/package.json +2 -2
  104. package/runtime/ext_gui/css.cpp +743 -0
  105. package/runtime/ext_gui/css.h +98 -0
  106. package/runtime/ext_gui/document.cpp +264 -0
  107. package/runtime/ext_gui/document.h +89 -0
  108. package/runtime/ext_gui/dom.cpp +472 -0
  109. package/runtime/ext_gui/dom.h +71 -0
  110. package/runtime/ext_gui/gui.cpp +457 -0
  111. package/runtime/ext_gui/gui_engine.h +81 -0
  112. package/runtime/ext_gui/image.cpp +125 -0
  113. package/runtime/ext_gui/image.h +42 -0
  114. package/runtime/ext_gui/layout.cpp +748 -0
  115. package/runtime/ext_gui/layout.h +93 -0
  116. package/runtime/ext_gui/paint.cpp +137 -0
  117. package/runtime/ext_gui/paint.h +75 -0
  118. package/runtime/ext_gui/renderer.cpp +959 -0
  119. package/runtime/ext_gui/renderer.h +68 -0
  120. package/runtime/ext_gui/stb_image.h +7988 -0
  121. package/runtime/ext_gui/style.cpp +771 -0
  122. package/runtime/ext_gui/style.h +117 -0
  123. package/runtime/ext_gui/text.cpp +378 -0
  124. package/runtime/ext_gui/text.h +78 -0
  125. package/runtime/ext_gui/window.cpp +405 -0
  126. package/runtime/ext_node/fs/fs_common.h +13 -527
  127. package/runtime/ext_node/fs/meta_ops.c +3 -3
  128. package/runtime/ext_node/fs/parts/buffer-bridge.inc +6 -0
  129. package/runtime/ext_node/fs/parts/builtins.inc +69 -0
  130. package/runtime/ext_node/fs/parts/dir.inc +47 -0
  131. package/runtime/ext_node/fs/parts/encoding.inc +186 -0
  132. package/runtime/ext_node/fs/parts/errors.inc +66 -0
  133. package/runtime/ext_node/fs/parts/flags.inc +39 -0
  134. package/runtime/ext_node/fs/parts/platform.inc +86 -0
  135. package/runtime/ext_node/fs/parts/promisify.inc +15 -0
  136. package/runtime/ext_node/fs/parts/time.inc +9 -0
  137. package/runtime/rt.h +36 -4
  138. package/runtime/rt_internal.h +10 -23
  139. package/runtime/xt_builtins.c +4 -0
  140. package/runtime/xt_containers/access.inc +168 -0
  141. package/runtime/xt_containers/arrays.inc +108 -0
  142. package/runtime/xt_containers/boxes.inc +11 -0
  143. package/runtime/xt_containers/objects.inc +326 -0
  144. package/runtime/xt_containers.c +8 -618
  145. package/runtime/xt_ext.h +0 -1
  146. package/runtime/xt_io/base64.inc +87 -0
  147. package/runtime/xt_io/console.inc +119 -0
  148. package/runtime/xt_io/exception.inc +142 -0
  149. package/runtime/xt_io/inspect.inc +212 -0
  150. package/runtime/xt_io.c +11 -556
  151. package/runtime/xt_loop.c +262 -24
  152. package/runtime/xt_regex/api.inc +58 -0
  153. package/runtime/xt_regex/helpers.inc +68 -0
  154. package/runtime/xt_regex/matcher.inc +248 -0
  155. package/runtime/xt_regex/parser.inc +236 -0
  156. package/runtime/xt_regex/types.inc +58 -0
  157. package/runtime/xt_regex.h +9 -672
  158. package/runtime/xt_stdlib2/helpers.inc +2 -4
  159. package/runtime/xt_values/arithmetic.inc +150 -0
  160. package/runtime/xt_values/comparison.inc +112 -0
  161. package/runtime/xt_values/constructors.inc +41 -0
  162. package/runtime/xt_values/conversions.inc +115 -0
  163. package/runtime/xt_values/number-format.inc +180 -0
  164. package/runtime/xt_values/strings.inc +22 -0
  165. package/runtime/xt_values.c +10 -626
  166. package/scripts/build-gui.ts +317 -0
  167. package/scripts/build-runtime.ts +7 -8
  168. package/scripts/coverage-runtime.ts +4 -4
  169. package/scripts/package-release.ts +12 -84
  170. package/src/cli/main.ts +8 -4
  171. package/src/codegen/generator/state.ts +8 -0
  172. package/src/codegen/generator/tables.ts +13 -6
  173. package/src/driver/bundler/graph.ts +95 -0
  174. package/src/driver/bundler/merge.ts +312 -0
  175. package/src/driver/bundler/resolve.ts +240 -0
  176. package/src/driver/bundler/symbols.ts +55 -0
  177. package/src/driver/bundler/types.ts +37 -0
  178. package/src/driver/index.ts +1 -9
  179. package/src/driver/modules.ts +9 -693
  180. package/src/driver/paths.ts +0 -31
  181. package/src/driver/toolchain-provider.ts +12 -45
  182. package/src/driver/toolchain.ts +7 -2
  183. package/src/extensions/catalog.ts +2 -1
  184. package/src/extensions/gui/index.ts +107 -0
  185. package/src/extensions/native.ts +2 -3
  186. package/dist/src/driver/toolchain-download.d.ts +0 -50
  187. package/dist/src/driver/toolchain-download.js +0 -102
  188. package/dist/src/driver/toolchain-download.js.map +0 -1
  189. package/dist/tests/driver/toolchain-download.test.d.ts +0 -1
  190. package/dist/tests/driver/toolchain-download.test.js +0 -53
  191. package/dist/tests/driver/toolchain-download.test.js.map +0 -1
  192. package/dist/tests/e2e/compile.test.d.ts +0 -8
  193. package/dist/tests/e2e/compile.test.js +0 -893
  194. package/dist/tests/e2e/compile.test.js.map +0 -1
  195. package/dist/tests/e2e/differential.test.d.ts +0 -7
  196. package/dist/tests/e2e/differential.test.js.map +0 -1
  197. package/dist/tests/e2e/runtime-coverage.test.d.ts +0 -11
  198. package/dist/tests/e2e/runtime-coverage.test.js +0 -646
  199. package/dist/tests/e2e/runtime-coverage.test.js.map +0 -1
  200. package/scripts/fetch-toolchain.ts +0 -101
  201. package/src/driver/toolchain-download.ts +0 -135
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Runtime-coverage tests for `url`, `os`, `process` and `child_process`.
3
+ */
4
+ import { expect, it } from "vitest";
5
+ import { describeE2E } from "./harness.js";
6
+ const TIMEOUT = 120000;
7
+ describeE2E("runtime coverage: system", (h) => {
8
+ it("converts between file paths and file URLs", () => {
9
+ const source = `
10
+ import { pathToFileURL, fileURLToPath } from "url";
11
+ import url from "url";
12
+
13
+ const u = pathToFileURL("/tmp/a b");
14
+ console.log(u.protocol, u.href.startsWith("file://"), u.href.includes("a b"));
15
+ console.log(fileURLToPath("file:///tmp/a%20b"));
16
+ console.log(fileURLToPath("file://localhost/tmp/c"));
17
+ console.log(fileURLToPath("/tmp/plain"));
18
+ console.log(url.pathToFileURL("/tmp/x").href.startsWith("file://"));
19
+ `;
20
+ const stdout = h.runProgram(source, { extensions: true, timeout: TIMEOUT });
21
+ expect(stdout.split("\n")).toEqual([
22
+ "file: true true",
23
+ "/tmp/a b",
24
+ "/tmp/c",
25
+ "/tmp/plain",
26
+ "true",
27
+ ]);
28
+ });
29
+ it("reads operating-system and process information", () => {
30
+ const source = `
31
+ import os from "os";
32
+ import * as os2 from "node:os";
33
+ import process from "process";
34
+ import * as proc from "node:process";
35
+
36
+ console.log(os.platform().length > 0, os.type().length > 0, os.arch().length > 0, os.endianness().length > 0);
37
+ console.log(os.homedir().length > 0, os.tmpdir().length > 0, os.hostname().length > 0, os.release().length > 0);
38
+ console.log(os.totalmem() > 0, os.freemem() > 0, os.cpus().length > 0, os2.cpus()[0].model.length > 0);
39
+ console.log(os2.platform().length > 0);
40
+ console.log(process.platform.length > 0, process.arch.length > 0, process.pid > 0, process.ppid >= 0, process.version.length > 0);
41
+ console.log(process.cwd().length > 0, process.uptime() >= 0, process.hrtime().length === 2);
42
+ console.log(process.getuid() >= 0, process.argv.length >= 1, Object.keys(process.env).length > 0);
43
+ process.stdout.write("stdout-write\\n");
44
+ process.stderr.write("stderr-write\\n");
45
+ console.log(proc.cwd().length > 0, proc.platform.length > 0, proc.getuid() >= 0);
46
+ `;
47
+ const result = h.runProgramFull(source, { extensions: true, timeout: TIMEOUT });
48
+ expect(result.status).toBe(0);
49
+ expect(result.stdout.trim().split("\n")).toEqual([
50
+ "true true true true",
51
+ "true true true true",
52
+ "true true true true",
53
+ "true",
54
+ "true true true true true",
55
+ "true true true",
56
+ "true true true",
57
+ "stdout-write",
58
+ "true true true",
59
+ ]);
60
+ expect(result.stderr.trim()).toBe("stderr-write");
61
+ });
62
+ it("spawns child processes synchronously", () => {
63
+ const source = `
64
+ import { spawnSync } from "node:child_process";
65
+
66
+ let isChild = false;
67
+ for (const arg of process.argv) {
68
+ if (arg === "xb-child-capture") isChild = true;
69
+ }
70
+ if (isChild) {
71
+ console.log("from-child");
72
+ console.error("child-err");
73
+ console.log("x".repeat(5000));
74
+ } else {
75
+ const r = spawnSync(process.argv[0], ["xb-child-capture"], { encoding: "utf8" });
76
+ console.log("status", r.status, "out", r.stdout.trim().length, "err", r.stderr.trim());
77
+ const missing = spawnSync("definitely-not-a-real-command-xyz", [], {});
78
+ console.log("missing", missing.status !== 0);
79
+ const cd = spawnSync(process.argv[0], ["xb-child-capture"], { cwd: process.cwd() });
80
+ console.log("cwd-status", cd.status);
81
+ }
82
+ `;
83
+ const stdout = h.runProgram(source, { extensions: true, timeout: TIMEOUT });
84
+ expect(stdout.split("\n")).toEqual([
85
+ "status 0 out 5011 err child-err",
86
+ "missing true",
87
+ "cwd-status 0",
88
+ ]);
89
+ });
90
+ }, { tmpPrefix: "xbintsc-runtime-coverage-" });
91
+ //# sourceMappingURL=runtime-coverage-system.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-coverage-system.test.js","sourceRoot":"","sources":["../../../tests/e2e/runtime-coverage-system.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,OAAO,GAAG,MAAM,CAAC;AAEvB,WAAW,CACT,0BAA0B,EAC1B,CAAC,CAAC,EAAE,EAAE;IACJ,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,MAAM,GAAG;;;;;;;;;;OAUd,CAAC;QACF,MAAM,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAC5E,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;YACjC,iBAAiB;YACjB,UAAU;YACV,QAAQ;YACR,YAAY;YACZ,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;OAgBd,CAAC;QACF,MAAM,MAAM,GAAG,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAChF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;YAC/C,qBAAqB;YACrB,qBAAqB;YACrB,qBAAqB;YACrB,MAAM;YACN,0BAA0B;YAC1B,gBAAgB;YAChB,gBAAgB;YAChB,cAAc;YACd,gBAAgB;SACjB,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;OAmBd,CAAC;QACF,MAAM,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAC5E,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;YACjC,iCAAiC;YACjC,cAAc;YACd,cAAc;SACf,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,EACD,EAAE,SAAS,EAAE,2BAA2B,EAAE,CAC3C,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * End-to-end tests for the timer globals (`setTimeout` / `setInterval` and the
3
+ * matching `clear*` functions). They are implemented on the core event loop, so
4
+ * they work without any extension and keep the process alive until no timer is
5
+ * pending.
6
+ */
7
+ export {};
@@ -0,0 +1,63 @@
1
+ /**
2
+ * End-to-end tests for the timer globals (`setTimeout` / `setInterval` and the
3
+ * matching `clear*` functions). They are implemented on the core event loop, so
4
+ * they work without any extension and keep the process alive until no timer is
5
+ * pending.
6
+ */
7
+ import { expect, it } from "vitest";
8
+ import { describeE2E } from "./harness.js";
9
+ import { makeDifferential } from "./differential-helpers.js";
10
+ describeE2E("end-to-end timers", (harness) => {
11
+ const { runProgram } = harness;
12
+ const { diff } = makeDifferential(harness);
13
+ diff("orders timers after synchronous code and microtasks", `const order: string[] = [];
14
+ order.push("sync");
15
+ setTimeout(() => order.push("timeout0"), 0);
16
+ Promise.resolve().then(() => order.push("microtask"));
17
+ setTimeout(() => order.push("timeout5"), 5);
18
+ order.push("sync2");
19
+ setTimeout(() => console.log(order.join(",")), 20);`);
20
+ it("cancels a pending timeout", () => {
21
+ const source = `
22
+ const id = setTimeout(() => console.log("fired"), 10);
23
+ clearTimeout(id);
24
+ setTimeout(() => console.log("done"), 20);
25
+ `;
26
+ expect(runProgram(source)).toBe("done");
27
+ });
28
+ it("repeats an interval until cleared", () => {
29
+ const source = `
30
+ let n = 0;
31
+ const iv = setInterval(() => {
32
+ n++;
33
+ console.log("tick", n);
34
+ if (n === 3) clearInterval(iv);
35
+ }, 1);
36
+ `;
37
+ expect(runProgram(source)).toBe("tick 1\ntick 2\ntick 3");
38
+ });
39
+ it("forwards extra arguments and supports first-class timer functions", () => {
40
+ const source = `
41
+ const schedule = setTimeout;
42
+ schedule((a: number, b: number) => console.log(a + b), 1, 3, 4);
43
+ console.log(typeof setTimeout, typeof clearInterval);
44
+ `;
45
+ expect(runProgram(source)).toBe("function function\n7");
46
+ });
47
+ it("stops an interval when cleared (clearTimeout also accepts an interval id)", () => {
48
+ // A timer can only be *observed* to have stopped by checking that a later
49
+ // window produces no further ticks, so the assertion compares the count at
50
+ // the moment of `clearTimeout` against the count after another 15ms.
51
+ const source = `
52
+ let n = 0;
53
+ const id = setInterval(() => { n++; }, 2);
54
+ setTimeout(() => {
55
+ clearTimeout(id);
56
+ const atClear = n;
57
+ setTimeout(() => console.log("stable", n === atClear), 15);
58
+ }, 5);
59
+ `;
60
+ expect(runProgram(source)).toBe("stable true");
61
+ });
62
+ });
63
+ //# sourceMappingURL=timers.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timers.test.js","sourceRoot":"","sources":["../../../tests/e2e/timers.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,WAAW,CAAC,mBAAmB,EAAE,CAAC,OAAO,EAAE,EAAE;IAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE3C,IAAI,CACF,qDAAqD,EACrD;;;;;;oDAMgD,CACjD,CAAC;IAEF,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,MAAM,GAAG;;;;KAId,CAAC;QACF,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,MAAM,GAAG;;;;;;;KAOd,CAAC;QACF,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,MAAM,GAAG;;;;KAId,CAAC;QACF,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2EAA2E,EAAE,GAAG,EAAE;QACnF,0EAA0E;QAC1E,2EAA2E;QAC3E,qEAAqE;QACrE,MAAM,MAAM,GAAG;;;;;;;;KAQd,CAAC;QACF,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xbintsc",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "description": "xbintsc - a TypeScript binary compiler (TypeScript -> LLVM IR -> native binary)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "build": "tsc -p tsconfig.json",
34
34
  "prepublishOnly": "npm run build",
35
35
  "runtime": "tsx scripts/build-runtime.ts",
36
- "fetch-toolchain": "tsx scripts/fetch-toolchain.ts",
36
+ "gui": "tsx scripts/build-gui.ts",
37
37
  "package-release": "tsx scripts/package-release.ts",
38
38
  "runtime:clean": "node -e \"require('fs').rmSync('build/runtime-obj',{recursive:true,force:true});require('fs').rmSync('runtime/lib',{recursive:true,force:true})\"",
39
39
  "xbintsc": "tsx src/cli/main.ts",