@loopdive/js2 0.57.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 (233) hide show
  1. package/CHANGELOG.md +1425 -0
  2. package/LICENSE +189 -0
  3. package/README.md +451 -0
  4. package/dist/checker/index.d.ts +117 -0
  5. package/dist/checker/language-service.d.ts +39 -0
  6. package/dist/checker/node-capability-map.d.ts +63 -0
  7. package/dist/checker/type-mapper.d.ts +84 -0
  8. package/dist/cjs-rewrite.d.ts +19 -0
  9. package/dist/cli.d.ts +2 -0
  10. package/dist/cli.js +363 -0
  11. package/dist/codegen/accessor-driver.d.ts +97 -0
  12. package/dist/codegen/any-helpers.d.ts +72 -0
  13. package/dist/codegen/array-element-typing.d.ts +46 -0
  14. package/dist/codegen/array-holes.d.ts +69 -0
  15. package/dist/codegen/array-methods.d.ts +68 -0
  16. package/dist/codegen/array-object-proto.d.ts +64 -0
  17. package/dist/codegen/array-reduce-fusion.d.ts +31 -0
  18. package/dist/codegen/array-to-primitive.d.ts +28 -0
  19. package/dist/codegen/async-cps.d.ts +239 -0
  20. package/dist/codegen/async-scheduler.d.ts +349 -0
  21. package/dist/codegen/binary-ops.d.ts +78 -0
  22. package/dist/codegen/binding-info.d.ts +31 -0
  23. package/dist/codegen/builtin-scaffold.d.ts +98 -0
  24. package/dist/codegen/builtin-static-globals.d.ts +8 -0
  25. package/dist/codegen/builtin-tags.d.ts +189 -0
  26. package/dist/codegen/case-convert-native.d.ts +12 -0
  27. package/dist/codegen/case-tables.d.ts +4 -0
  28. package/dist/codegen/class-bodies.d.ts +41 -0
  29. package/dist/codegen/class-member-keys.d.ts +33 -0
  30. package/dist/codegen/class-to-primitive.d.ts +39 -0
  31. package/dist/codegen/closed-method-dispatch.d.ts +42 -0
  32. package/dist/codegen/closures.d.ts +285 -0
  33. package/dist/codegen/coercion-engine.d.ts +154 -0
  34. package/dist/codegen/coercion-plan.d.ts +29 -0
  35. package/dist/codegen/context/bodies.d.ts +4 -0
  36. package/dist/codegen/context/create-context.d.ts +4 -0
  37. package/dist/codegen/context/errors.d.ts +39 -0
  38. package/dist/codegen/context/locals.d.ts +69 -0
  39. package/dist/codegen/context/source-pos.d.ts +5 -0
  40. package/dist/codegen/context/speculative.d.ts +95 -0
  41. package/dist/codegen/context/types.d.ts +1936 -0
  42. package/dist/codegen/custom-iterable.d.ts +34 -0
  43. package/dist/codegen/dataview-native.d.ts +51 -0
  44. package/dist/codegen/date-parse-native.d.ts +13 -0
  45. package/dist/codegen/dead-elimination.d.ts +26 -0
  46. package/dist/codegen/declarations.d.ts +147 -0
  47. package/dist/codegen/deno-api.d.ts +11 -0
  48. package/dist/codegen/destructuring-params.d.ts +102 -0
  49. package/dist/codegen/dyn-read.d.ts +26 -0
  50. package/dist/codegen/eval-tiering.d.ts +19 -0
  51. package/dist/codegen/expressions/assignment.d.ts +61 -0
  52. package/dist/codegen/expressions/builtins.d.ts +26 -0
  53. package/dist/codegen/expressions/calls-closures.d.ts +54 -0
  54. package/dist/codegen/expressions/calls-guards.d.ts +49 -0
  55. package/dist/codegen/expressions/calls-optional.d.ts +4 -0
  56. package/dist/codegen/expressions/calls.d.ts +83 -0
  57. package/dist/codegen/expressions/eval-inline.d.ts +24 -0
  58. package/dist/codegen/expressions/extern.d.ts +67 -0
  59. package/dist/codegen/expressions/fnctor-prototype.d.ts +52 -0
  60. package/dist/codegen/expressions/helpers.d.ts +212 -0
  61. package/dist/codegen/expressions/identifiers.d.ts +57 -0
  62. package/dist/codegen/expressions/late-imports.d.ts +81 -0
  63. package/dist/codegen/expressions/logical-ops.d.ts +18 -0
  64. package/dist/codegen/expressions/misc.d.ts +27 -0
  65. package/dist/codegen/expressions/new-super.d.ts +25 -0
  66. package/dist/codegen/expressions/promise-subclass.d.ts +38 -0
  67. package/dist/codegen/expressions/proto-override.d.ts +63 -0
  68. package/dist/codegen/expressions/unary-updates.d.ts +21 -0
  69. package/dist/codegen/expressions/unary.d.ts +6 -0
  70. package/dist/codegen/expressions.d.ts +31 -0
  71. package/dist/codegen/fallback-telemetry.d.ts +53 -0
  72. package/dist/codegen/fixups.d.ts +80 -0
  73. package/dist/codegen/fmod.d.ts +10 -0
  74. package/dist/codegen/fnctor-escape-gate.d.ts +92 -0
  75. package/dist/codegen/function-body.d.ts +52 -0
  76. package/dist/codegen/generators-native.d.ts +92 -0
  77. package/dist/codegen/helpers/body-references-own-this.d.ts +22 -0
  78. package/dist/codegen/helpers/body-uses-arguments.d.ts +12 -0
  79. package/dist/codegen/helpers/is-strict-function.d.ts +52 -0
  80. package/dist/codegen/host-import-allowlist.d.ts +140 -0
  81. package/dist/codegen/index.d.ts +500 -0
  82. package/dist/codegen/ir-tail-call.d.ts +8 -0
  83. package/dist/codegen/iterator-native.d.ts +44 -0
  84. package/dist/codegen/json-codec-native.d.ts +78 -0
  85. package/dist/codegen/json-runtime.d.ts +35 -0
  86. package/dist/codegen/json-standalone.d.ts +25 -0
  87. package/dist/codegen/linear-uint8-analysis.d.ts +46 -0
  88. package/dist/codegen/linear-uint8-arena.d.ts +7 -0
  89. package/dist/codegen/linear-uint8-codegen.d.ts +103 -0
  90. package/dist/codegen/linear-uint8-signatures.d.ts +26 -0
  91. package/dist/codegen/literals.d.ts +115 -0
  92. package/dist/codegen/map-runtime.d.ts +142 -0
  93. package/dist/codegen/math-helpers.d.ts +7 -0
  94. package/dist/codegen/member-get-dispatch.d.ts +42 -0
  95. package/dist/codegen/member-set-dispatch.d.ts +28 -0
  96. package/dist/codegen/native-proto.d.ts +98 -0
  97. package/dist/codegen/native-regex.d.ts +158 -0
  98. package/dist/codegen/native-strings.d.ts +146 -0
  99. package/dist/codegen/new-target.d.ts +30 -0
  100. package/dist/codegen/node-fs-api.d.ts +47 -0
  101. package/dist/codegen/number-format-native.d.ts +9 -0
  102. package/dist/codegen/number-ryu.d.ts +27 -0
  103. package/dist/codegen/object-ops.d.ts +94 -0
  104. package/dist/codegen/object-runtime.d.ts +171 -0
  105. package/dist/codegen/parse-number-native.d.ts +10 -0
  106. package/dist/codegen/peephole.d.ts +6 -0
  107. package/dist/codegen/property-access.d.ts +294 -0
  108. package/dist/codegen/raw-wasi-api.d.ts +13 -0
  109. package/dist/codegen/regex/bytecode.d.ts +140 -0
  110. package/dist/codegen/regex/casefold.d.ts +41 -0
  111. package/dist/codegen/regex/compile.d.ts +51 -0
  112. package/dist/codegen/regex/parse.d.ts +76 -0
  113. package/dist/codegen/regex/unicode.d.ts +42 -0
  114. package/dist/codegen/regex/vm.d.ts +24 -0
  115. package/dist/codegen/regexp-standalone.d.ts +350 -0
  116. package/dist/codegen/registry/error-types.d.ts +38 -0
  117. package/dist/codegen/registry/imports.d.ts +46 -0
  118. package/dist/codegen/registry/types.d.ts +59 -0
  119. package/dist/codegen/set-algebra.d.ts +17 -0
  120. package/dist/codegen/set-runtime.d.ts +74 -0
  121. package/dist/codegen/shared.d.ts +111 -0
  122. package/dist/codegen/stack-balance.d.ts +43 -0
  123. package/dist/codegen/statements/control-flow.d.ts +25 -0
  124. package/dist/codegen/statements/destructuring.d.ts +177 -0
  125. package/dist/codegen/statements/exceptions.d.ts +11 -0
  126. package/dist/codegen/statements/functions.d.ts +1 -0
  127. package/dist/codegen/statements/index.d.ts +1 -0
  128. package/dist/codegen/statements/loops.d.ts +7 -0
  129. package/dist/codegen/statements/nested-declarations.d.ts +78 -0
  130. package/dist/codegen/statements/shared.d.ts +38 -0
  131. package/dist/codegen/statements/tdz.d.ts +43 -0
  132. package/dist/codegen/statements/variables.d.ts +3 -0
  133. package/dist/codegen/statements.d.ts +9 -0
  134. package/dist/codegen/string-builder.d.ts +131 -0
  135. package/dist/codegen/string-ops.d.ts +87 -0
  136. package/dist/codegen/struct-accessor-closure.d.ts +36 -0
  137. package/dist/codegen/symbol-native.d.ts +55 -0
  138. package/dist/codegen/temporal-native.d.ts +8 -0
  139. package/dist/codegen/timsort.d.ts +2 -0
  140. package/dist/codegen/type-coercion.d.ts +123 -0
  141. package/dist/codegen/typeof-delete.d.ts +38 -0
  142. package/dist/codegen/uri-encoding-native.d.ts +33 -0
  143. package/dist/codegen/value-tags.d.ts +74 -0
  144. package/dist/codegen/walk-instructions.d.ts +20 -0
  145. package/dist/codegen/weak-collections-runtime.d.ts +16 -0
  146. package/dist/codegen/with-scope.d.ts +106 -0
  147. package/dist/codegen-linear/c-abi.d.ts +74 -0
  148. package/dist/codegen-linear/context.d.ts +86 -0
  149. package/dist/codegen-linear/index.d.ts +28 -0
  150. package/dist/codegen-linear/layout.d.ts +39 -0
  151. package/dist/codegen-linear/runtime.d.ts +161 -0
  152. package/dist/codegen-linear/simd.d.ts +7 -0
  153. package/dist/compiler/define-substitution.d.ts +27 -0
  154. package/dist/compiler/early-errors/assignment.d.ts +26 -0
  155. package/dist/compiler/early-errors/context.d.ts +17 -0
  156. package/dist/compiler/early-errors/duplicates.d.ts +20 -0
  157. package/dist/compiler/early-errors/index.d.ts +11 -0
  158. package/dist/compiler/early-errors/labels.d.ts +13 -0
  159. package/dist/compiler/early-errors/module-rules.d.ts +36 -0
  160. package/dist/compiler/early-errors/node-checks.d.ts +7 -0
  161. package/dist/compiler/early-errors/predicates.d.ts +140 -0
  162. package/dist/compiler/early-errors/tdz.d.ts +17 -0
  163. package/dist/compiler/import-manifest.d.ts +18 -0
  164. package/dist/compiler/output.d.ts +46 -0
  165. package/dist/compiler/validation.d.ts +45 -0
  166. package/dist/compiler.d.ts +48 -0
  167. package/dist/define-substitution-BcUeKC2A.js +109 -0
  168. package/dist/emit/binary.d.ts +50 -0
  169. package/dist/emit/c-header.d.ts +23 -0
  170. package/dist/emit/canonical-recgroup.d.ts +86 -0
  171. package/dist/emit/encoder.d.ts +28 -0
  172. package/dist/emit/object.d.ts +14 -0
  173. package/dist/emit/opcodes.d.ts +464 -0
  174. package/dist/emit/sourcemap.d.ts +33 -0
  175. package/dist/emit/wat.d.ts +6 -0
  176. package/dist/env.d.ts +46 -0
  177. package/dist/import-resolver.d.ts +68 -0
  178. package/dist/index.d.ts +486 -0
  179. package/dist/index.js +755 -0
  180. package/dist/ir/alloc-registry.d.ts +75 -0
  181. package/dist/ir/analysis/encoding.d.ts +38 -0
  182. package/dist/ir/analysis/escape.d.ts +32 -0
  183. package/dist/ir/analysis/lattice.d.ts +72 -0
  184. package/dist/ir/analysis/ownership.d.ts +31 -0
  185. package/dist/ir/analysis/stack-alloc.d.ts +20 -0
  186. package/dist/ir/backend/bytecode-emitter.d.ts +237 -0
  187. package/dist/ir/backend/bytecode-vm.d.ts +74 -0
  188. package/dist/ir/backend/emitter.d.ts +121 -0
  189. package/dist/ir/backend/handles.d.ts +133 -0
  190. package/dist/ir/backend/legality.d.ts +9 -0
  191. package/dist/ir/backend/linear-emitter.d.ts +41 -0
  192. package/dist/ir/backend/wasmgc-emitter.d.ts +43 -0
  193. package/dist/ir/builder.d.ts +401 -0
  194. package/dist/ir/from-ast.d.ts +192 -0
  195. package/dist/ir/index.d.ts +16 -0
  196. package/dist/ir/integration.d.ts +27 -0
  197. package/dist/ir/lower.d.ts +203 -0
  198. package/dist/ir/nodes.d.ts +1452 -0
  199. package/dist/ir/passes/alloc-discipline.d.ts +19 -0
  200. package/dist/ir/passes/constant-fold.d.ts +7 -0
  201. package/dist/ir/passes/dead-code.d.ts +18 -0
  202. package/dist/ir/passes/inline-small.d.ts +7 -0
  203. package/dist/ir/passes/monomorphize.d.ts +21 -0
  204. package/dist/ir/passes/simplify-cfg.d.ts +19 -0
  205. package/dist/ir/passes/tagged-union-types.d.ts +45 -0
  206. package/dist/ir/passes/tagged-unions.d.ts +22 -0
  207. package/dist/ir/propagate.d.ts +135 -0
  208. package/dist/ir/select.d.ts +81 -0
  209. package/dist/ir/types.d.ts +832 -0
  210. package/dist/ir/verify-alloc.d.ts +18 -0
  211. package/dist/ir/verify.d.ts +7 -0
  212. package/dist/link/index.d.ts +11 -0
  213. package/dist/link/isolation.d.ts +24 -0
  214. package/dist/link/linker.d.ts +37 -0
  215. package/dist/link/reader.d.ts +158 -0
  216. package/dist/link/resolver.d.ts +19 -0
  217. package/dist/optimize.d.ts +54 -0
  218. package/dist/optimize.js +262 -0
  219. package/dist/position-map.d.ts +64 -0
  220. package/dist/process-stdin-prelude.d.ts +16 -0
  221. package/dist/resolve.d.ts +82 -0
  222. package/dist/runtime/builtins.d.ts +1 -0
  223. package/dist/runtime-C-4q_KwU.js +164438 -0
  224. package/dist/runtime-containment.d.ts +6 -0
  225. package/dist/runtime-eval.d.ts +132 -0
  226. package/dist/runtime-instantiate.d.ts +16 -0
  227. package/dist/runtime.d.ts +128 -0
  228. package/dist/runtime.js +12 -0
  229. package/dist/shape-inference.d.ts +20 -0
  230. package/dist/treeshake.d.ts +17 -0
  231. package/dist/ts-api.d.ts +30 -0
  232. package/dist/wit-generator.d.ts +18 -0
  233. package/package.json +187 -0
