lawspec 0.30.0 → 0.31.1
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 +405 -1
- package/README.md +19 -7
- package/api.mjs +1 -0
- package/beam-doctor.mjs +2 -2
- package/bin/lawspec.mjs +104 -96
- package/build.json +498 -406
- package/component-packages.mjs +339 -0
- package/component.d.ts +46 -0
- package/component.mjs +208 -0
- package/core.wasm +2 -2
- package/core_jsffi.js +5 -5
- package/examples/native-payments/clojure/lawspec.edn +48 -0
- package/examples/native-payments/clojure/src/domain/payments.clj +1 -1
- package/examples/native-payments/clojure/test/domain/payment_generators.clj +1 -1
- package/examples/native-payments/csharp/lawspec.edn +48 -0
- package/examples/native-payments/elixir/lawspec.edn +123 -0
- package/examples/native-payments/erlang/lawspec.edn +128 -0
- package/examples/native-payments/fsharp/lawspec.edn +123 -0
- package/examples/native-payments/gleam/lawspec.edn +123 -0
- package/examples/native-payments/go/lawspec.edn +123 -0
- package/examples/native-payments/groovy/lawspec.edn +123 -0
- package/examples/native-payments/haskell/lawspec.edn +123 -0
- package/examples/native-payments/java/lawspec.edn +123 -0
- package/examples/native-payments/javascript/lawspec.edn +123 -0
- package/examples/native-payments/kotlin/lawspec.edn +123 -0
- package/examples/native-payments/prolog/lawspec.edn +48 -0
- package/examples/native-payments/python/lawspec.edn +123 -0
- package/examples/native-payments/rust/lawspec.edn +124 -0
- package/examples/native-payments/scala/lawspec.edn +123 -0
- package/examples/native-payments/swift/lawspec.edn +123 -0
- package/examples/native-payments/typescript/lawspec.edn +123 -0
- package/examples/packages/orders/lawspec.edn +25 -0
- package/examples/packages/shop-domain/lawspec.edn +13 -0
- package/examples/packages/shop-tax-1/lawspec.edn +9 -0
- package/examples/packages/shop-tax-2/lawspec.edn +9 -0
- package/examples/specs/handler_bindings.lawspec +2 -2
- package/files.mjs +2 -1
- package/go.mod +4 -0
- package/index.d.ts +135 -2
- package/input-files.mjs +47 -0
- package/launcher.mjs +33 -13
- 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 +8187 -0
- package/learn/curriculum.json +2952 -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.5arcua4vy0.wasm +0 -0
- package/learn/vendor/fantomas/LawSpec.Learn.Formatter.u1ne3a6xd2.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 +1358 -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 +10 -5
- package/native-evidence.mjs +50 -15
- package/native-examples.mjs +8 -7
- package/native-host.mjs +71 -0
- package/package.json +10 -4
- package/proof.d.ts +8 -2
- package/proof.mjs +183 -31
- package/scala-build-state.mjs +59 -0
- package/templates.mjs +242 -2
- package/test-command.mjs +192 -60
- package/builtin-data-names.mjs +0 -73
- package/examples/native-payments/clojure/lawspec.json +0 -62
- package/examples/native-payments/csharp/lawspec.json +0 -62
- package/examples/native-payments/elixir/lawspec.json +0 -160
- package/examples/native-payments/erlang/lawspec.json +0 -159
- package/examples/native-payments/fsharp/lawspec.json +0 -178
- package/examples/native-payments/gleam/lawspec.json +0 -160
- package/examples/native-payments/go/lawspec.json +0 -147
- package/examples/native-payments/groovy/lawspec.json +0 -176
- package/examples/native-payments/haskell/lawspec.json +0 -160
- package/examples/native-payments/java/lawspec.json +0 -176
- package/examples/native-payments/javascript/lawspec.json +0 -160
- package/examples/native-payments/kotlin/lawspec.json +0 -176
- package/examples/native-payments/prolog/lawspec.json +0 -20
- package/examples/native-payments/python/lawspec.json +0 -160
- package/examples/native-payments/rust/lawspec.json +0 -178
- package/examples/native-payments/scala/lawspec.json +0 -176
- package/examples/native-payments/swift/lawspec.json +0 -165
- package/examples/native-payments/typescript/lawspec.json +0 -160
- package/examples/packages/orders/lawspec.json +0 -27
- package/examples/packages/shop-domain/lawspec-package.json +0 -7
- package/examples/packages/shop-tax-1/lawspec-package.json +0 -5
- package/examples/packages/shop-tax-2/lawspec-package.json +0 -5
- package/explain.mjs +0 -114
- package/expression-presentation.mjs +0 -333
- package/positional-fields.mjs +0 -13
- package/typed-presentation.mjs +0 -165
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Keep the .NET runtime in its own worker and initialize it before accepting work.
|
|
2
|
+
// This worker formats source; learner F# execution remains Fable/JavaScript.
|
|
3
|
+
// ref:DEC-learn-format-before-run
|
|
4
|
+
import {dotnet} from './vendor/fantomas/dotnet.js';
|
|
5
|
+
const runtime = await dotnet.create();
|
|
6
|
+
const exports = await runtime.getAssemblyExports(
|
|
7
|
+
runtime.getConfig().mainAssemblyName,
|
|
8
|
+
);
|
|
9
|
+
const formatter = exports.LawSpec.Learn.Formatter;
|
|
10
|
+
self.addEventListener('message', async ({data}) =>
|
|
11
|
+
{
|
|
12
|
+
try
|
|
13
|
+
{
|
|
14
|
+
postMessage({
|
|
15
|
+
id: data.id,
|
|
16
|
+
source: await formatter.FormatFSharp(data.source),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
catch (error)
|
|
20
|
+
{
|
|
21
|
+
postMessage({id: data.id, error: String(error.message ?? error)});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
postMessage({ready: true});
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// Formatting is trusted tooling; it never executes learner source.
|
|
2
|
+
// ref:DEC-learn-format-before-run ref:DEC-google-style-allman
|
|
3
|
+
import * as prettier from './vendor/prettier/standalone.mjs';
|
|
4
|
+
import * as babel from './vendor/prettier/babel.mjs';
|
|
5
|
+
import * as estree from './vendor/prettier/estree.mjs';
|
|
6
|
+
import * as typescript from './vendor/prettier/typescript.mjs';
|
|
7
|
+
import braceStyle from './vendor/prettier/brace-style.mjs';
|
|
8
|
+
import {formatWeb} from './web-format.mjs';
|
|
9
|
+
let core;
|
|
10
|
+
let fantomas;
|
|
11
|
+
const style = fetch(new URL('./style-options.json', import.meta.url)).then(
|
|
12
|
+
response =>
|
|
13
|
+
{
|
|
14
|
+
if (!response.ok)
|
|
15
|
+
{
|
|
16
|
+
throw new Error('Missing packaged style options');
|
|
17
|
+
}
|
|
18
|
+
return response.json();
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
async function formatFSharp(source)
|
|
22
|
+
{
|
|
23
|
+
fantomas ??= new Promise((resolve, reject) =>
|
|
24
|
+
{
|
|
25
|
+
const worker = new Worker(
|
|
26
|
+
new URL('./fantomas-worker.mjs', import.meta.url),
|
|
27
|
+
{type: 'module'},
|
|
28
|
+
);
|
|
29
|
+
const ready = ({data}) =>
|
|
30
|
+
{
|
|
31
|
+
if (data.ready)
|
|
32
|
+
{
|
|
33
|
+
worker.removeEventListener('message', ready);
|
|
34
|
+
worker.removeEventListener('error', failed);
|
|
35
|
+
resolve(worker);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const failed = event => reject(new Error(event.message));
|
|
39
|
+
worker.addEventListener('message', ready);
|
|
40
|
+
worker.addEventListener('error', failed, {once: true});
|
|
41
|
+
});
|
|
42
|
+
const worker = await fantomas;
|
|
43
|
+
return new Promise((resolve, reject) =>
|
|
44
|
+
{
|
|
45
|
+
const clean = () =>
|
|
46
|
+
{
|
|
47
|
+
worker.removeEventListener('message', received);
|
|
48
|
+
worker.removeEventListener('error', failed);
|
|
49
|
+
};
|
|
50
|
+
const received = ({data}) =>
|
|
51
|
+
{
|
|
52
|
+
clean();
|
|
53
|
+
data.error ? reject(new Error(data.error)) : resolve(data.source);
|
|
54
|
+
};
|
|
55
|
+
const failed = event =>
|
|
56
|
+
{
|
|
57
|
+
clean();
|
|
58
|
+
reject(new Error(event.message));
|
|
59
|
+
};
|
|
60
|
+
worker.addEventListener('message', received);
|
|
61
|
+
worker.addEventListener('error', failed);
|
|
62
|
+
worker.postMessage({id: 1, source});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
self.onmessage = async ({data}) =>
|
|
66
|
+
{
|
|
67
|
+
const files = {...data.files};
|
|
68
|
+
const diagnostics = [];
|
|
69
|
+
try
|
|
70
|
+
{
|
|
71
|
+
postMessage({
|
|
72
|
+
id: data.id,
|
|
73
|
+
progress: 'Formatting LawSpec files on this device…',
|
|
74
|
+
});
|
|
75
|
+
core ??= import('./lawspec-core.mjs').then(({createCompiler}) =>
|
|
76
|
+
createCompiler(),
|
|
77
|
+
);
|
|
78
|
+
const sources = Object.entries(files)
|
|
79
|
+
.filter(([path]) => path.endsWith('.lawspec'))
|
|
80
|
+
.map(([path, content]) => ({path, content}));
|
|
81
|
+
const lawspec = await (
|
|
82
|
+
await core
|
|
83
|
+
).format({
|
|
84
|
+
languageProfile: '1.0-rc.2',
|
|
85
|
+
compile: false,
|
|
86
|
+
sources,
|
|
87
|
+
});
|
|
88
|
+
diagnostics.push(...(lawspec.diagnostics ?? []));
|
|
89
|
+
if (lawspec.formattedSources)
|
|
90
|
+
{
|
|
91
|
+
for (const source of lawspec.formattedSources)
|
|
92
|
+
{
|
|
93
|
+
files[source.path] = source.content;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
for (const [path, content] of Object.entries(files))
|
|
97
|
+
{
|
|
98
|
+
if (path.endsWith('.lawspec'))
|
|
99
|
+
{
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
try
|
|
103
|
+
{
|
|
104
|
+
postMessage({
|
|
105
|
+
id: data.id,
|
|
106
|
+
progress: 'Formatting ' + path + ' on this device…',
|
|
107
|
+
});
|
|
108
|
+
if (path.endsWith('.fs'))
|
|
109
|
+
{
|
|
110
|
+
files[path] = await formatFSharp(content);
|
|
111
|
+
}
|
|
112
|
+
else if (/\.[cm]?[jt]s$/.test(path))
|
|
113
|
+
{
|
|
114
|
+
files[path] = await formatWeb(content, path, {
|
|
115
|
+
prettier,
|
|
116
|
+
plugins: [babel, estree, typescript, braceStyle],
|
|
117
|
+
style: await style,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else
|
|
121
|
+
{
|
|
122
|
+
throw new Error('Unsupported lesson source: ' + path);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (error)
|
|
126
|
+
{
|
|
127
|
+
diagnostics.push({
|
|
128
|
+
code: 'LEARN_FORMAT_SYNTAX',
|
|
129
|
+
severity: 'error',
|
|
130
|
+
message: String(error.message ?? error),
|
|
131
|
+
at: {
|
|
132
|
+
file: path,
|
|
133
|
+
line: error.loc?.start?.line ?? 1,
|
|
134
|
+
column: (error.loc?.start?.column ?? 0) + 1,
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
postMessage({
|
|
140
|
+
id: data.id,
|
|
141
|
+
result: diagnostics.length ? {diagnostics} : {files, diagnostics},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
catch (error)
|
|
145
|
+
{
|
|
146
|
+
postMessage({id: data.id, error: String(error.message ?? error)});
|
|
147
|
+
}
|
|
148
|
+
};
|
package/learn/fsharp.mjs
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Fable's own manager and printer perform type checking and emission.
|
|
2
|
+
/** Check the exercise and typed bridge with Fable, then emit JavaScript through its PrintTargetAst API. ref:DEC-learn-course-preview */
|
|
3
|
+
export async function createFsharp(fable, assemblies)
|
|
4
|
+
{
|
|
5
|
+
const manager = fable.init();
|
|
6
|
+
const names = Object.keys(assemblies).map(name => name.replace(/\.dll$/, ''));
|
|
7
|
+
const checker = manager.CreateChecker(
|
|
8
|
+
names,
|
|
9
|
+
name =>
|
|
10
|
+
{
|
|
11
|
+
const bytes = assemblies[name.endsWith('.dll') ? name : name + '.dll'];
|
|
12
|
+
if (!bytes)
|
|
13
|
+
{
|
|
14
|
+
throw new Error('Missing F# assembly: ' + name);
|
|
15
|
+
}
|
|
16
|
+
return bytes;
|
|
17
|
+
},
|
|
18
|
+
['--langversion:preview'],
|
|
19
|
+
);
|
|
20
|
+
return async files =>
|
|
21
|
+
{
|
|
22
|
+
const names = Object.keys(files),
|
|
23
|
+
diagnostics = [];
|
|
24
|
+
const checked = manager.ParseAndCheckProject(
|
|
25
|
+
checker,
|
|
26
|
+
'Lesson.fsproj',
|
|
27
|
+
names,
|
|
28
|
+
Object.values(files),
|
|
29
|
+
);
|
|
30
|
+
const convert = error => ({
|
|
31
|
+
file: error.FileName,
|
|
32
|
+
line: error.StartLine,
|
|
33
|
+
column: error.StartColumn + 1,
|
|
34
|
+
severity: error.IsWarning ? 'warning' : 'error',
|
|
35
|
+
message: error.Message,
|
|
36
|
+
});
|
|
37
|
+
diagnostics.push(...manager.GetErrors(checked).map(convert));
|
|
38
|
+
const modules = {};
|
|
39
|
+
if (diagnostics.some(row => row.severity === 'error'))
|
|
40
|
+
{
|
|
41
|
+
return {diagnostics, modules};
|
|
42
|
+
}
|
|
43
|
+
for (const name of names)
|
|
44
|
+
{
|
|
45
|
+
const ast = manager.CompileToTargetAst(
|
|
46
|
+
'fable-library',
|
|
47
|
+
checked,
|
|
48
|
+
name,
|
|
49
|
+
false,
|
|
50
|
+
'javascript',
|
|
51
|
+
);
|
|
52
|
+
diagnostics.push(...ast.FableErrors.map(convert));
|
|
53
|
+
let code = '';
|
|
54
|
+
const writer = {
|
|
55
|
+
Dispose()
|
|
56
|
+
{},
|
|
57
|
+
AddSourceMapping()
|
|
58
|
+
{},
|
|
59
|
+
MakeImportPath: path =>
|
|
60
|
+
path.endsWith('.fs') ? './' + path.slice(0, -3) + '.js' : path,
|
|
61
|
+
Write: text => context =>
|
|
62
|
+
{
|
|
63
|
+
code += text;
|
|
64
|
+
context.onSuccess();
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
await new Promise((resolve, reject) =>
|
|
68
|
+
manager.PrintTargetAst(
|
|
69
|
+
ast,
|
|
70
|
+
writer,
|
|
71
|
+
)({
|
|
72
|
+
onSuccess: resolve,
|
|
73
|
+
onError: reject,
|
|
74
|
+
onCancel: reject,
|
|
75
|
+
cancelToken: {isCancelled: false},
|
|
76
|
+
trampoline: {incrementAndCheck: () => false, hijack: fn => fn()},
|
|
77
|
+
}),
|
|
78
|
+
);
|
|
79
|
+
modules[name.replace(/\.fs$/, '.js')] = code;
|
|
80
|
+
}
|
|
81
|
+
return {diagnostics, modules};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Browser host services used by the generated LawSpec JS harness. No Node IO.
|
|
2
|
+
// ref:DEC-learn-tests-in-lawspec
|
|
3
|
+
/** Supply explicitly bounded in-memory reports and sequential context storage to the unchanged generated harness. ref:DEC-learn-tests-in-lawspec */
|
|
4
|
+
export function harnessHostModules()
|
|
5
|
+
{
|
|
6
|
+
return {
|
|
7
|
+
'node:fs': `const root='/browser-stats';
|
|
8
|
+
const refuse=()=>{const error=new Error('unsupported: native filesystem access is unavailable in browser lessons');error.code='LEARN_UNSUPPORTED_HOST';throw error;};
|
|
9
|
+
export function mkdirSync(path){if(path!==root)refuse();}
|
|
10
|
+
export function writeFileSync(path,text){if(!path.startsWith(root+'/')||path.includes('/../'))refuse();(globalThis.__harnessReports??=[]).push(JSON.parse(text));}`,
|
|
11
|
+
'node:path': `export const join=(...parts)=>parts.join('/');`,
|
|
12
|
+
'node:async_hooks': `export class AsyncLocalStorage{
|
|
13
|
+
getStore(){return this.value;}
|
|
14
|
+
run(value,callback){
|
|
15
|
+
if(this.active){const error=new Error('unsupported: overlapping asynchronous harness contexts in the sequential browser host');error.code='LEARN_UNSUPPORTED_HOST';throw error;}
|
|
16
|
+
this.active=true;this.value=value;
|
|
17
|
+
const clear=()=>{this.active=false;this.value=undefined;};
|
|
18
|
+
try{const result=callback();if(result&&typeof result.then==='function')return Promise.resolve(result).finally(clear);clear();return result;}catch(error){clear();throw error;}
|
|
19
|
+
}
|
|
20
|
+
}`,
|
|
21
|
+
};
|
|
22
|
+
}
|
package/learn/index.html
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" data-workspace-view="read">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta
|
|
7
|
+
http-equiv="Content-Security-Policy"
|
|
8
|
+
content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; font-src 'self' data:; worker-src 'self' blob:; frame-src 'self' blob:; connect-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'none'"
|
|
9
|
+
/>
|
|
10
|
+
<script src="./theme.js"></script>
|
|
11
|
+
<link
|
|
12
|
+
rel="preload"
|
|
13
|
+
href="./vendor/fonts/overpass-latin-600-normal.woff2"
|
|
14
|
+
as="font"
|
|
15
|
+
type="font/woff2"
|
|
16
|
+
crossorigin
|
|
17
|
+
/>
|
|
18
|
+
<link
|
|
19
|
+
rel="preload"
|
|
20
|
+
href="./vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2"
|
|
21
|
+
as="font"
|
|
22
|
+
type="font/woff2"
|
|
23
|
+
crossorigin
|
|
24
|
+
/>
|
|
25
|
+
<link
|
|
26
|
+
rel="preload"
|
|
27
|
+
href="./vendor/fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2"
|
|
28
|
+
as="font"
|
|
29
|
+
type="font/woff2"
|
|
30
|
+
crossorigin
|
|
31
|
+
/>
|
|
32
|
+
<title>Learn LawSpec · Coding foundations</title>
|
|
33
|
+
<link rel="stylesheet" href="./style.css" />
|
|
34
|
+
<link rel="stylesheet" href="./vendor/editor.css" />
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<header>
|
|
38
|
+
<a class="brand" href="./"
|
|
39
|
+
>L<span>LawSpec <b>Learn</b></span></a
|
|
40
|
+
>
|
|
41
|
+
<fieldset id="theme-picker">
|
|
42
|
+
<legend class="sr-only">Color theme</legend>
|
|
43
|
+
<label
|
|
44
|
+
><input type="radio" name="color-theme" value="auto" checked /><span
|
|
45
|
+
>Auto</span
|
|
46
|
+
></label
|
|
47
|
+
><label
|
|
48
|
+
><input type="radio" name="color-theme" value="light" /><span
|
|
49
|
+
>Light</span
|
|
50
|
+
></label
|
|
51
|
+
><label
|
|
52
|
+
><input type="radio" name="color-theme" value="dark" /><span
|
|
53
|
+
>Dark</span
|
|
54
|
+
></label
|
|
55
|
+
>
|
|
56
|
+
</fieldset>
|
|
57
|
+
</header>
|
|
58
|
+
<nav id="workspace-views" role="tablist" aria-label="Workspace view">
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
role="tab"
|
|
62
|
+
data-view="course"
|
|
63
|
+
aria-controls="course-panel"
|
|
64
|
+
aria-selected="false"
|
|
65
|
+
tabindex="-1"
|
|
66
|
+
>
|
|
67
|
+
Course</button
|
|
68
|
+
><button
|
|
69
|
+
type="button"
|
|
70
|
+
role="tab"
|
|
71
|
+
data-view="read"
|
|
72
|
+
aria-controls="lesson-panel"
|
|
73
|
+
aria-selected="true"
|
|
74
|
+
>
|
|
75
|
+
Read</button
|
|
76
|
+
><button
|
|
77
|
+
type="button"
|
|
78
|
+
role="tab"
|
|
79
|
+
data-view="code"
|
|
80
|
+
aria-controls="code-panel"
|
|
81
|
+
aria-selected="false"
|
|
82
|
+
tabindex="-1"
|
|
83
|
+
>
|
|
84
|
+
Code & results
|
|
85
|
+
</button>
|
|
86
|
+
</nav>
|
|
87
|
+
<div class="layout">
|
|
88
|
+
<aside id="course-panel">
|
|
89
|
+
<h2 class="course-heading">Course outline</h2>
|
|
90
|
+
<nav id="lessons" aria-label="Course outline"></nav>
|
|
91
|
+
<div class="course-utilities">
|
|
92
|
+
<details id="progress-panel">
|
|
93
|
+
<summary>Your progress</summary>
|
|
94
|
+
<p>Code and milestones save automatically on this device.</p>
|
|
95
|
+
<p id="backup-help">
|
|
96
|
+
Back up all saved lessons, steps, languages and notebooks for this
|
|
97
|
+
course version as a JSON file, including kept regression cases in
|
|
98
|
+
Laws. Nothing is uploaded. Theme preferences, run seeds and
|
|
99
|
+
execution results are excluded.
|
|
100
|
+
</p>
|
|
101
|
+
<div class="progress-actions">
|
|
102
|
+
<button id="export" aria-describedby="backup-help">
|
|
103
|
+
Back up progress</button
|
|
104
|
+
><button id="restore" aria-describedby="restore-help">
|
|
105
|
+
Restore progress</button
|
|
106
|
+
><input
|
|
107
|
+
id="import"
|
|
108
|
+
type="file"
|
|
109
|
+
accept="application/json"
|
|
110
|
+
hidden
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
<p id="restore-help">
|
|
114
|
+
Restore a backup from the same course version. Matching drafts are
|
|
115
|
+
replaced; other drafts stay saved. Rerun checks after restoring.
|
|
116
|
+
</p>
|
|
117
|
+
<p id="saved-notebook" hidden></p>
|
|
118
|
+
<p id="progress-status" role="status"></p>
|
|
119
|
+
</details>
|
|
120
|
+
<details id="about-course">
|
|
121
|
+
<summary>About this course</summary>
|
|
122
|
+
<p id="course-status"></p>
|
|
123
|
+
<p>
|
|
124
|
+
F# comes first; TypeScript and JavaScript are also available.
|
|
125
|
+
Everything runs on your device, with no source uploads or
|
|
126
|
+
automatic AI calls.
|
|
127
|
+
</p>
|
|
128
|
+
<p>
|
|
129
|
+
F# executes through Fable and the JavaScript testing harness.
|
|
130
|
+
Native .NET/FsCheck evidence is separate.
|
|
131
|
+
</p>
|
|
132
|
+
<details id="roadmap-panel">
|
|
133
|
+
<summary>Roadmap</summary>
|
|
134
|
+
<ol id="roadmap"></ol>
|
|
135
|
+
<h3>Future capstones</h3>
|
|
136
|
+
<ul id="planned-tracks"></ul>
|
|
137
|
+
<div id="future-attribution"></div>
|
|
138
|
+
</details>
|
|
139
|
+
<a href="./coverage.json" target="_blank" rel="noopener"
|
|
140
|
+
>Public API coverage inventory</a
|
|
141
|
+
>
|
|
142
|
+
<p>Missing examples remain deferred.</p>
|
|
143
|
+
</details>
|
|
144
|
+
</div>
|
|
145
|
+
</aside>
|
|
146
|
+
<main>
|
|
147
|
+
<section class="lesson" id="lesson-panel">
|
|
148
|
+
<div class="lesson-heading">
|
|
149
|
+
<h1 id="title"></h1>
|
|
150
|
+
<nav class="scene-navigation" aria-label="Step navigation">
|
|
151
|
+
<button id="previous-scene">← Previous</button
|
|
152
|
+
><span class="eyebrow" id="lesson-number"></span
|
|
153
|
+
><button id="next-scene">Next →</button>
|
|
154
|
+
</nav>
|
|
155
|
+
</div>
|
|
156
|
+
<div
|
|
157
|
+
class="lesson-reader"
|
|
158
|
+
id="lesson-reader"
|
|
159
|
+
tabindex="0"
|
|
160
|
+
aria-label="Lesson text"
|
|
161
|
+
>
|
|
162
|
+
<h2 id="stage-title" tabindex="-1"></h2>
|
|
163
|
+
<div id="story"></div>
|
|
164
|
+
<pre class="symbol" id="symbol" hidden></pre>
|
|
165
|
+
<div class="story-source">
|
|
166
|
+
<button id="story-file" type="button"></button
|
|
167
|
+
><span id="story-state" role="status"></span>
|
|
168
|
+
<pre id="story-code" class="monaco-colorized"></pre>
|
|
169
|
+
</div>
|
|
170
|
+
<p id="reason"></p>
|
|
171
|
+
<p id="action"></p>
|
|
172
|
+
<p class="expected">
|
|
173
|
+
<b>In the supplied scene: </b><span id="expect"></span>
|
|
174
|
+
</p>
|
|
175
|
+
<details>
|
|
176
|
+
<summary>Syntax in this step</summary>
|
|
177
|
+
<p id="explanation"></p>
|
|
178
|
+
<p id="naming-guide"></p>
|
|
179
|
+
</details>
|
|
180
|
+
<div class="scene-actions">
|
|
181
|
+
<button id="load-stage">Reset this step</button
|
|
182
|
+
><button id="solution">Load solution</button>
|
|
183
|
+
<button
|
|
184
|
+
id="undo-replacement"
|
|
185
|
+
hidden
|
|
186
|
+
title="Restore the previous files in this open step"
|
|
187
|
+
>
|
|
188
|
+
Undo reset / solution
|
|
189
|
+
</button>
|
|
190
|
+
</div>
|
|
191
|
+
<details>
|
|
192
|
+
<summary>Stuck? Recover here</summary>
|
|
193
|
+
<p id="recovery"></p>
|
|
194
|
+
<button id="hint">Show next hint</button>
|
|
195
|
+
<p id="hint-text"></p>
|
|
196
|
+
</details>
|
|
197
|
+
<details>
|
|
198
|
+
<summary>About this lesson</summary>
|
|
199
|
+
<p class="slogan" id="slogan"></p>
|
|
200
|
+
<p id="vision"></p>
|
|
201
|
+
<p id="news"></p>
|
|
202
|
+
<p id="contributions"></p>
|
|
203
|
+
</details>
|
|
204
|
+
<details>
|
|
205
|
+
<summary>Attribution & further reading</summary>
|
|
206
|
+
<div id="attribution"></div>
|
|
207
|
+
</details>
|
|
208
|
+
<button id="complete">Mark learning milestone</button
|
|
209
|
+
><span id="completion"></span>
|
|
210
|
+
</div>
|
|
211
|
+
</section>
|
|
212
|
+
<section
|
|
213
|
+
class="workspace"
|
|
214
|
+
id="code-panel"
|
|
215
|
+
aria-label="Coding workspace"
|
|
216
|
+
>
|
|
217
|
+
<p id="code-step" class="mobile-context"></p>
|
|
218
|
+
<div class="workspace-toolbar">
|
|
219
|
+
<div
|
|
220
|
+
id="languages"
|
|
221
|
+
role="tablist"
|
|
222
|
+
aria-label="Implementation language"
|
|
223
|
+
></div>
|
|
224
|
+
<div class="runbar">
|
|
225
|
+
<div class="run-action">
|
|
226
|
+
<button id="run" class="primary" aria-describedby="run-scope">
|
|
227
|
+
Run checks
|
|
228
|
+
</button>
|
|
229
|
+
<span id="run-scope">Examples + boundaries</span>
|
|
230
|
+
</div>
|
|
231
|
+
<button id="cancel" disabled hidden>Cancel</button>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
<div class="filebar">
|
|
235
|
+
<div
|
|
236
|
+
id="files"
|
|
237
|
+
class="file-tabs"
|
|
238
|
+
role="tablist"
|
|
239
|
+
aria-label="Project files"
|
|
240
|
+
></div>
|
|
241
|
+
<span id="save-status" role="status">Loading drafts…</span
|
|
242
|
+
><span id="current-file" class="sr-only"></span>
|
|
243
|
+
</div>
|
|
244
|
+
<div
|
|
245
|
+
id="editor"
|
|
246
|
+
role="tabpanel"
|
|
247
|
+
aria-label="Source editor"
|
|
248
|
+
aria-describedby="current-file"
|
|
249
|
+
></div>
|
|
250
|
+
<details id="harness-help" hidden>
|
|
251
|
+
<summary>Harness explained: where test inputs come from</summary>
|
|
252
|
+
<div id="harness-explanation"></div>
|
|
253
|
+
</details>
|
|
254
|
+
<details id="run-options">
|
|
255
|
+
<summary>Test controls<span id="replay-hint"></span></summary>
|
|
256
|
+
<div class="test-controls">
|
|
257
|
+
<div class="alternate-runs">
|
|
258
|
+
<button id="examples">Run examples + boundaries</button
|
|
259
|
+
><button id="sample">Run sampled properties</button>
|
|
260
|
+
</div>
|
|
261
|
+
<div class="replaybar">
|
|
262
|
+
<label
|
|
263
|
+
>Seed
|
|
264
|
+
<input
|
|
265
|
+
id="seed"
|
|
266
|
+
type="number"
|
|
267
|
+
value="424242"
|
|
268
|
+
step="1" /></label
|
|
269
|
+
><button id="replay" disabled>Replay failure</button
|
|
270
|
+
><button id="regression" disabled>Save regression</button>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
</details>
|
|
274
|
+
<section class="results" tabindex="0" aria-label="Execution results">
|
|
275
|
+
<h2>Results <span id="result-status">Ready</span></h2>
|
|
276
|
+
<p id="message" role="status">
|
|
277
|
+
Run examples first. Predict an unfamiliar input before running all
|
|
278
|
+
checks.
|
|
279
|
+
</p>
|
|
280
|
+
<p id="teaching-feedback" role="status" hidden></p>
|
|
281
|
+
<div id="outcomes"></div>
|
|
282
|
+
<details>
|
|
283
|
+
<summary>How to read these results</summary>
|
|
284
|
+
<p>
|
|
285
|
+
A passed check held for the inputs tried. A failed check found a
|
|
286
|
+
disagreement. A generated trial tries an input against a
|
|
287
|
+
property; shrinking tries simpler inputs that still fail.
|
|
288
|
+
Incomplete or unsupported checks need attention before you can
|
|
289
|
+
draw a conclusion.
|
|
290
|
+
</p>
|
|
291
|
+
<p>
|
|
292
|
+
Specific inputs are written examples. Boundary inputs try edges
|
|
293
|
+
or special cases in a stated domain. A property is a claim about
|
|
294
|
+
many inputs; generated trials test individual inputs against it.
|
|
295
|
+
Save regression keeps a discovered failure as a named example in
|
|
296
|
+
Laws.
|
|
297
|
+
</p>
|
|
298
|
+
</details>
|
|
299
|
+
<details id="diagnostic-panel">
|
|
300
|
+
<summary>Diagnostics & evidence</summary>
|
|
301
|
+
<p id="execution-label" class="muted">
|
|
302
|
+
F# → Fable → JavaScript · LawSpec JS harness + fast-check
|
|
303
|
+
</p>
|
|
304
|
+
<pre id="diagnostics"></pre>
|
|
305
|
+
<p>
|
|
306
|
+
Mandatory definition validation checks the files independently
|
|
307
|
+
of optional law verification. Compiler evidence retains its
|
|
308
|
+
original statuses.
|
|
309
|
+
</p>
|
|
310
|
+
</details>
|
|
311
|
+
<details>
|
|
312
|
+
<summary>Generated output (read only)</summary>
|
|
313
|
+
<nav id="generated-files" aria-label="Generated files"></nav>
|
|
314
|
+
<pre id="generated" class="monaco-colorized"></pre>
|
|
315
|
+
</details>
|
|
316
|
+
<p class="muted">
|
|
317
|
+
Files are checked before execution. Passing tests describe the
|
|
318
|
+
inputs tried; they do not prove every possible input correct.
|
|
319
|
+
</p>
|
|
320
|
+
</section>
|
|
321
|
+
</section>
|
|
322
|
+
</main>
|
|
323
|
+
</div>
|
|
324
|
+
<script type="module" src="./app.mjs"></script>
|
|
325
|
+
</body>
|
|
326
|
+
</html>
|