lawspec 0.31.0 → 0.31.3

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 (437) hide show
  1. package/CHANGELOG.md +116 -1
  2. package/README.md +86 -4
  3. package/api.mjs +14 -9
  4. package/authoring.mjs +899 -0
  5. package/beam-coverage.mjs +190 -65
  6. package/beam-doctor.mjs +343 -124
  7. package/bin/lawspec.mjs +1955 -657
  8. package/build.json +135 -129
  9. package/component-packages.mjs +662 -176
  10. package/component.d.ts +82 -20
  11. package/component.mjs +317 -94
  12. package/core.wasm +2 -2
  13. package/core_jsffi.js +5 -5
  14. package/doctor.mjs +558 -299
  15. package/examples-command.mjs +44 -23
  16. package/failure-database.mjs +60 -17
  17. package/files.mjs +122 -62
  18. package/index.d.ts +585 -312
  19. package/input-files.mjs +90 -25
  20. package/launcher.mjs +72 -31
  21. package/learn/adapters.mjs +226 -0
  22. package/learn/app.mjs +1279 -0
  23. package/learn/assert.mjs +33 -0
  24. package/learn/assets.mjs +15 -0
  25. package/learn/browser-runtime.mjs +58 -0
  26. package/learn/bundle.mjs +118 -0
  27. package/learn/compile-worker.mjs +106 -0
  28. package/learn/compiler.mjs +230 -0
  29. package/learn/coverage.json +8259 -0
  30. package/learn/curriculum.json +2955 -0
  31. package/learn/fantomas-worker.mjs +25 -0
  32. package/learn/format-worker.mjs +148 -0
  33. package/learn/fsharp.mjs +83 -0
  34. package/learn/harness-host.mjs +22 -0
  35. package/learn/index.html +326 -0
  36. package/learn/lawspec-core.mjs +223 -0
  37. package/learn/lawspec-language.mjs +69 -0
  38. package/learn/node-test.mjs +11 -0
  39. package/learn/presentation.mjs +73 -0
  40. package/learn/runner.mjs +72 -0
  41. package/learn/sandbox-frame.html +34 -0
  42. package/learn/sandbox.mjs +91 -0
  43. package/learn/store.mjs +141 -0
  44. package/learn/story.mjs +42 -0
  45. package/learn/style-options.json +16 -0
  46. package/learn/style.css +1023 -0
  47. package/learn/theme.js +77 -0
  48. package/learn/typescript.mjs +53 -0
  49. package/learn/vendor/@fontsource-atkinson-hyperlegible-LICENSE.txt +93 -0
  50. package/learn/vendor/@fontsource-atkinson-hyperlegible-mono-LICENSE.txt +93 -0
  51. package/learn/vendor/@fontsource-overpass-LICENSE.txt +93 -0
  52. package/learn/vendor/assemblies.json +1 -0
  53. package/learn/vendor/editor-worker.js +30 -0
  54. package/learn/vendor/editor.css +1 -0
  55. package/learn/vendor/editor.mjs +931 -0
  56. package/learn/vendor/esbuild-wasm-LICENSE.txt +21 -0
  57. package/learn/vendor/esbuild.mjs +2683 -0
  58. package/learn/vendor/esbuild.wasm +0 -0
  59. package/learn/vendor/fable-library/Array.js +1347 -0
  60. package/learn/vendor/fable-library/Async.js +134 -0
  61. package/learn/vendor/fable-library/AsyncBuilder.js +183 -0
  62. package/learn/vendor/fable-library/BigInt.js +306 -0
  63. package/learn/vendor/fable-library/BitConverter.js +138 -0
  64. package/learn/vendor/fable-library/Boolean.js +22 -0
  65. package/learn/vendor/fable-library/CHANGELOG.md +242 -0
  66. package/learn/vendor/fable-library/Char.js +202 -0
  67. package/learn/vendor/fable-library/Choice.js +184 -0
  68. package/learn/vendor/fable-library/CollectionUtil.js +182 -0
  69. package/learn/vendor/fable-library/ConditionalWeakTable.js +21 -0
  70. package/learn/vendor/fable-library/Date.js +841 -0
  71. package/learn/vendor/fable-library/DateOffset.js +261 -0
  72. package/learn/vendor/fable-library/DateOnly.js +124 -0
  73. package/learn/vendor/fable-library/Decimal.js +238 -0
  74. package/learn/vendor/fable-library/Double.js +47 -0
  75. package/learn/vendor/fable-library/Encoding.js +185 -0
  76. package/learn/vendor/fable-library/Event.js +93 -0
  77. package/learn/vendor/fable-library/FSharp.Collections.js +45 -0
  78. package/learn/vendor/fable-library/FSharp.Core.CompilerServices.js +27 -0
  79. package/learn/vendor/fable-library/FSharp.Core.js +156 -0
  80. package/learn/vendor/fable-library/Global.js +29 -0
  81. package/learn/vendor/fable-library/Guid.js +161 -0
  82. package/learn/vendor/fable-library/Int32.js +135 -0
  83. package/learn/vendor/fable-library/List.js +1323 -0
  84. package/learn/vendor/fable-library/Long.js +47 -0
  85. package/learn/vendor/fable-library/MailboxProcessor.js +94 -0
  86. package/learn/vendor/fable-library/Map.js +1396 -0
  87. package/learn/vendor/fable-library/MapUtil.js +130 -0
  88. package/learn/vendor/fable-library/MutableMap.js +339 -0
  89. package/learn/vendor/fable-library/MutableSet.js +233 -0
  90. package/learn/vendor/fable-library/Native.js +14 -0
  91. package/learn/vendor/fable-library/Numeric.js +75 -0
  92. package/learn/vendor/fable-library/Observable.js +113 -0
  93. package/learn/vendor/fable-library/Option.js +104 -0
  94. package/learn/vendor/fable-library/README.md +3 -0
  95. package/learn/vendor/fable-library/Random.js +172 -0
  96. package/learn/vendor/fable-library/Range.js +45 -0
  97. package/learn/vendor/fable-library/Reflection.js +479 -0
  98. package/learn/vendor/fable-library/RegExp.js +141 -0
  99. package/learn/vendor/fable-library/Result.js +165 -0
  100. package/learn/vendor/fable-library/Seq.js +1417 -0
  101. package/learn/vendor/fable-library/Seq2.js +111 -0
  102. package/learn/vendor/fable-library/Set.js +1816 -0
  103. package/learn/vendor/fable-library/String.js +674 -0
  104. package/learn/vendor/fable-library/System.Collections.Generic.js +333 -0
  105. package/learn/vendor/fable-library/System.Text.js +200 -0
  106. package/learn/vendor/fable-library/System.js +289 -0
  107. package/learn/vendor/fable-library/TimeOnly.js +122 -0
  108. package/learn/vendor/fable-library/TimeSpan.js +180 -0
  109. package/learn/vendor/fable-library/Timer.js +67 -0
  110. package/learn/vendor/fable-library/Types.js +198 -0
  111. package/learn/vendor/fable-library/Unicode.13.0.0.js +4 -0
  112. package/learn/vendor/fable-library/Uri.js +165 -0
  113. package/learn/vendor/fable-library/Util.js +796 -0
  114. package/learn/vendor/fable-library/big.d.ts +338 -0
  115. package/learn/vendor/fable-library/lib/big.js +825 -0
  116. package/learn/vendor/fable-library/package.json +24 -0
  117. package/learn/vendor/fable-library/quotation.js +618 -0
  118. package/learn/vendor/fable.js +430 -0
  119. package/learn/vendor/fantomas/FSharp.Core.uawo19tl4c.wasm +0 -0
  120. package/learn/vendor/fantomas/Fantomas.Core.stnanlnpyw.wasm +0 -0
  121. package/learn/vendor/fantomas/Fantomas.FCS.lqohfu5o9y.wasm +0 -0
  122. package/learn/vendor/fantomas/LawSpec.Learn.Formatter.poiijdbsl9.wasm +0 -0
  123. package/learn/vendor/fantomas/Microsoft.CSharp.mp8lhr6rez.wasm +0 -0
  124. package/learn/vendor/fantomas/Microsoft.VisualBasic.0e5fchkecn.wasm +0 -0
  125. package/learn/vendor/fantomas/Microsoft.VisualBasic.Core.17wn27qal2.wasm +0 -0
  126. package/learn/vendor/fantomas/Microsoft.Win32.Primitives.9d566sle9e.wasm +0 -0
  127. package/learn/vendor/fantomas/Microsoft.Win32.Registry.52dy96yk8i.wasm +0 -0
  128. package/learn/vendor/fantomas/System.AppContext.jwujeh069z.wasm +0 -0
  129. package/learn/vendor/fantomas/System.Buffers.y0isk1x97h.wasm +0 -0
  130. package/learn/vendor/fantomas/System.Collections.Concurrent.x5koi7bzem.wasm +0 -0
  131. package/learn/vendor/fantomas/System.Collections.Immutable.diwg7advch.wasm +0 -0
  132. package/learn/vendor/fantomas/System.Collections.NonGeneric.4089xs440e.wasm +0 -0
  133. package/learn/vendor/fantomas/System.Collections.Specialized.hj81u7zblb.wasm +0 -0
  134. package/learn/vendor/fantomas/System.Collections.nvrdeoknr1.wasm +0 -0
  135. package/learn/vendor/fantomas/System.ComponentModel.Annotations.yatcnfjeuk.wasm +0 -0
  136. package/learn/vendor/fantomas/System.ComponentModel.DataAnnotations.led9l5awu3.wasm +0 -0
  137. package/learn/vendor/fantomas/System.ComponentModel.EventBasedAsync.hpvp6cf4de.wasm +0 -0
  138. package/learn/vendor/fantomas/System.ComponentModel.Primitives.v7cajwpaqo.wasm +0 -0
  139. package/learn/vendor/fantomas/System.ComponentModel.TypeConverter.xk1hnyt762.wasm +0 -0
  140. package/learn/vendor/fantomas/System.ComponentModel.rrnda1lucx.wasm +0 -0
  141. package/learn/vendor/fantomas/System.Configuration.bn9vghjcq8.wasm +0 -0
  142. package/learn/vendor/fantomas/System.Console.09ajpiafhz.wasm +0 -0
  143. package/learn/vendor/fantomas/System.Core.wc649o5mw9.wasm +0 -0
  144. package/learn/vendor/fantomas/System.Data.Common.s4cowzd9a9.wasm +0 -0
  145. package/learn/vendor/fantomas/System.Data.DataSetExtensions.5fm360ikxl.wasm +0 -0
  146. package/learn/vendor/fantomas/System.Data.fsu4j4t4jw.wasm +0 -0
  147. package/learn/vendor/fantomas/System.Diagnostics.Contracts.p74re5oxzn.wasm +0 -0
  148. package/learn/vendor/fantomas/System.Diagnostics.Debug.622sixg49n.wasm +0 -0
  149. package/learn/vendor/fantomas/System.Diagnostics.DiagnosticSource.2j35bc2g2b.wasm +0 -0
  150. package/learn/vendor/fantomas/System.Diagnostics.FileVersionInfo.7n0wdvltaa.wasm +0 -0
  151. package/learn/vendor/fantomas/System.Diagnostics.Process.8iffh49mew.wasm +0 -0
  152. package/learn/vendor/fantomas/System.Diagnostics.StackTrace.1yz88vico8.wasm +0 -0
  153. package/learn/vendor/fantomas/System.Diagnostics.TextWriterTraceListener.ua8iuh2vhj.wasm +0 -0
  154. package/learn/vendor/fantomas/System.Diagnostics.Tools.roy5445ugj.wasm +0 -0
  155. package/learn/vendor/fantomas/System.Diagnostics.TraceSource.6qx1ldzz7g.wasm +0 -0
  156. package/learn/vendor/fantomas/System.Diagnostics.Tracing.b4799zpaas.wasm +0 -0
  157. package/learn/vendor/fantomas/System.Drawing.8gcjjqj0pu.wasm +0 -0
  158. package/learn/vendor/fantomas/System.Drawing.Primitives.y2uveru2yk.wasm +0 -0
  159. package/learn/vendor/fantomas/System.Dynamic.Runtime.023zrvzh9x.wasm +0 -0
  160. package/learn/vendor/fantomas/System.Formats.Asn1.znpklkbgqv.wasm +0 -0
  161. package/learn/vendor/fantomas/System.Formats.Tar.5yybjepfi2.wasm +0 -0
  162. package/learn/vendor/fantomas/System.Globalization.Calendars.10g6hyjy3k.wasm +0 -0
  163. package/learn/vendor/fantomas/System.Globalization.Extensions.hrinfrismg.wasm +0 -0
  164. package/learn/vendor/fantomas/System.Globalization.uvs4rah8fk.wasm +0 -0
  165. package/learn/vendor/fantomas/System.IO.4j645gw40d.wasm +0 -0
  166. package/learn/vendor/fantomas/System.IO.Compression.2z7vdt6tfb.wasm +0 -0
  167. package/learn/vendor/fantomas/System.IO.Compression.Brotli.fv80xs79j3.wasm +0 -0
  168. package/learn/vendor/fantomas/System.IO.Compression.FileSystem.88jdddz3sw.wasm +0 -0
  169. package/learn/vendor/fantomas/System.IO.Compression.ZipFile.jkn9avr4vo.wasm +0 -0
  170. package/learn/vendor/fantomas/System.IO.FileSystem.AccessControl.yme0uhbu37.wasm +0 -0
  171. package/learn/vendor/fantomas/System.IO.FileSystem.DriveInfo.qas7wf73rs.wasm +0 -0
  172. package/learn/vendor/fantomas/System.IO.FileSystem.Primitives.d1jmhkzu0e.wasm +0 -0
  173. package/learn/vendor/fantomas/System.IO.FileSystem.Watcher.z570derp0d.wasm +0 -0
  174. package/learn/vendor/fantomas/System.IO.FileSystem.o6jtz51fup.wasm +0 -0
  175. package/learn/vendor/fantomas/System.IO.IsolatedStorage.hqyeyb5ipe.wasm +0 -0
  176. package/learn/vendor/fantomas/System.IO.MemoryMappedFiles.zhamjnusxd.wasm +0 -0
  177. package/learn/vendor/fantomas/System.IO.Pipelines.wrmw5vws31.wasm +0 -0
  178. package/learn/vendor/fantomas/System.IO.Pipes.AccessControl.qcancj8gj2.wasm +0 -0
  179. package/learn/vendor/fantomas/System.IO.Pipes.zhcyguvwkr.wasm +0 -0
  180. package/learn/vendor/fantomas/System.IO.UnmanagedMemoryStream.o8cpjnlard.wasm +0 -0
  181. package/learn/vendor/fantomas/System.Linq.AsyncEnumerable.hyc0b7okjw.wasm +0 -0
  182. package/learn/vendor/fantomas/System.Linq.Expressions.ldibvm0efj.wasm +0 -0
  183. package/learn/vendor/fantomas/System.Linq.Parallel.2buevezvch.wasm +0 -0
  184. package/learn/vendor/fantomas/System.Linq.Queryable.cvq43g1awj.wasm +0 -0
  185. package/learn/vendor/fantomas/System.Linq.lz6mvi0hm2.wasm +0 -0
  186. package/learn/vendor/fantomas/System.Memory.3jekerw0ga.wasm +0 -0
  187. package/learn/vendor/fantomas/System.Net.Http.Json.8k237kkwec.wasm +0 -0
  188. package/learn/vendor/fantomas/System.Net.Http.cityx2bvcl.wasm +0 -0
  189. package/learn/vendor/fantomas/System.Net.HttpListener.s1jreclykx.wasm +0 -0
  190. package/learn/vendor/fantomas/System.Net.Mail.cmlj4c0gto.wasm +0 -0
  191. package/learn/vendor/fantomas/System.Net.NameResolution.q3gf18q13l.wasm +0 -0
  192. package/learn/vendor/fantomas/System.Net.NetworkInformation.xaz5tjw7d0.wasm +0 -0
  193. package/learn/vendor/fantomas/System.Net.Ping.a40atim1h0.wasm +0 -0
  194. package/learn/vendor/fantomas/System.Net.Primitives.i88i20r8sr.wasm +0 -0
  195. package/learn/vendor/fantomas/System.Net.Quic.hx06eo5xkj.wasm +0 -0
  196. package/learn/vendor/fantomas/System.Net.Requests.hkjxlfe5f5.wasm +0 -0
  197. package/learn/vendor/fantomas/System.Net.Security.ch34yya69o.wasm +0 -0
  198. package/learn/vendor/fantomas/System.Net.ServerSentEvents.0u7o0jk3p1.wasm +0 -0
  199. package/learn/vendor/fantomas/System.Net.ServicePoint.xbhxnytx4l.wasm +0 -0
  200. package/learn/vendor/fantomas/System.Net.Sockets.hzgzlvkc9l.wasm +0 -0
  201. package/learn/vendor/fantomas/System.Net.WebClient.84i8nwzbgu.wasm +0 -0
  202. package/learn/vendor/fantomas/System.Net.WebHeaderCollection.326nl7s9g3.wasm +0 -0
  203. package/learn/vendor/fantomas/System.Net.WebProxy.oq3mgkkqef.wasm +0 -0
  204. package/learn/vendor/fantomas/System.Net.WebSockets.2cx1v74vg8.wasm +0 -0
  205. package/learn/vendor/fantomas/System.Net.WebSockets.Client.rafzkktw8j.wasm +0 -0
  206. package/learn/vendor/fantomas/System.Net.w1hpj3bo6r.wasm +0 -0
  207. package/learn/vendor/fantomas/System.Numerics.Vectors.oyv7biw9ux.wasm +0 -0
  208. package/learn/vendor/fantomas/System.Numerics.lyu36wqn19.wasm +0 -0
  209. package/learn/vendor/fantomas/System.ObjectModel.kxu80demuu.wasm +0 -0
  210. package/learn/vendor/fantomas/System.Private.CoreLib.1vy46s12u6.wasm +0 -0
  211. package/learn/vendor/fantomas/System.Private.DataContractSerialization.ao8k9iu77a.wasm +0 -0
  212. package/learn/vendor/fantomas/System.Private.Uri.itn0n2zjd0.wasm +0 -0
  213. package/learn/vendor/fantomas/System.Private.Xml.19nzpxrx8w.wasm +0 -0
  214. package/learn/vendor/fantomas/System.Private.Xml.Linq.tw5eq1hjvo.wasm +0 -0
  215. package/learn/vendor/fantomas/System.Reflection.DispatchProxy.7lajnj8s8c.wasm +0 -0
  216. package/learn/vendor/fantomas/System.Reflection.Emit.7liz9zln06.wasm +0 -0
  217. package/learn/vendor/fantomas/System.Reflection.Emit.ILGeneration.1ut3qgacw8.wasm +0 -0
  218. package/learn/vendor/fantomas/System.Reflection.Emit.Lightweight.d0gvllb1jj.wasm +0 -0
  219. package/learn/vendor/fantomas/System.Reflection.Extensions.zr5bhwfczd.wasm +0 -0
  220. package/learn/vendor/fantomas/System.Reflection.Metadata.ff6np6mz2j.wasm +0 -0
  221. package/learn/vendor/fantomas/System.Reflection.Primitives.igpmvwv78c.wasm +0 -0
  222. package/learn/vendor/fantomas/System.Reflection.TypeExtensions.qouojzlnp9.wasm +0 -0
  223. package/learn/vendor/fantomas/System.Reflection.mk3jyxvh13.wasm +0 -0
  224. package/learn/vendor/fantomas/System.Resources.Reader.41ppfyz2vc.wasm +0 -0
  225. package/learn/vendor/fantomas/System.Resources.ResourceManager.sfwvfmw1ea.wasm +0 -0
  226. package/learn/vendor/fantomas/System.Resources.Writer.3uvs9tp38z.wasm +0 -0
  227. package/learn/vendor/fantomas/System.Runtime.CompilerServices.Unsafe.puz1xm53oc.wasm +0 -0
  228. package/learn/vendor/fantomas/System.Runtime.CompilerServices.VisualC.9qdau315py.wasm +0 -0
  229. package/learn/vendor/fantomas/System.Runtime.Extensions.i7gntui96b.wasm +0 -0
  230. package/learn/vendor/fantomas/System.Runtime.Handles.00oxj4o6ov.wasm +0 -0
  231. package/learn/vendor/fantomas/System.Runtime.InteropServices.JavaScript.9kq1vofond.wasm +0 -0
  232. package/learn/vendor/fantomas/System.Runtime.InteropServices.RuntimeInformation.my7qeqbhfh.wasm +0 -0
  233. package/learn/vendor/fantomas/System.Runtime.InteropServices.vqp80tnwc7.wasm +0 -0
  234. package/learn/vendor/fantomas/System.Runtime.Intrinsics.u0samjybfo.wasm +0 -0
  235. package/learn/vendor/fantomas/System.Runtime.Loader.n6zxw1b98a.wasm +0 -0
  236. package/learn/vendor/fantomas/System.Runtime.Numerics.o40sjhz59x.wasm +0 -0
  237. package/learn/vendor/fantomas/System.Runtime.Serialization.Formatters.1esvva4te3.wasm +0 -0
  238. package/learn/vendor/fantomas/System.Runtime.Serialization.Json.4n7u09advh.wasm +0 -0
  239. package/learn/vendor/fantomas/System.Runtime.Serialization.Primitives.xs2bo91wvk.wasm +0 -0
  240. package/learn/vendor/fantomas/System.Runtime.Serialization.Xml.ny21jmziti.wasm +0 -0
  241. package/learn/vendor/fantomas/System.Runtime.Serialization.qcxaur5wqs.wasm +0 -0
  242. package/learn/vendor/fantomas/System.Runtime.odq454d6j9.wasm +0 -0
  243. package/learn/vendor/fantomas/System.Security.AccessControl.8yfnzmqzaq.wasm +0 -0
  244. package/learn/vendor/fantomas/System.Security.Claims.8ogy0860de.wasm +0 -0
  245. package/learn/vendor/fantomas/System.Security.Cryptography.Algorithms.8zijp1svfw.wasm +0 -0
  246. package/learn/vendor/fantomas/System.Security.Cryptography.Cng.yxagtt77no.wasm +0 -0
  247. package/learn/vendor/fantomas/System.Security.Cryptography.Csp.uhfbvvau84.wasm +0 -0
  248. package/learn/vendor/fantomas/System.Security.Cryptography.Encoding.2ywrusvy8q.wasm +0 -0
  249. package/learn/vendor/fantomas/System.Security.Cryptography.OpenSsl.oa268u7i92.wasm +0 -0
  250. package/learn/vendor/fantomas/System.Security.Cryptography.Primitives.5uhvqe8puk.wasm +0 -0
  251. package/learn/vendor/fantomas/System.Security.Cryptography.X509Certificates.6i7pxilopt.wasm +0 -0
  252. package/learn/vendor/fantomas/System.Security.Cryptography.d0quqk1iyr.wasm +0 -0
  253. package/learn/vendor/fantomas/System.Security.Principal.Windows.gpqua4rz29.wasm +0 -0
  254. package/learn/vendor/fantomas/System.Security.Principal.i20kfklf3g.wasm +0 -0
  255. package/learn/vendor/fantomas/System.Security.SecureString.x2y8tzci3c.wasm +0 -0
  256. package/learn/vendor/fantomas/System.Security.e83vvh6sl2.wasm +0 -0
  257. package/learn/vendor/fantomas/System.ServiceModel.Web.poglliv2no.wasm +0 -0
  258. package/learn/vendor/fantomas/System.ServiceProcess.yro5uj2opo.wasm +0 -0
  259. package/learn/vendor/fantomas/System.Text.Encoding.CodePages.2wchx40i7z.wasm +0 -0
  260. package/learn/vendor/fantomas/System.Text.Encoding.Extensions.8utaw61kn5.wasm +0 -0
  261. package/learn/vendor/fantomas/System.Text.Encoding.cxdyfepnpj.wasm +0 -0
  262. package/learn/vendor/fantomas/System.Text.Encodings.Web.37ehbi7cye.wasm +0 -0
  263. package/learn/vendor/fantomas/System.Text.Json.ixiaa8hd3h.wasm +0 -0
  264. package/learn/vendor/fantomas/System.Text.RegularExpressions.2fhfmkk6vf.wasm +0 -0
  265. package/learn/vendor/fantomas/System.Threading.6pry74a050.wasm +0 -0
  266. package/learn/vendor/fantomas/System.Threading.AccessControl.76zfdfy8go.wasm +0 -0
  267. package/learn/vendor/fantomas/System.Threading.Channels.gpxnr01lmp.wasm +0 -0
  268. package/learn/vendor/fantomas/System.Threading.Overlapped.aqpl8tzdyc.wasm +0 -0
  269. package/learn/vendor/fantomas/System.Threading.Tasks.Dataflow.ytwttt7fzh.wasm +0 -0
  270. package/learn/vendor/fantomas/System.Threading.Tasks.Extensions.0deavcb00v.wasm +0 -0
  271. package/learn/vendor/fantomas/System.Threading.Tasks.Parallel.tjwtxugso0.wasm +0 -0
  272. package/learn/vendor/fantomas/System.Threading.Tasks.fu4qd5h3qy.wasm +0 -0
  273. package/learn/vendor/fantomas/System.Threading.Thread.klaua2by9m.wasm +0 -0
  274. package/learn/vendor/fantomas/System.Threading.ThreadPool.mkzm212njz.wasm +0 -0
  275. package/learn/vendor/fantomas/System.Threading.Timer.yp49llu5h2.wasm +0 -0
  276. package/learn/vendor/fantomas/System.Transactions.Local.vz6cgeh4w7.wasm +0 -0
  277. package/learn/vendor/fantomas/System.Transactions.ipwm3rsy66.wasm +0 -0
  278. package/learn/vendor/fantomas/System.ValueTuple.7ol6ljuhx8.wasm +0 -0
  279. package/learn/vendor/fantomas/System.Web.HttpUtility.itlvncjd96.wasm +0 -0
  280. package/learn/vendor/fantomas/System.Web.np8uzzakvl.wasm +0 -0
  281. package/learn/vendor/fantomas/System.Windows.18nzio44t3.wasm +0 -0
  282. package/learn/vendor/fantomas/System.Xml.45jprtg1pa.wasm +0 -0
  283. package/learn/vendor/fantomas/System.Xml.Linq.v9v8udncm1.wasm +0 -0
  284. package/learn/vendor/fantomas/System.Xml.ReaderWriter.a9mr08uzci.wasm +0 -0
  285. package/learn/vendor/fantomas/System.Xml.Serialization.03juoguwgc.wasm +0 -0
  286. package/learn/vendor/fantomas/System.Xml.XDocument.c9dhjnzqjb.wasm +0 -0
  287. package/learn/vendor/fantomas/System.Xml.XPath.XDocument.138b12i1pm.wasm +0 -0
  288. package/learn/vendor/fantomas/System.Xml.XPath.pvxm9341ce.wasm +0 -0
  289. package/learn/vendor/fantomas/System.Xml.XmlDocument.450wsyxvl0.wasm +0 -0
  290. package/learn/vendor/fantomas/System.Xml.XmlSerializer.y3t2n0tce7.wasm +0 -0
  291. package/learn/vendor/fantomas/System.gjriafnqmz.wasm +0 -0
  292. package/learn/vendor/fantomas/WindowsBase.8zsce9qxfb.wasm +0 -0
  293. package/learn/vendor/fantomas/cs/FSharp.Core.resources.9ehmavdel7.wasm +0 -0
  294. package/learn/vendor/fantomas/de/FSharp.Core.resources.2ofmxloa01.wasm +0 -0
  295. package/learn/vendor/fantomas/dotnet.js +1233 -0
  296. package/learn/vendor/fantomas/dotnet.native.b6l13xorvf.js +16 -0
  297. package/learn/vendor/fantomas/dotnet.native.rw4kynp763.wasm +0 -0
  298. package/learn/vendor/fantomas/dotnet.runtime.v06hirbjsv.js +4 -0
  299. package/learn/vendor/fantomas/es/FSharp.Core.resources.hkr5ggb4tr.wasm +0 -0
  300. package/learn/vendor/fantomas/fr/FSharp.Core.resources.43soen28ow.wasm +0 -0
  301. package/learn/vendor/fantomas/icudt_CJK.tjcz0u77k5.dat +0 -0
  302. package/learn/vendor/fantomas/icudt_EFIGS.tptq2av103.dat +0 -0
  303. package/learn/vendor/fantomas/icudt_no_CJK.lfu7j35m59.dat +0 -0
  304. package/learn/vendor/fantomas/it/FSharp.Core.resources.m60n5ls7oq.wasm +0 -0
  305. package/learn/vendor/fantomas/ja/FSharp.Core.resources.o6oof69v14.wasm +0 -0
  306. package/learn/vendor/fantomas/ko/FSharp.Core.resources.q6l4snlu9o.wasm +0 -0
  307. package/learn/vendor/fantomas/mscorlib.8ptuc08eli.wasm +0 -0
  308. package/learn/vendor/fantomas/netstandard.eymp85mooh.wasm +0 -0
  309. package/learn/vendor/fantomas/pl/FSharp.Core.resources.8bni0w6j8b.wasm +0 -0
  310. package/learn/vendor/fantomas/pt-BR/FSharp.Core.resources.k849vqm41u.wasm +0 -0
  311. package/learn/vendor/fantomas/ru/FSharp.Core.resources.jz9rhhtsla.wasm +0 -0
  312. package/learn/vendor/fantomas/tr/FSharp.Core.resources.wn6vbvjm1u.wasm +0 -0
  313. package/learn/vendor/fantomas/zh-Hans/FSharp.Core.resources.z7zzbso094.wasm +0 -0
  314. package/learn/vendor/fantomas/zh-Hant/FSharp.Core.resources.iammfsi7ls.wasm +0 -0
  315. package/learn/vendor/fast-check-LICENSE.txt +21 -0
  316. package/learn/vendor/fast-check.mjs +37 -0
  317. package/learn/vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
  318. package/learn/vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
  319. package/learn/vendor/fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2 +0 -0
  320. package/learn/vendor/fonts/overpass-latin-600-normal.woff2 +0 -0
  321. package/learn/vendor/fonts/overpass-latin-700-normal.woff2 +0 -0
  322. package/learn/vendor/formatter-licenses/DotNet-LICENSE.txt +23 -0
  323. package/learn/vendor/formatter-licenses/DotNet-THIRD-PARTY-NOTICES.txt +1418 -0
  324. package/learn/vendor/formatter-licenses/FSharp-LICENSE.txt +23 -0
  325. package/learn/vendor/formatter-licenses/Fantomas-LICENSE.txt +202 -0
  326. package/learn/vendor/formatter-licenses/README.md +12 -0
  327. package/learn/vendor/manifest.json +1354 -0
  328. package/learn/vendor/metadata/Browser.Blob.dll +0 -0
  329. package/learn/vendor/metadata/Browser.Dom.dll +0 -0
  330. package/learn/vendor/metadata/Browser.Event.dll +0 -0
  331. package/learn/vendor/metadata/Browser.Gamepad.dll +0 -0
  332. package/learn/vendor/metadata/Browser.WebGL.dll +0 -0
  333. package/learn/vendor/metadata/Browser.WebStorage.dll +0 -0
  334. package/learn/vendor/metadata/FSharp.Core.dll +0 -0
  335. package/learn/vendor/metadata/Fable.Core.dll +0 -0
  336. package/learn/vendor/metadata/Fable.Repl.Lib.dll +0 -0
  337. package/learn/vendor/metadata/System.Collections.Concurrent.dll +0 -0
  338. package/learn/vendor/metadata/System.Collections.dll +0 -0
  339. package/learn/vendor/metadata/System.ComponentModel.Primitives.dll +0 -0
  340. package/learn/vendor/metadata/System.ComponentModel.TypeConverter.dll +0 -0
  341. package/learn/vendor/metadata/System.ComponentModel.dll +0 -0
  342. package/learn/vendor/metadata/System.Console.dll +0 -0
  343. package/learn/vendor/metadata/System.Core.dll +0 -0
  344. package/learn/vendor/metadata/System.Diagnostics.Debug.dll +0 -0
  345. package/learn/vendor/metadata/System.Diagnostics.Tools.dll +0 -0
  346. package/learn/vendor/metadata/System.Diagnostics.Tracing.dll +0 -0
  347. package/learn/vendor/metadata/System.Globalization.dll +0 -0
  348. package/learn/vendor/metadata/System.IO.dll +0 -0
  349. package/learn/vendor/metadata/System.Net.Requests.dll +0 -0
  350. package/learn/vendor/metadata/System.Net.WebClient.dll +0 -0
  351. package/learn/vendor/metadata/System.Numerics.dll +0 -0
  352. package/learn/vendor/metadata/System.Reflection.Extensions.dll +0 -0
  353. package/learn/vendor/metadata/System.Reflection.Metadata.dll +0 -0
  354. package/learn/vendor/metadata/System.Reflection.Primitives.dll +0 -0
  355. package/learn/vendor/metadata/System.Reflection.TypeExtensions.dll +0 -0
  356. package/learn/vendor/metadata/System.Reflection.dll +0 -0
  357. package/learn/vendor/metadata/System.Runtime.Extensions.dll +0 -0
  358. package/learn/vendor/metadata/System.Runtime.InteropServices.dll +0 -0
  359. package/learn/vendor/metadata/System.Runtime.Numerics.dll +0 -0
  360. package/learn/vendor/metadata/System.Runtime.dll +0 -0
  361. package/learn/vendor/metadata/System.Text.Encoding.Extensions.dll +0 -0
  362. package/learn/vendor/metadata/System.Text.Encoding.dll +0 -0
  363. package/learn/vendor/metadata/System.Text.RegularExpressions.dll +0 -0
  364. package/learn/vendor/metadata/System.Threading.Tasks.dll +0 -0
  365. package/learn/vendor/metadata/System.Threading.Thread.dll +0 -0
  366. package/learn/vendor/metadata/System.Threading.dll +0 -0
  367. package/learn/vendor/metadata/System.ValueTuple.dll +0 -0
  368. package/learn/vendor/metadata/System.dll +0 -0
  369. package/learn/vendor/metadata/mscorlib.dll +0 -0
  370. package/learn/vendor/metadata/netstandard.dll +0 -0
  371. package/learn/vendor/monaco-editor-LICENSE.txt +21 -0
  372. package/learn/vendor/prettier/babel.mjs +16 -0
  373. package/learn/vendor/prettier/brace-style.mjs +376 -0
  374. package/learn/vendor/prettier/estree.mjs +44 -0
  375. package/learn/vendor/prettier/standalone.mjs +29 -0
  376. package/learn/vendor/prettier/typescript.mjs +22 -0
  377. package/learn/vendor/prettier-LICENSE.txt +7 -0
  378. package/learn/vendor/prettier-plugin-brace-style-LICENSE.txt +21 -0
  379. package/learn/vendor/typescript-LICENSE.txt +55 -0
  380. package/learn/vendor/typescript-libs.json +1 -0
  381. package/learn/vendor/typescript.mjs +451 -0
  382. package/learn/vendor/zod-LICENSE.txt +21 -0
  383. package/learn/web-format.mjs +8 -0
  384. package/learn.mjs +126 -0
  385. package/lsp.mjs +444 -133
  386. package/mcp.mjs +250 -0
  387. package/native-evidence.mjs +668 -182
  388. package/native-examples.mjs +56 -19
  389. package/native-host.mjs +136 -42
  390. package/native-parsers/clojure.LICENSE +121 -0
  391. package/native-parsers/clojure.wasm +0 -0
  392. package/native-parsers/csharp.LICENSE +21 -0
  393. package/native-parsers/csharp.wasm +0 -0
  394. package/native-parsers/elixir.LICENSE +176 -0
  395. package/native-parsers/elixir.wasm +0 -0
  396. package/native-parsers/erlang.LICENSE +201 -0
  397. package/native-parsers/erlang.wasm +0 -0
  398. package/native-parsers/fsharp.LICENSE +21 -0
  399. package/native-parsers/fsharp.wasm +0 -0
  400. package/native-parsers/gleam.LICENSE +202 -0
  401. package/native-parsers/gleam.wasm +0 -0
  402. package/native-parsers/go.LICENSE +21 -0
  403. package/native-parsers/go.wasm +0 -0
  404. package/native-parsers/groovy.LICENSE +21 -0
  405. package/native-parsers/groovy.wasm +0 -0
  406. package/native-parsers/haskell.LICENSE +21 -0
  407. package/native-parsers/haskell.wasm +0 -0
  408. package/native-parsers/java.LICENSE +21 -0
  409. package/native-parsers/java.wasm +0 -0
  410. package/native-parsers/javascript.LICENSE +21 -0
  411. package/native-parsers/javascript.wasm +0 -0
  412. package/native-parsers/kotlin.LICENSE +9 -0
  413. package/native-parsers/kotlin.wasm +0 -0
  414. package/native-parsers/lock.json +114 -0
  415. package/native-parsers/prolog.LICENSE +21 -0
  416. package/native-parsers/prolog.wasm +0 -0
  417. package/native-parsers/python.LICENSE +21 -0
  418. package/native-parsers/python.wasm +0 -0
  419. package/native-parsers/rust.LICENSE +21 -0
  420. package/native-parsers/rust.wasm +0 -0
  421. package/native-parsers/scala.LICENSE +21 -0
  422. package/native-parsers/scala.wasm +0 -0
  423. package/native-parsers/swift.LICENSE +21 -0
  424. package/native-parsers/swift.wasm +0 -0
  425. package/native-parsers/typescript.LICENSE +21 -0
  426. package/native-parsers/typescript.wasm +0 -0
  427. package/node-events-reporter.mjs +41 -17
  428. package/package.json +5 -3
  429. package/project.mjs +338 -0
  430. package/proof.d.ts +93 -19
  431. package/proof.mjs +1538 -447
  432. package/read-only-hpack.mjs +6 -5
  433. package/scala-build-state.mjs +131 -41
  434. package/scala-coverage.mjs +57 -34
  435. package/scalars.mjs +23 -8
  436. package/templates.mjs +566 -617
  437. package/test-command.mjs +1671 -521