package/LICENSE ADDED
@@ -0,0 +1,189 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form, made
34
+ available under the License, as indicated by a copyright notice that is included
35
+ in or attached to the work (an example is provided in the Appendix below).
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original version
45
+ of the Work and any modifications or additions to that Work or Derivative Works
46
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
47
+ by the copyright owner or by an individual or Legal Entity authorized to submit
48
+ on behalf of the copyright owner. For the purposes of this definition,
49
+ "submitted" means any form of electronic, verbal, or written communication sent
50
+ to the Licensor or its representatives, including but not limited to
51
+ communication on electronic mailing lists, source code control systems, and
52
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
53
+ the purpose of discussing and improving the Work, but excluding communication
54
+ that is conspicuously marked or otherwise designated in writing by the copyright
55
+ owner as "Not a Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
62
+ License, each Contributor hereby grants to You a perpetual, worldwide,
63
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
64
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
65
+ sublicense, and distribute the Work and such Derivative Works in Source or
66
+ Object form.
67
+
68
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
69
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
70
+ no-charge, royalty-free, irrevocable (except as stated in this section) patent
71
+ license to make, have made, use, offer to sell, sell, import, and otherwise
72
+ transfer the Work, where such license applies only to those patent claims
73
+ licensable by such Contributor that are necessarily infringed by their
74
+ Contribution(s) alone or by combination of their Contribution(s) with the Work
75
+ to which such Contribution(s) was submitted. If You institute patent litigation
76
+ against any entity (including a cross-claim or counterclaim in a lawsuit)
77
+ alleging that the Work or a Contribution incorporated within the Work
78
+ constitutes direct or contributory patent infringement, then any patent licenses
79
+ granted to You under this License for that Work shall terminate as of the date
80
+ such litigation is filed.
81
+
82
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
83
+ Derivative Works thereof in any medium, with or without modifications, and in
84
+ Source or Object form, provided that You meet the following conditions:
85
+
86
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
87
+ this License; and
88
+
89
+ (b) You must cause any modified files to carry prominent notices stating that
90
+ You changed the files; and
91
+
92
+ (c) You must retain, in the Source form of any Derivative Works that You
93
+ distribute, all copyright, patent, trademark, and attribution notices from the
94
+ Source form of the Work, excluding those notices that do not pertain to any part
95
+ of the Derivative Works; and
96
+
97
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
98
+ any Derivative Works that You distribute must include a readable copy of the
99
+ attribution notices contained within such NOTICE file, excluding those notices
100
+ that do not pertain to any part of the Derivative Works, in at least one of the
101
+ following places: within a NOTICE text file distributed as part of the
102
+ Derivative Works; within the Source form or documentation, if provided along
103
+ with the Derivative Works; or, within a display generated by the Derivative
104
+ Works, if and wherever such third-party notices normally appear. The contents of
105
+ the NOTICE file are for informational purposes only and do not modify the
106
+ License. You may add Your own attribution notices within Derivative Works that
107
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
108
+ provided that such additional attribution notices cannot be construed as
109
+ modifying the License.
110
+
111
+ You may add Your own copyright statement to Your modifications and may provide
112
+ additional or different license terms and conditions for use, reproduction, or
113
+ distribution of Your modifications, or for any such Derivative Works as a whole,
114
+ provided Your use, reproduction, and distribution of the Work otherwise complies
115
+ with the conditions stated in this License.
116
+
117
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
118
+ Contribution intentionally submitted for inclusion in the Work by You to the
119
+ Licensor shall be under the terms and conditions of this License, without any
120
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
121
+ supersede or modify the terms of any separate license agreement you may have
122
+ executed with Licensor regarding such Contributions.
123
+
124
+ 6. Trademarks. This License does not grant permission to use the trade names,
125
+ trademarks, service marks, or product names of the Licensor, except as required
126
+ for reasonable and customary use in describing the origin of the Work and
127
+ reproducing the content of the NOTICE file.
128
+
129
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
130
+ writing, Licensor provides the Work (and each Contributor provides its
131
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
132
+ KIND, either express or implied, including, without limitation, any warranties
133
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
134
+ PARTICULAR PURPOSE. You are solely responsible for determining the
135
+ appropriateness of using or redistributing the Work and assume any risks
136
+ associated with Your exercise of permissions under this License.
137
+
138
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
139
+ tort (including negligence), contract, or otherwise, unless required by
140
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
141
+ writing, shall any Contributor be liable to You for damages, including any
142
+ direct, indirect, special, incidental, or consequential damages of any
143
+ character arising as a result of this License or out of the use or inability to
144
+ use the Work (including but not limited to damages for loss of goodwill, work
145
+ stoppage, computer failure or malfunction, or any and all other commercial
146
+ damages or losses), even if such Contributor has been advised of the possibility
147
+ of such damages.
148
+
149
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
150
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
151
+ acceptance of support, warranty, indemnity, or other liability obligations
152
+ and/or rights consistent with this License. However, in accepting such
153
+ obligations, You may act only on Your own behalf and on Your sole
154
+ responsibility, not on behalf of any other Contributor, and only if You agree to
155
+ indemnify, defend, and hold each Contributor harmless for any liability incurred
156
+ by, or claims asserted against, such Contributor by reason of your accepting any
157
+ such warranty or additional liability.
158
+
159
+ END OF TERMS AND CONDITIONS
160
+
161
+ APPENDIX: How to apply the Apache License to your work.
162
+
163
+ To apply the Apache License to your work, attach the following boilerplate
164
+ notice, with the fields enclosed by brackets "[]" replaced with your own
165
+ identifying information. (Don't include the brackets!) The text should be
166
+ enclosed in the appropriate comment syntax for the file format. We also
167
+ recommend that a file or class name and description of purpose be included on
168
+ the same "printed page" as the copyright notice for easier identification within
169
+ third-party archives.
170
+
171
+ Copyright [yyyy] [name of copyright owner]
172
+
173
+ Licensed under the Apache License, Version 2.0 (the "License");
174
+ you may not use this file except in compliance with the License.
175
+ You may obtain a copy of the License at
176
+
177
+ https://www.apache.org/licenses/LICENSE-2.0
178
+
179
+ Unless required by applicable law or agreed to in writing, software distributed
180
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
181
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
182
+ specific language governing permissions and limitations under the License.
183
+
184
+ Exceptions to the Apache 2.0 License
185
+
186
+ As an exception, if, as a result of your compiling your source code, portions of
187
+ this Software are embedded into an Object form of such source code, you may
188
+ redistribute such embedded portions in such Object form without complying with
189
+ the conditions of Sections 4(a), 4(b), and 4(d) of the License.
package/README.md ADDED
@@ -0,0 +1,451 @@
1
+ # js2wasm
2
+
3
+ Direct AOT compilation from JavaScript and TypeScript to WebAssembly GC.
4
+
5
+ > **Status: early-stage research prototype — a tech demo, not a production-ready compiler.**
6
+ > `js2wasm` is an experimental ahead-of-time JavaScript/TypeScript-to-WasmGC compiler under active development. It explores one specific point in the design space: full ECMAScript backwards compatibility via direct AOT compilation, with no JavaScript engine or interpreter bundled into the output. It does **not** claim production readiness, full language coverage, or stable APIs — expect rough edges, gaps, and breaking changes. Live conformance and benchmark figures are in **[STATUS.md](./STATUS.md)** (numbers change frequently and are not duplicated in this README).
7
+
8
+ `js2wasm` compiles source code into WasmGC binaries without embedding a JavaScript interpreter or shipping a bundled runtime. That avoids the runtime tax common in the interpreter-based and engine-embedding approaches — where a JavaScript interpreter or full engine is compiled to Wasm and shipped inside every module — and keeps the output aligned with Wasm-native deployment models.
9
+
10
+ `js2wasm` is a free and open-source project developed by **Loopdive GmbH** and released under the **Apache License 2.0 with LLVM Exceptions**. It is a freely-licensed, open-source technical foundation and reusable building block, developed fully in the open, including its agentic engineering workflow. The repository contains the compiler source, the complete planning surface (`plan/`), and the agent coordination infrastructure (`.claude/`) that a small team uses to ship fixes in parallel.
11
+
12
+ ## Value Proposition
13
+
14
+ Most JavaScript-on-Wasm systems work by putting a JavaScript engine inside a Wasm module. That approach inherits good compatibility, but it also inherits the cost of shipping and initializing the engine.
15
+
16
+ `js2wasm` takes the opposite approach:
17
+
18
+ - **Direct AOT compilation to WasmGC** instead of interpreter bundling
19
+ - **No embedded JS engine** in the deployed module
20
+ - **No bundled interpreter or engine tax** just to execute application code
21
+ - **Wasm-native deployment model** for runtimes, serverless platforms, and embedded hosts
22
+
23
+ This matters for infrastructure workloads where artifact size, cold start, density, and host integration are first-order constraints.
24
+
25
+ It also matters for security boundaries. In browsers, Node.js, and other JavaScript-capable hosts, compiling modules to Wasm introduces an isolation boundary that can limit how much third-party dependencies and user-provided code can affect the surrounding process. That is relevant for supply-chain defense, plugin systems, and multi-tenant execution.
26
+
27
+ ## Why This Architecture
28
+
29
+ `js2wasm` is being built for environments where bundling a JavaScript engine is the wrong tradeoff:
30
+
31
+ - edge and serverless runtimes
32
+ - Wasm-first infrastructure platforms
33
+ - plugin and extension systems
34
+ - embedders that want JavaScript semantics without shipping an interpreter
35
+ - desktop applications that want a lighter and safer alternative to Electron-style runtime bundling
36
+
37
+ That includes practical combinations with hosts like Tauri, where compiler output can be shipped as executable Wasm artifacts instead of bundling a full browser-plus-JS-engine runtime into the application.
38
+
39
+ The current public benchmark and conformance work exists to test an open question: whether direct AOT compilation can become a viable alternative to bundling a runtime for these workloads. That has not been settled yet — it is what the project is investigating.
40
+
41
+ Many alternatives in adjacent spaces solve the problem by narrowing the language instead:
42
+
43
+ - supporting only a constrained subset of TypeScript or JavaScript
44
+ - introducing a new language or dialect that compiles to Wasm more easily
45
+
46
+ `js2wasm` is aimed at a harder target: targeting mainstream JavaScript semantics through direct compilation rather than changing the language model to fit the compiler.
47
+
48
+ Projects in this category usually take years to reach meaningful semantic coverage. A large part of the Loopdive thesis is that an AI-native compiler workflow can compress that timeline substantially without giving up on the harder target.
49
+
50
+ Current Test262 conformance and benchmark numbers are tracked in one place and
51
+ change frequently — see **[STATUS.md](./STATUS.md)** for the live figures, the
52
+ [Playground](https://js2.loopdive.com/playground/), and the
53
+ [Roadmap](./ROADMAP.md). The single auto-updated conformance figure (refreshed
54
+ by CI on every merge) is for the JS-host path; everything else links to
55
+ STATUS.md rather than duplicating numbers that go stale. Standalone
56
+ (no-JS-host) pass-rate and benchmark figures are intentionally omitted from the
57
+ README until the current standalone regression is fixed.
58
+
59
+ <!-- AUTO:conformance-start -->
60
+ **test262 conformance**: 32,456 / 43,135 (75.2 %)
61
+ <!-- AUTO:conformance-end -->
62
+
63
+ ## Current Status
64
+
65
+ `js2wasm` is an early-stage research prototype: an experimental compiler under
66
+ active development, not a production-ready tool. It is being explored as a
67
+ public, in-the-open project, and the conformance story, runtime boundary, and
68
+ standalone path are all still hardening. What exists today:
69
+
70
+ - a JS-hosted compilation path passing a substantial subset of Test262 (see
71
+ [STATUS.md](./STATUS.md) for the current figure)
72
+ - a public browser playground
73
+ - continuous conformance and benchmark reporting on every change
74
+ - a standalone (no-JS-host) path that is in progress; its public numeric
75
+ baselines are paused here until the current regression is fixed
76
+
77
+ Treat it as a tech demo to evaluate the approach, not as something to deploy.
78
+
79
+ ## The AOT JavaScript compilation landscape
80
+
81
+ There are several established ways to get JavaScript running on WebAssembly.
82
+ Each makes a different, reasonable trade-off, and most have years of engineering
83
+ behind them. The point of this map is not to rank them — it is to locate the
84
+ specific gap `js2wasm` is exploring. Described by architecture rather than by
85
+ product:
86
+
87
+ - **Interpreter-based approach** — compile a JavaScript *interpreter* to Wasm
88
+ and run the user's program on top of it. Gets broad ECMAScript compatibility
89
+ more or less for free, because a real interpreter is doing the work. The cost:
90
+ every deployed module ships and initializes the interpreter, which adds size
91
+ and startup overhead and means application code runs interpreted rather than
92
+ compiled.
93
+
94
+ - **Engine-embedding approach** — compile a full production JavaScript *engine*
95
+ to Wasm (optionally specialized per-script, e.g. via partial evaluation).
96
+ Inherits mature, battle-tested engine semantics and very high compatibility.
97
+ The cost: the engine is large, and even when specialized the engine itself is
98
+ still part of what ships.
99
+
100
+ - **Typed JS/TS subset languages** — a statically typed language with
101
+ JavaScript-like or TypeScript-like syntax that compiles ahead of time to
102
+ compact Wasm. Output is small and fast precisely *because* it deliberately
103
+ does **not** accept full ECMAScript: dynamic semantics are excluded by design
104
+ and the type system is the contract. Excellent when you can write to that
105
+ language; not a path to running existing JavaScript unchanged.
106
+
107
+ - **Linear-memory AOT compilers** — compile JavaScript ahead of time to Wasm
108
+ using linear memory, implementing object model, allocation, and (typically) a
109
+ garbage collector inside the module. This shares the "compile, don't embed a
110
+ runtime" goal; the distinguishing axis from `js2wasm` is the lowering target
111
+ (linear memory and a self-managed heap vs. host-managed WasmGC) and, in
112
+ current projects, how much of full ECMAScript compatibility is an explicit
113
+ goal.
114
+
115
+ **Where `js2wasm` sits.** Direct AOT compilation to **WasmGC** (objects,
116
+ closures, and arrays lower to host-managed GC structs/arrays/references), with
117
+ **full ECMAScript backwards compatibility as the explicit goal**, and **no
118
+ JavaScript engine or interpreter bundled into the output**. Where the compiler
119
+ can prove stable types and shapes it lowers them directly; where JavaScript
120
+ stays dynamic it inserts guards, boxed representations, or host fallbacks.
121
+
122
+ The structural observation behind the project is that this *combination* of
123
+ trade-offs is largely unoccupied: the typed-subset languages excluded full
124
+ ECMAScript compatibility on purpose; the linear-memory AOT compilers do not
125
+ currently center it; and the interpreter-based and engine-embedding approaches
126
+ reach compatibility only by shipping a runtime (paying in size and startup).
127
+ Targeting WasmGC + full backwards compatibility + no bundled runtime is a point
128
+ that has not been seriously attempted. `js2wasm` is testing whether it is
129
+ viable — that is an open question, not a settled result, and the honest answer
130
+ today is "we don't know yet."
131
+
132
+ ## Quick Start
133
+
134
+ Install dependencies:
135
+
136
+ ```bash
137
+ pnpm install
138
+ ```
139
+
140
+ Compile a file:
141
+
142
+ ```bash
143
+ npx js2wasm input.ts -o output.wasm
144
+ ```
145
+
146
+ Programmatic API:
147
+
148
+ > **Breaking change (#1757):** `compile()` (and `compileMulti`, `compileFiles`,
149
+ > `compileToWat`, `compileProject`, `createIncrementalCompiler().compile`) now
150
+ > return a `Promise` — `await` them. This lets the optional Binaryen optimizer
151
+ > load lazily only when `optimize` is requested, without forcing standalone
152
+ > bundles to embed Binaryen (GH #986).
153
+
154
+ ```ts
155
+ import { compile } from "js2wasm";
156
+
157
+ const result = await compile(
158
+ `
159
+ export function add(a: number, b: number): number {
160
+ return a + b;
161
+ }
162
+ `,
163
+ { target: "standalone" },
164
+ );
165
+
166
+ if (result.success) {
167
+ // standalone modules have no host imports, so {} is sufficient
168
+ const { instance } = await WebAssembly.instantiate(result.binary, {});
169
+ console.log((instance.exports as any).add(2, 3)); // → 5
170
+ }
171
+ ```
172
+
173
+ Standalone CLI bundle:
174
+
175
+ ```bash
176
+ pnpm run build:standalone-cli -- --minify
177
+ deno compile -A --no-check -o js2wasm dist/js2wasm-standalone.mjs
178
+ # or:
179
+ bun build --compile --target=node --outfile js2wasm dist/js2wasm-standalone.mjs
180
+ ```
181
+
182
+ `build:standalone-cli` creates a relocatable `dist/js2wasm-standalone.mjs`
183
+ bundle for native-executable workflows. Unlike the normal npm library build, it
184
+ bundles the core compiler dependencies and embeds TypeScript's `lib.*.d.ts`
185
+ declarations, so the generated file does not need to remain next to
186
+ `node_modules/typescript/lib` after it is moved or compiled. The `--ts7`
187
+ preview backend and Binaryen optimizer remain development/optimization opt-ins
188
+ and are not bundled into this standalone artifact. If you use `-O` with the
189
+ standalone CLI, install `binaryen` next to the runner or put `wasm-opt` on PATH;
190
+ you can also run `wasm-opt` directly on the emitted `.wasm` afterward.
191
+
192
+ ### Compile modes and imports
193
+
194
+ The imports a module needs depend on the compile target:
195
+
196
+ - **Default (JS-host) mode** (no `target`, or `target: "gc"`) emits runtime
197
+ imports — a `string_constants` module plus `env.*` helpers such as
198
+ `__box_number`, `__extern_get`, and `__throw_reference_error`. These are
199
+ supplied by the js2wasm JS runtime, so instantiating with an empty `{}`
200
+ throws `Import #0 "string_constants": module is not an object or function`.
201
+ Use this mode when you run the output alongside the JS runtime that provides
202
+ those imports. The result carries a ready-to-pass `result.importObject` that
203
+ wires those host helpers for you — pass it straight to
204
+ `WebAssembly.instantiate` with no hand-wiring:
205
+
206
+ ```ts
207
+ const r = await compile(`
208
+ export function add(a: number, b: number): number { return a + b; }
209
+ `);
210
+ const { instance } = await WebAssembly.instantiate(r.binary, r.importObject);
211
+ (instance.exports as any).add(2, 3); // → 5
212
+ ```
213
+ - **Standalone mode** (`target: "standalone"`, also `target: "wasi"`) emits a
214
+ pure WasmGC module with Wasm-native intrinsics and **no host imports**, so it
215
+ instantiates with `WebAssembly.instantiate(binary, {})` and runs anywhere
216
+ WasmGC is available. Prefer this for portable, host-independent output — it is
217
+ what the snippet above uses.
218
+
219
+ Useful local commands:
220
+
221
+ ```bash
222
+ pnpm typecheck
223
+ pnpm lint
224
+ npm test
225
+ pnpm run test:262
226
+ pnpm dev
227
+ ```
228
+
229
+ ## Running compiled output
230
+
231
+ `js2wasm` emits WasmGC modules that use several post-MVP WebAssembly proposals.
232
+ Most are on by default in current engines, but **WasmGC and typed function
233
+ references are not enabled by default in stable Wasmtime**, so a bare
234
+ `wasmtime out.wasm` fails with a validation error until they are turned on.
235
+
236
+ Enable exactly the proposals the compiler emits:
237
+
238
+ ```bash
239
+ wasmtime -W gc=y,function-references=y,tail-call=y,exceptions=y out.wasm
240
+ ```
241
+
242
+ The proposals the compiler actually relies on are:
243
+
244
+ | Proposal | Wasmtime `-W` flag | Why js2wasm needs it |
245
+ | --- | --- | --- |
246
+ | Garbage collection | `gc=y` | objects, arrays, closures lower to GC structs/arrays |
247
+ | Typed function references | `function-references=y` | required by GC; typed `call_ref` for closures |
248
+ | Exception handling | `exceptions=y` | `throw` / `try` / `catch` lowering |
249
+ | Tail calls | `tail-call=y` | `return_call` optimization in tail position |
250
+
251
+ Bulk memory, sign-extension, saturating float-to-int, multi-value, mutable
252
+ globals, and reference types are also emitted but are enabled by default in
253
+ current Wasmtime, so they do not need explicit flags. `js2wasm` deliberately
254
+ avoids the custom-descriptors proposal, which stable Wasmtime does not yet
255
+ accept.
256
+
257
+ **Do not use `-W all-proposals=y`.** It also enables the **stack-switching**
258
+ proposal, which Wasmtime 44/45 does not support in its compiler configuration —
259
+ the runtime then fails at module load with `the wasm_stack_switching feature is
260
+ not supported on this compiler configuration` and exits before running anything,
261
+ regardless of module content (js2wasm output contains zero stack-switching
262
+ opcodes). Stick to the targeted flag set above.
263
+
264
+ **Minimum version:** Wasmtime **44+** (the first release with a stable WasmGC
265
+ implementation). Older versions reject the GC types.
266
+
267
+ Other standalone runtimes: WasmGC support in WAMR and WasmEdge is still
268
+ maturing, so compiled output is not guaranteed to run there yet. Browser hosts
269
+ (Chrome 119+, Firefox 120+) and Node.js 22+ run the JS-host target without extra
270
+ flags.
271
+
272
+ For reading STDIN and writing STDOUT/STDERR from standalone (`--target wasi`)
273
+ output, see [docs/standalone-io.md](./docs/standalone-io.md).
274
+
275
+ ## Current coverage and limitations
276
+
277
+ In a JS host, `js2wasm` passes a substantial subset of Test262 — enough that a
278
+ large, useful slice of the language works — but there are real gaps, and you
279
+ will hit them. The current pass rate lives in [STATUS.md](./STATUS.md) and the
280
+ full [Test262 report](./benchmarks/results/report.html); this section is the
281
+ qualitative high-level shape, and the report is the authoritative per-feature
282
+ detail. Note that Test262 measures conformance to the ECMAScript *language*
283
+ specification — it does not cover Web APIs, Node.js host behavior, or whether an
284
+ arbitrary real-world npm package runs unchanged.
285
+
286
+ **Solid** (broadly works):
287
+
288
+ - arithmetic, comparison, and scalar operations
289
+ - functions, closures, recursion, and most control-flow forms
290
+ - classes, inheritance, methods, and object operations
291
+ - arrays and array methods, destructuring, spread, template literals
292
+ - strings and common string methods
293
+ - `try`/`catch`/`finally` and `throw`
294
+ - `async`/`await`, generators, and iterators
295
+
296
+ **Partial** (works in common cases, with gaps):
297
+
298
+ - standard-library built-ins — many are implemented, but not the full surface;
299
+ some methods are missing or only handle the common overloads
300
+ - `Map`, `Set`, `RegExp`, `JSON` — present but not fully spec-complete
301
+ - standalone (no-JS-host) mode — actively in progress; standalone numeric
302
+ baselines are temporarily omitted here while the current regression is fixed
303
+ - getters/setters and other highly dynamic patterns — limited
304
+
305
+ **Not yet** (intentionally unsupported or out of scope today):
306
+
307
+ - `eval`, `with`, and dynamic `Function` construction
308
+ - `Proxy` and `Reflect`-driven metaprogramming
309
+ - `SharedArrayBuffer` / threads, `WeakRef` / `FinalizationRegistry`, `Temporal`
310
+ - dropping in an arbitrary npm package unchanged
311
+
312
+ If a pattern you rely on does not work, check the [Test262 report](./benchmarks/results/report.html)
313
+ or open an issue. This is an actively developed compiler with a growing
314
+ compatibility baseline and a clear infrastructure target — but it is a research
315
+ prototype, not yet a "drop in any npm package" story.
316
+
317
+ ## FAQ
318
+
319
+ **Why not embed an existing interpreter or engine?**
320
+ That is the interpreter-based / engine-embedding approach, and it is a perfectly
321
+ reasonable way to get compatibility — but every deployed module then ships and
322
+ initializes a runtime, which is exactly the size and startup cost `js2wasm` is
323
+ trying to avoid. The bet here is that *compiling* the code, rather than shipping
324
+ something to run it, is worth pursuing for size- and cold-start-sensitive
325
+ deployments. Whether that bet holds across enough real code is the open
326
+ question.
327
+
328
+ **Isn't the Test262 conformance still incomplete?**
329
+ Yes, and the live figure is in [STATUS.md](./STATUS.md) and the
330
+ [Test262 report](./benchmarks/results/report.html) rather than rounded up here.
331
+ Two caveats matter more than the number: Test262 measures the ECMAScript
332
+ *language* spec, **not** Web APIs, host/Node.js behavior, or whether an arbitrary
333
+ npm package runs unchanged; and standalone (no-JS-host) figures are omitted here
334
+ until the current regression is fixed. A high pass rate is necessary but not
335
+ sufficient for "runs real JavaScript."
336
+
337
+ **Won't you eventually re-implement a JavaScript engine?**
338
+ That is the real risk, treated as an empirical question, not a solved one. The
339
+ design is compiled-code-first: resolve what can be resolved statically and lower
340
+ it directly, with no interpreter on the common paths. The genuinely unstatic
341
+ corners (`eval`, dynamic `Function`) would need a small interpreter fallback that
342
+ runs only on those paths — not a full engine in every module. Whether that
343
+ fallback stays small, and how much real code avoids it, is what the prototype is
344
+ testing. If compatibility turns out to require shipping an engine, that is a
345
+ negative result worth knowing.
346
+
347
+ **Why not extend an existing typed JS/TS subset language?**
348
+ Typed JS/TS subset languages produce small, fast Wasm *because* they deliberately
349
+ exclude full ECMAScript — dynamic semantics are dropped by design and the static
350
+ type system is the contract. Extending one toward full backwards compatibility
351
+ means re-adding the dynamics it was built to avoid. `js2wasm` instead targets
352
+ existing JavaScript semantics directly, so existing code is the input rather than
353
+ a rewrite into a new dialect.
354
+
355
+ **Why WasmGC rather than linear memory?**
356
+ WasmGC gives the compiler host-managed structs, arrays, references, and function
357
+ references, which map onto JavaScript objects, closures, and arrays fairly
358
+ directly and let the host GC manage memory instead of shipping a collector inside
359
+ the module. Linear-memory AOT compilation is a legitimate alternative with its
360
+ own trade-offs (more control, broader runtime support today, but a self-managed
361
+ heap); `js2wasm` keeps a linear-memory backend for WASI-oriented targets, so this
362
+ is a per-target choice rather than a one-way bet. See the
363
+ [ADRs](./docs/adr/README.md) for the reasoning.
364
+
365
+ **What is the realistic timeline to production-ready?**
366
+ Unknown. This is research-stage work, and a firm date would be a guess dressed up
367
+ as a commitment. The viability of the core bet — full ECMAScript backwards
368
+ compatibility, AOT-compiled to WasmGC, no bundled runtime — is still being
369
+ established. The conformance and benchmark trends are public so progress can be
370
+ judged from data. Until they say otherwise, treat it as something to evaluate,
371
+ not to deploy.
372
+
373
+ ## The Methodology
374
+
375
+ Loopdive develops `js2wasm` with an **Automated Agile Team** model. The goal is not novelty for its own sake. The goal is to compress the feedback loop between product intent, compiler implementation, and conformance verification.
376
+
377
+ ### Operating Roles
378
+
379
+ - **Product Owner**: defines goals with the human stakeholder, plans sprints, prioritizes work, and keeps the backlog aligned with the product surface.
380
+ - **Technical Delivery Lead**: orchestrates sprint execution, coordinates task flow, manages merge discipline, and keeps implementation work moving through the pipeline.
381
+ - **Compiler Engineer (AI)**: implements ECMA-262 behavior, compiler pipeline changes, WasmGC lowering, and code generation details.
382
+ - **QA Engineer (Automated)**: runs CI-based conformance and regression feedback loops, especially around Test262 trend tracking and behavioral drift.
383
+ - **Architect (Human / Loopdive)**: owns system design, strategic constraints, runtime boundaries, and platform-facing product decisions.
384
+
385
+ ### Why It Matters
386
+
387
+ This model is a bet that a tight, automated feedback loop lets a small team
388
+ iterate on a hard compatibility target faster than a conventional one would.
389
+ Whether that bet pays off is part of what this prototype is testing.
390
+
391
+ The workflow is optimized for:
392
+
393
+ - short implementation-to-validation cycles
394
+ - continuous spec-aligned compiler iteration
395
+ - rapid backlog triage from conformance data
396
+ - keeping product direction, engineering execution, and QA tightly coupled
397
+
398
+ ### Open Agentic Development
399
+
400
+ The workflow is not hidden behind a consultancy. It is **in this repository**:
401
+
402
+ - `plan/issues/` — architect-written implementation specs for every open and completed work item
403
+ - `plan/log/dependency-graph.md` — current priorities and what's blocked on what
404
+ - `plan/issues/sprints/` — sprint plans and retrospectives
405
+ - `.claude/agents/` — agent role definitions (product owner, architect, developer, scrum master)
406
+ - `.claude/hooks/` — safety scripts (pre-commit gates, path checks)
407
+ - `.claude/skills/` — reusable workflow protocols (test-and-merge, self-merge, harvest-errors)
408
+ - `.claude/memory/` — accumulated feedback and learnings shared across sessions
409
+
410
+ Anyone with a [Claude Code](https://docs.claude.com/claude-code) subscription can clone the repo, spawn a `developer` agent from `.claude/agents/developer.md`, point it at a `status: ready` issue under `plan/issues/sprints/`, and contribute a real fix through the same pipeline the core team uses. See [CONTRIBUTING.md](./CONTRIBUTING.md) for the agentic contribution path.
411
+
412
+ ### How this is built
413
+
414
+ For a long-form, technical account of the agentic development methodology — how the team is structured, how correctness is anchored across multiple test suites, where the decision boundaries between human and agent are drawn, what has gone wrong, and how the methodology has evolved — see [`docs/methodology.md`](./docs/methodology.md).
415
+
416
+ The document is intended for senior engineers who are skeptical but curious. It cites concrete numbers (sprint count, PR count, test262 pass rate), names the failure modes the team has hit, and discusses honest tradeoffs versus a traditional engineering team. It synthesizes the raw planning material in `plan/` for an external reader without contradicting it; if the two ever diverge, `plan/` is the primary source.
417
+
418
+ ## Licensing
419
+
420
+ This repository is licensed under the **Apache License 2.0 with LLVM Exceptions**. See [LICENSE](./LICENSE).
421
+
422
+ - Source code in this repository is available under **Apache-2.0 WITH LLVM-exception**
423
+ - Community contributions are accepted under the contributor terms described in [CONTRIBUTING.md](./CONTRIBUTING.md)
424
+
425
+ ## Testing
426
+
427
+ `js2wasm` validates correctness through three complementary test layers:
428
+
429
+ - **Unit & equivalence tests** — `npm test` (vitest). Targeted regression coverage and JS↔Wasm equivalence assertions. See `tests/equivalence/`.
430
+ - **Test262 conformance** — `pnpm run test:262` runs the official ECMAScript test suite (~48k tests) and reports per-edition / per-path pass rates. CI runs this sharded on every PR; the [report](./benchmarks/results/report.html) is regenerated on each merge.
431
+ - **Differential testing vs V8** — `pnpm run test:diff` (#1203). For each program in `tests/differential/corpus/`, the harness runs Node-V8 directly and the compiled `.wasm` and compares stdout. test262 measures spec compliance; differential testing measures whether real programs actually produce the right answer. CI gates each PR on a delta against `benchmarks/results/diff-test-baseline.json` — no new mismatches allowed. Use `pnpm run test:diff:triage` to bucket mismatches by category for follow-up filing.
432
+
433
+ ## Development
434
+
435
+ Additional contributor workflow details, including CLA terms, are in [CONTRIBUTING.md](./CONTRIBUTING.md).
436
+
437
+ ## Architecture decisions
438
+
439
+ The foundational design choices behind `js2wasm` — why WasmGC instead of linear memory, why AOT instead of an embedded engine, how TypeScript annotations are treated, how closures are lowered — are documented as Architecture Decision Records in [`docs/adr/`](./docs/adr/README.md). Each record states the context, the decision, and the consequences in 200–600 words. Start with [ADR-002 (architectural approach)](./docs/adr/0002-architectural-approach.md) and [ADR-001 (hybrid compilation strategy)](./docs/adr/0001-hybrid-compilation-strategy.md); the rest are sub-decisions within that frame.
440
+
441
+ ## Further Reading
442
+
443
+ - [Playground](https://js2.loopdive.com/playground/)
444
+ - [Roadmap](./ROADMAP.md)
445
+ - [Architecture Decisions](./docs/adr/README.md)
446
+ - [Architecture Notes](./CLAUDE.md)
447
+ - [Contributing](./CONTRIBUTING.md)
448
+
449
+ ## Trademark Disclaimer
450
+
451
+ JavaScript is a trademark or registered trademark of Oracle in the United States and other countries. This project is independent from Oracle and is not endorsed by, sponsored by, or affiliated with Oracle.