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.
- package/CHANGELOG.md +116 -1
- package/README.md +86 -4
- package/api.mjs +14 -9
- package/authoring.mjs +899 -0
- package/beam-coverage.mjs +190 -65
- package/beam-doctor.mjs +343 -124
- package/bin/lawspec.mjs +1955 -657
- package/build.json +135 -129
- package/component-packages.mjs +662 -176
- package/component.d.ts +82 -20
- package/component.mjs +317 -94
- package/core.wasm +2 -2
- package/core_jsffi.js +5 -5
- package/doctor.mjs +558 -299
- package/examples-command.mjs +44 -23
- package/failure-database.mjs +60 -17
- package/files.mjs +122 -62
- package/index.d.ts +585 -312
- package/input-files.mjs +90 -25
- package/launcher.mjs +72 -31
- package/learn/adapters.mjs +226 -0
- package/learn/app.mjs +1279 -0
- package/learn/assert.mjs +33 -0
- package/learn/assets.mjs +15 -0
- package/learn/browser-runtime.mjs +58 -0
- package/learn/bundle.mjs +118 -0
- package/learn/compile-worker.mjs +106 -0
- package/learn/compiler.mjs +230 -0
- package/learn/coverage.json +8259 -0
- package/learn/curriculum.json +2955 -0
- package/learn/fantomas-worker.mjs +25 -0
- package/learn/format-worker.mjs +148 -0
- package/learn/fsharp.mjs +83 -0
- package/learn/harness-host.mjs +22 -0
- package/learn/index.html +326 -0
- package/learn/lawspec-core.mjs +223 -0
- package/learn/lawspec-language.mjs +69 -0
- package/learn/node-test.mjs +11 -0
- package/learn/presentation.mjs +73 -0
- package/learn/runner.mjs +72 -0
- package/learn/sandbox-frame.html +34 -0
- package/learn/sandbox.mjs +91 -0
- package/learn/store.mjs +141 -0
- package/learn/story.mjs +42 -0
- package/learn/style-options.json +16 -0
- package/learn/style.css +1023 -0
- package/learn/theme.js +77 -0
- package/learn/typescript.mjs +53 -0
- package/learn/vendor/@fontsource-atkinson-hyperlegible-LICENSE.txt +93 -0
- package/learn/vendor/@fontsource-atkinson-hyperlegible-mono-LICENSE.txt +93 -0
- package/learn/vendor/@fontsource-overpass-LICENSE.txt +93 -0
- package/learn/vendor/assemblies.json +1 -0
- package/learn/vendor/editor-worker.js +30 -0
- package/learn/vendor/editor.css +1 -0
- package/learn/vendor/editor.mjs +931 -0
- package/learn/vendor/esbuild-wasm-LICENSE.txt +21 -0
- package/learn/vendor/esbuild.mjs +2683 -0
- package/learn/vendor/esbuild.wasm +0 -0
- package/learn/vendor/fable-library/Array.js +1347 -0
- package/learn/vendor/fable-library/Async.js +134 -0
- package/learn/vendor/fable-library/AsyncBuilder.js +183 -0
- package/learn/vendor/fable-library/BigInt.js +306 -0
- package/learn/vendor/fable-library/BitConverter.js +138 -0
- package/learn/vendor/fable-library/Boolean.js +22 -0
- package/learn/vendor/fable-library/CHANGELOG.md +242 -0
- package/learn/vendor/fable-library/Char.js +202 -0
- package/learn/vendor/fable-library/Choice.js +184 -0
- package/learn/vendor/fable-library/CollectionUtil.js +182 -0
- package/learn/vendor/fable-library/ConditionalWeakTable.js +21 -0
- package/learn/vendor/fable-library/Date.js +841 -0
- package/learn/vendor/fable-library/DateOffset.js +261 -0
- package/learn/vendor/fable-library/DateOnly.js +124 -0
- package/learn/vendor/fable-library/Decimal.js +238 -0
- package/learn/vendor/fable-library/Double.js +47 -0
- package/learn/vendor/fable-library/Encoding.js +185 -0
- package/learn/vendor/fable-library/Event.js +93 -0
- package/learn/vendor/fable-library/FSharp.Collections.js +45 -0
- package/learn/vendor/fable-library/FSharp.Core.CompilerServices.js +27 -0
- package/learn/vendor/fable-library/FSharp.Core.js +156 -0
- package/learn/vendor/fable-library/Global.js +29 -0
- package/learn/vendor/fable-library/Guid.js +161 -0
- package/learn/vendor/fable-library/Int32.js +135 -0
- package/learn/vendor/fable-library/List.js +1323 -0
- package/learn/vendor/fable-library/Long.js +47 -0
- package/learn/vendor/fable-library/MailboxProcessor.js +94 -0
- package/learn/vendor/fable-library/Map.js +1396 -0
- package/learn/vendor/fable-library/MapUtil.js +130 -0
- package/learn/vendor/fable-library/MutableMap.js +339 -0
- package/learn/vendor/fable-library/MutableSet.js +233 -0
- package/learn/vendor/fable-library/Native.js +14 -0
- package/learn/vendor/fable-library/Numeric.js +75 -0
- package/learn/vendor/fable-library/Observable.js +113 -0
- package/learn/vendor/fable-library/Option.js +104 -0
- package/learn/vendor/fable-library/README.md +3 -0
- package/learn/vendor/fable-library/Random.js +172 -0
- package/learn/vendor/fable-library/Range.js +45 -0
- package/learn/vendor/fable-library/Reflection.js +479 -0
- package/learn/vendor/fable-library/RegExp.js +141 -0
- package/learn/vendor/fable-library/Result.js +165 -0
- package/learn/vendor/fable-library/Seq.js +1417 -0
- package/learn/vendor/fable-library/Seq2.js +111 -0
- package/learn/vendor/fable-library/Set.js +1816 -0
- package/learn/vendor/fable-library/String.js +674 -0
- package/learn/vendor/fable-library/System.Collections.Generic.js +333 -0
- package/learn/vendor/fable-library/System.Text.js +200 -0
- package/learn/vendor/fable-library/System.js +289 -0
- package/learn/vendor/fable-library/TimeOnly.js +122 -0
- package/learn/vendor/fable-library/TimeSpan.js +180 -0
- package/learn/vendor/fable-library/Timer.js +67 -0
- package/learn/vendor/fable-library/Types.js +198 -0
- package/learn/vendor/fable-library/Unicode.13.0.0.js +4 -0
- package/learn/vendor/fable-library/Uri.js +165 -0
- package/learn/vendor/fable-library/Util.js +796 -0
- package/learn/vendor/fable-library/big.d.ts +338 -0
- package/learn/vendor/fable-library/lib/big.js +825 -0
- package/learn/vendor/fable-library/package.json +24 -0
- package/learn/vendor/fable-library/quotation.js +618 -0
- package/learn/vendor/fable.js +430 -0
- package/learn/vendor/fantomas/FSharp.Core.uawo19tl4c.wasm +0 -0
- package/learn/vendor/fantomas/Fantomas.Core.stnanlnpyw.wasm +0 -0
- package/learn/vendor/fantomas/Fantomas.FCS.lqohfu5o9y.wasm +0 -0
- package/learn/vendor/fantomas/LawSpec.Learn.Formatter.poiijdbsl9.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.CSharp.mp8lhr6rez.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.VisualBasic.0e5fchkecn.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.VisualBasic.Core.17wn27qal2.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.Win32.Primitives.9d566sle9e.wasm +0 -0
- package/learn/vendor/fantomas/Microsoft.Win32.Registry.52dy96yk8i.wasm +0 -0
- package/learn/vendor/fantomas/System.AppContext.jwujeh069z.wasm +0 -0
- package/learn/vendor/fantomas/System.Buffers.y0isk1x97h.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.Concurrent.x5koi7bzem.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.Immutable.diwg7advch.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.NonGeneric.4089xs440e.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.Specialized.hj81u7zblb.wasm +0 -0
- package/learn/vendor/fantomas/System.Collections.nvrdeoknr1.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.Annotations.yatcnfjeuk.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.DataAnnotations.led9l5awu3.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.EventBasedAsync.hpvp6cf4de.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.Primitives.v7cajwpaqo.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.TypeConverter.xk1hnyt762.wasm +0 -0
- package/learn/vendor/fantomas/System.ComponentModel.rrnda1lucx.wasm +0 -0
- package/learn/vendor/fantomas/System.Configuration.bn9vghjcq8.wasm +0 -0
- package/learn/vendor/fantomas/System.Console.09ajpiafhz.wasm +0 -0
- package/learn/vendor/fantomas/System.Core.wc649o5mw9.wasm +0 -0
- package/learn/vendor/fantomas/System.Data.Common.s4cowzd9a9.wasm +0 -0
- package/learn/vendor/fantomas/System.Data.DataSetExtensions.5fm360ikxl.wasm +0 -0
- package/learn/vendor/fantomas/System.Data.fsu4j4t4jw.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Contracts.p74re5oxzn.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Debug.622sixg49n.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.DiagnosticSource.2j35bc2g2b.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.FileVersionInfo.7n0wdvltaa.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Process.8iffh49mew.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.StackTrace.1yz88vico8.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.TextWriterTraceListener.ua8iuh2vhj.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Tools.roy5445ugj.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.TraceSource.6qx1ldzz7g.wasm +0 -0
- package/learn/vendor/fantomas/System.Diagnostics.Tracing.b4799zpaas.wasm +0 -0
- package/learn/vendor/fantomas/System.Drawing.8gcjjqj0pu.wasm +0 -0
- package/learn/vendor/fantomas/System.Drawing.Primitives.y2uveru2yk.wasm +0 -0
- package/learn/vendor/fantomas/System.Dynamic.Runtime.023zrvzh9x.wasm +0 -0
- package/learn/vendor/fantomas/System.Formats.Asn1.znpklkbgqv.wasm +0 -0
- package/learn/vendor/fantomas/System.Formats.Tar.5yybjepfi2.wasm +0 -0
- package/learn/vendor/fantomas/System.Globalization.Calendars.10g6hyjy3k.wasm +0 -0
- package/learn/vendor/fantomas/System.Globalization.Extensions.hrinfrismg.wasm +0 -0
- package/learn/vendor/fantomas/System.Globalization.uvs4rah8fk.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.4j645gw40d.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.2z7vdt6tfb.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.Brotli.fv80xs79j3.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.FileSystem.88jdddz3sw.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Compression.ZipFile.jkn9avr4vo.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.AccessControl.yme0uhbu37.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.DriveInfo.qas7wf73rs.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.Primitives.d1jmhkzu0e.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.Watcher.z570derp0d.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.FileSystem.o6jtz51fup.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.IsolatedStorage.hqyeyb5ipe.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.MemoryMappedFiles.zhamjnusxd.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Pipelines.wrmw5vws31.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Pipes.AccessControl.qcancj8gj2.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.Pipes.zhcyguvwkr.wasm +0 -0
- package/learn/vendor/fantomas/System.IO.UnmanagedMemoryStream.o8cpjnlard.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.AsyncEnumerable.hyc0b7okjw.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.Expressions.ldibvm0efj.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.Parallel.2buevezvch.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.Queryable.cvq43g1awj.wasm +0 -0
- package/learn/vendor/fantomas/System.Linq.lz6mvi0hm2.wasm +0 -0
- package/learn/vendor/fantomas/System.Memory.3jekerw0ga.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Http.Json.8k237kkwec.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Http.cityx2bvcl.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.HttpListener.s1jreclykx.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Mail.cmlj4c0gto.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.NameResolution.q3gf18q13l.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.NetworkInformation.xaz5tjw7d0.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Ping.a40atim1h0.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Primitives.i88i20r8sr.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Quic.hx06eo5xkj.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Requests.hkjxlfe5f5.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Security.ch34yya69o.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.ServerSentEvents.0u7o0jk3p1.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.ServicePoint.xbhxnytx4l.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.Sockets.hzgzlvkc9l.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebClient.84i8nwzbgu.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebHeaderCollection.326nl7s9g3.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebProxy.oq3mgkkqef.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebSockets.2cx1v74vg8.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.WebSockets.Client.rafzkktw8j.wasm +0 -0
- package/learn/vendor/fantomas/System.Net.w1hpj3bo6r.wasm +0 -0
- package/learn/vendor/fantomas/System.Numerics.Vectors.oyv7biw9ux.wasm +0 -0
- package/learn/vendor/fantomas/System.Numerics.lyu36wqn19.wasm +0 -0
- package/learn/vendor/fantomas/System.ObjectModel.kxu80demuu.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.CoreLib.1vy46s12u6.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.DataContractSerialization.ao8k9iu77a.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.Uri.itn0n2zjd0.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.Xml.19nzpxrx8w.wasm +0 -0
- package/learn/vendor/fantomas/System.Private.Xml.Linq.tw5eq1hjvo.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.DispatchProxy.7lajnj8s8c.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Emit.7liz9zln06.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Emit.ILGeneration.1ut3qgacw8.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Emit.Lightweight.d0gvllb1jj.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Extensions.zr5bhwfczd.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Metadata.ff6np6mz2j.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.Primitives.igpmvwv78c.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.TypeExtensions.qouojzlnp9.wasm +0 -0
- package/learn/vendor/fantomas/System.Reflection.mk3jyxvh13.wasm +0 -0
- package/learn/vendor/fantomas/System.Resources.Reader.41ppfyz2vc.wasm +0 -0
- package/learn/vendor/fantomas/System.Resources.ResourceManager.sfwvfmw1ea.wasm +0 -0
- package/learn/vendor/fantomas/System.Resources.Writer.3uvs9tp38z.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.CompilerServices.Unsafe.puz1xm53oc.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.CompilerServices.VisualC.9qdau315py.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Extensions.i7gntui96b.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Handles.00oxj4o6ov.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.InteropServices.JavaScript.9kq1vofond.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.InteropServices.RuntimeInformation.my7qeqbhfh.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.InteropServices.vqp80tnwc7.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Intrinsics.u0samjybfo.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Loader.n6zxw1b98a.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Numerics.o40sjhz59x.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Formatters.1esvva4te3.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Json.4n7u09advh.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Primitives.xs2bo91wvk.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.Xml.ny21jmziti.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.Serialization.qcxaur5wqs.wasm +0 -0
- package/learn/vendor/fantomas/System.Runtime.odq454d6j9.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.AccessControl.8yfnzmqzaq.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Claims.8ogy0860de.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Algorithms.8zijp1svfw.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Cng.yxagtt77no.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Csp.uhfbvvau84.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Encoding.2ywrusvy8q.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.OpenSsl.oa268u7i92.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.Primitives.5uhvqe8puk.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.X509Certificates.6i7pxilopt.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Cryptography.d0quqk1iyr.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Principal.Windows.gpqua4rz29.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.Principal.i20kfklf3g.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.SecureString.x2y8tzci3c.wasm +0 -0
- package/learn/vendor/fantomas/System.Security.e83vvh6sl2.wasm +0 -0
- package/learn/vendor/fantomas/System.ServiceModel.Web.poglliv2no.wasm +0 -0
- package/learn/vendor/fantomas/System.ServiceProcess.yro5uj2opo.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encoding.CodePages.2wchx40i7z.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encoding.Extensions.8utaw61kn5.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encoding.cxdyfepnpj.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Encodings.Web.37ehbi7cye.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.Json.ixiaa8hd3h.wasm +0 -0
- package/learn/vendor/fantomas/System.Text.RegularExpressions.2fhfmkk6vf.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.6pry74a050.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.AccessControl.76zfdfy8go.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Channels.gpxnr01lmp.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Overlapped.aqpl8tzdyc.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.Dataflow.ytwttt7fzh.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.Extensions.0deavcb00v.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.Parallel.tjwtxugso0.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Tasks.fu4qd5h3qy.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Thread.klaua2by9m.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.ThreadPool.mkzm212njz.wasm +0 -0
- package/learn/vendor/fantomas/System.Threading.Timer.yp49llu5h2.wasm +0 -0
- package/learn/vendor/fantomas/System.Transactions.Local.vz6cgeh4w7.wasm +0 -0
- package/learn/vendor/fantomas/System.Transactions.ipwm3rsy66.wasm +0 -0
- package/learn/vendor/fantomas/System.ValueTuple.7ol6ljuhx8.wasm +0 -0
- package/learn/vendor/fantomas/System.Web.HttpUtility.itlvncjd96.wasm +0 -0
- package/learn/vendor/fantomas/System.Web.np8uzzakvl.wasm +0 -0
- package/learn/vendor/fantomas/System.Windows.18nzio44t3.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.45jprtg1pa.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.Linq.v9v8udncm1.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.ReaderWriter.a9mr08uzci.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.Serialization.03juoguwgc.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XDocument.c9dhjnzqjb.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XPath.XDocument.138b12i1pm.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XPath.pvxm9341ce.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XmlDocument.450wsyxvl0.wasm +0 -0
- package/learn/vendor/fantomas/System.Xml.XmlSerializer.y3t2n0tce7.wasm +0 -0
- package/learn/vendor/fantomas/System.gjriafnqmz.wasm +0 -0
- package/learn/vendor/fantomas/WindowsBase.8zsce9qxfb.wasm +0 -0
- package/learn/vendor/fantomas/cs/FSharp.Core.resources.9ehmavdel7.wasm +0 -0
- package/learn/vendor/fantomas/de/FSharp.Core.resources.2ofmxloa01.wasm +0 -0
- package/learn/vendor/fantomas/dotnet.js +1233 -0
- package/learn/vendor/fantomas/dotnet.native.b6l13xorvf.js +16 -0
- package/learn/vendor/fantomas/dotnet.native.rw4kynp763.wasm +0 -0
- package/learn/vendor/fantomas/dotnet.runtime.v06hirbjsv.js +4 -0
- package/learn/vendor/fantomas/es/FSharp.Core.resources.hkr5ggb4tr.wasm +0 -0
- package/learn/vendor/fantomas/fr/FSharp.Core.resources.43soen28ow.wasm +0 -0
- package/learn/vendor/fantomas/icudt_CJK.tjcz0u77k5.dat +0 -0
- package/learn/vendor/fantomas/icudt_EFIGS.tptq2av103.dat +0 -0
- package/learn/vendor/fantomas/icudt_no_CJK.lfu7j35m59.dat +0 -0
- package/learn/vendor/fantomas/it/FSharp.Core.resources.m60n5ls7oq.wasm +0 -0
- package/learn/vendor/fantomas/ja/FSharp.Core.resources.o6oof69v14.wasm +0 -0
- package/learn/vendor/fantomas/ko/FSharp.Core.resources.q6l4snlu9o.wasm +0 -0
- package/learn/vendor/fantomas/mscorlib.8ptuc08eli.wasm +0 -0
- package/learn/vendor/fantomas/netstandard.eymp85mooh.wasm +0 -0
- package/learn/vendor/fantomas/pl/FSharp.Core.resources.8bni0w6j8b.wasm +0 -0
- package/learn/vendor/fantomas/pt-BR/FSharp.Core.resources.k849vqm41u.wasm +0 -0
- package/learn/vendor/fantomas/ru/FSharp.Core.resources.jz9rhhtsla.wasm +0 -0
- package/learn/vendor/fantomas/tr/FSharp.Core.resources.wn6vbvjm1u.wasm +0 -0
- package/learn/vendor/fantomas/zh-Hans/FSharp.Core.resources.z7zzbso094.wasm +0 -0
- package/learn/vendor/fantomas/zh-Hant/FSharp.Core.resources.iammfsi7ls.wasm +0 -0
- package/learn/vendor/fast-check-LICENSE.txt +21 -0
- package/learn/vendor/fast-check.mjs +37 -0
- package/learn/vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
- package/learn/vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
- package/learn/vendor/fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2 +0 -0
- package/learn/vendor/fonts/overpass-latin-600-normal.woff2 +0 -0
- package/learn/vendor/fonts/overpass-latin-700-normal.woff2 +0 -0
- package/learn/vendor/formatter-licenses/DotNet-LICENSE.txt +23 -0
- package/learn/vendor/formatter-licenses/DotNet-THIRD-PARTY-NOTICES.txt +1418 -0
- package/learn/vendor/formatter-licenses/FSharp-LICENSE.txt +23 -0
- package/learn/vendor/formatter-licenses/Fantomas-LICENSE.txt +202 -0
- package/learn/vendor/formatter-licenses/README.md +12 -0
- package/learn/vendor/manifest.json +1354 -0
- package/learn/vendor/metadata/Browser.Blob.dll +0 -0
- package/learn/vendor/metadata/Browser.Dom.dll +0 -0
- package/learn/vendor/metadata/Browser.Event.dll +0 -0
- package/learn/vendor/metadata/Browser.Gamepad.dll +0 -0
- package/learn/vendor/metadata/Browser.WebGL.dll +0 -0
- package/learn/vendor/metadata/Browser.WebStorage.dll +0 -0
- package/learn/vendor/metadata/FSharp.Core.dll +0 -0
- package/learn/vendor/metadata/Fable.Core.dll +0 -0
- package/learn/vendor/metadata/Fable.Repl.Lib.dll +0 -0
- package/learn/vendor/metadata/System.Collections.Concurrent.dll +0 -0
- package/learn/vendor/metadata/System.Collections.dll +0 -0
- package/learn/vendor/metadata/System.ComponentModel.Primitives.dll +0 -0
- package/learn/vendor/metadata/System.ComponentModel.TypeConverter.dll +0 -0
- package/learn/vendor/metadata/System.ComponentModel.dll +0 -0
- package/learn/vendor/metadata/System.Console.dll +0 -0
- package/learn/vendor/metadata/System.Core.dll +0 -0
- package/learn/vendor/metadata/System.Diagnostics.Debug.dll +0 -0
- package/learn/vendor/metadata/System.Diagnostics.Tools.dll +0 -0
- package/learn/vendor/metadata/System.Diagnostics.Tracing.dll +0 -0
- package/learn/vendor/metadata/System.Globalization.dll +0 -0
- package/learn/vendor/metadata/System.IO.dll +0 -0
- package/learn/vendor/metadata/System.Net.Requests.dll +0 -0
- package/learn/vendor/metadata/System.Net.WebClient.dll +0 -0
- package/learn/vendor/metadata/System.Numerics.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.Extensions.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.Metadata.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.Primitives.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.TypeExtensions.dll +0 -0
- package/learn/vendor/metadata/System.Reflection.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.Extensions.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.InteropServices.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.Numerics.dll +0 -0
- package/learn/vendor/metadata/System.Runtime.dll +0 -0
- package/learn/vendor/metadata/System.Text.Encoding.Extensions.dll +0 -0
- package/learn/vendor/metadata/System.Text.Encoding.dll +0 -0
- package/learn/vendor/metadata/System.Text.RegularExpressions.dll +0 -0
- package/learn/vendor/metadata/System.Threading.Tasks.dll +0 -0
- package/learn/vendor/metadata/System.Threading.Thread.dll +0 -0
- package/learn/vendor/metadata/System.Threading.dll +0 -0
- package/learn/vendor/metadata/System.ValueTuple.dll +0 -0
- package/learn/vendor/metadata/System.dll +0 -0
- package/learn/vendor/metadata/mscorlib.dll +0 -0
- package/learn/vendor/metadata/netstandard.dll +0 -0
- package/learn/vendor/monaco-editor-LICENSE.txt +21 -0
- package/learn/vendor/prettier/babel.mjs +16 -0
- package/learn/vendor/prettier/brace-style.mjs +376 -0
- package/learn/vendor/prettier/estree.mjs +44 -0
- package/learn/vendor/prettier/standalone.mjs +29 -0
- package/learn/vendor/prettier/typescript.mjs +22 -0
- package/learn/vendor/prettier-LICENSE.txt +7 -0
- package/learn/vendor/prettier-plugin-brace-style-LICENSE.txt +21 -0
- package/learn/vendor/typescript-LICENSE.txt +55 -0
- package/learn/vendor/typescript-libs.json +1 -0
- package/learn/vendor/typescript.mjs +451 -0
- package/learn/vendor/zod-LICENSE.txt +21 -0
- package/learn/web-format.mjs +8 -0
- package/learn.mjs +126 -0
- package/lsp.mjs +444 -133
- package/mcp.mjs +250 -0
- package/native-evidence.mjs +668 -182
- package/native-examples.mjs +56 -19
- package/native-host.mjs +136 -42
- package/native-parsers/clojure.LICENSE +121 -0
- package/native-parsers/clojure.wasm +0 -0
- package/native-parsers/csharp.LICENSE +21 -0
- package/native-parsers/csharp.wasm +0 -0
- package/native-parsers/elixir.LICENSE +176 -0
- package/native-parsers/elixir.wasm +0 -0
- package/native-parsers/erlang.LICENSE +201 -0
- package/native-parsers/erlang.wasm +0 -0
- package/native-parsers/fsharp.LICENSE +21 -0
- package/native-parsers/fsharp.wasm +0 -0
- package/native-parsers/gleam.LICENSE +202 -0
- package/native-parsers/gleam.wasm +0 -0
- package/native-parsers/go.LICENSE +21 -0
- package/native-parsers/go.wasm +0 -0
- package/native-parsers/groovy.LICENSE +21 -0
- package/native-parsers/groovy.wasm +0 -0
- package/native-parsers/haskell.LICENSE +21 -0
- package/native-parsers/haskell.wasm +0 -0
- package/native-parsers/java.LICENSE +21 -0
- package/native-parsers/java.wasm +0 -0
- package/native-parsers/javascript.LICENSE +21 -0
- package/native-parsers/javascript.wasm +0 -0
- package/native-parsers/kotlin.LICENSE +9 -0
- package/native-parsers/kotlin.wasm +0 -0
- package/native-parsers/lock.json +114 -0
- package/native-parsers/prolog.LICENSE +21 -0
- package/native-parsers/prolog.wasm +0 -0
- package/native-parsers/python.LICENSE +21 -0
- package/native-parsers/python.wasm +0 -0
- package/native-parsers/rust.LICENSE +21 -0
- package/native-parsers/rust.wasm +0 -0
- package/native-parsers/scala.LICENSE +21 -0
- package/native-parsers/scala.wasm +0 -0
- package/native-parsers/swift.LICENSE +21 -0
- package/native-parsers/swift.wasm +0 -0
- package/native-parsers/typescript.LICENSE +21 -0
- package/native-parsers/typescript.wasm +0 -0
- package/node-events-reporter.mjs +41 -17
- package/package.json +5 -3
- package/project.mjs +338 -0
- package/proof.d.ts +93 -19
- package/proof.mjs +1538 -447
- package/read-only-hpack.mjs +6 -5
- package/scala-build-state.mjs +131 -41
- package/scala-coverage.mjs +57 -34
- package/scalars.mjs +23 -8
- package/templates.mjs +566 -617
- package/test-command.mjs +1671 -521
package/learn/assert.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// The part of node:assert/strict that generated LawSpec tests use.
|
|
2
|
+
class AssertionError extends Error
|
|
3
|
+
{
|
|
4
|
+
constructor(message)
|
|
5
|
+
{
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'AssertionError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function ok(value, message)
|
|
11
|
+
{
|
|
12
|
+
if (!value) throw new AssertionError(message ?? 'Expected a truthy value');
|
|
13
|
+
}
|
|
14
|
+
function equal(actual, expected, message)
|
|
15
|
+
{
|
|
16
|
+
if (!Object.is(actual, expected))
|
|
17
|
+
throw new AssertionError(
|
|
18
|
+
message ?? `${String(actual)} !== ${String(expected)}`,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function fail(message)
|
|
22
|
+
{
|
|
23
|
+
throw new AssertionError(message ?? 'Failed');
|
|
24
|
+
}
|
|
25
|
+
const assert = Object.assign((value, message) => ok(value, message), {
|
|
26
|
+
ok,
|
|
27
|
+
equal,
|
|
28
|
+
strictEqual: equal,
|
|
29
|
+
fail,
|
|
30
|
+
AssertionError,
|
|
31
|
+
});
|
|
32
|
+
export {ok, equal, equal as strictEqual, fail, AssertionError};
|
|
33
|
+
export default assert;
|
package/learn/assets.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Untrusted imports may request only known packaged asset names. In particular,
|
|
2
|
+
// source text cannot become a query string, URL, or path sent to the asset host.
|
|
3
|
+
/** Allow only fixed packaged asset names so an untrusted import cannot submit source text through a URL or filesystem path. ref:DEC-learn-course-preview */
|
|
4
|
+
export function packagedReader(manifest, read)
|
|
5
|
+
{
|
|
6
|
+
const allowed = new Set([...Object.keys(manifest.assets), 'assert.mjs']);
|
|
7
|
+
return async name =>
|
|
8
|
+
{
|
|
9
|
+
if (!allowed.has(name))
|
|
10
|
+
{
|
|
11
|
+
throw new Error('Unsupported packaged import: ' + name);
|
|
12
|
+
}
|
|
13
|
+
return read(name);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// esbuild-wasm has no filesystem for computed import globs. The compiler's
|
|
2
|
+
// optional native secure-network loader is outside these browser exercises.
|
|
3
|
+
// Use TypeScript's parser/printer to replace that one loader with a module that
|
|
4
|
+
// fails explicitly when requested; all other generated code remains intact.
|
|
5
|
+
/** Refuse the optional native network loader when bundling the runtime for a browser; all other generated runtime code is retained. ref:DEC-learn-course-preview */
|
|
6
|
+
export function browserRuntime(ts, source)
|
|
7
|
+
{
|
|
8
|
+
const ast = ts.createSourceFile(
|
|
9
|
+
'lawspec_runtime.mjs',
|
|
10
|
+
source,
|
|
11
|
+
ts.ScriptTarget.ES2022,
|
|
12
|
+
true,
|
|
13
|
+
ts.ScriptKind.JS,
|
|
14
|
+
);
|
|
15
|
+
const result = ts.transform(ast, [
|
|
16
|
+
context =>
|
|
17
|
+
{
|
|
18
|
+
const visit = node =>
|
|
19
|
+
{
|
|
20
|
+
if (
|
|
21
|
+
ts.isCallExpression(node) &&
|
|
22
|
+
node.expression.kind === ts.SyntaxKind.ImportKeyword &&
|
|
23
|
+
node.arguments.length === 1
|
|
24
|
+
)
|
|
25
|
+
{
|
|
26
|
+
const arg = node.arguments[0];
|
|
27
|
+
if (
|
|
28
|
+
ts.isBinaryExpression(arg) &&
|
|
29
|
+
ts.isStringLiteral(arg.left) &&
|
|
30
|
+
arg.left.text === './lawspec_network'
|
|
31
|
+
)
|
|
32
|
+
{
|
|
33
|
+
return ts.factory.updateCallExpression(
|
|
34
|
+
node,
|
|
35
|
+
node.expression,
|
|
36
|
+
node.typeArguments,
|
|
37
|
+
[
|
|
38
|
+
ts.factory.createStringLiteral(
|
|
39
|
+
'browser:unsupported-secure-network',
|
|
40
|
+
),
|
|
41
|
+
],
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return ts.visitEachChild(node, visit, context);
|
|
46
|
+
};
|
|
47
|
+
return root => ts.visitNode(root, visit);
|
|
48
|
+
},
|
|
49
|
+
]);
|
|
50
|
+
try
|
|
51
|
+
{
|
|
52
|
+
return ts.createPrinter().printFile(result.transformed[0]);
|
|
53
|
+
}
|
|
54
|
+
finally
|
|
55
|
+
{
|
|
56
|
+
result.dispose();
|
|
57
|
+
}
|
|
58
|
+
}
|
package/learn/bundle.mjs
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Resolve virtual modules through esbuild's parser, including cycles and re-exports.
|
|
2
|
+
/** Link virtual lesson files with esbuild, keeping parsing and module resolution separate from learner execution. ref:DEC-learn-course-preview */
|
|
3
|
+
export async function bundle(esbuild, modules, entry, readLibrary)
|
|
4
|
+
{
|
|
5
|
+
const normalize = path =>
|
|
6
|
+
{
|
|
7
|
+
const parts = [];
|
|
8
|
+
for (const part of path.split('/'))
|
|
9
|
+
{
|
|
10
|
+
if (part === '..')
|
|
11
|
+
{
|
|
12
|
+
if (!parts.length)
|
|
13
|
+
{
|
|
14
|
+
throw new Error('Module escapes workspace');
|
|
15
|
+
}
|
|
16
|
+
parts.pop();
|
|
17
|
+
}
|
|
18
|
+
else if (part && part !== '.')
|
|
19
|
+
{
|
|
20
|
+
parts.push(part);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return parts.join('/');
|
|
24
|
+
};
|
|
25
|
+
const result = await esbuild.build({
|
|
26
|
+
entryPoints: [entry],
|
|
27
|
+
bundle: true,
|
|
28
|
+
write: false,
|
|
29
|
+
format: 'iife',
|
|
30
|
+
platform: 'browser',
|
|
31
|
+
target: 'es2022',
|
|
32
|
+
logLevel: 'silent',
|
|
33
|
+
plugins: [
|
|
34
|
+
{
|
|
35
|
+
name: 'lesson-files',
|
|
36
|
+
setup(build)
|
|
37
|
+
{
|
|
38
|
+
build.onResolve({filter: /.*/}, args =>
|
|
39
|
+
{
|
|
40
|
+
const special = {
|
|
41
|
+
'node:test': 'node-test.mjs',
|
|
42
|
+
'node:assert/strict': 'assert.mjs',
|
|
43
|
+
'fast-check': 'fast-check.mjs',
|
|
44
|
+
};
|
|
45
|
+
let name = special[args.path] ?? args.path;
|
|
46
|
+
if (name.startsWith('.'))
|
|
47
|
+
{
|
|
48
|
+
name = normalize(
|
|
49
|
+
args.importer.split('/').slice(0, -1).join('/') + '/' + name,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
if (
|
|
53
|
+
['node:fs', 'node:path', 'node:async_hooks'].includes(name) &&
|
|
54
|
+
args.importer !== 'test/lawspec_harness.mjs'
|
|
55
|
+
)
|
|
56
|
+
{
|
|
57
|
+
throw new Error(
|
|
58
|
+
'Unsupported native import outside the generated harness: ' +
|
|
59
|
+
name,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
if (Object.hasOwn(modules, name))
|
|
63
|
+
{
|
|
64
|
+
return {path: name, namespace: 'lesson'};
|
|
65
|
+
}
|
|
66
|
+
if (name.startsWith('fable-library/'))
|
|
67
|
+
{
|
|
68
|
+
return {path: name.slice(14), namespace: 'fable'};
|
|
69
|
+
}
|
|
70
|
+
if (args.namespace === 'fable' && args.path.startsWith('.'))
|
|
71
|
+
{
|
|
72
|
+
return {
|
|
73
|
+
path: normalize(
|
|
74
|
+
args.importer.split('/').slice(0, -1).join('/') +
|
|
75
|
+
'/' +
|
|
76
|
+
args.path,
|
|
77
|
+
),
|
|
78
|
+
namespace: 'fable',
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (name === 'fast-check-original')
|
|
82
|
+
{
|
|
83
|
+
return {path: 'fast-check.mjs', namespace: 'vendor'};
|
|
84
|
+
}
|
|
85
|
+
if (
|
|
86
|
+
[
|
|
87
|
+
'node:http',
|
|
88
|
+
'node:net',
|
|
89
|
+
'browser:unsupported-secure-network',
|
|
90
|
+
].includes(name)
|
|
91
|
+
)
|
|
92
|
+
{
|
|
93
|
+
return {path: name, namespace: 'unsupported'};
|
|
94
|
+
}
|
|
95
|
+
throw new Error('Unsupported import: ' + args.path);
|
|
96
|
+
});
|
|
97
|
+
build.onLoad({filter: /.*/, namespace: 'lesson'}, args => ({
|
|
98
|
+
contents: modules[args.path],
|
|
99
|
+
loader: args.path.endsWith('.ts') ? 'ts' : 'js',
|
|
100
|
+
}));
|
|
101
|
+
build.onLoad({filter: /.*/, namespace: 'fable'}, async args => ({
|
|
102
|
+
contents: await readLibrary('fable-library/' + args.path),
|
|
103
|
+
loader: 'js',
|
|
104
|
+
}));
|
|
105
|
+
build.onLoad({filter: /.*/, namespace: 'vendor'}, async args => ({
|
|
106
|
+
contents: await readLibrary(args.path),
|
|
107
|
+
loader: 'js',
|
|
108
|
+
}));
|
|
109
|
+
build.onLoad({filter: /.*/, namespace: 'unsupported'}, args => ({
|
|
110
|
+
contents: `throw new Error(${JSON.stringify('unsupported: ' + args.path + ' is unavailable in browser lessons')});`,
|
|
111
|
+
loader: 'js',
|
|
112
|
+
}));
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
});
|
|
117
|
+
return result.outputFiles[0].text;
|
|
118
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {packagedReader} from './assets.mjs';
|
|
2
|
+
import {browserRuntime} from './browser-runtime.mjs';
|
|
3
|
+
import * as esbuild from './vendor/esbuild.mjs';
|
|
4
|
+
import ts from './vendor/typescript.mjs';
|
|
5
|
+
import './vendor/fable.js';
|
|
6
|
+
import {createFsharp} from './fsharp.mjs';
|
|
7
|
+
import {compileProject} from './compiler.mjs';
|
|
8
|
+
import {checkTypes} from './typescript.mjs';
|
|
9
|
+
let initialized, fs, core, libs;
|
|
10
|
+
let assetReader;
|
|
11
|
+
const readAsset = async path =>
|
|
12
|
+
{
|
|
13
|
+
assetReader ??= fetch(new URL('./vendor/manifest.json', import.meta.url))
|
|
14
|
+
.then(response =>
|
|
15
|
+
{
|
|
16
|
+
if (!response.ok)
|
|
17
|
+
{
|
|
18
|
+
throw new Error('Missing packaged manifest');
|
|
19
|
+
}
|
|
20
|
+
return response.json();
|
|
21
|
+
})
|
|
22
|
+
.then(manifest =>
|
|
23
|
+
packagedReader(manifest, async name =>
|
|
24
|
+
{
|
|
25
|
+
const response = await fetch(
|
|
26
|
+
new URL(
|
|
27
|
+
name === 'assert.mjs' ? name : 'vendor/' + name,
|
|
28
|
+
import.meta.url,
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
if (!response.ok)
|
|
32
|
+
{
|
|
33
|
+
throw new Error('Missing packaged asset: ' + name);
|
|
34
|
+
}
|
|
35
|
+
return response.text();
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
return (await assetReader)(path);
|
|
39
|
+
};
|
|
40
|
+
async function fsharp(files)
|
|
41
|
+
{
|
|
42
|
+
fs ??= (async () =>
|
|
43
|
+
{
|
|
44
|
+
const names = await (
|
|
45
|
+
await fetch(new URL('./vendor/assemblies.json', import.meta.url))
|
|
46
|
+
).json();
|
|
47
|
+
const assemblies = Object.fromEntries(
|
|
48
|
+
await Promise.all(
|
|
49
|
+
names.map(async name =>
|
|
50
|
+
{
|
|
51
|
+
const response = await fetch(
|
|
52
|
+
new URL('./vendor/metadata/' + name, import.meta.url),
|
|
53
|
+
);
|
|
54
|
+
if (!response.ok)
|
|
55
|
+
{
|
|
56
|
+
throw new Error('Missing F# metadata: ' + name);
|
|
57
|
+
}
|
|
58
|
+
return [name, new Uint8Array(await response.arrayBuffer())];
|
|
59
|
+
}),
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
return createFsharp(globalThis.__FABLE_STANDALONE__, assemblies);
|
|
63
|
+
})();
|
|
64
|
+
return (await fs)(files);
|
|
65
|
+
}
|
|
66
|
+
async function typescript(files)
|
|
67
|
+
{
|
|
68
|
+
libs ??= fetch(
|
|
69
|
+
new URL('./vendor/typescript-libs.json', import.meta.url),
|
|
70
|
+
).then(response => response.json());
|
|
71
|
+
return checkTypes(ts, files, await libs);
|
|
72
|
+
}
|
|
73
|
+
self.onmessage = async ({data}) =>
|
|
74
|
+
{
|
|
75
|
+
try
|
|
76
|
+
{
|
|
77
|
+
initialized ??= esbuild.initialize({
|
|
78
|
+
wasmURL: new URL('./vendor/esbuild.wasm', import.meta.url).href,
|
|
79
|
+
worker: false,
|
|
80
|
+
});
|
|
81
|
+
await initialized;
|
|
82
|
+
const result = await compileProject(data, {
|
|
83
|
+
esbuild,
|
|
84
|
+
readAsset,
|
|
85
|
+
fsharp,
|
|
86
|
+
typescript,
|
|
87
|
+
browserRuntime: source => browserRuntime(ts, source),
|
|
88
|
+
lawspec: async () =>
|
|
89
|
+
{
|
|
90
|
+
core ??= import('./lawspec-core.mjs').then(({createCompiler}) =>
|
|
91
|
+
createCompiler(),
|
|
92
|
+
);
|
|
93
|
+
return core;
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
postMessage({id: data.id, result});
|
|
97
|
+
}
|
|
98
|
+
catch (error)
|
|
99
|
+
{
|
|
100
|
+
postMessage({
|
|
101
|
+
id: data.id,
|
|
102
|
+
error: String(error?.message ?? error),
|
|
103
|
+
diagnostics: error.errors,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import {
|
|
2
|
+
implementationBinding,
|
|
3
|
+
fsharpAdapter,
|
|
4
|
+
adapterSource,
|
|
5
|
+
harnessModule,
|
|
6
|
+
} from './adapters.mjs';
|
|
7
|
+
import {harnessHostModules} from './harness-host.mjs';
|
|
8
|
+
import {bundle} from './bundle.mjs';
|
|
9
|
+
import {runnerEntry, supportSource, nodeTestSource} from './runner.mjs';
|
|
10
|
+
import {lawLabel} from './presentation.mjs';
|
|
11
|
+
/** Run mandatory definition admission and language checking before packaging authored and generated checks for isolated execution. ref:DEC-learn-course-preview */
|
|
12
|
+
export async function compileProject(request, services)
|
|
13
|
+
{
|
|
14
|
+
const {
|
|
15
|
+
language,
|
|
16
|
+
files,
|
|
17
|
+
mode = 'all',
|
|
18
|
+
seed = 424242,
|
|
19
|
+
path = '',
|
|
20
|
+
replayTest = null,
|
|
21
|
+
} = request;
|
|
22
|
+
if (!Number.isInteger(seed) || seed < -2147483648 || seed > 2147483647)
|
|
23
|
+
{
|
|
24
|
+
throw new Error('Seed must be a 32-bit integer');
|
|
25
|
+
}
|
|
26
|
+
if (!['all', 'examples', 'sample'].includes(mode))
|
|
27
|
+
{
|
|
28
|
+
throw new Error('Unsupported execution mode');
|
|
29
|
+
}
|
|
30
|
+
const diagnostics = [],
|
|
31
|
+
generated = [];
|
|
32
|
+
let modules = {},
|
|
33
|
+
lawResult = null;
|
|
34
|
+
// Admission is mandatory even for the separate authored-example mode.
|
|
35
|
+
const sources = Object.entries(files)
|
|
36
|
+
.filter(([path]) => path.endsWith('.lawspec'))
|
|
37
|
+
.map(([path, content]) => ({path, content}));
|
|
38
|
+
if (!sources.some(source => source.path === 'Tests.lawspec'))
|
|
39
|
+
{
|
|
40
|
+
throw new Error('Missing Tests.lawspec');
|
|
41
|
+
}
|
|
42
|
+
const compiler = await services.lawspec();
|
|
43
|
+
lawResult = await compiler.check({
|
|
44
|
+
languageProfile: '1.0-rc.2',
|
|
45
|
+
verification: {layers: []},
|
|
46
|
+
sources,
|
|
47
|
+
});
|
|
48
|
+
diagnostics.push(
|
|
49
|
+
...(lawResult.diagnostics ?? []).map(row => ({
|
|
50
|
+
...row,
|
|
51
|
+
severity: row.severity ?? 'error',
|
|
52
|
+
})),
|
|
53
|
+
);
|
|
54
|
+
if (diagnostics.some(row => row.severity === 'error'))
|
|
55
|
+
{
|
|
56
|
+
return {
|
|
57
|
+
diagnostics,
|
|
58
|
+
definitionValidation: lawResult.verification,
|
|
59
|
+
evidence: lawResult.evidence,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
let binding;
|
|
63
|
+
try
|
|
64
|
+
{
|
|
65
|
+
binding = implementationBinding(
|
|
66
|
+
lawResult,
|
|
67
|
+
sources.map(source => source.path),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
catch (error)
|
|
71
|
+
{
|
|
72
|
+
return {
|
|
73
|
+
diagnostics: [
|
|
74
|
+
{
|
|
75
|
+
severity: 'error',
|
|
76
|
+
code: 'LEARN_UNSUPPORTED_BINDING',
|
|
77
|
+
message: error.message,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
definitionValidation: lawResult.verification,
|
|
81
|
+
evidence: lawResult.evidence,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const fn = binding.name;
|
|
85
|
+
let propertyMetadata = {};
|
|
86
|
+
let checks = [];
|
|
87
|
+
generated.push({
|
|
88
|
+
path: 'adapter/binding.json',
|
|
89
|
+
content: JSON.stringify(binding, null, 2) + '\n',
|
|
90
|
+
});
|
|
91
|
+
if (language === 'fsharp')
|
|
92
|
+
{
|
|
93
|
+
const bridge = fsharpAdapter(binding);
|
|
94
|
+
const result = await services.fsharp({
|
|
95
|
+
'Solution.fs': files['Solution.fs'],
|
|
96
|
+
'Adapter.fs': bridge,
|
|
97
|
+
});
|
|
98
|
+
diagnostics.push(...result.diagnostics);
|
|
99
|
+
modules = result.modules;
|
|
100
|
+
generated.push(
|
|
101
|
+
{path: 'adapter/Adapter.fs', content: bridge},
|
|
102
|
+
...Object.entries(modules).map(([path, content]) => ({
|
|
103
|
+
path: 'fable/' + path,
|
|
104
|
+
content,
|
|
105
|
+
})),
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
else if (language === 'javascript' || language === 'typescript')
|
|
109
|
+
{
|
|
110
|
+
const ext = language === 'typescript' ? 'ts' : 'js';
|
|
111
|
+
modules = {[`Solution.${ext}`]: files[`Solution.${ext}`]};
|
|
112
|
+
if (language === 'typescript')
|
|
113
|
+
{
|
|
114
|
+
diagnostics.push(...(await services.typescript(modules)));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else
|
|
118
|
+
{
|
|
119
|
+
return {
|
|
120
|
+
diagnostics: [
|
|
121
|
+
{severity: 'error', message: 'Unsupported browser language'},
|
|
122
|
+
],
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (diagnostics.some(row => row.severity === 'error'))
|
|
126
|
+
{
|
|
127
|
+
return {diagnostics, definitionValidation: lawResult.verification};
|
|
128
|
+
}
|
|
129
|
+
{
|
|
130
|
+
const plan = await compiler.planGeneration({
|
|
131
|
+
languageProfile: '1.0-rc.2',
|
|
132
|
+
target: 'javascript',
|
|
133
|
+
verification: {layers: ['property']},
|
|
134
|
+
sources,
|
|
135
|
+
});
|
|
136
|
+
diagnostics.push(...(plan.diagnostics ?? []));
|
|
137
|
+
if (plan.diagnostics?.length)
|
|
138
|
+
{
|
|
139
|
+
return {diagnostics, definitionValidation: lawResult.verification};
|
|
140
|
+
}
|
|
141
|
+
for (const file of plan.files ?? [])
|
|
142
|
+
{
|
|
143
|
+
if (file.ownership !== 'user')
|
|
144
|
+
{
|
|
145
|
+
modules[file.path] = file.content;
|
|
146
|
+
generated.push(file);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
lawResult = plan;
|
|
150
|
+
checks = (plan.tests ?? []).map(test =>
|
|
151
|
+
{
|
|
152
|
+
const law = plan.laws.find(row => row.id === test.law);
|
|
153
|
+
return {
|
|
154
|
+
name: test.name,
|
|
155
|
+
label: law ? lawLabel(law.name) : test.label,
|
|
156
|
+
quantified: Boolean(law?.inputs.length),
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
propertyMetadata = Object.fromEntries(
|
|
160
|
+
(plan.laws ?? []).map(law => [
|
|
161
|
+
law.owner + '::' + law.name + ' property',
|
|
162
|
+
{
|
|
163
|
+
inputNames: law.inputs.map(input => input.name),
|
|
164
|
+
inputValues: Boolean(law.harness?.strategies?.length),
|
|
165
|
+
},
|
|
166
|
+
]),
|
|
167
|
+
);
|
|
168
|
+
// Every generated check calls the implementation through this checked
|
|
169
|
+
// bridge. Int32 values map exactly; lists cross explicitly.
|
|
170
|
+
const modulePath = harnessModule(plan, binding);
|
|
171
|
+
const depth = modulePath.split('/').length - 1;
|
|
172
|
+
modules[modulePath] =
|
|
173
|
+
`export {${fn}} from '${'../'.repeat(depth)}lesson-adapter.js';`;
|
|
174
|
+
generated.push({
|
|
175
|
+
path: 'adapter/' + modulePath,
|
|
176
|
+
content: modules[modulePath],
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (modules['src/lawspec_runtime.mjs'])
|
|
180
|
+
{
|
|
181
|
+
modules['src/lawspec_runtime.mjs'] = services.browserRuntime(
|
|
182
|
+
modules['src/lawspec_runtime.mjs'],
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
modules['lesson-adapter.js'] = adapterSource(binding, language);
|
|
186
|
+
generated.push({
|
|
187
|
+
path: 'adapter/lesson-adapter.js',
|
|
188
|
+
content: modules['lesson-adapter.js'],
|
|
189
|
+
});
|
|
190
|
+
modules['run-support.mjs'] = supportSource;
|
|
191
|
+
modules['fast-check.mjs'] =
|
|
192
|
+
`export * from 'fast-check-original';export {default,assert} from './run-support.mjs';`;
|
|
193
|
+
modules['node-test.mjs'] = nodeTestSource;
|
|
194
|
+
modules['assert.mjs'] = await services.readAsset('assert.mjs');
|
|
195
|
+
Object.assign(modules, harnessHostModules());
|
|
196
|
+
const testFiles = Object.keys(modules).filter(
|
|
197
|
+
name => name.startsWith('test/') && name.endsWith('.mjs'),
|
|
198
|
+
);
|
|
199
|
+
if (path && !replayTest)
|
|
200
|
+
{
|
|
201
|
+
throw new Error('A replay path must identify the failing LawSpec test');
|
|
202
|
+
}
|
|
203
|
+
modules['entry.mjs'] = runnerEntry({
|
|
204
|
+
testFiles,
|
|
205
|
+
seed,
|
|
206
|
+
path,
|
|
207
|
+
replayTest,
|
|
208
|
+
mode,
|
|
209
|
+
propertyMetadata,
|
|
210
|
+
});
|
|
211
|
+
const code = await bundle(
|
|
212
|
+
services.esbuild,
|
|
213
|
+
modules,
|
|
214
|
+
'entry.mjs',
|
|
215
|
+
services.readAsset,
|
|
216
|
+
);
|
|
217
|
+
return {
|
|
218
|
+
code,
|
|
219
|
+
diagnostics,
|
|
220
|
+
binding,
|
|
221
|
+
checks,
|
|
222
|
+
generated: generated.map(({path, content}) => ({path, content})),
|
|
223
|
+
definitionValidation: lawResult.verification,
|
|
224
|
+
evidence: lawResult.evidence ?? [],
|
|
225
|
+
execution:
|
|
226
|
+
language === 'fsharp'
|
|
227
|
+
? 'F# → Fable → JavaScript; LawSpec JS harness + fast-check'
|
|
228
|
+
: 'JavaScript execution; LawSpec JS harness + fast-check',
|
|
229
|
+
};
|
|
230
|
+
}
|