@@ -0,0 +1,223 @@
1
+ // The LawSpec compiler in the browser. core.wasm and core_jsffi.js sit beside
2
+ // this module. The compiler core is pure: it reads no files and needs no
3
+ // clock beyond startup, so a minimal WASI preview1 shim suffices.
4
+
5
+ // GHC's JSFFI reactor reads these WASI arguments during initialization. Bound
6
+ // the heap below wasm32's address ceiling and compact the oldest generation
7
+ // in place instead of reserving a second copy near that ceiling.
8
+ // -with-rtsopts has no effect on this -no-hs-main reactor build.
9
+ const coreArguments = ['lawspec', '+RTS', '-M3584m', '-c', '-RTS'];
10
+
11
+ // Instantiate the compiler core with a platform's WASI preview1 imports and
12
+ // serialize calls: the core handles one JSON request at a time.
13
+ async function instantiateCore(module, wasiImports, initialize)
14
+ {
15
+ const exports = {};
16
+ const jsffi = (await import('./core_jsffi.js')).default;
17
+ const instance = await WebAssembly.instantiate(module, {
18
+ wasi_snapshot_preview1: wasiImports,
19
+ ghc_wasm_jsffi: jsffi(exports),
20
+ });
21
+ Object.assign(exports, instance.exports);
22
+ initialize(instance);
23
+ let pending = Promise.resolve();
24
+ return input =>
25
+ {
26
+ const result = pending.then(async () =>
27
+ JSON.parse(await instance.exports.lawspec_call(JSON.stringify(input))),
28
+ );
29
+ // The queue needs completion only, not the previous generated project DTO.
30
+ pending = result.then(
31
+ () =>
32
+ {},
33
+ () =>
34
+ {},
35
+ );
36
+ return result;
37
+ };
38
+ }
39
+
40
+ const ERRNO_SUCCESS = 0;
41
+ const ERRNO_BADF = 8;
42
+ const ERRNO_NOENT = 44;
43
+ const ERRNO_NOSYS = 52;
44
+
45
+ class ExitError extends Error
46
+ {
47
+ constructor(code)
48
+ {
49
+ super(`LawSpec core exited with status ${code}`);
50
+ this.code = code;
51
+ }
52
+ }
53
+
54
+ // Arguments and environment are fixed; standard output and error go to the
55
+ // console; there are no preopened directories, so every path fails.
56
+ function wasiImports(memory)
57
+ {
58
+ const view = () => new DataView(memory().buffer);
59
+ const bytes = () => new Uint8Array(memory().buffer);
60
+ const encoder = new TextEncoder();
61
+ const args = coreArguments.map(a => encoder.encode(a + '\0'));
62
+ const environment = [];
63
+ const strings = list => ({
64
+ sizes(countOut, sizeOut)
65
+ {
66
+ view().setUint32(countOut, list.length, true);
67
+ view().setUint32(
68
+ sizeOut,
69
+ list.reduce((n, s) => n + s.length, 0),
70
+ true,
71
+ );
72
+ return ERRNO_SUCCESS;
73
+ },
74
+ get(pointers, buffer)
75
+ {
76
+ let offset = buffer;
77
+ list.forEach((s, i) =>
78
+ {
79
+ view().setUint32(pointers + 4 * i, offset, true);
80
+ bytes().set(s, offset);
81
+ offset += s.length;
82
+ });
83
+ return ERRNO_SUCCESS;
84
+ },
85
+ });
86
+ const argv = strings(args);
87
+ const environ = strings(environment);
88
+ const decoders = {1: new TextDecoder(), 2: new TextDecoder()};
89
+ const lines = {1: '', 2: ''};
90
+ const known = {
91
+ args_sizes_get: argv.sizes,
92
+ args_get: argv.get,
93
+ environ_sizes_get: environ.sizes,
94
+ environ_get: environ.get,
95
+ clock_time_get(_id, _precision, out)
96
+ {
97
+ const nanoseconds =
98
+ BigInt(Math.round(performance.now() * 1e6)) +
99
+ 1_700_000_000_000_000_000n;
100
+ view().setBigUint64(out, nanoseconds, true);
101
+ return ERRNO_SUCCESS;
102
+ },
103
+ clock_res_get(_id, out)
104
+ {
105
+ view().setBigUint64(out, 1000n, true);
106
+ return ERRNO_SUCCESS;
107
+ },
108
+ random_get(buffer, length)
109
+ {
110
+ crypto.getRandomValues(bytes().subarray(buffer, buffer + length));
111
+ return ERRNO_SUCCESS;
112
+ },
113
+ fd_write(fd, iovs, count, writtenOut)
114
+ {
115
+ if (fd !== 1 && fd !== 2) return ERRNO_BADF;
116
+ let written = 0;
117
+ for (let i = 0; i < count; i++)
118
+ {
119
+ const pointer = view().getUint32(iovs + 8 * i, true);
120
+ const length = view().getUint32(iovs + 8 * i + 4, true);
121
+ lines[fd] += decoders[fd].decode(
122
+ bytes().subarray(pointer, pointer + length),
123
+ {stream: true},
124
+ );
125
+ written += length;
126
+ }
127
+ const parts = lines[fd].split('\n');
128
+ lines[fd] = parts.pop();
129
+ for (const line of parts) (fd === 1 ? console.log : console.error)(line);
130
+ view().setUint32(writtenOut, written, true);
131
+ return ERRNO_SUCCESS;
132
+ },
133
+ fd_fdstat_get(fd, out)
134
+ {
135
+ if (fd > 2) return ERRNO_BADF;
136
+ bytes().fill(0, out, out + 24);
137
+ view().setUint8(out, 2); // character device
138
+ return ERRNO_SUCCESS;
139
+ },
140
+ fd_prestat_get: () => ERRNO_BADF,
141
+ fd_close: () => ERRNO_SUCCESS,
142
+ proc_exit(code)
143
+ {
144
+ throw new ExitError(code);
145
+ },
146
+ sched_yield: () => ERRNO_SUCCESS,
147
+ };
148
+ return new Proxy(known, {
149
+ get(target, name)
150
+ {
151
+ if (name in target) return target[name];
152
+ if (typeof name === 'string' && name.startsWith('path_'))
153
+ return () => ERRNO_NOENT;
154
+ return () => ERRNO_NOSYS;
155
+ },
156
+ });
157
+ }
158
+
159
+ let compiled;
160
+
161
+ // Learn packages the same compiler with gzip so static hosts can accept it.
162
+ // A .gz asset has no Content-Encoding header: decompress explicitly before WASM.
163
+ async function fetchCompiler(url)
164
+ {
165
+ const response = await fetch(url);
166
+ if (!response.ok) throw new Error(`Cannot load ${url}: ${response.status}`);
167
+ return String(url).split('?')[0].endsWith('.gz')
168
+ ? new Response(response.body.pipeThrough(new DecompressionStream('gzip')), {
169
+ headers: {'Content-Type': 'application/wasm'},
170
+ })
171
+ : response;
172
+ }
173
+
174
+ // url: where core.wasm is served; defaults to beside this module.
175
+ export async function loadCore(
176
+ url = new URL('./core.wasm.gz', import.meta.url),
177
+ )
178
+ {
179
+ compiled ??= (async () =>
180
+ {
181
+ const response = await fetchCompiler(url);
182
+ return WebAssembly.compileStreaming
183
+ ? WebAssembly.compileStreaming(response).catch(async () =>
184
+ WebAssembly.compile(await (await fetchCompiler(url)).arrayBuffer()),
185
+ )
186
+ : WebAssembly.compile(await response.arrayBuffer());
187
+ })();
188
+ const module = await compiled;
189
+ let memory;
190
+ // Imports are fixed up front by name; the memory is known once instantiated.
191
+ const imports = {};
192
+ for (const entry of WebAssembly.Module.imports(module))
193
+ if (entry.module === 'wasi_snapshot_preview1')
194
+ imports[entry.name] = (...args) => shim[entry.name](...args);
195
+ const shim = wasiImports(() => memory);
196
+ return instantiateCore(module, imports, instance =>
197
+ {
198
+ memory = instance.exports.memory;
199
+ instance.exports._initialize();
200
+ });
201
+ }
202
+
203
+ export async function createCompiler(url)
204
+ {
205
+ const call = await loadCore(url);
206
+ const request = method => input =>
207
+ call({
208
+ schemaVersion:
209
+ input.languageProfile === '1.0-rc.2'
210
+ ? 5
211
+ : input.nativeBindings === undefined
212
+ ? 3
213
+ : 4,
214
+ ...input,
215
+ method,
216
+ });
217
+ return {
218
+ format: request('format'),
219
+ check: request('check'),
220
+ expand: request('expand'),
221
+ planGeneration: request('planGeneration'),
222
+ };
223
+ }
@@ -0,0 +1,69 @@
1
+ // Public token patterns come from the maintained VS Code grammar at build time.
2
+ // The state machine handles comments and quoted/phrase literals before words.
3
+ /** Highlight LawSpec using the maintained grammar vocabulary and stateful literal handling in Monaco. ref:DEC-learn-course-preview */
4
+ export function registerLawspec(monaco, patterns)
5
+ {
6
+ monaco.languages.register({
7
+ id: 'lawspec',
8
+ extensions: ['.lawspec'],
9
+ aliases: ['LawSpec'],
10
+ });
11
+ monaco.languages.setLanguageConfiguration('lawspec', {
12
+ comments: {lineComment: '--'},
13
+ brackets: [
14
+ ['(', ')'],
15
+ ['[', ']'],
16
+ ['{', '}'],
17
+ ],
18
+ autoClosingPairs: [
19
+ {open: '(', close: ')'},
20
+ {open: '[', close: ']'},
21
+ {open: '{', close: '}'},
22
+ {open: '"|', close: '|', notIn: ['string', 'comment']},
23
+ ],
24
+ });
25
+ monaco.languages.setMonarchTokensProvider('lawspec', {
26
+ unicode: true,
27
+ defaultToken: '',
28
+ tokenPostfix: '.lawspec',
29
+ tokenizer: {
30
+ root: [
31
+ [/--.*$/, 'comment'],
32
+ [/"\|/, 'type.identifier', '@phrase'],
33
+ [/`\|/, 'type.identifier', '@phrase'],
34
+ [/"""/, 'string', '@triple'],
35
+ [/"/, 'string', '@string'],
36
+ [/`[^`\n]*`/, 'type.identifier'],
37
+ ...patterns.map(([pattern, token]) => [
38
+ new RegExp(pattern, 'u'),
39
+ token,
40
+ ]),
41
+ [/\b(?:true|false|Absent|Present|Nil|Cons|Left|Right)\b/, 'constant'],
42
+ [
43
+ /[-+]?(?:0x[\da-fA-F]+|0b[01]+|\d+(?:\.\d+)?(?:[eE][-+]?\d+)?)(?:us|ms|min|s|h|d)?\b/,
44
+ 'number',
45
+ ],
46
+ [/[\p{L}_][\p{L}\p{N}_.]*/u, 'identifier'],
47
+ [/::|->|=>|>=|<=|<>|&&|\|\||[=+*/<>!|&?.:-]/, 'operator'],
48
+ [/[{}()[\]]/, '@brackets'],
49
+ [/[,;]/, 'delimiter'],
50
+ ],
51
+ string: [
52
+ [/\\./, 'string.escape'],
53
+ [/"/, 'string', '@pop'],
54
+ [/[^"\\]+/, 'string'],
55
+ ],
56
+ triple: [
57
+ [/"""/, 'string', '@pop'],
58
+ [/[^"\\]+/, 'string'],
59
+ [/\\./, 'string.escape'],
60
+ [/"/, 'string'],
61
+ ],
62
+ phrase: [
63
+ [/\\./, 'string.escape'],
64
+ [/\|/, 'type.identifier', '@pop'],
65
+ [/[^|\\]+/, 'type.identifier'],
66
+ ],
67
+ },
68
+ });
69
+ }
@@ -0,0 +1,11 @@
1
+ // The part of node:test that generated LawSpec tests use, collecting tests
2
+ // for the page's runner.
3
+ const registered = (globalThis.__lawspecTests ??= []);
4
+ export function test(name, options, fn)
5
+ {
6
+ registered.push({
7
+ name: String(name),
8
+ fn: typeof options === 'function' ? options : fn,
9
+ });
10
+ }
11
+ export default test;
@@ -0,0 +1,73 @@
1
+ /** Render a compiler-provided law label without its phrase delimiters. ref:DEC-learn-english-names */
2
+ export function lawLabel(name)
3
+ {
4
+ return name.startsWith('|') && name.endsWith('|')
5
+ ? name.slice(1, -1).replace(/\\([|\\])/g, '$1')
6
+ : name;
7
+ }
8
+ /** Match executed checks to authoritative compiler metadata; retain raw identities separately. ref:DEC-learn-novice-results */
9
+ export function describeCheck(name, checks = [])
10
+ {
11
+ const check = checks
12
+ .filter(row => name === row.name || name.startsWith(row.name + ' '))
13
+ .sort((a, b) => b.name.length - a.name.length)[0];
14
+ if (!check)
15
+ {
16
+ return {label: name, kind: 'Check'};
17
+ }
18
+ return {
19
+ label: check.label,
20
+ kind: name.endsWith(' property')
21
+ ? 'Generated trials'
22
+ : check.quantified
23
+ ? 'Boundary inputs'
24
+ : 'Specific inputs',
25
+ };
26
+ }
27
+ /** Count actual fast-check trials separately from named properties and accepted shrinking steps. ref:DEC-learn-novice-results */
28
+ export function runSummary(result, elapsed)
29
+ {
30
+ const parts = [
31
+ `${result.tests.length} ${result.tests.length === 1 ? 'check' : 'checks'}`,
32
+ ];
33
+ if (result.properties.length)
34
+ {
35
+ const trials = result.properties.reduce(
36
+ (count, row) => count + row.numRuns,
37
+ 0,
38
+ );
39
+ const shrinks = result.properties.reduce(
40
+ (count, row) => count + row.numShrinks,
41
+ 0,
42
+ );
43
+ parts.push(
44
+ `${result.properties.length} sampled ${result.properties.length === 1 ? 'property' : 'properties'}`,
45
+ `${trials} generated trials`,
46
+ );
47
+ if (shrinks)
48
+ {
49
+ parts.push(`${shrinks} smaller failing cases kept`);
50
+ }
51
+ }
52
+ parts.push(`${Math.round(elapsed)} ms`);
53
+ return parts.join(' · ');
54
+ }
55
+ /** Show observed calls in the selected implementation language, respecting tuple versus list inputs. ref:DEC-learn-novice-results */
56
+ export function observedCall(binding, call, language)
57
+ {
58
+ const values = binding.inputs.length > 1 ? call.input : [call.input];
59
+ const literal = value =>
60
+ Array.isArray(value)
61
+ ? '[' + value.map(literal).join(language === 'fsharp' ? '; ' : ', ') + ']'
62
+ : String(value);
63
+ const args = values.map(value =>
64
+ language === 'fsharp' && typeof value === 'number' && value < 0
65
+ ? '(' + value + ')'
66
+ : literal(value),
67
+ );
68
+ const invocation =
69
+ language === 'fsharp'
70
+ ? binding.name + ' ' + args.join(' ')
71
+ : binding.name + '(' + args.join(', ') + ')';
72
+ return invocation + ' → ' + literal(call.output);
73
+ }
@@ -0,0 +1,72 @@
1
+ // All behaviour tests come from LawSpec's generated JavaScript harness.
2
+ /** Run the selected generated LawSpec checks and return their actual observations and replay information. ref:DEC-learn-tests-in-lawspec */
3
+ export function runnerEntry({
4
+ testFiles,
5
+ seed,
6
+ path = '',
7
+ replayTest = null,
8
+ mode,
9
+ propertyMetadata = {},
10
+ })
11
+ {
12
+ return `import {details,coverage,beginTest,namedCalls} from './run-support.mjs';
13
+ ${testFiles.map(file => `import ${JSON.stringify('./' + file)};`).join('\n')}
14
+ (async()=>{try{
15
+ globalThis.process={env:{LAWSPEC_SEED:${JSON.stringify(String(seed))},LAWSPEC_STATS:'/browser-stats'}};
16
+ globalThis.__lessonPropertyMetadata=${JSON.stringify(propertyMetadata)};globalThis.__lessonSeed=${seed};globalThis.__lessonReplay=${JSON.stringify({path, test: replayTest})};
17
+ const result={tests:[],properties:details,coverage,seed:${seed},mode:${JSON.stringify(mode)},harnessReports:(globalThis.__harnessReports??=[])};
18
+ const selected=(globalThis.__lawspecTests??[]).filter(row=>${JSON.stringify(mode)}==='sample'?row.name.endsWith(' property'):${JSON.stringify(mode)}==='examples'?!row.name.endsWith(' property')&&!row.name.endsWith(' replay'):true).filter(row=>!${JSON.stringify(replayTest)}||row.name===${JSON.stringify(replayTest)});
19
+ if(!selected.length)throw new Error('Missing LawSpec checks for this execution mode. Add a concrete law or a quantified property.');
20
+ for(const {name,options,fn}of selected){
21
+ beginTest(name);
22
+ if(options?.skip){result.tests.push({name,ok:false,status:'unsupported',error:String(options.skip)});continue;}
23
+ try{await fn();result.tests.push({name,ok:true,status:'passed',calls:[...namedCalls]});}catch(error){result.tests.push({name,ok:false,status:error.code==='LEARN_UNSUPPORTED_HOST'?'unsupported':/incomplete|unknown/i.test(error.message)?'incomplete':'failed',error:String(error.message),calls:[...namedCalls]});}
24
+ }
25
+ result.sampled=details.find(row=>row.status!=='passed')??details[0]??null;
26
+ result.samples=result.sampled?.observations?.slice(0,8).map(row=>row.input)??[];
27
+ result.ok=result.tests.every(row=>row.ok)&&details.every(row=>row.status==='passed');
28
+ postMessage({result});
29
+ }catch(error){postMessage({error:String(error?.stack??error)});}})();`;
30
+ }
31
+ /** Observe native fast-check properties without rewriting their assertions, arbitraries, shrinkers or evidence status. ref:DEC-learn-tests-in-lawspec */
32
+ export const supportSource = `import fc from 'fast-check-original';
33
+ export const details=[];
34
+ export const namedCalls=[];
35
+ export const coverage={evaluations:0,empty:0,zero:0,negative:0,duplicates:0};
36
+ let testName='',currentCase;
37
+ const observations=new WeakMap();
38
+ export function beginTest(name){testName=name;namedCalls.length=0;}
39
+ function plain(value){
40
+ if(typeof value==='bigint'){const number=Number(value);return Number.isSafeInteger(number)?number:value.toString();}
41
+ if(value===null||typeof value!=='object')return value;
42
+ if(Array.isArray(value))return value.map(plain);
43
+ if(value instanceof Map)return Object.fromEntries([...value].map(([key,item])=>[String(key),plain(item)]));
44
+ return Object.fromEntries(Object.entries(value).map(([key,item])=>[key,plain(item)]));
45
+ }
46
+ function observe(input){const xs=Array.isArray(input)?input:[input];coverage.evaluations++;if(!xs.length)coverage.empty++;if(xs.includes(0))coverage.zero++;if(xs.some(x=>typeof x==='number'&&x<0))coverage.negative++;if(new Set(xs).size<xs.length)coverage.duplicates++;}
47
+ globalThis.__lessonObserveCall=(input,output)=>{const call={input:plain(input),output:plain(output)};if(currentCase)currentCase.calls.push(call);else if(namedCalls.length<100)namedCalls.push(call);};
48
+ function property(factory,args){
49
+ const predicate=args.pop(),rows=[];
50
+ const wrapped=(...values)=>{
51
+ const input=plain(values.length===1?values[0]:values),row={input,output:null,ok:null,calls:[]};
52
+ currentCase=row;observe(input);
53
+ const finish=ok=>{row.ok=ok;row.output=row.calls.at(-1)?.output??null;if(rows.length<1000)rows.push(row);currentCase=null;};
54
+ try{const answer=predicate(...values);if(answer&&typeof answer.then==='function')return answer.then(value=>{finish(value!==false);return value;},error=>{finish(false);throw error;});finish(answer!==false);return answer;}catch(error){finish(false);throw error;}
55
+ };
56
+ const result=factory(...args,wrapped);observations.set(result,rows);return result;
57
+ }
58
+ export function assert(prop,options){
59
+ const replay=globalThis.__lessonReplay;
60
+ const checked=fc.check(prop,{...options,seed:globalThis.__lessonSeed,verbose:2,...(replay?.path&&replay.test===testName?{path:replay.path}:{})});
61
+ const finish=run=>{
62
+ const detail={test:testName,origin:globalThis.__lessonPropertyMetadata?.[testName]?.inputValues?'LawSpec property: counterexample contains law input values':'LawSpec property: counterexample is a generator representation',counterexampleDomain:globalThis.__lessonPropertyMetadata?.[testName]?.inputValues?'law-inputs':'generator-representation',status:run.interrupted||run.failed&&!run.counterexample?'incomplete':run.failed?'failed':'passed',seed:run.seed,path:run.counterexamplePath,counterexample:plain(run.counterexample),numRuns:run.numRuns,numShrinks:run.numShrinks,numSkips:run.numSkips,failures:plain(run.failures),error:run.errorInstance?.message??null,observations:observations.get(prop)??[]};
63
+ if(detail.counterexampleDomain==='law-inputs'&&detail.counterexample){const names=globalThis.__lessonPropertyMetadata?.[testName]?.inputNames??[];detail.inputs=Object.fromEntries(names.map((name,index)=>[name,detail.counterexample[index]]));}
64
+ if(run.errorInstance?.code==='LEARN_UNSUPPORTED_HOST')detail.status='unsupported';
65
+ details.push(detail);
66
+ if(detail.status!=='passed')throw run.errorInstance??new Error('LawSpec property '+detail.status);
67
+ };
68
+ return checked&&typeof checked.then==='function'?checked.then(finish):finish(checked);
69
+ }
70
+ export default Object.assign({},fc,{assert,property:(...args)=>property(fc.property,args),asyncProperty:(...args)=>property(fc.asyncProperty,args)});`;
71
+ /** Register generated node:test callbacks without requiring native Node's test runner. ref:DEC-learn-tests-in-lawspec */
72
+ export const nodeTestSource = `const registered=(globalThis.__lawspecTests??=[]);export function test(name,options,fn){registered.push({name:String(name),options:typeof options==='object'?options:{},fn:typeof options==='function'?options:fn});}export default test;export function describe(){const error=new Error('unsupported: parallel suites are not available in the sequential browser host');error.code='LEARN_UNSUPPORTED_HOST';throw error;}`;
@@ -0,0 +1,34 @@
1
+ <!doctype html><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; connect-src 'none'; script-src 'sha256-NE2/nqP5Oz55rEL9REefoYkq2EFGWl8HJj0j4i0vq4w=' blob:; worker-src blob:"><title>Isolated execution</title><script>(function frameMain()
2
+ {
3
+ addEventListener(
4
+ 'message',
5
+ ({source, data}) =>
6
+ {
7
+ if (source !== parent || typeof data.code !== 'string')
8
+ {
9
+ return;
10
+ }
11
+ const url = URL.createObjectURL(
12
+ new Blob([data.code], {type: 'text/javascript'}),
13
+ );
14
+ const worker = new Worker(url);
15
+ worker.onmessage = event =>
16
+ {
17
+ parent.postMessage(event.data, '*');
18
+ worker.terminate();
19
+ URL.revokeObjectURL(url);
20
+ };
21
+ worker.onerror = event =>
22
+ {
23
+ parent.postMessage(
24
+ {error: event.message || 'Learner execution failed'},
25
+ '*',
26
+ );
27
+ worker.terminate();
28
+ URL.revokeObjectURL(url);
29
+ };
30
+ },
31
+ {once: true},
32
+ );
33
+ parent.postMessage({ready: true}, '*');
34
+ })()</script>
@@ -0,0 +1,91 @@
1
+ // An opaque frame owns a dedicated execution worker. CSP applies to its blob
2
+ // worker too: learner code has no network, DOM, storage or parent-origin access.
3
+ /** Execute a compiled bundle in an opaque frame worker, keeping cancellation and timeout control on the responsive parent. ref:DEC-learn-course-preview */
4
+ export function execute(code, {signal, timeout = 15000} = {})
5
+ {
6
+ return new Promise((resolve, reject) =>
7
+ {
8
+ const frame = document.createElement('iframe');
9
+ frame.hidden = true;
10
+ frame.title = 'Isolated lesson execution';
11
+ frame.setAttribute('sandbox', 'allow-scripts');
12
+ let timer;
13
+ const finish = (error, value) =>
14
+ {
15
+ clearTimeout(timer);
16
+ window.removeEventListener('message', listen);
17
+ signal?.removeEventListener('abort', abort);
18
+ frame.remove();
19
+ error ? reject(error) : resolve(value);
20
+ };
21
+ const abort = () =>
22
+ finish(new DOMException('Execution cancelled', 'AbortError'));
23
+ const listen = event =>
24
+ {
25
+ if (event.source !== frame.contentWindow)
26
+ {
27
+ return;
28
+ }
29
+ if (event.data?.ready)
30
+ {
31
+ frame.contentWindow.postMessage({code}, '*');
32
+ }
33
+ else if (event.data?.result)
34
+ {
35
+ finish(null, event.data.result);
36
+ }
37
+ else if (event.data?.error)
38
+ {
39
+ finish(new Error(event.data.error));
40
+ }
41
+ };
42
+ if (signal?.aborted)
43
+ {
44
+ abort();
45
+ return;
46
+ }
47
+ window.addEventListener('message', listen);
48
+ signal?.addEventListener('abort', abort, {once: true});
49
+ timer = setTimeout(
50
+ () => finish(new Error('Execution timed out; your draft is saved.')),
51
+ timeout,
52
+ );
53
+ frame.src = new URL('./sandbox-frame.html', import.meta.url).href;
54
+ document.body.append(frame);
55
+ });
56
+ }
57
+ /** Own the execution worker inside the network-disabled frame and relay its result before terminating it. ref:DEC-learn-course-preview */
58
+ export function frameMain()
59
+ {
60
+ addEventListener(
61
+ 'message',
62
+ ({source, data}) =>
63
+ {
64
+ if (source !== parent || typeof data.code !== 'string')
65
+ {
66
+ return;
67
+ }
68
+ const url = URL.createObjectURL(
69
+ new Blob([data.code], {type: 'text/javascript'}),
70
+ );
71
+ const worker = new Worker(url);
72
+ worker.onmessage = event =>
73
+ {
74
+ parent.postMessage(event.data, '*');
75
+ worker.terminate();
76
+ URL.revokeObjectURL(url);
77
+ };
78
+ worker.onerror = event =>
79
+ {
80
+ parent.postMessage(
81
+ {error: event.message || 'Learner execution failed'},
82
+ '*',
83
+ );
84
+ worker.terminate();
85
+ URL.revokeObjectURL(url);
86
+ };
87
+ },
88
+ {once: true},
89
+ );
90
+ parent.postMessage({ready: true}, '*');
91
+ }