WebSharper 4.4

@Tarmil Tarmil released this Jul 11, 2018

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.

WebSharper 4.3.1

@Jand42 Jand42 released this Jun 26, 2018 · 35 commits to master since this release

This is a small feature release for WebSharper 4.3.

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

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

Features

  • #965: Add support for == and != operators for tuple types in C#.

WebSharper 4.3

@Tarmil Tarmil released this Jun 26, 2018 · 37 commits to master since this release

This is a major release for WebSharper 4. See the associated WebSharper UI release.

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

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

Features

  • #941: Run the compiler on .NET Core.

    Both the F# and C# compilers are now compiled for .NET Core 2.0, in addition to the existing .NET Framework 4.6.1 versions. This means that it is not necessary anymore to have mono installed to compile a WebSharper project on Linux or OSX.

    By default, compiling a .NET Framework project uses the .NET Framework version of the compiler, and compiling a .NET Core or .NET Standard project uses the .NET Core version of the compiler. To override this default, you can set the project property <WebSharperUseNetFxCompiler> to True (to use the .NET Framework compiler) or False (to use the .NET Core compiler).

  • #964: Add proxies for the new functions in F# 4.5:

    • Async.StartImmediateAsTask
    • Seq/List/Array.transpose
    • ValueOption type
    • Map.TryGetValue
    • FuncConvert.FromFunc/FromAction
  • #965: Add support for C# 7.3 language features:

    • ref local reassign
    • Expression variables in initializers

    Known missing C# 7.3 feature, upcoming in WebSharper 4.3.1:

    • == and != for tuple types
  • #929: The WebSharper.Compiler NuGet package, which provides the WebSharper compilers as a library, has been split in order to better handle the specific F# and C# use cases.

    • WebSharper.Compiler.Common contains the common compiler libraries.
    • WebSharper.Compiler.FSharp and WebSharper.Compiler.CSharp contain the compilers for their respective languages. In addition to both depending on WebSharper.Compiler.Common, they also have properly versioned dependencies on the F# Compiler Service and Roslyn, respectively.
    • WebSharper.Compiler still exists, but it is now a meta-package with no content of its own but which depends on both WebSharper.Compiler.FSharp and WebSharper.Compiler.CSharp. If you were using WebSharper.Compiler to compile only one language, then you are encouraged to switch to the corresponding language-specific package.

    Note that although the core WebSharper libraries are compatible with F# 4.1, the compiler requires the latest FSharp.Core 4.5.

  • #938: Allow macros to resolve let-bound variables.

    In an expression like let y = x + 1 in macroedFunction y, this allows the macro to retrieve and manipulate the expression x + 1, rather than just seeing y.

Fixes

  • #963 Add missing proxies for F# numeric conversion functions: int8, byte, int16, uint16, uint32, uint64, double.

  • #966: Support the Method sitelet endpoint attribute on a class.

  • #968: Task.Result throws if accessed before the task is completed.

  • #969: Include inherited C# auto-property backing field in remoting.

WebSharper 4.2.14

@Jand42 Jand42 released this Jun 15, 2018 · 93 commits to master since this release

This is a bugfix release for WebSharper 4.2.

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

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

Fixes

  • #951 Virtual methods do not cause compiler to fail with a duplicate key error if the class also has a static constructor. Also abstract/virtual methods have better name resolution logic, if a subclass defines a member with a fixed name (with the Name attribute), and the abstract/virtual method does not have a fixed name, it will be resolved to avoid naming conflicts in JavaScript translation automatically.
  • #959 A specific error is given if a method marked with the SPAEntryPoint attribute is non-static or has arguments.
  • #961 C# proxy types do not incorrectly warn that they should not be public when they are not public. Also, proxy method resolution has been improved, the member signature can use the proxy type as equivalent to the target type, making casts unnecessary.

Example

This is now a working minimal proxy for StringBuilder:

[Proxy(typeof(StringBuilder))]
internal class StringBuilderProxy
{
    private List<string> b = new List<string>();

    public StringBuilderProxy Append(string s)
    {
        b.Add(s);
        return this;
    }

    public override string ToString()
    {
        var s = String.Concat(b);
        b.Clear();
        b.Add(s);
        return s;
    }
}

Previously the Append method would have needed to return StringBuilder, using an unsafe JavaScript cast (WebSharper.JavaScript.Pervasives.As<StringBuilder>) on the return value.

WebSharper 4.2.13

@Jand42 Jand42 released this Jun 13, 2018 · 97 commits to master since this release

