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
package/bin/lawspec.mjs
CHANGED
|
@@ -4,19 +4,21 @@ import { readFile, mkdir, readdir, rm, stat, writeFile } from "node:fs/promises"
|
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { createCompiler } from "../api.mjs";
|
|
7
|
+
import {readManifest, writeManifest, findManifest, dependencyRanges, resolveComponent} from "../component.mjs";
|
|
8
|
+
import {resolveDependencies, packComponent} from "../component-packages.mjs";
|
|
7
9
|
import { targets, artifactTargets, templates, commands, setup } from "../templates.mjs";
|
|
8
10
|
import { generateExamples } from "../examples-command.mjs";
|
|
9
11
|
import { proveWithZ3 } from "../proof.mjs";
|
|
10
12
|
import { serveLanguage } from "../lsp.mjs";
|
|
11
|
-
import { explainLaw, explanationViews } from "../explain.mjs";
|
|
12
13
|
import { showScalar } from "../scalars.mjs";
|
|
13
14
|
import { doctor } from "../doctor.mjs";
|
|
14
15
|
import { recordNativeAttempts, nativeSeed, attestedKeys, readNativeObservations, attachNativeEvidence, nativeEvidenceText } from "../native-evidence.mjs";
|
|
15
16
|
import { beamCoverageRequirement, collectBeamCoverage } from "../beam-coverage.mjs";
|
|
16
17
|
import { collectScalaCoverage } from "../scala-coverage.mjs";
|
|
18
|
+
import {captureScalaBuildFailure,isScalaCompilationFailure} from "../scala-build-state.mjs";
|
|
17
19
|
import { failureDatabase, projectKey } from "../failure-database.mjs";
|
|
18
20
|
import { spawn, spawnSync } from "node:child_process";
|
|
19
|
-
import { benchmarkInvocations, configurationInvocations, preparationInvocations, environmentDigest, executedTests, invocations, lawKeys, projectDigest, recordedDigest, selectByTags, mergeJunit,
|
|
21
|
+
import { benchmarkInvocations, presentationInvocations, presentationDigest, configurationInvocations, preparationInvocations, environmentDigest, executedTests, invocations, lawKeys, previousResult, projectDigest, recordedDigest, selectByTags, mergeJunit,
|
|
20
22
|
harnessStatistics, coverageTools, junitFromTests, testsToRun } from "../test-command.mjs";
|
|
21
23
|
import {
|
|
22
24
|
readOptional,
|
|
@@ -26,14 +28,14 @@ import {
|
|
|
26
28
|
safePath,
|
|
27
29
|
collectSources,
|
|
28
30
|
} from "../files.mjs";
|
|
29
|
-
const VERSION = "0.
|
|
31
|
+
const VERSION = "0.31.1";
|
|
30
32
|
const args = process.argv.slice(2);
|
|
31
33
|
const verb = args.shift();
|
|
32
34
|
const options = {};
|
|
33
35
|
const positional = [];
|
|
34
36
|
for (let i = 0; i < args.length; i++) {
|
|
35
37
|
const arg = args[i];
|
|
36
|
-
if (["--target", "--project", "--config", "--output", "--machine-bits", "--example", "--seed", "--report", "--attestation", "--view", "--solver", "--proof-timeout", "--proof-memory", "--proof-rlimit", "--proof-seed"].includes(arg)) {
|
|
38
|
+
if (["--port", "--target", "--project", "--config", "--output", "--machine-bits", "--example", "--seed", "--report", "--attestation", "--view", "--solver", "--proof-timeout", "--proof-memory", "--proof-rlimit", "--proof-seed"].includes(arg)) {
|
|
37
39
|
if (!args[i + 1] || args[i + 1].startsWith("--"))
|
|
38
40
|
throw new Error(`Missing value for ${arg}`);
|
|
39
41
|
options[arg.slice(2)] = args[++i];
|
|
@@ -42,13 +44,13 @@ for (let i = 0; i < args.length; i++) {
|
|
|
42
44
|
if (!args[i + 1] || args[i + 1].startsWith("--"))
|
|
43
45
|
throw new Error(`Missing value for ${arg}`);
|
|
44
46
|
options[arg.slice(2)] = [...(options[arg.slice(2)] ?? []), ...args[++i].split(",").filter(Boolean)];
|
|
45
|
-
} else if (["--dry-run", "--check", "--json", "--minify", "--no-cache", "--fresh", "--coverage", "--update-recorded", "--benchmarks", "--stdio", "--warn-matches", "--compile"].includes(arg))
|
|
47
|
+
} else if (["--dry-run", "--check", "--json", "--minify", "--no-cache", "--fresh", "--coverage", "--update-recorded", "--benchmarks", "--stdio", "--warn-matches", "--compile", "--locked", "--offline"].includes(arg))
|
|
46
48
|
options[arg.slice(2)] = true;
|
|
47
49
|
else if (arg.startsWith("--")) throw new Error(`Unknown option: ${arg}`);
|
|
48
50
|
else positional.push(arg);
|
|
49
51
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
let configFile = path.resolve(options.config || "lawspec.edn");
|
|
53
|
+
let configRoot = path.dirname(configFile);
|
|
52
54
|
const output = (value) =>
|
|
53
55
|
console.log(
|
|
54
56
|
typeof value === "string" ? value : JSON.stringify(value, null, 2),
|
|
@@ -101,46 +103,18 @@ async function sources(config) {
|
|
|
101
103
|
return lawspecFiles(configRoot, config.sources);
|
|
102
104
|
}
|
|
103
105
|
async function lawspecFiles(root,entries){return collectSources(root,entries,configRoot);}
|
|
104
|
-
// A package directory holds lawspec-package.json: its name, version, source
|
|
105
|
-
// directories and dependency ranges. The compiler checks names, versions,
|
|
106
|
-
// namespaces and which units may import which.
|
|
107
|
-
async function loadPackage(directory) {
|
|
108
|
-
const file = path.join(directory, "lawspec-package.json");
|
|
109
|
-
const manifest = JSON.parse(await readFile(file, "utf8"));
|
|
110
|
-
if (
|
|
111
|
-
typeof manifest.name !== "string" ||
|
|
112
|
-
typeof manifest.version !== "string" ||
|
|
113
|
-
!Array.isArray(manifest.sources)
|
|
114
|
-
)
|
|
115
|
-
throw new Error(`${file}: expected name, version and a sources array`);
|
|
116
|
-
return {
|
|
117
|
-
manifest,
|
|
118
|
-
package: {
|
|
119
|
-
name: manifest.name,
|
|
120
|
-
version: manifest.version,
|
|
121
|
-
dependencies: manifest.dependencies ?? {},
|
|
122
|
-
sources: await lawspecFiles(directory, manifest.sources),
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
106
|
async function packageInput(owner, root, optional = false) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return {
|
|
136
|
-
...(packages.some(Boolean) ? { packages: packages.filter(Boolean) } : {}),
|
|
137
|
-
...(owner.dependencies !== undefined ? { dependencies: owner.dependencies } : {}),
|
|
138
|
-
};
|
|
107
|
+
try {
|
|
108
|
+
const resolved = await resolveDependencies(path.join(root, "lawspec.edn"), owner,
|
|
109
|
+
{locked: !!options.locked, offline: optional || !!options.offline});
|
|
110
|
+
return {packages: resolved.packages, dependencies: dependencyRanges(owner), ...(owner.package ? {package: owner.package} : {})};
|
|
111
|
+
} catch (error) {
|
|
112
|
+
if (optional && (error.code === "ENOENT" || /Offline:/.test(error.message))) return {};
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
139
115
|
}
|
|
140
116
|
async function formatCommand() {
|
|
141
|
-
const config = positional.length ? null :
|
|
142
|
-
if(config&&(config.version!==2||config.languageProfile!=="1.0-rc.2"))
|
|
143
|
-
throw new Error("Formatting a project requires configuration version 2 and languageProfile 1.0-rc.2");
|
|
117
|
+
const config = positional.length ? null : await readManifest(configFile);
|
|
144
118
|
const root = positional.length ? process.cwd() : configRoot;
|
|
145
119
|
const files = await collectSources(root, positional.length ? positional : config.sources);
|
|
146
120
|
const compiler = await createCompiler();
|
|
@@ -157,8 +131,11 @@ async function formatCommand() {
|
|
|
157
131
|
}
|
|
158
132
|
|
|
159
133
|
async function packageCommand() {
|
|
160
|
-
const
|
|
161
|
-
const
|
|
134
|
+
const file = options.config ? configFile : path.resolve(options.project || ".", "lawspec.edn");
|
|
135
|
+
const directory = path.dirname(file);
|
|
136
|
+
const manifest = await readManifest(file);
|
|
137
|
+
if (!manifest.package) throw new Error(`${file}: expected a package identity`);
|
|
138
|
+
const own = {...manifest.package, dependencies: dependencyRanges(manifest), sources: await lawspecFiles(directory, manifest.sources)};
|
|
162
139
|
const compiler = await createCompiler();
|
|
163
140
|
const result = diagnostics(
|
|
164
141
|
await compiler.check({
|
|
@@ -184,6 +161,7 @@ async function packageCommand() {
|
|
|
184
161
|
.filter((d) => units.some((u) => d.id.startsWith(u + "::")))
|
|
185
162
|
.map((d) => d.id),
|
|
186
163
|
};
|
|
164
|
+
if (options.output) summary.archive = await packComponent(file, options.output);
|
|
187
165
|
output(
|
|
188
166
|
options.json
|
|
189
167
|
? summary
|
|
@@ -199,13 +177,16 @@ async function init() {
|
|
|
199
177
|
if (!targets.includes(language))
|
|
200
178
|
throw new Error(`Choose --target ${targets.join("|")}`);
|
|
201
179
|
const root = path.resolve(configRoot, options.project || ".");
|
|
180
|
+
if (path.extname(configFile) !== '.edn') throw new Error('Use lawspec.edn; JSON configuration is no longer supported');
|
|
181
|
+
for (const old of ['lawspec.json', 'lawspec-package.json']) {
|
|
182
|
+
if (await readOptional(path.join(configRoot, old)) !== null)
|
|
183
|
+
throw new Error(`${old} is no longer supported; use lawspec.edn`);
|
|
184
|
+
}
|
|
202
185
|
const current = await readOptional(configFile);
|
|
203
186
|
const config =
|
|
204
187
|
current === null
|
|
205
|
-
? { version:
|
|
206
|
-
:
|
|
207
|
-
if(config.version!==2||config.languageProfile!=='1.0-rc.2')
|
|
208
|
-
throw new Error('Existing projects require configuration version 2 and languageProfile 1.0-rc.2');
|
|
188
|
+
? { manifestVersion: 1, component: {name: path.basename(configRoot), version: "0.1.0"}, languageProfile: "1.0-rc.2", verification: { layers: [] }, sources: ["laws"], targets: [] }
|
|
189
|
+
: await readManifest(configFile);
|
|
209
190
|
if (
|
|
210
191
|
config.targets.some(
|
|
211
192
|
(t) =>
|
|
@@ -242,7 +223,7 @@ async function init() {
|
|
|
242
223
|
await safePath(configRoot, path.basename(configFile));
|
|
243
224
|
if (current === null && (await readOptional(starter)) !== null)
|
|
244
225
|
throw new Error(
|
|
245
|
-
"Starter specification already exists; create lawspec.
|
|
226
|
+
"Starter specification already exists; create lawspec.edn manually to use it",
|
|
246
227
|
);
|
|
247
228
|
if (!hasBuild && language !== "go")
|
|
248
229
|
await mkdir(path.join(root, "src"), { recursive: true });
|
|
@@ -263,7 +244,7 @@ async function init() {
|
|
|
263
244
|
});
|
|
264
245
|
await atomicWrite(
|
|
265
246
|
configFile,
|
|
266
|
-
|
|
247
|
+
writeManifest(config, {compact: options.minify === true}),
|
|
267
248
|
current === null,
|
|
268
249
|
);
|
|
269
250
|
output(
|
|
@@ -335,7 +316,7 @@ async function lastRuns() {
|
|
|
335
316
|
}
|
|
336
317
|
// An environment attestation: a versioned JSON document any tool may write,
|
|
337
318
|
// recording for one run where each dependency was wired and whether it was
|
|
338
|
-
// the real dependency or a stand-in. --attestation names one, or lawspec.
|
|
319
|
+
// the real dependency or a stand-in. --attestation names one, or lawspec.edn
|
|
339
320
|
// does; the compiler checks it. It is reporting only and changes no evidence.
|
|
340
321
|
async function readAttestation(config) {
|
|
341
322
|
const file = options.attestation !== undefined ? path.resolve(options.attestation)
|
|
@@ -438,7 +419,7 @@ async function buildDigest() {
|
|
|
438
419
|
// harness tags, and a skipped law runs nothing. A law whose last run failed
|
|
439
420
|
// runs first, and its failing inputs are replayed first (.lawspec/failures).
|
|
440
421
|
async function runTests(compiler, input, selected, roots, config) {
|
|
441
|
-
// Recorded values live beside lawspec.
|
|
422
|
+
// Recorded values live beside lawspec.edn, under recorded/<unit>/<name>.
|
|
442
423
|
const recordedFolder = path.join(configRoot, "recorded");
|
|
443
424
|
const seed = options.seed ?? String(1 + Math.floor(Math.random() * 2147483646));
|
|
444
425
|
const offline = process.env.LAWSPEC_OFFLINE === "1";
|
|
@@ -474,15 +455,25 @@ async function runTests(compiler, input, selected, roots, config) {
|
|
|
474
455
|
const generated = new Set(planned.files.filter((f) => f.ownership === "generated").map((f) => f.path));
|
|
475
456
|
const keys = lawKeys({
|
|
476
457
|
build, target, machineBits: input.machineBits, minify: options.minify === true,
|
|
477
|
-
tests: planned.tests,
|
|
458
|
+
tests: planned.tests,
|
|
478
459
|
// Recorded values are spec data: a changed recording runs its laws again.
|
|
479
|
-
environment: await environmentDigest(root, report_)
|
|
480
|
-
|
|
460
|
+
environment: await environmentDigest(root, report_,target.language),
|
|
461
|
+
recorded: await recordedDigest(recordedFolder),
|
|
462
|
+
project: await projectDigest(root, generated,target.language,{inputRoot:configRoot,inputs:config.inputs??[]}),
|
|
481
463
|
attested,
|
|
482
464
|
});
|
|
483
465
|
const identity = projectKey(root);
|
|
484
466
|
const resultsFile = path.join(configRoot, ".lawspec", "results", `${target.language}-${identity}.json`);
|
|
485
467
|
const previous = JSON.parse((await readOptional(resultsFile)) ?? '{"version":1,"laws":{}}');
|
|
468
|
+
const presentation=presentationDigest(planned.files,await environmentDigest(root,report_,target.language));
|
|
469
|
+
if(previous.presentation!==presentation){
|
|
470
|
+
const checks=presentationInvocations(target,planned.files,{offline});
|
|
471
|
+
if(!checks.length)throw new Error(`${target.language}: no native source validator is available`);
|
|
472
|
+
for(const check of checks){
|
|
473
|
+
const result=await spawned(check.command,check.args,root,{...process.env,...check.environment});
|
|
474
|
+
if(!result.ok)throw new Error(`${target.language}: current generated source failed native validation`);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
486
477
|
const attempts = {...(previous.attempts ?? {})};
|
|
487
478
|
const {directory: failures, file: databaseFile, database} = await failureDatabase(configRoot, target.language, root);
|
|
488
479
|
// Recording again runs every law, so each records what it sees now.
|
|
@@ -558,6 +549,10 @@ async function runTests(compiler, input, selected, roots, config) {
|
|
|
558
549
|
{ ...process.env, ...run.env, LAWSPEC_SEED: batch.seed, HSPEC_SEED: batch.seed,
|
|
559
550
|
LAWSPEC_STATS: stats, LAWSPEC_FAILURES: failures, LAWSPEC_RECORDED: recordedFolder,
|
|
560
551
|
...(options["update-recorded"] ? { LAWSPEC_UPDATE_RECORDED: "1" } : {}) }, run.report?.kind === "go-json");
|
|
552
|
+
if(!ok&&target.language==='scala'&&isScalaCompilationFailure(output)) {
|
|
553
|
+
const directory=await captureScalaBuildFailure({root,command:run.command,args:run.args,output});
|
|
554
|
+
if(directory)console.error(`Scala compiler state: ${directory}`);
|
|
555
|
+
}
|
|
561
556
|
if (run.coverage) coverageRuns.push(run.coverage);
|
|
562
557
|
const executed = await executedTests(run.report, output, root, since);
|
|
563
558
|
const observed=recordNativeAttempts(run,executed,{keys,seed:batch.seed,ok,profile,output,allEntries:planned.tests});
|
|
@@ -600,7 +595,9 @@ async function runTests(compiler, input, selected, roots, config) {
|
|
|
600
595
|
if (!ok) { failed = true; break; }
|
|
601
596
|
}
|
|
602
597
|
const statistics = await harnessStatistics(stats);
|
|
603
|
-
|
|
598
|
+
// A renamed law keeps its result: it is found by its key.
|
|
599
|
+
const kept = (entry) => previous.laws[entry.law] ?? previousResult(previous.laws, entry.law, keys.get(entry.law));
|
|
600
|
+
const laws = Object.fromEntries(planned.tests.filter(kept).map((entry) => [entry.law, kept(entry)]));
|
|
604
601
|
for (const entry of passed) {
|
|
605
602
|
const label = entry.label;
|
|
606
603
|
const observed = statistics.filter((s) => s.law === label);
|
|
@@ -626,13 +623,16 @@ async function runTests(compiler, input, selected, roots, config) {
|
|
|
626
623
|
await writeFile(path.join(path.dirname(resultsFile), ".gitignore"), "*\n");
|
|
627
624
|
// Each attempt at a law the attestation touches names the run it was
|
|
628
625
|
// made in, whatever its outcome.
|
|
629
|
-
if (attestation) for (const entry of stale)
|
|
630
|
-
if (
|
|
626
|
+
if (attestation) for (const entry of stale) {
|
|
627
|
+
if (!seedOf.has(entry.law) || !attempts[entry.law]) continue;
|
|
628
|
+
attempts[entry.law] = {...attempts[entry.law], executionRun: attestation.run.id,
|
|
629
|
+
...(attested.has(entry.law) ? {environment: attestation.run.id} : {})};
|
|
630
|
+
}
|
|
631
631
|
// Each attestation a recorded law ran under is kept with the results.
|
|
632
632
|
const attestations = Object.fromEntries(Object.entries({ ...(previous.attestations ?? {}),
|
|
633
633
|
...(attestation ? { [attestation.run.id]: attestation } : {}) })
|
|
634
|
-
.filter(([id]) => [...Object.values(laws), ...Object.values(attempts)].some((run) => run.environment === id)));
|
|
635
|
-
await atomicWrite(resultsFile, JSON.stringify({ version: 1, laws, attempts,
|
|
634
|
+
.filter(([id]) => [...Object.values(laws), ...Object.values(attempts)].some((run) => run.environment === id || run.executionRun === id)));
|
|
635
|
+
await atomicWrite(resultsFile, JSON.stringify({ version: 1, laws, attempts,presentation,
|
|
636
636
|
...(Object.keys(attestations).length ? { attestations } : {}) }, null, 2) + "\n");
|
|
637
637
|
const flaky = statistics.filter((s) => s.outcome === "flaky").map((s) => s.law);
|
|
638
638
|
const unmet = statistics.flatMap((s) => (s.cover ?? []).filter((c) => !c.met).map((c) => `${s.law}: cover ${c.required}% "${c.label}" (${c.observed}%)`));
|
|
@@ -759,7 +759,7 @@ async function main() {
|
|
|
759
759
|
}
|
|
760
760
|
if (!verb || ["help", "--help", "-h"].includes(verb)) {
|
|
761
761
|
output(
|
|
762
|
-
"LawSpec " + VERSION + "\nUsage: lawspec init --target <language> [--project <directory>] [--minify]\n lawspec fmt [paths...] [--check] [--compile]\n lawspec lsp --stdio\n lawspec prove [--solver <z3-executable>] [--proof-timeout <ms>] [--json]\n lawspec check [--warn-matches] | doctor | explain [<unit>::<law>] [--view
|
|
762
|
+
"LawSpec " + VERSION + "\nUsage: lawspec learn [--port <port>]\n lawspec init --target <language> [--project <directory>] [--minify]\n lawspec fmt [paths...] [--check] [--compile]\n lawspec lsp --stdio\n lawspec prove [--solver <z3-executable>] [--proof-timeout <ms>] [--json]\n lawspec check [--warn-matches] | doctor | explain [<unit>::<law>] [--view eng|math|dev] | generate\n lawspec evidence [<unit> | <unit>::<declaration>] [--attestation <file>]\n lawspec test [--target <language>] [--fresh] [--seed <n>] [--attestation <file>] [--update-recorded] [--tag <t>] [--exclude-tag <t>] [--report junit=<path>] [--coverage] [--benchmarks]\n lawspec describe --json\n lawspec fetch | update [<package>]\n lawspec package [--project <package directory>] [--output <archive.tgz>]\n lawspec examples [--example payments] [--target <language>] [--output <directory>]\nOptions: --config <path>, --target <language>, --machine-bits <32|64>, --json, --no-cache, --locked, --offline\nGeneration: --dry-run, --check, --minify\nTargets: " +
|
|
763
763
|
targets.join(", "),
|
|
764
764
|
);
|
|
765
765
|
return;
|
|
@@ -768,8 +768,18 @@ async function main() {
|
|
|
768
768
|
output(VERSION);
|
|
769
769
|
return;
|
|
770
770
|
}
|
|
771
|
+
if (verb === 'learn')
|
|
772
|
+
{
|
|
773
|
+
if (positional.length || Object.keys(options).some(key => key !== 'port'))
|
|
774
|
+
{
|
|
775
|
+
throw new Error('learn supports --port only');
|
|
776
|
+
}
|
|
777
|
+
const {serveLearn} = await import('../learn.mjs');
|
|
778
|
+
return serveLearn(options.port ?? '8384');
|
|
779
|
+
}
|
|
780
|
+
if (options.port) throw new Error('--port applies to learn');
|
|
771
781
|
if (options.compile && verb !== "fmt") throw new Error("--compile applies to fmt");
|
|
772
|
-
if (verb !== "fmt" && positional.length > (["explain", "evidence"].includes(verb) ? 1 : 0))
|
|
782
|
+
if (verb !== "fmt" && positional.length > (["explain", "evidence", "update"].includes(verb) ? 1 : 0))
|
|
773
783
|
throw new Error(`Unexpected argument: ${positional.join(" ")}`);
|
|
774
784
|
if (verb === "examples") {
|
|
775
785
|
if (
|
|
@@ -803,7 +813,7 @@ async function main() {
|
|
|
803
813
|
if (["solver","proof-timeout","proof-memory","proof-rlimit","proof-seed"].some(key => options[key] !== undefined) && verb !== "prove")
|
|
804
814
|
throw new Error("Z3 options apply to prove");
|
|
805
815
|
if (options.view && verb !== "explain") throw new Error("--view applies to explain");
|
|
806
|
-
if (options.output) throw new Error("--output is only supported by examples");
|
|
816
|
+
if (options.output && verb !== "package") throw new Error("--output is only supported by examples and package");
|
|
807
817
|
if (options.example) throw new Error("--example is only supported by examples");
|
|
808
818
|
if (options.minify && !["init", "generate", "examples", "test"].includes(verb))
|
|
809
819
|
throw new Error("--minify applies to init, generate, test and examples");
|
|
@@ -820,21 +830,23 @@ async function main() {
|
|
|
820
830
|
if (!options.stdio) throw new Error("lsp requires --stdio");
|
|
821
831
|
return serveLanguage();
|
|
822
832
|
}
|
|
833
|
+
if (!options.config && verb !== "init" && verb !== "package" && !(verb === "fmt" && positional.length)) {
|
|
834
|
+
configFile = await findManifest();
|
|
835
|
+
configRoot = path.dirname(configFile);
|
|
836
|
+
}
|
|
837
|
+
if (verb === "describe") return output(await resolveComponent(configFile, options));
|
|
838
|
+
if (verb === "fetch" || verb === "update") {
|
|
839
|
+
const manifest = await readManifest(configFile);
|
|
840
|
+
const resolved = await resolveDependencies(configFile, manifest, {...options, update: verb === "update" ? positional[0] ?? true : false});
|
|
841
|
+
return output(options.json ? resolved.lock : `Resolved ${resolved.packages.length} contract package(s).`);
|
|
842
|
+
}
|
|
823
843
|
if (verb === "fmt") return formatCommand();
|
|
824
844
|
if (verb === "init") return init();
|
|
825
845
|
if (verb === "package") return packageCommand();
|
|
826
846
|
if (!["check", "doctor", "evidence", "explain", "generate", "test", "prove"].includes(verb))
|
|
827
847
|
throw new Error(`Unknown command: ${verb}`);
|
|
828
|
-
const config =
|
|
829
|
-
|
|
830
|
-
config.version!==2 ||
|
|
831
|
-
!Array.isArray(config.sources) ||
|
|
832
|
-
!Array.isArray(config.targets)
|
|
833
|
-
)
|
|
834
|
-
throw new Error(
|
|
835
|
-
"Expected lawspec.json version 2 with languageProfile 1.0-rc.2, sources and targets arrays",
|
|
836
|
-
);
|
|
837
|
-
if (config.languageProfile !== "1.0-rc.2") throw new Error("Configuration version 2 requires languageProfile 1.0-rc.2");
|
|
848
|
+
const config = await readManifest(configFile);
|
|
849
|
+
config.targets ??= [];
|
|
838
850
|
if (verb === "test" && artifactTargets.includes(options.target))
|
|
839
851
|
throw new Error(`${options.target} is an artifact target and cannot execute application laws`);
|
|
840
852
|
const selected = config.targets.filter(
|
|
@@ -842,7 +854,7 @@ async function main() {
|
|
|
842
854
|
(verb !== "test" || !artifactTargets.includes(t.language)),
|
|
843
855
|
);
|
|
844
856
|
if (["doctor", "generate", "test"].includes(verb) && !selected.length &&
|
|
845
|
-
!(verb === "test" && !options.benchmarks && config.
|
|
857
|
+
!(verb === "test" && !options.benchmarks && config.manifestVersion === 1 && !(config.verification?.layers ?? []).some(layer => ["exhaustive", "property", "examples", "model"].includes(layer))))
|
|
846
858
|
throw new Error("No matching configured target");
|
|
847
859
|
const roots = selected.map((t) => path.resolve(configRoot, t.root));
|
|
848
860
|
if (new Set(roots).size !== roots.length)
|
|
@@ -878,12 +890,11 @@ async function main() {
|
|
|
878
890
|
machineBits: options.machineBits ?? config.machineBits ?? 64,
|
|
879
891
|
// What a law-set exemption's until is compared with: the project's
|
|
880
892
|
// version and the current UTC time.
|
|
881
|
-
...(
|
|
893
|
+
...((config.component?.version ?? config.package?.version) ? {projectVersion: config.component?.version ?? config.package?.version} : {}),
|
|
882
894
|
now: new Date().toISOString(),
|
|
883
895
|
};
|
|
884
896
|
const compiler = await createCompiler();
|
|
885
897
|
if (verb === "prove") {
|
|
886
|
-
if (config.version !== 2) throw new Error("prove requires configuration version 2 and languageProfile 1.0-rc.2");
|
|
887
898
|
const result = diagnostics(await proveWithZ3(compiler, input, {
|
|
888
899
|
...(options.solver !== undefined ? {binary: options.solver} : {}),
|
|
889
900
|
...Object.fromEntries([["proof-timeout","timeoutMs"],["proof-memory","memoryMb"],
|
|
@@ -953,7 +964,7 @@ async function main() {
|
|
|
953
964
|
return;
|
|
954
965
|
}
|
|
955
966
|
if (verb === "evidence") {
|
|
956
|
-
// An attestation named here, or in lawspec.
|
|
967
|
+
// An attestation named here, or in lawspec.edn, says where the tests
|
|
957
968
|
// ran; otherwise each law shows the attested run it last passed in.
|
|
958
969
|
// A named attestation of a run lawspec test recorded links each law to
|
|
959
970
|
// that run, with the outcome recorded for it, unless the document says
|
|
@@ -965,7 +976,7 @@ async function main() {
|
|
|
965
976
|
...(named ? { attestation: named, ...(recorded ? { attestedOutcomes: recorded } : {}) } : {}) })));
|
|
966
977
|
if (result.refuted) process.exitCode = 1;
|
|
967
978
|
let evidence = attachNativeEvidence(result.evidence,await readNativeObservations({compiler,input,selected,roots,
|
|
968
|
-
configRoot,build:await buildDigest(),evidence:result.evidence,attestation:named}));
|
|
979
|
+
configRoot,config,build:await buildDigest(),evidence:result.evidence,attestation:named}));
|
|
969
980
|
const environments = named ? [result.attestation] : [];
|
|
970
981
|
if (!named) for (const [id, attestation] of attestations) {
|
|
971
982
|
const laws = new Set([...runs].filter(([, run]) => run.environment === id).map(([law]) => law));
|
|
@@ -1041,7 +1052,8 @@ async function main() {
|
|
|
1041
1052
|
...environments.map((e) => `ENVIRONMENT ${e.environment} (run ${e.run.id}, recorded ${e.run.recordedAt}${executionText(e.run)})\n` +
|
|
1042
1053
|
(e.architecture ? ` architecture ${e.architecture.document} ${e.architecture.digest}` +
|
|
1043
1054
|
(e.architecture.topologyDigest ? `, topology ${e.architecture.topologyDigest}` : "") + "\n" : "") +
|
|
1044
|
-
(e.application ? ` application ${e.application.node}:
|
|
1055
|
+
(e.application ? ` application ${e.application.node}: ` +
|
|
1056
|
+
(e.application.component ? `component ${e.application.component.name} ${e.application.component.version} (${e.application.component.fingerprint}); ` : `contract ${e.application.contract.package} ${e.application.contract.version}; `) +
|
|
1045
1057
|
`${e.application.implementation.kind} ${e.application.implementation.product} ${e.application.implementation.version}` +
|
|
1046
1058
|
(e.application.implementation.commit ? ` (commit ${e.application.implementation.commit})` : "") + "\n" : "") +
|
|
1047
1059
|
e.dependencies.map((d) => {
|
|
@@ -1056,23 +1068,19 @@ async function main() {
|
|
|
1056
1068
|
return;
|
|
1057
1069
|
}
|
|
1058
1070
|
if (verb === "explain") {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
compiler,input,selected,roots,configRoot,build:await buildDigest(),evidence:result.evidence,
|
|
1070
|
-
attestation:await readAttestation(config)}))};
|
|
1071
|
-
const explanations = indices.map(({e}) => explainLaw(e, observed, view));
|
|
1072
|
-
output(options.json ? explanations : explanations.map(e => e.text).join("\n\n"));
|
|
1071
|
+
// The compiler words the law (eng by default); the CLI only reads the
|
|
1072
|
+
// recorded native observations and passes their evidence rows in.
|
|
1073
|
+
const request = { ...input, view: options.view ?? "eng", ...(positional[0] ? { law: positional[0] } : {}) };
|
|
1074
|
+
let explained = diagnostics(await compiler.explain(request));
|
|
1075
|
+
const expanded = diagnostics(await compiler.expand(input));
|
|
1076
|
+
const observations = await readNativeObservations({ compiler, input, selected, roots, configRoot, config,
|
|
1077
|
+
build: await buildDigest(), evidence: expanded.evidence, attestation: await readAttestation(config) });
|
|
1078
|
+
if (observations.length)
|
|
1079
|
+
explained = diagnostics(await compiler.explain({ ...request, evidence: attachNativeEvidence(expanded.evidence, observations) }));
|
|
1080
|
+
output(options.json ? explained.explanations : explained.text);
|
|
1073
1081
|
return;
|
|
1074
1082
|
}
|
|
1075
|
-
if (verb === "test" && !options.benchmarks && config.
|
|
1083
|
+
if (verb === "test" && !options.benchmarks && config.manifestVersion === 1 && !(config.verification?.layers ?? []).some(layer => ["exhaustive", "property", "examples", "model"].includes(layer))) {
|
|
1076
1084
|
const checked = diagnostics(await compiler.check(input));
|
|
1077
1085
|
output(options.json ? { verification: checked.verification, evidence: checked.evidence, testsExecuted: 0 }
|
|
1078
1086
|
: (config.verification?.layers?.length ? "No native law checks selected. See lawspec evidence for the selected static analyses." : "No law verification layers selected. Intrinsic definition checks passed; no law checks ran."));
|