@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,267 @@
1
+ /*
2
+ * QuickJS atom definitions
3
+ *
4
+ * Copyright (c) 2017-2018 Fabrice Bellard
5
+ * Copyright (c) 2017-2018 Charlie Gordon
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
+
26
+ #ifdef DEF
27
+
28
+ /* Note: first atoms are considered as keywords in the parser */
29
+ DEF(null, "null") /* must be first */
30
+ DEF(false, "false")
31
+ DEF(true, "true")
32
+ DEF(if, "if")
33
+ DEF(else, "else")
34
+ DEF(return, "return")
35
+ DEF(var, "var")
36
+ DEF(this, "this")
37
+ DEF(delete, "delete")
38
+ DEF(void, "void")
39
+ DEF(typeof, "typeof")
40
+ DEF(new, "new")
41
+ DEF(in, "in")
42
+ DEF(instanceof, "instanceof")
43
+ DEF(do, "do")
44
+ DEF(while, "while")
45
+ DEF(for, "for")
46
+ DEF(break, "break")
47
+ DEF(continue, "continue")
48
+ DEF(switch, "switch")
49
+ DEF(case, "case")
50
+ DEF(default, "default")
51
+ DEF(throw, "throw")
52
+ DEF(try, "try")
53
+ DEF(catch, "catch")
54
+ DEF(finally, "finally")
55
+ DEF(function, "function")
56
+ DEF(debugger, "debugger")
57
+ DEF(with, "with")
58
+ /* FutureReservedWord */
59
+ DEF(class, "class")
60
+ DEF(const, "const")
61
+ DEF(enum, "enum")
62
+ DEF(export, "export")
63
+ DEF(extends, "extends")
64
+ DEF(import, "import")
65
+ DEF(super, "super")
66
+ /* FutureReservedWords when parsing strict mode code */
67
+ DEF(implements, "implements")
68
+ DEF(interface, "interface")
69
+ DEF(let, "let")
70
+ DEF(package, "package")
71
+ DEF(private, "private")
72
+ DEF(protected, "protected")
73
+ DEF(public, "public")
74
+ DEF(static, "static")
75
+ DEF(yield, "yield")
76
+ DEF(await, "await")
77
+
78
+ /* empty string */
79
+ DEF(empty_string, "")
80
+ /* identifiers */
81
+ DEF(keys, "keys")
82
+ DEF(size, "size")
83
+ DEF(length, "length")
84
+ DEF(message, "message")
85
+ DEF(cause, "cause")
86
+ DEF(errors, "errors")
87
+ DEF(stack, "stack")
88
+ DEF(name, "name")
89
+ DEF(toString, "toString")
90
+ DEF(toLocaleString, "toLocaleString")
91
+ DEF(valueOf, "valueOf")
92
+ DEF(eval, "eval")
93
+ DEF(prototype, "prototype")
94
+ DEF(constructor, "constructor")
95
+ DEF(configurable, "configurable")
96
+ DEF(writable, "writable")
97
+ DEF(enumerable, "enumerable")
98
+ DEF(value, "value")
99
+ DEF(get, "get")
100
+ DEF(set, "set")
101
+ DEF(of, "of")
102
+ DEF(__proto__, "__proto__")
103
+ DEF(undefined, "undefined")
104
+ DEF(number, "number")
105
+ DEF(boolean, "boolean")
106
+ DEF(string, "string")
107
+ DEF(object, "object")
108
+ DEF(symbol, "symbol")
109
+ DEF(integer, "integer")
110
+ DEF(unknown, "unknown")
111
+ DEF(arguments, "arguments")
112
+ DEF(callee, "callee")
113
+ DEF(caller, "caller")
114
+ DEF(_eval_, "<eval>")
115
+ DEF(_ret_, "<ret>")
116
+ DEF(_var_, "<var>")
117
+ DEF(_arg_var_, "<arg_var>")
118
+ DEF(_with_, "<with>")
119
+ DEF(lastIndex, "lastIndex")
120
+ DEF(target, "target")
121
+ DEF(index, "index")
122
+ DEF(input, "input")
123
+ DEF(defineProperties, "defineProperties")
124
+ DEF(apply, "apply")
125
+ DEF(join, "join")
126
+ DEF(concat, "concat")
127
+ DEF(split, "split")
128
+ DEF(construct, "construct")
129
+ DEF(getPrototypeOf, "getPrototypeOf")
130
+ DEF(setPrototypeOf, "setPrototypeOf")
131
+ DEF(isExtensible, "isExtensible")
132
+ DEF(preventExtensions, "preventExtensions")
133
+ DEF(has, "has")
134
+ DEF(deleteProperty, "deleteProperty")
135
+ DEF(defineProperty, "defineProperty")
136
+ DEF(getOwnPropertyDescriptor, "getOwnPropertyDescriptor")
137
+ DEF(ownKeys, "ownKeys")
138
+ DEF(add, "add")
139
+ DEF(done, "done")
140
+ DEF(next, "next")
141
+ DEF(values, "values")
142
+ DEF(source, "source")
143
+ DEF(flags, "flags")
144
+ DEF(global, "global")
145
+ DEF(unicode, "unicode")
146
+ DEF(raw, "raw")
147
+ DEF(new_target, "new.target")
148
+ DEF(this_active_func, "this.active_func")
149
+ DEF(home_object, "<home_object>")
150
+ DEF(computed_field, "<computed_field>")
151
+ DEF(static_computed_field, "<static_computed_field>") /* must come after computed_fields */
152
+ DEF(class_fields_init, "<class_fields_init>")
153
+ DEF(brand, "<brand>")
154
+ DEF(hash_constructor, "#constructor")
155
+ DEF(as, "as")
156
+ DEF(from, "from")
157
+ DEF(fromAsync, "fromAsync")
158
+ DEF(meta, "meta")
159
+ DEF(_default_, "*default*")
160
+ DEF(_star_, "*")
161
+ DEF(Module, "Module")
162
+ DEF(then, "then")
163
+ DEF(resolve, "resolve")
164
+ DEF(reject, "reject")
165
+ DEF(promise, "promise")
166
+ DEF(proxy, "proxy")
167
+ DEF(revoke, "revoke")
168
+ DEF(async, "async")
169
+ DEF(exec, "exec")
170
+ DEF(groups, "groups")
171
+ DEF(indices, "indices")
172
+ DEF(status, "status")
173
+ DEF(reason, "reason")
174
+ DEF(globalThis, "globalThis")
175
+ DEF(bigint, "bigint")
176
+ DEF(not_equal, "not-equal")
177
+ DEF(timed_out, "timed-out")
178
+ DEF(ok, "ok")
179
+ DEF(toJSON, "toJSON")
180
+ DEF(maxByteLength, "maxByteLength")
181
+ DEF(zip, "zip")
182
+ DEF(zipKeyed, "zipKeyed")
183
+ /* class names */
184
+ DEF(Object, "Object")
185
+ DEF(Array, "Array")
186
+ DEF(Error, "Error")
187
+ DEF(Number, "Number")
188
+ DEF(String, "String")
189
+ DEF(Boolean, "Boolean")
190
+ DEF(Symbol, "Symbol")
191
+ DEF(Arguments, "Arguments")
192
+ DEF(Math, "Math")
193
+ DEF(JSON, "JSON")
194
+ DEF(Date, "Date")
195
+ DEF(Function, "Function")
196
+ DEF(GeneratorFunction, "GeneratorFunction")
197
+ DEF(ForInIterator, "ForInIterator")
198
+ DEF(RegExp, "RegExp")
199
+ DEF(ArrayBuffer, "ArrayBuffer")
200
+ DEF(SharedArrayBuffer, "SharedArrayBuffer")
201
+ /* must keep same order as class IDs for typed arrays */
202
+ DEF(Uint8ClampedArray, "Uint8ClampedArray")
203
+ DEF(Int8Array, "Int8Array")
204
+ DEF(Uint8Array, "Uint8Array")
205
+ DEF(Int16Array, "Int16Array")
206
+ DEF(Uint16Array, "Uint16Array")
207
+ DEF(Int32Array, "Int32Array")
208
+ DEF(Uint32Array, "Uint32Array")
209
+ DEF(BigInt64Array, "BigInt64Array")
210
+ DEF(BigUint64Array, "BigUint64Array")
211
+ DEF(Float16Array, "Float16Array")
212
+ DEF(Float32Array, "Float32Array")
213
+ DEF(Float64Array, "Float64Array")
214
+ DEF(DataView, "DataView")
215
+ DEF(BigInt, "BigInt")
216
+ DEF(WeakRef, "WeakRef")
217
+ DEF(FinalizationRegistry, "FinalizationRegistry")
218
+ DEF(Map, "Map")
219
+ DEF(Set, "Set") /* Map + 1 */
220
+ DEF(WeakMap, "WeakMap") /* Map + 2 */
221
+ DEF(WeakSet, "WeakSet") /* Map + 3 */
222
+ DEF(Iterator, "Iterator")
223
+ DEF(IteratorConcat, "Iterator Concat")
224
+ DEF(IteratorHelper, "Iterator Helper")
225
+ DEF(IteratorWrap, "Iterator Wrap")
226
+ DEF(Map_Iterator, "Map Iterator")
227
+ DEF(Set_Iterator, "Set Iterator")
228
+ DEF(Array_Iterator, "Array Iterator")
229
+ DEF(String_Iterator, "String Iterator")
230
+ DEF(RegExp_String_Iterator, "RegExp String Iterator")
231
+ DEF(Generator, "Generator")
232
+ DEF(Proxy, "Proxy")
233
+ DEF(Promise, "Promise")
234
+ DEF(PromiseResolveFunction, "PromiseResolveFunction")
235
+ DEF(PromiseRejectFunction, "PromiseRejectFunction")
236
+ DEF(AsyncFunction, "AsyncFunction")
237
+ DEF(AsyncFunctionResolve, "AsyncFunctionResolve")
238
+ DEF(AsyncFunctionReject, "AsyncFunctionReject")
239
+ DEF(AsyncGeneratorFunction, "AsyncGeneratorFunction")
240
+ DEF(AsyncGenerator, "AsyncGenerator")
241
+ DEF(EvalError, "EvalError")
242
+ DEF(RangeError, "RangeError")
243
+ DEF(ReferenceError, "ReferenceError")
244
+ DEF(SyntaxError, "SyntaxError")
245
+ DEF(TypeError, "TypeError")
246
+ DEF(URIError, "URIError")
247
+ DEF(InternalError, "InternalError")
248
+ DEF(DOMException, "DOMException")
249
+ DEF(CallSite, "CallSite")
250
+ /* private symbols */
251
+ DEF(Private_brand, "<brand>")
252
+ /* symbols */
253
+ DEF(Symbol_toPrimitive, "Symbol.toPrimitive")
254
+ DEF(Symbol_iterator, "Symbol.iterator")
255
+ DEF(Symbol_match, "Symbol.match")
256
+ DEF(Symbol_matchAll, "Symbol.matchAll")
257
+ DEF(Symbol_replace, "Symbol.replace")
258
+ DEF(Symbol_search, "Symbol.search")
259
+ DEF(Symbol_split, "Symbol.split")
260
+ DEF(Symbol_toStringTag, "Symbol.toStringTag")
261
+ DEF(Symbol_isConcatSpreadable, "Symbol.isConcatSpreadable")
262
+ DEF(Symbol_hasInstance, "Symbol.hasInstance")
263
+ DEF(Symbol_species, "Symbol.species")
264
+ DEF(Symbol_unscopables, "Symbol.unscopables")
265
+ DEF(Symbol_asyncIterator, "Symbol.asyncIterator")
266
+
267
+ #endif /* DEF */
@@ -0,0 +1,54 @@
1
+ /*
2
+ * QuickJS C atomics definitions
3
+ *
4
+ * Copyright (c) 2023 Marcin Kolny
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ */
24
+
25
+ #if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__)
26
+ // Use GCC builtins for version < 4.9
27
+ # if((__GNUC__ << 16) + __GNUC_MINOR__ < ((4) << 16) + 9)
28
+ # define GCC_BUILTIN_ATOMICS
29
+ # endif
30
+ #endif
31
+
32
+ #ifdef GCC_BUILTIN_ATOMICS
33
+ #define atomic_fetch_add(obj, arg) \
34
+ __atomic_fetch_add(obj, arg, __ATOMIC_SEQ_CST)
35
+ #define atomic_compare_exchange_strong(obj, expected, desired) \
36
+ __atomic_compare_exchange_n(obj, expected, desired, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
37
+ #define atomic_exchange(obj, desired) \
38
+ __atomic_exchange_n (obj, desired, __ATOMIC_SEQ_CST)
39
+ #define atomic_load(obj) \
40
+ __atomic_load_n(obj, __ATOMIC_SEQ_CST)
41
+ #define atomic_store(obj, desired) \
42
+ __atomic_store_n(obj, desired, __ATOMIC_SEQ_CST)
43
+ #define atomic_fetch_or(obj, arg) \
44
+ __atomic_fetch_or(obj, arg, __ATOMIC_SEQ_CST)
45
+ #define atomic_fetch_xor(obj, arg) \
46
+ __atomic_fetch_xor(obj, arg, __ATOMIC_SEQ_CST)
47
+ #define atomic_fetch_and(obj, arg) \
48
+ __atomic_fetch_and(obj, arg, __ATOMIC_SEQ_CST)
49
+ #define atomic_fetch_sub(obj, arg) \
50
+ __atomic_fetch_sub(obj, arg, __ATOMIC_SEQ_CST)
51
+ #define _Atomic
52
+ #else
53
+ #include <stdatomic.h>
54
+ #endif