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/input-files.mjs
CHANGED
|
@@ -2,46 +2,111 @@
|
|
|
2
2
|
// Native implementations may depend on declared files outside their target
|
|
3
3
|
// directory. Component descriptions and native result keys share this walker.
|
|
4
4
|
import {createHash} from 'node:crypto';
|
|
5
|
-
import {lstat,readFile,readdir} from 'node:fs/promises';
|
|
5
|
+
import {lstat, readFile, readdir} from 'node:fs/promises';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
|
|
8
|
-
export const buildDirectories = new Set([
|
|
9
|
-
'.
|
|
10
|
-
'.
|
|
8
|
+
export const buildDirectories = new Set([
|
|
9
|
+
'.git',
|
|
10
|
+
'.lawspec',
|
|
11
|
+
'node_modules',
|
|
12
|
+
'dist',
|
|
13
|
+
'build',
|
|
14
|
+
'target',
|
|
15
|
+
'out',
|
|
16
|
+
'.gradle',
|
|
17
|
+
'bin',
|
|
18
|
+
'obj',
|
|
19
|
+
'TestResults',
|
|
20
|
+
'.stack-work',
|
|
21
|
+
'_build',
|
|
22
|
+
'deps',
|
|
23
|
+
'.elixir_ls',
|
|
24
|
+
'__pycache__',
|
|
25
|
+
'.hypothesis',
|
|
26
|
+
'.pytest_cache',
|
|
27
|
+
'.venv',
|
|
28
|
+
'venv',
|
|
29
|
+
'.idea',
|
|
30
|
+
'.vscode',
|
|
31
|
+
'.scala-build',
|
|
32
|
+
'.bsp',
|
|
33
|
+
'.bloop',
|
|
34
|
+
'.metals',
|
|
35
|
+
'.build',
|
|
36
|
+
'.swiftpm',
|
|
37
|
+
'.cpcache',
|
|
38
|
+
]);
|
|
11
39
|
|
|
12
40
|
// These outputs belong to the generated crypto builder; its sources and
|
|
13
41
|
// other priv/ assets still contribute to the native implementation identity.
|
|
14
|
-
export const cryptoBuildOutput = file =>
|
|
42
|
+
export const cryptoBuildOutput = file =>
|
|
43
|
+
/(?:^|\/)priv\/lawspec_crypto_native\.(?:so|dll)(?:\.build|\.\d+\.tmp)?$/.test(
|
|
44
|
+
file,
|
|
45
|
+
);
|
|
15
46
|
|
|
16
47
|
// Execution reports are observations, independent of implementation inputs.
|
|
17
48
|
// ref:DEC-completed-run-attestation
|
|
18
|
-
export function isAttestation(content)
|
|
19
|
-
|
|
49
|
+
export function isAttestation(content)
|
|
50
|
+
{
|
|
51
|
+
try
|
|
52
|
+
{
|
|
20
53
|
const value = JSON.parse(content);
|
|
21
|
-
return
|
|
22
|
-
|
|
54
|
+
return (
|
|
55
|
+
value !== null &&
|
|
56
|
+
typeof value === 'object' &&
|
|
57
|
+
value.format === 'environment-attestation'
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
catch
|
|
61
|
+
{
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
23
64
|
}
|
|
24
65
|
|
|
25
|
-
export async function fingerprintInputs(
|
|
26
|
-
|
|
66
|
+
export async function fingerprintInputs(
|
|
67
|
+
root,
|
|
68
|
+
inputs,
|
|
69
|
+
{generated = new Set()} = {},
|
|
70
|
+
)
|
|
71
|
+
{
|
|
72
|
+
if (
|
|
73
|
+
!Array.isArray(inputs) ||
|
|
74
|
+
inputs.some(entry => typeof entry !== 'string' || !entry)
|
|
75
|
+
)
|
|
27
76
|
throw new Error('Component inputs must be an array of nonempty paths');
|
|
28
77
|
const rows = new Map();
|
|
29
|
-
async function visit(file,relative)
|
|
78
|
+
async function visit(file, relative)
|
|
79
|
+
{
|
|
30
80
|
const info = await lstat(file);
|
|
31
|
-
if(info.isSymbolicLink())
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
81
|
+
if (info.isSymbolicLink())
|
|
82
|
+
throw new Error(
|
|
83
|
+
`Symbolic links are not supported in component inputs: ${relative}`,
|
|
84
|
+
);
|
|
85
|
+
if (info.isDirectory())
|
|
86
|
+
{
|
|
87
|
+
for (const entry of (await readdir(file)).sort())
|
|
88
|
+
{
|
|
89
|
+
if (buildDirectories.has(entry)) continue;
|
|
90
|
+
const next = relative + '/' + entry;
|
|
91
|
+
if (next.endsWith('testdata/rapid')) continue;
|
|
92
|
+
await visit(path.join(file, entry), next);
|
|
38
93
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
94
|
+
}
|
|
95
|
+
else if (
|
|
96
|
+
info.isFile() &&
|
|
97
|
+
!generated.has(path.resolve(file)) &&
|
|
98
|
+
!cryptoBuildOutput(relative)
|
|
99
|
+
)
|
|
100
|
+
{
|
|
101
|
+
const content = await readFile(file);
|
|
102
|
+
if (relative.endsWith('.json') && isAttestation(content.toString('utf8')))
|
|
103
|
+
return;
|
|
104
|
+
rows.set(relative, createHash('sha256').update(content).digest('hex'));
|
|
43
105
|
}
|
|
44
106
|
}
|
|
45
|
-
for(const entry of inputs)
|
|
46
|
-
|
|
107
|
+
for (const entry of inputs)
|
|
108
|
+
await visit(path.resolve(root, entry), entry.split(path.sep).join('/'));
|
|
109
|
+
return [...rows].sort(([left], [right]) =>
|
|
110
|
+
left < right ? -1 : left > right ? 1 : 0,
|
|
111
|
+
);
|
|
47
112
|
}
|
package/launcher.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// Generated from templates/npm/launcher.mjs by lawspec-dev generate. Do not edit.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import path from
|
|
2
|
+
import {mkdir, readFile} from 'node:fs/promises';
|
|
3
|
+
import {createHash} from 'node:crypto';
|
|
4
|
+
import path from 'node:path';
|
|
5
5
|
let compiled;
|
|
6
6
|
|
|
7
7
|
// GHC's JSFFI reactor reads these WASI arguments during initialization. Bound
|
|
8
8
|
// the heap below wasm32's address ceiling and compact the oldest generation
|
|
9
9
|
// in place instead of reserving a second copy near that ceiling.
|
|
10
10
|
// -with-rtsopts has no effect on this -no-hs-main reactor build.
|
|
11
|
-
const coreArguments = [
|
|
11
|
+
const coreArguments = ['lawspec', '+RTS', '-M3584m', '-c', '-RTS'];
|
|
12
12
|
|
|
13
13
|
// Instantiate the compiler core with a platform's WASI preview1 imports and
|
|
14
14
|
// serialize calls: the core handles one JSON request at a time.
|
|
15
|
-
async function instantiateCore(module, wasiImports, initialize)
|
|
15
|
+
async function instantiateCore(module, wasiImports, initialize)
|
|
16
|
+
{
|
|
16
17
|
const exports = {};
|
|
17
|
-
const jsffi = (await import(
|
|
18
|
+
const jsffi = (await import('./core_jsffi.js')).default;
|
|
18
19
|
const instance = await WebAssembly.instantiate(module, {
|
|
19
20
|
wasi_snapshot_preview1: wasiImports,
|
|
20
21
|
ghc_wasm_jsffi: jsffi(exports),
|
|
@@ -22,48 +23,88 @@ async function instantiateCore(module, wasiImports, initialize) {
|
|
|
22
23
|
Object.assign(exports, instance.exports);
|
|
23
24
|
initialize(instance);
|
|
24
25
|
let pending = Promise.resolve();
|
|
25
|
-
return
|
|
26
|
+
return input =>
|
|
27
|
+
{
|
|
26
28
|
const result = pending.then(async () =>
|
|
27
29
|
JSON.parse(await instance.exports.lawspec_call(JSON.stringify(input))),
|
|
28
30
|
);
|
|
29
31
|
// The queue needs completion only, not the previous generated project DTO.
|
|
30
|
-
pending = result.then(
|
|
32
|
+
pending = result.then(
|
|
33
|
+
() =>
|
|
34
|
+
{},
|
|
35
|
+
() =>
|
|
36
|
+
{},
|
|
37
|
+
);
|
|
31
38
|
return result;
|
|
32
39
|
};
|
|
33
40
|
}
|
|
34
41
|
|
|
35
|
-
export async function loadCore()
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
export async function loadCore()
|
|
43
|
+
{
|
|
44
|
+
const {WASI} = await import('node:wasi');
|
|
45
|
+
if (Number(process.versions.node.split('.')[0]) < 22)
|
|
46
|
+
throw new Error('LawSpec requires Node 22+');
|
|
47
|
+
compiled ??= readFile(new URL('./core.wasm', import.meta.url)).then(
|
|
48
|
+
async bytes => ({
|
|
49
|
+
module: await WebAssembly.compile(bytes),
|
|
50
|
+
build: createHash('sha256').update(bytes).digest('hex'),
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
53
|
+
const {module, build} = await compiled;
|
|
44
54
|
let activeRoot, invoke;
|
|
45
|
-
let pending=Promise.resolve();
|
|
46
|
-
const request=async input=>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
let pending = Promise.resolve();
|
|
56
|
+
const request = async input =>
|
|
57
|
+
{
|
|
58
|
+
const validCache = typeof input.cacheDirectory === 'string';
|
|
59
|
+
let root =
|
|
60
|
+
validCache && input.cacheDirectory
|
|
61
|
+
? path.resolve(input.cacheDirectory)
|
|
62
|
+
: null;
|
|
63
|
+
if (root)
|
|
64
|
+
try
|
|
65
|
+
{
|
|
66
|
+
await mkdir(root, {recursive: true});
|
|
67
|
+
}
|
|
68
|
+
catch
|
|
69
|
+
{
|
|
70
|
+
root = null;
|
|
71
|
+
}
|
|
50
72
|
// The requested host directory is an explicit mount, rather than an
|
|
51
73
|
// absolute WASI path accidentally interpreted below cwd. The binary
|
|
52
74
|
// identity separates persisted memos even within one package version.
|
|
53
|
-
if(!invoke||root!==activeRoot)
|
|
75
|
+
if (!invoke || root !== activeRoot)
|
|
76
|
+
{
|
|
54
77
|
const wasi = new WASI({
|
|
55
|
-
version:
|
|
56
|
-
|
|
78
|
+
version: 'preview1',
|
|
79
|
+
args: coreArguments,
|
|
80
|
+
env: {PWD: '/'},
|
|
81
|
+
preopens: {
|
|
82
|
+
'/': process.cwd(),
|
|
83
|
+
...(root ? {'/lawspec-cache': root} : {}),
|
|
84
|
+
},
|
|
57
85
|
});
|
|
58
|
-
invoke=await instantiateCore(module,wasi.wasiImport,instance=>
|
|
59
|
-
|
|
86
|
+
invoke = await instantiateCore(module, wasi.wasiImport, instance =>
|
|
87
|
+
wasi.initialize(instance),
|
|
88
|
+
);
|
|
89
|
+
activeRoot = root;
|
|
60
90
|
}
|
|
61
|
-
return invoke({
|
|
91
|
+
return invoke({
|
|
92
|
+
...input,
|
|
93
|
+
...(validCache
|
|
94
|
+
? {cacheDirectory: root ? `/lawspec-cache/${build}` : undefined}
|
|
95
|
+
: {}),
|
|
96
|
+
});
|
|
62
97
|
};
|
|
63
98
|
// Cache-root changes are serialized with calls on the active instance.
|
|
64
|
-
return input=>
|
|
65
|
-
|
|
66
|
-
pending
|
|
99
|
+
return input =>
|
|
100
|
+
{
|
|
101
|
+
const result = pending.then(() => request(input));
|
|
102
|
+
pending = result.then(
|
|
103
|
+
() =>
|
|
104
|
+
{},
|
|
105
|
+
() =>
|
|
106
|
+
{},
|
|
107
|
+
);
|
|
67
108
|
return result;
|
|
68
109
|
};
|
|
69
110
|
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
const commonName = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
2
|
+
const reserved = new Set([
|
|
3
|
+
'abstract',
|
|
4
|
+
'and',
|
|
5
|
+
'as',
|
|
6
|
+
'assert',
|
|
7
|
+
'base',
|
|
8
|
+
'begin',
|
|
9
|
+
'class',
|
|
10
|
+
'default',
|
|
11
|
+
'delegate',
|
|
12
|
+
'do',
|
|
13
|
+
'done',
|
|
14
|
+
'downcast',
|
|
15
|
+
'downto',
|
|
16
|
+
'elif',
|
|
17
|
+
'else',
|
|
18
|
+
'end',
|
|
19
|
+
'exception',
|
|
20
|
+
'extern',
|
|
21
|
+
'false',
|
|
22
|
+
'finally',
|
|
23
|
+
'fixed',
|
|
24
|
+
'for',
|
|
25
|
+
'fun',
|
|
26
|
+
'function',
|
|
27
|
+
'global',
|
|
28
|
+
'if',
|
|
29
|
+
'in',
|
|
30
|
+
'inherit',
|
|
31
|
+
'inline',
|
|
32
|
+
'interface',
|
|
33
|
+
'internal',
|
|
34
|
+
'lazy',
|
|
35
|
+
'let',
|
|
36
|
+
'match',
|
|
37
|
+
'member',
|
|
38
|
+
'module',
|
|
39
|
+
'mutable',
|
|
40
|
+
'namespace',
|
|
41
|
+
'new',
|
|
42
|
+
'null',
|
|
43
|
+
'of',
|
|
44
|
+
'open',
|
|
45
|
+
'or',
|
|
46
|
+
'override',
|
|
47
|
+
'private',
|
|
48
|
+
'public',
|
|
49
|
+
'rec',
|
|
50
|
+
'return',
|
|
51
|
+
'sig',
|
|
52
|
+
'static',
|
|
53
|
+
'struct',
|
|
54
|
+
'then',
|
|
55
|
+
'to',
|
|
56
|
+
'true',
|
|
57
|
+
'try',
|
|
58
|
+
'type',
|
|
59
|
+
'upcast',
|
|
60
|
+
'use',
|
|
61
|
+
'val',
|
|
62
|
+
'void',
|
|
63
|
+
'when',
|
|
64
|
+
'while',
|
|
65
|
+
'with',
|
|
66
|
+
'yield',
|
|
67
|
+
]);
|
|
68
|
+
function shape(type)
|
|
69
|
+
{
|
|
70
|
+
if (
|
|
71
|
+
type?.kind === 'constructor' &&
|
|
72
|
+
type.name === 'Bool' &&
|
|
73
|
+
type.arguments.length === 0
|
|
74
|
+
)
|
|
75
|
+
{
|
|
76
|
+
return 'boolean';
|
|
77
|
+
}
|
|
78
|
+
if (
|
|
79
|
+
type?.kind === 'constructor' &&
|
|
80
|
+
type.name === 'Int32' &&
|
|
81
|
+
type.arguments.length === 0
|
|
82
|
+
)
|
|
83
|
+
{
|
|
84
|
+
return 'integer';
|
|
85
|
+
}
|
|
86
|
+
if (
|
|
87
|
+
type?.kind === 'constructor' &&
|
|
88
|
+
type.name === 'List' &&
|
|
89
|
+
type.arguments.length === 1 &&
|
|
90
|
+
type.arguments[0].kind === 'type' &&
|
|
91
|
+
shape(type.arguments[0].type) === 'integer'
|
|
92
|
+
)
|
|
93
|
+
{
|
|
94
|
+
return 'list';
|
|
95
|
+
}
|
|
96
|
+
throw new Error(
|
|
97
|
+
'Unsupported browser adapter type: ' +
|
|
98
|
+
JSON.stringify(type) +
|
|
99
|
+
'. The preview supports Int32, Bool and List Int32.',
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
/** Derive the implementation boundary from checked declarations, excluding functions whose definitions LawSpec already provides. ref:DEC-learn-generated-boundaries */
|
|
103
|
+
export function implementationBinding(checked, sourcePaths)
|
|
104
|
+
{
|
|
105
|
+
const defined = new Set((checked.definitions ?? []).map(row => row.id));
|
|
106
|
+
const candidates = (checked.units ?? [])
|
|
107
|
+
.flatMap(unit =>
|
|
108
|
+
unit.declarations.map(declaration => ({unit: unit.id, declaration})),
|
|
109
|
+
)
|
|
110
|
+
.filter(
|
|
111
|
+
({declaration}) =>
|
|
112
|
+
declaration.origin?.kind === 'source' &&
|
|
113
|
+
(sourcePaths ?? ['Tests.lawspec']).includes(
|
|
114
|
+
declaration.origin.span?.start.file,
|
|
115
|
+
) &&
|
|
116
|
+
!defined.has(declaration.id),
|
|
117
|
+
);
|
|
118
|
+
if (candidates.length !== 1)
|
|
119
|
+
{
|
|
120
|
+
throw new Error(
|
|
121
|
+
`Unsupported browser adapter project: expected one implementation declaration, found ${candidates.length}.`,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
const {unit, declaration} = candidates[0];
|
|
125
|
+
if (!commonName.test(declaration.name) || reserved.has(declaration.name))
|
|
126
|
+
{
|
|
127
|
+
throw new Error(
|
|
128
|
+
'Unsupported cross-language implementation name: ' + declaration.name,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
let result = declaration.type;
|
|
132
|
+
const inputs = [];
|
|
133
|
+
while (result.kind === 'function')
|
|
134
|
+
{
|
|
135
|
+
inputs.push(shape(result.parameter));
|
|
136
|
+
result = result.result;
|
|
137
|
+
}
|
|
138
|
+
if (inputs.includes('boolean'))
|
|
139
|
+
{
|
|
140
|
+
throw new Error(
|
|
141
|
+
'Unsupported browser generator input: Bool; Boolean results are supported.',
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
if (
|
|
145
|
+
!inputs.length ||
|
|
146
|
+
inputs.length > 8 ||
|
|
147
|
+
(inputs.length > 1 && inputs.some(value => value !== 'integer'))
|
|
148
|
+
)
|
|
149
|
+
{
|
|
150
|
+
throw new Error(
|
|
151
|
+
'Unsupported browser adapter signature: multiple inputs must be Int32.',
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
declaration: declaration.id,
|
|
156
|
+
unit,
|
|
157
|
+
name: declaration.name,
|
|
158
|
+
inputs,
|
|
159
|
+
input: inputs.length > 1 ? 'tuple' : inputs[0],
|
|
160
|
+
output: shape(result),
|
|
161
|
+
checkedType: declaration.type,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/** Emit the F# bridge from the checked input/result shapes; Fable checks the bridge together with learner code. ref:DEC-learn-generated-boundaries */
|
|
165
|
+
export function fsharpAdapter(binding)
|
|
166
|
+
{
|
|
167
|
+
const inputs = binding.inputs ?? [binding.input];
|
|
168
|
+
const inputType =
|
|
169
|
+
inputs.length > 1 || binding.input === 'list' ? 'int array' : 'int';
|
|
170
|
+
const arguments_ =
|
|
171
|
+
inputs.length > 1
|
|
172
|
+
? inputs.map((_, i) => `input[${i}]`).join(' ')
|
|
173
|
+
: binding.input === 'list'
|
|
174
|
+
? '(Array.toList input)'
|
|
175
|
+
: 'input';
|
|
176
|
+
const resultType =
|
|
177
|
+
binding.output === 'list'
|
|
178
|
+
? 'int array'
|
|
179
|
+
: binding.output === 'boolean'
|
|
180
|
+
? 'bool'
|
|
181
|
+
: 'int';
|
|
182
|
+
return `module Adapter\nlet call (input: ${inputType}) : ${resultType} = Solution.${binding.name} ${arguments_}${binding.output === 'list' ? ' |> List.toArray' : ''}\n`;
|
|
183
|
+
}
|
|
184
|
+
/** Emit the typed implementation boundary only; every assertion comes from generated LawSpec tests. ref:DEC-learn-tests-in-lawspec */
|
|
185
|
+
export function adapterSource(binding, language)
|
|
186
|
+
{
|
|
187
|
+
const raw =
|
|
188
|
+
language === 'fsharp'
|
|
189
|
+
? 'Adapter.js'
|
|
190
|
+
: `Solution.${language === 'typescript' ? 'ts' : 'js'}`;
|
|
191
|
+
const inputs = binding.inputs ?? [binding.input];
|
|
192
|
+
const convert = value =>
|
|
193
|
+
value === 'integer' ? 'integer' : value === 'boolean' ? 'boolean' : 'list';
|
|
194
|
+
const validateInput =
|
|
195
|
+
inputs.length > 1 ? 'tuple(input)' : `${convert(binding.input)}(input)`;
|
|
196
|
+
const args =
|
|
197
|
+
inputs.length > 1
|
|
198
|
+
? inputs.map((value, i) => `${convert(value)}(input[${i}])`).join(', ')
|
|
199
|
+
: `${convert(binding.input)}(input)`;
|
|
200
|
+
const invoke =
|
|
201
|
+
language === 'fsharp'
|
|
202
|
+
? `solution.call(input)`
|
|
203
|
+
: `solution.${binding.name}(${args})`;
|
|
204
|
+
return `import * as solution from './${raw}';
|
|
205
|
+
const integer=x=>{if(!Number.isInteger(x)||x< -2147483648||x>2147483647)throw new TypeError('Adapter expects Int32');return x;};
|
|
206
|
+
const boolean=x=>{if(typeof x!=='boolean')throw new TypeError('Adapter expects Bool');return x;};
|
|
207
|
+
const list=xs=>{if(!Array.isArray(xs))throw new TypeError('Adapter expects an integer list');return xs.map(integer);};
|
|
208
|
+
const tuple=xs=>{if(!Array.isArray(xs)||xs.length!==${inputs.length})throw new TypeError('Adapter expects ${inputs.length} arguments');return xs.map(integer);};
|
|
209
|
+
export const call=input=>{input=${validateInput};const output=${convert(binding.output)}(${invoke});globalThis.__lessonObserveCall?.(input,output);return output;};
|
|
210
|
+
${inputs.length > 1 ? `export const ${binding.name}=(...inputs)=>call(inputs);` : `export {call as ${binding.name}};`}`;
|
|
211
|
+
}
|
|
212
|
+
/** Use the compiler's actual user-owned module path when wiring generated tests to the checked implementation. ref:DEC-learn-generated-boundaries */
|
|
213
|
+
export function harnessModule(plan, binding)
|
|
214
|
+
{
|
|
215
|
+
const expected = 'src/' + binding.unit.split('.').join('/') + '.mjs';
|
|
216
|
+
const files = plan.files.filter(
|
|
217
|
+
file => file.placement === 'source' && file.path === expected,
|
|
218
|
+
);
|
|
219
|
+
if (files.length !== 1)
|
|
220
|
+
{
|
|
221
|
+
throw new Error(
|
|
222
|
+
`Unsupported browser module graph: expected one native implementation module, found ${files.length}.`,
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
return files[0].path;
|
|
226
|
+
}
|