Skip to content

Releases: dotnet-websharper/core

WebSharper 6.0.1

06 Sep 15:50
Compare
Choose a tag to compare

This is a minor enhancement release of WebSharper 6. NuGet version 6.0.1.233.

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

Enhancements

  • #1262 Whenever a method with JavaScript-enabled parameter also needs value of expression passed, like Doc.Hydrate, a warning is given if you use explicit <@ @> F# quotation instead of an auto-quoted parameter. This ensures the intended use of Doc.Hydrate to generate a server-side DOM too for SEO but it's still non-breaking if value cannot be found.
  • #1263 Compiler prints errors happening during offline Sitelet generation with all their inner exception info.

WebSharper 6.0

07 Jul 17:26
Compare
Choose a tag to compare

This is first stable release of WebSharper 6. NuGet version 6.0.0.228.

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

The .vsix installer has been retired, install dotnet templates as above to have them available within Visual Studio 2022 New Project wizard.

Features

  • #1225 Support for .NET 6.0. .NET Standard 2.0+, and .NET Core 2.1+ are also still supported.
  • #1218 Using FSharp.Compiler.Service 41.0.3 for F# 6.0 language features. Added support for:
    • task computation expression builder
    • new List/Array/Seq module functions: insertAt/removeAt/updateAt/insertManyAt/removeManyAt
    • F# Map properties: Keys/Values
    • printf %B binary printing support
    • F# 6 syntax enhancements: expr[idx] indexing, as patterns, implicit conversions
  • #1219 Support for most new C# 10 features:
    • Extended property patters Prop1.Prop2: value
    • global using directives
    • File-scoped namespace declarations
    • Lambda expression improvements
    • Constant interpolated strings
    • Record types can seal ToString
  • #1117 Support for more C# 9 features:
    • Covariant return types
  • #1049 Support for more C# 8 features:
    • #1224 Default implementations of interface members
    • Recursive patterns

Enhancements

  • #1216 Serving minified/non-minified scripts is now controlled by the "UseMinifiedScripts" runtime setting. Added appsettings.json and appsettings.Development.json to all web templates so that existing behavior is kept, Debug builds use non-minified scripts.
  • #1088 All supported collection interface types can be cast to collection interfaces: ICollection, ICollection<T>, IList, IList<T>, IDictionary<K,V>, ISet<T> and calling methods on these interface types work as expected. As types are erased in WebSharper translation, there is no performance loss on this. (For example calling .Count would not enumerate whole collection, if the underlying collection object would not.)
  • #1229 Runtime settings are now have more standardized names. Existing names for settings still kept as fallback. The new names are:
    • StdlibUseCdn, StdlibCdnFormat and CdnFormat.* for controlling WebSharper CDN link generation. Now cdn.websharper.com is live for WebSharper 5+ public releases.
    • UseDownloadedResources - remote scripts are dowloaded at compile time (also needs similar wsconfig.json setting) and linking them from local server.
    • UseMinifiedScripts - if true, serves .min.js scripts. Default is true.
  • #1230 Added missing overloads for JavaScript EventTarget methods.
  • #1232 Runtime helper functions are now named as WebSharper.Runtime.* instead of IntelliFactory.Runtime.*. This should require no changes, unless you called any of these functions directly which is not their intended use.
  • #1241 The WebSharper core package does not depend on either System.Configuration.ConfigurationManager or Microsoft.AspNetCore.Mvc.Abstractions any more. The single MVC-related functionality of WebSharper.Sitelets.Content type implementing IActionResult has been used to WebSharper.AspNetCore package via a .ToIActionResult() extension method instead of direct implementation.
  • #1247 Logging initialization/request handling times now follows ASP.NET Core standards. The "WebSharper.AspNetCore.IWebSharperService" category currently has 2 levels of logging, Information writes the sitelet runtime initialization time and Debug writes routing+handling+writing subtimes for requests handled by WebSharper Sitelets.
  • #1254 Added extension methods for WebSharper.Sitelets.Content and their async forms (Async<Content> in F# and Task<Content> in C#) to help integrating WebSharper content into ASP.NET Core applications. Use .ToIActionResult() to return WebSharper Content from inside an MVC handler, or .HandleRequest as a handler in minimal ANC APIs. For the other direction, also added Content.MvcResult to convert any object allowed as a return type in MVC to a WebSharper Content value.
  • #1253 Added support for per-endpoint CORS for C# via the new SiteletBuilder.WithCors methods.
  • #1252 Standardized project type names. For each existing alias, only one is made standard. No breaking changes, other allowed project type aliases just give a warning, recommending to switch to standard name.
  • #1258 Improved logging for html projects (offline Sitelets), visible with MSBuild Verbosity=Detailed.
  • #1260 Html project generation now generates as much output as it can while collecting errors if any, and reporting errors for each failed page separately instead of a global failure.
  • #1257 Conflicting multiple proxies for the same type/member now always should give specific compilation errors with message ""Duplicate client-side representation found for ..." instead of a global compiler failure.

