Releases: dotnet-websharper/core
WebSharper 4 beta-9
Zafir.4.0.177.78-beta9
Fixes
- #719
beta8
had a serious bug where it generated unsafe accesses to global object at the top of the scripts, this is now fixed, but not reverting the change to shorten outside addresses, see the note about breaking change below.
Improvements
- #722 Auto-hash WebSharper-generated output and files included as
WebResource
, use this hash on generating links to avoid browsers caching an outdated version. This is an automatic feature, no configuration currently. - #725 Client-side JSON can de/serialize custom classes. (
Serializable
attribute and default constructor are not required as on the server.) - #726 Not creating .js file for an assembly containing only inlined code
- #715 Client-side JSON module is visible as
WebSharper.TypedJson
from C# to avoid name conflict. - #723
JavaScript(false)
on an interface opts-out of default interface handling on client-side, allows for more divergence of client/server behavior when needed. - #724 optional analyzer for closures, helping to avoid some classes of memory leaks in JavaScript.
There is an inconvenient source of memory leaks in most JavaScript engines: captured variables are tied to a Context object and even functions that do not use some (or any) variables from a Context still retain the whole object. This is described well here: http://point.davidglasser.net/2013/06/27/surprising-javascript-memory-leak.html
Adding a
WebSharperAnalyzeClosures
project property gives warnings on these kinds of captures, helping to eliminate memory leaks.Usage:
<WebSharperAnalyzeClosures>True</WebSharperAnalyzeClosures>
or<WebSharperAnalyzeClosures>MoveToTop</WebSharperAnalyzeClosures>
. The latter additionally moves all non-capturing lambdas to top level automatically (experimental).
Breaking change
- Previously, having
[<Inline "myLibrary.doSomething()">]
and[<Inline "$global.myLibrary.doSomething()">]
was working equivalently. Now access to global scope without the$global
object is assumed to be initialized before the current script starts running (WebSharper itself takes care of this, if you use theRequire
attribute) and will not change, so it is safe to shorten. Whenever you want the exact call on the current global scope (window
object), be sure to use$global
.
WebSharper 4 beta-8
Zafir.4.0.171.72-beta8
Fixes and improvements
- #717 Fixed exponential compile time on chained method/property calls
- #716 C# helper for constructing a custom plain JavaScript object:
new JSObject() { { "background-color", "#666" } }
- #709 Remove unnecessary variables around inlines. Also stronger optimizations for conditionals, function
.apply
and array.concat
to reduce translated code size and make it more readable.
WebSharper 4 beta-7 bugfix-2
WebSharper 4 beta-7 bugfix-1
WebSharper 4 beta-7
Zafir.4.0.169.70-beta7
Latest Visual Studio template installers compatible with VS2015/2017 is available here.
Enhancements
- #689 Added support for F# 4.1 and C# 7 new language features.
- #596 Automatic download of remote web resources to serve from locally. Set
<WebSharperDownloadResources>True</WebSharperDownloadResources>
in your project file to have WebSharper download all remote js/css defined in current project and all references. Add
<add key="UseDownloadedResources" value="True" />
to your<appSettings>
section inweb.config
. - #696 Parameterless union cases of a JavaScript-annotated union translate to a singleton instance for performance. Equality checks are optimized for these cases to just check the tag.
- #638 Added
Warn
attribute, calls to annotated member will generate a warning wherever it is called from client-side code. - #693 F# multi-type trait calls translate but still are not supporting overloads. F#
+
and-
operators properly translate to the operator defined by the type. - #703 Stub classes with a base class do not emit a new class overwriting outside one.
UI.Next
- #117 IE compatibility: use DomElement.parentNode, not parentElement.
- Implement the revised templating engine for C#.
Fixes
WebSharper 4 beta-6 bugfix-6
Zafir.4.0.161.45-beta6
We are working on F#4.1+C#7 support, coming soon, now releasing some fixes and a new template installer for Visual Studio 2015/2017. Download latest here: http://websharper.com/Zafir.vsix
Thanks to @FilippoPolo for submitting a bug report.
Fixes
- #695 JavaScript property getter expressionss are not moved during optimization when there are any side-effecting code between.
- Offline sitelets work for Endpoint types without structural equality, making it easily usable from C#, there is a new template for it.
WebSharper 3.6.20
Fixes
- #562 Field types are included when calculating code dependencies. This solves an issue when an RPC is returning a type in a field of the return value that is contained in an assembly that is not used directly. Previously the
.js
link to the generated code of this library was missing, resulting in a runtime error when looking up the prototype. - #688 Websharper 3.6 is now compatible with FSharp.Core 4.1. (Full F# 4.1 language support is coming with WebSharper 4.0 soon.)
CanvasElement
andMediaElement
inherit fromElement
WebSharper 4 beta-6 bugfix-5
Zafir.4.0.160.40-beta6
Thanks to @cgravill and @amieres for submitting bug reports.
Fixes
- #681 Return was missing so infinite loop was generated on a module-level
let rec
returningunit
- #682 Mark arguments transformed in tail recursion optimization as mutable to avoid incorrect inlining which could result in invalid JS code
- #680 Do not eta-reduce to expressions that has side effects so needs the closure
- #666 Ignore duplicate references when initializing Sitelets in non-ASP.NET contexts, fail only on WS assemblies with different versions.
- #684 Fix for JavaScript statements in
Inline
to not drop first statement if it was an expression - #685 Different
Name
andAssemblyName
in F# does not cause errors
Improvements
- #683 You can now opt-out of dead code elimination for SPA projects. Use
<WebSharperDeadCodeElimination>False</WebSharperDeadCodeElimination>
in the project file or add--dce-
to thewsfsc.exe
command line. - #686 Case test for erased unions with a case which is a plain object in JS now compiles, if there is no previous case that is also a plain object, then it gives a more specific error
Breaking changes
- #670 By default, classes (including F# records and unions) with no methods translated to JS instance methods and having no base class are now translated not to have a prototype. JSON serializer was fixed to handle this. This is a performance optimization, but disallows type checks or inheriting from a class like this. So a new attribute
Prototype
was added to opt-in for generating a prototype for the type in the translation. Extra features:Prototype(false)
forces the type to have no prototype, converting instance methods to static in translation.
WebSharper 4 beta-6 bugfix-4
Zafir.4.0.159.36-beta6
Fixes
- #668 Printing WebSharper errors with full file path and correct source position format so it shows up in Visual Studio
WebSharper 4 beta-6 bugfix-3
Zafir.4.0.158.33-beta6
Fixes
- #668 Printing F# compilation errors and warnings as compiling with
fsc.exe
would, respectingnowarn
,warn
,warnon
,warneserror
flags - #667 Fix C# analyzer giving failure warnings on build
- #669
Async.StartImmediate
andAsync.StartWithContinuations
now start theasync
immediately as in .NET, possibly finishing synchronously if they contain no bind/combine. - #671 Fix a translation bug in optimization around calling curried instance members
- #673 integer type
Parse
andTryParse
methods follow .NET semantics, checking boundaries and disallowing fractions - #677 Fix using
Inline
on constructors calling into other constructors - #678 Fix inlining JavaScript statements, and using
return
to produce a value - #679 exception properties
Message
andInnerException
should work for all exception types - #676
Queue
andStack
constructors taking aseq<'T>
(IEnumerable<T>
)