Skip to content

WebSharper 4.4

Compare
Choose a tag to compare
@Tarmil Tarmil released this 11 Jul 17:55
· 1184 commits to master since this release

This is a major release for WebSharper 4.

Templates for .NET Core SDK: dotnet new -i WebSharper.Templates::4.4.0.255

Templates for Visual Studio 2017: http://websharper.com/installers/WebSharper.4.4.0.255.vsix

Features

  • #641, #970: Add support for Web Workers.
    • Add the Worker API to WebSharper.JavaScript.
    • Add a set of special constructors for Worker which takes a function as argument. The compiler automatically compiles this function into a minimal bundle script and compiles the constructor call to reference this script by URL. See the documentation for more details.
    • Add a new compiler setting scriptBaseUrl which determines the base URL under which the worker scripts are located. The full URL is <scriptBaseUrl>/<assemblyname>/<assemblyname>.<scriptname>.js, where <scriptname> is worker unless specified in the constructor call.
  • #807: Merge the class WebSharper.JavaScript.JS from the assembly WebSharper.JavaScript with the module of the same name from the assembly WebSharper.Main. This mean that all uses of JSModule in C# must be replaced with JS.
  • #939: Add JavaScript Promises support. This includes:
    • Add a proxy for the Promise<'T> class.
    • Add a Promise module with functions AsAysnc, OfAsync, AsTask and OfTask.
      The As* functions handle rejected promises as follows: if the rejection value is an Error, then it is used directly as the exception raised from the Async / Task. Otherwise, it is wrapped as the Reason property of a NonStandardPromiseRejectionException.
    • Add the above functions as extension methods to their respective relevant classes.
    • Add a promise computation expression.
  • #975: Drop the [Serializable] requirement for classes used in JSON serialization (RPC, Sitelets, WebSharper.Json).
  • #976: Allow Bundle projects to reference other Bundle projects that have an EntryPoint.
  • #979: Change signature of Router.Create to parse to option.
  • #980: Sitelets: add Content.FromContent(Content<obj>) to convert an F# content into a C# content.
  • #981: Add Sitelet.MapContent.
    • For F#: module function Sitelet.MapContent : (Async<Content<'T>> -> Async<Content<'T>>) -> Sitelet<'T> -> Sitelet<'T>
    • For C#: extension method Sitelet<obj> Sitelet<obj>.MapContent(Func<Task<Content>, Task<Content>>)
  • #982: Make all exceptions inherit from the JavaScript Error type. This affects exceptions declared with the F# keyword exception as well as classes inheriting from System.Exception. This makes it possible to perform runtime type tests (F# :?, C# is) against System.Exception.

Fixes

  • #971: WIG: properly fail when trying to declare that a class implements a class, rather than inherits from it.
  • #977: Give a better error if there is a conflict where two projects include a server-side compiled quotation from the exact same file and position.
  • #978: Give a better error if a Bundle is missing a project reference.
  • #983: Fix dotnet build on a C# project failing to find FSharp.Core.
  • WebSharper.Testing: reference QUnit via https.
  • #987: Change the assemblies WebSharper.Compiler, WebSharper.Compiler.CSharp and WebSharper.Compiler.FSharp to reference FSharp.Core 4.4.1.0 rather than 4.5.0.0. This fixes assembly loading issues in the Roslyn analyzer.
    As a consequence, we reduced the minimum dependency of the WebSharper.Compiler packages on FSharp.Core from >= 4.5.0 to >= 4.1.0.