Breaking changes

  • #1220 Compilers now run on .NET 6, need a 6.x dotnet runtime installed.
  • #1141 Context.Request.BodyText property now has type Task<string>. This means that it cannot be used synchronously without explicitly waiting on result, resolving all hidden synchronous waits within WebSharper routing too that had some performance drawbacks.
  • #1227 Cleanup of ANC initialization methods. All obsolete IApplicationBuilder extensions removed. You do need to use .AddWebSharper() in services builder too when you have .UseWebSharper(), a runtime error pointing this out is given if missing. This fixed scenarios where WebSharper has ran its metadata loading step twice, improving startup performance.
  • #1226 The Actions property of WebSharper.Sitelets.IWebSite interface (used for describing pages to generate for offline sitelets) is now of type IEnumerable<'Action> instead of F# list: list<'Action>. As the type is widened, it would only break existing code in rare cases.
  • #1250 The "outputDir": "wwwroot" setting is now the default for website projects. Use new project type microservice if you need no .js output, only server-side WebSharper functionality like JSON endpoints or RPC.

Fixes

  • #1243 C# analyzer, providing WebSharper errors/warnings during code editing now works as expected on Visual Studio 2022.
  • #1217 F# compilation service for faster recompilations now supported on MacOS.
  • #1248 Fixed a bug in translating F# string interpolations where the accessing this can get scoped incorrectly, resulting in client side null error. Also includes optimizations for JS output for printf family and string interpolation, outputting cleaner and shorter code.
  • #1251 Fix printing errors reading wsconfig.json or console args by the WebSharper F# compiler (wsfsc.exe)
  • #1255 F# records/unions with private internals can be used for server-side inferred routing without runtime error.

WebSharper 5.0

20 Oct 13:11
Compare
Choose a tag to compare

This is the first stable release of WebSharper 5.

Templates for .NET Core SDK: dotnet new -i WebSharper.Templates::5.0.0.119
Templates for Visual Studio 2019/2022: WebSharper.5.0.0.119.vsix

Enhancements

  • #1209 various C# 8/9 features are now usable for JavaScript translation, including records, pattern matching, local functions.
  • #1210 C# records can be used with WebSharper's routing, remoting and JSON serialization.
  • #1207 Updated DOM API.
  • #1213 Added WebSharper.AspNetCore.Sitelets.HttpHandler and WebSharper.AspNetCore.Remoting.HttpHandler helpers to allow hosting WebSharper Sitelets in giraffe/Saturn pipelines. Add .AddWebSharper() in your ConfigureServices method to enable.

WebSharper 5.0.0.104-preview1

28 Sep 07:36
Compare
Choose a tag to compare
Pre-release

This is a small fix and enhancement release of WebSharper 5 Preview.

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

Fixes

  • #1206 Web.Control subtypes defined without a namespace in F# (file header like module X) work as intended.