This is a feature release for WebSharper 4.2.

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

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

Enhancements

  • #954 More support for decimal, numeric conversions, abs, sign all work as expected on client-side. Referencing the WebSharper.MathJS nuget package is still needed for using decimals (as well as Complex and BigInteger), which is now have a version that is matching WebSharper package version because of tighter coupling.
  • #956 Added client-side support for DateTime.DaysInMonth/IsLeapYear.
  • #900 Added a new attribute called JavaScriptExport. This can be used to mark parts of code (members or whole types, files or assemblies) to be always included in JavaScript output for Bundle/BundleOnly projects (serving additional starting points for dead-code elimination next to SPAEntryPoint). Also SPAEntryPoint is now optional. See ticket #900 for full specification.
  • The JavaScript attribute has also got enhancements, same as JavaScriptExport:
    • You can now have multiple JavaScript attributes, this is useful on assembly-level for annotating multiple types/files remotely.
    • You can use a type as argument, for example [<JavaScript(typeof<MyType>)>]. This is equivalent to marking the type named with [<JavaScript>]. The attribute must be on the assembly or on a type/module that is containing the targeted type as a nested type.

Fixes

  • #953 Dictionary methods do not return undefined instead of false.

WebSharper 4.2.12

@Jand42 Jand42 released this May 19, 2018 · 104 commits to master since this release

This is a feature release for WebSharper 4.2.

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

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

Enhancements

  • #945 The System.Decimal type now can be used as RPC arguments or return value. Using it on the client side still requires the WebSharper.MathJS package, so it is also needed for remoting.

WebSharper 4.2.11

@Jand42 Jand42 released this May 17, 2018 · 105 commits to master since this release

This is a bugfix release for WebSharper 4.2. See the associated WebSharper.UI release.

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

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

Fixes

  • #945 WebSharper's build tools accept non-numeric nowarn arguments. This fixes compatibility with Visual Studio 15.7 and associated C#/F# build tools.
  • #947 Resources using BaseResource and an URL starting with // are correctly downloaded during build when UseDownloadedResources is on.
  • #946 Union cases with a Wildcard attribute used for inferred routing has improved behavior: if another case can be fully matched, then that takes precedence over the Wildcard one.
  • #948 An erased union where one type argument is a union with a possible null value (either using WebSharper's [<Constant "null">] attribute or [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]) is now translating case checks with the proper null check included.
  • #944 when translating a check against an interface type, an "object" type check is also added to prevent runtime errors.

WebSharper 4.2.10

@Tarmil Tarmil released this May 4, 2018 · 113 commits to master since this release

This is a bugfix release for WebSharper 4.2. See the associated WebSharper.UI release.

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

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

Improvements

  • #943 New option for DownloadResources: WarnOnly.
    • true tries to download resources, and throws an error if it fails.
    • WarnOnly tries to download resources, and shows a warning if it fails.
    • false does not download resources.

Fixes

  • #940 Inferred sitelet: "GET /" union case prevents other cases from being parsed

WebSharper 4.2.9

@Jand42 Jand42 released this Apr 17, 2018 · 116 commits to master since this release

This is a bugfix release for WebSharper 4.2. See the associated WebSharper.UI release.

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

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

Enhancement

  • #921 Now JSON deserialization can handle the System.Object type, implemented as follows:
    • deserializing on the client side just returns the parsed value (ie. one of: null, a boolean, a string, a number, an array or a plain object).
    • deserializing on the server side produces a boxed value:
      • null, boolean, string return a value of the corresponding type.
      • number: returns a float (System.Double)
      • array: returns a recursively parsed obj[]
      • object: returns a recursively parsed Dictionary<string, obj>
    • serializing from System.Object is not supported. This is to avoid accidentally upcasting the argument of Json.Serialize to System.Object when a type annotation is missing.

Fixes

  • #935 Seq.chunkBySize and other similar functions does not fail erroneously on some inputs.
  • #934 If for a website project, there is no "outputdir" in ws.config or WebSharperOutputDir in project properties or a web.config file in the project folder, an explicit error is given that the unpack output directory cannot be determined.

WebSharper 4.2.8

@Tarmil Tarmil released this Mar 26, 2018 · 121 commits to master since this release

This is a bugfix release for WebSharper 4.2. See the associated WebSharper.UI release

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

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

Fixes

  • #931 Add downwards assembly redirects. This fixes an assembly load failure when a non-WebSharper-compiled referenced assembly uses FSharp.Core > 4.4.1.0.