Enhancements

WebSharper 5.0.0.100-preview1

10 Sep 16:08
Compare
Choose a tag to compare
Pre-release

This is a preview release of WebSharper 5.

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

Features

  • #1116 Support for .NET 5.0. .NET Standard 2.0+, and .NET Core 2.1+ are also still supported.
  • #1112 Using FSharp.Compiler.Service 40.0 for F# 5.0 language features. Added support for:
    • String interpolation
    • nameof
    • Enhanced slicing
    • Applicative Computation Expressions
    • Default interface member consumption
    • Implicit interop with nullable value types
  • #1131 New build service for caching F# compiler instance and WebSharper metadata, allowing hot startup for rebuilds. Service's name is "WebSharper Booster <version number>" where the version number can be 5.0.0.100 (#1156). Running the service is automatically enabled. Disabling this feature can be done by
    • Use --standalone+ flag at compile.
    • Add WebSharperBuildService environment variable with "False" value.
    • Add <WebSharperStandalone>True</WebSharperStandalone> project property.
  • #1153 Unpacking resources compilation step time improved.
  • #664 For Sitelets web projects, the compiler now pre-calculates and save runtime metadata in the web project assembly, gaining significant startup time improvements.
    • #1197 Added .SiteletAssembly(asm) method on WebSharperBuilder (to be used inside .UseWebSharper call in Startup.Configure). Sets the assembly used for getting sitelets runtime metadata, this is not needed in web projects themselves (defaults to entry assembly), but can be used for testing, to select which assembly is the WS web project.
  • #1181 Any Sitelets.Content objects now can be returned from ASP MVC routed endpoints too.

Enhancements

  • #1148 Added support for Floor/Ceiling methods in MathJS and updated bindings to support 9.4.4 (#1154).
  • #1164 Add ability to Property and Member to depend on resources as well as Assembly, Resource, Class, Interface in WebSharper Interface Generator.
  • #1160 Move WebSharper.JQuery into its own nuget package (https://github.com/dotnet-websharper/jquery).
  • #1172 Substitute JQuery's AjaxWith with a similar XMLHttpRequest solution in Routing.
  • #1176 Added Application.Text overload for C#
  • #1195 Added bindings for EventSource.
  • #1143 FSharp.Core 5.0 Map/Set working correctly with RPCs.

Breaking changes

  • Compiler project drops support for Net4x. netstandard2.0, .NET Core 3.1 are still supported.

Fixes

  • #1123 Fix "FSC : WebSharper error FS9001: You must provide assembly output path."
  • #1165 Fix "WebSharper warning WS9002: Failed to load return type..." Warning for generic types.
  • #1173 Fix XMLHttpRequest.send() binding.
  • #1183 Fix "error MSB6006: "wsfsc.sh" exited with code 134" on linux (wsfsc fails to build projects). Fixing #1184 together with #1183, because the new build service interactions coupled when build fails on linux.
  • #1184 Fix "Impossible to load assemblies for SwaggerProvider.DesignTime.dll".
  • #1191 Fix "CodeModel.Interface should auto-cast members".

WebSharper 4.7.3

19 Jul 15:15
Compare
Choose a tag to compare

This is a minor release for WebSharper 4.7.

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

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

Enhancements

  • #1109 Added Floor/Ceiling methods and comparison operators to the decimal proxy.
  • #1154 Updated MathJs binding to version 9.4.4
  • #984 System.Numerics.BigInteger (F# alias bigint) proxy now uses default EcmaScript 2020 BigInt. F# bigint literals like 99I are also supported.

WebSharper 4.7.2

23 Jun 21:03
Compare
Choose a tag to compare

This is a bugfix release for WebSharper 4.7.

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

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

Fixes

  • #1126 Fixed an optimizer bug around object expressions that could drop property sets
  • #1134 Added Context.WithSettings/Sitelets.WithSettings helpers that add new environment vars for a Http Context or Sitelet.
  • #1135 Offline Sitelets projects now respect the WebSharperDownloadResources setting (downloading all remote js/css resources during compile time and linking them from local output). Also, other resources can be redirected with the WithSettings helper within WebsiteEntryPoint definition like so:
    override this.Sitelet =
        MySitelet
        |> Sitelet.WithSettings [
            "WebSharper.JQuery.Resources.JQuery", "https://code.jquery.com/jquery-3.6.0.min.js" 
        ]
    Thanks to @btamas2000.
  • #1139 Synchronous http response writing hangup resolved in WebSharper.AspNetCore.

Known regression

  • #1141 Context.Request.BodyText now throws an error when accessed in an ASP.NET Core web application. Synchronous access to request body will be deprecated. Use asynchronous request read from Context.Request.Body instead:

    async {
        use stream = new StreamReader(ctx.Request.Body)
        let! data = stream.ReadToEndAsync() |> Async.AwaitTask
        // ... process data
    }

WebSharper 4.7.1

30 Apr 22:23
Compare
Choose a tag to compare

This is a bugfix release for WebSharper 4.7.

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

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

Fixes

  • #1123 Fix build error on new .NET5 SDK (Error: "You must provide assembly output path.")

  • #1125 Updated .NET Framework 4.x extension projects to use FSharp.Core 4.7.0 by default (FSharp.Core 5.0 is not yet supported for WIG)

WebSharper 4.7

07 Dec 17:55
Compare
Choose a tag to compare

This is a minor release for WebSharper 4.

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

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

This release updates to a new version of FSharp.Compiler.Service. For optimal compilation speed of F# projects, run the packages\WebSharper.FSharp.4.7.0.423\tools\runngen.ps1 script in administrator mode once.

Features

  • #1114 Added JS.Import, JS.ImportDefault, JS.ImportAll, JS.ImportDynamic functions. Sample usage:

    [<Inline>]
    let importTestJsAll : obj = JS.ImportAll "/modules/test.js"
    // translates to: import * as test from "/modules/test.js"
    
    [<Inline>]
    let importTestJs : obj = JS.Import("testExport", "/modules/test.js")
    // translates to: import { testExport } from "/modules/test.js"
    
    [<Inline>]
    let importTestJsDefault : obj = JS.ImportDefault "/modules/test.js"
    // translates to: import def$test from "/modules/test.js"
    
    // this does not add an import statement on top of the file as the others, but uses JavaScript import function
    [<JavaScript>]
    let testImportDynamic : Promise = JS.ImportDynamic("/modules/test.js").Then(fun testModule => testModule?testExport())
    // translates to: import("/modules/test.js").then(function (testModule) { testModule.testExport(); })
  • #1070 The javascript import function can now be used within inlines, translates to JS correctly.

    [<Inline "import('/modules/my-module.js').then(function (module) { module.run(); })">]
    let runMyModule() = X<Promise>
  • #1120 Updated to FSharp.Compiler.Service 37.0. Building for net5.0 target framework and using FSharp.Core 5.0 is possible but no F# 5 language features are available yet.

Fixes

  • #1115 WebSharper.InterfaceGenerator helper function Pattern.OptionalFields uses the original target JS name, does not appends Opt incorrectly.
  • #1008 uint8 and uint16 array literals are now translated without compiler error.

WebSharper 4.6.7

17 Jul 14:04
Compare
Choose a tag to compare

This is an enhancement release for WebSharper 4.6.

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

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

Enhancements

  • #1108 Added WebSharperSharedMetadata=None setting option to disable metadata loading for Sitelet runtime when not needed (only server-side features of WebSharper are used). Warning: this breaks any site with client-side functionality or RPCs.

Fixes

  • Templates specify langversion:7.3 for C#, which currently has full WebSharper support (projects with newer versions may compile but some newer language fetaures are not supported yet). Thanks to @3dGrabber.