Releases: dotnet-websharper/core
WebSharper 4 (codename Zafir) beta-1
New C# support and improved F# features are coming to WebSharper.
New in 4.0
- A C#-to-JavaScript compiler, fully compatible both ways with F# libraries.
- Many new .NET framework features are usable client-side, including delegates, Tasks (usable for remote calls too), Linq methods.
- Code dependency exploration for smaller output for single-page applications.
Try it
Project templates
Download the latest Visual Studio extension installers here:
In the 'New Project' dialog you can find project templates in the 'Zafir' section under Visual C# or F#.
Xamarin Studio and MonoDevelop upcoming.
In your browser
Try WebSharper has been updated for WebSharper 4 beta, including C# support.
Code service also shows WebSharper-specific errors and warnings for both languages.
Features
C# compiler and tools
- Code analyzer marking WebSharper translation errors as you code.
- New API for creating reactive DOM nodes and defining Sitelets (type safe site map) from C#.
- Full list of C# syntax currently supported and planned for stable release
- We are continuously expanding C# features, tests, APIs and documentation.
New F# features
- Not relying on ReflectedDefinition produces smaller .dll files and have improved compilation running time.
- All F# language features are now supported, including object expressions,
byref
and&
operator, inner generic functions, pattern matching on arrays, statically resolved type parameters. - Correct object-oriented behavior in JavaScript translation. WebSharper now fully supports method overrides, interface implementations, static constructors, base calls, constructor chaining, having no implicit constructor, self identifier on constructors.
- Module
let
values now work as in .NET, not all initialized semi-randomly on page load, only on first access of a value from a single file. - Better error reporting, translation failures are reported at the exact location of the expression.
- For upgrading your WebSharper 3 projects, check out the update guide.
Documentation
Websharper.com documentation page has been updated for WebSharper 4 beta, including pages for C#.
This is a work in progress, you can find the full source for the documentation pages in the websharper.docs repository, comments and contributions are welcome.
Package naming
WebSharper 4 is codenamed 'Zafir' (Sapphire in Hungarian).
Stable release of packages will be named WebSharper.X
with version 4.0.
We are planning to rework the build system for extensions, so that we can have cleaner package versioning, and no unnecessary updates for packages with no changes.
In the meantime all NuGet package names for WebSharper 4 beta are Zafir.X
.
Beta warning
Most planned changes until stable release are related to metaprogramming (macros and generators), compiler API, cleanup and optimizations, and extra features like TypeScript interoperability.
However, other breaking changes are possible while the project is in beta phase.
Happy coding!
WebSharper 3.6.11
WebSharper.Html
- Properly encode server-side attributes' value. (PR by @MaxKot)
WebSharper.UI.Next
- Added
View.MapAsync2
. - Added
on.viewUpdate
, an attribute that calls a callback whenever the givenView
is updated, as long as the containingDoc
is in the DOM. - Templating: handle
data-event-afterrender
properly. - Templating: Cache the provided type definition. (PR by @vasily-kirichenko)
WebSharper 3.6.10
WebSharper 3.6.7
WebSharper 3.6.6
WebSharper
- #491: Remove reference from
WebSharper.Sitelets.dll
toWebSharper.Compiler.dll
- #498: Add
WebSharper.Web.Require<'Resource>
server-side control. - #502: Add client-side Cookies library.
- #503:
Window
inherits fromEventTarget
, allowing the use ofAddEventHandler
onJS.Window
. - #504: MSBuild task: force loading the right version of FSharp.Core in the appdomain.
- #506: In unpack task, use
$(OutDir)
if set. - #507: Honor optional arguments
Async.AwaitEvent(?cancelAction)
andAsync.StartChild(?timeout)
. - #508: bind multiple-argument versions of
JSON.Stringify
. - #509: Fix
JSON.Serialize
macro for recursive types. - Add missing proxies for
querySelector
andquerySelectorAll
onWindow
andDom.Element
. - Add proxy for
System.TimeoutException
. - Always extract resources when
WebSharperProject
isSite
, thus fixing WebSharper.Suave #7.
WebSharper.UI.Next
WebSharper 3.6
The main new feature is the capability to point to our CDNs for the WebSharper libraries. You can simply add the following setting to your application configuration file (Web.config
or App.config
depending on the project type):
<appSettings>
<add key="WebSharper.StdlibUseCdn" value="true" />
</appSettings>
The links generated by WebSharper, instead of pointing to /Scripts/WebSharper/...
for scripts and /Content/WebSharper/...
for CSS, will point to //cdn.websharper.com/{assembly}/{version}/{filename}
. You can configure this URL by setting the WebSharper.StdlibCdnFormat
configuration setting. And finally, you can configure the CDN URL for the resources of a specific assembly (from the standard WebSharper library or not) by setting the WebSharper.CdnFormat.{assemblyname}
configuration setting.
Here is the full change log:
-
#488: Allow adding a macro attribute on a type. The macro is invoked for all static and instance method calls on this type.
-
Fix issue preventing macro use in argument to a PropertyGet/Set.
-
#490: Retrieve appConfig parameters from Web.config or App.config when building a single-page application.
-
#493: Add WebSharperReference project item. This allows you to pass references to the WebSharper compiler that are not referenced by the compiled assembly. For example, adding the following to your project file:
<ItemGroup> <WebSharperReference Include="..\packages\WebSharper.3.6.2.220\lib\net40\WebSharper.Core.dll" /> <WebSharperReference Include="..\packages\WebSharper.3.6.2.220\lib\net40\WebSharper.Core.JavaScript.dll" /> <WebSharperReference Include="..\packages\WebSharper.3.6.2.220\lib\net40\WebSharper.JavaScript.dll" /> <WebSharperReference Include="..\packages\WebSharper.3.5.2.220\lib\net40\WebSharper.JQuery.dll" /> <WebSharperReference Include="..\packages\WebSharper.3.5.2.220\lib\net40\WebSharper.Main.dll" /> <WebSharperReference Include="..\packages\WebSharper.3.5.2.220\lib\net40\WebSharper.Control.dll" /> <WebSharperReference Include="..\packages\WebSharper.3.5.2.220\lib\net40\WebSharper.Collections.dll" /> </ItemGroup>
and removing the corresponding
<Reference>
entries allows you to use the proxies from the standard libraries without referencing them in your assembly. -
Add
AssemblyFileVersionAttribute
to all standard library assemblies. -
#494: Add support for pointing resources to a CDN (see above).
-
#495: Add proxies for
{Int32,Double,DateTime}.{MinValue,MaxValue}
. -
#496: Add proxy for
String.IsNullOrWhiteSpace
.
WebSharper 3.5.16
WebSharper.Testing
The unit testing framework WebSharper.Testing has been split into a separate NuGet package.
This fixes the issue where QUnit was included as a script in Single-Page Applications even when it wasn't actually used.
WebSharper
- #486: Reference the correct version of FSharp.Core in the MSBuild task. This fixes issues such as
Json.Serialize
failing to compile when running MSBuild from the command line. - #489: Null argument exception when building on mono.
WebSharper.UI.Next
- #17: Add
try...with
,try...finally
andreturn!
to theView.Do
computation expression. - #19: Add
View.Sequence : seq<View<'T>> -> View<seq<'T>>
. - #55: In the templating type provider, translate
<[CDATA[...]]>
blocks toDoc.Verbatim
. - #56: Don't delete some text nodes when updating the view.
- #57: Fix genericity error on the
<~
update operator in Notation.
WebSharper 3.5.14
WebSharper
- The bundle command (a.k.a Single-Page Application) now extracts non-JS, non-CSS WebResources into
/Content
. - #483: Cleaning a bundle project does not fail if output folder does not exists.
WebSharper 3.5.13
Visual Studio Extension
- #2: Add supported product: Visual Studio 2015 Enterprise Edition.
WebSharper
- The bundle command (a.k.a Single-Page Application) now extracts non-JS, non-CSS WebResources into
/Content
. - #482: Fix the serialization of
None
and other values represented asnull
in .NET when passed to inline controls (ClientSide <@ ... @>
in WebSharper.Html,client <@ ... @>
in UI.Next). - Don't fail silently when failing to initialize a Sitelet from a
[<Website>]
-annotated static property.
WebSharper.UI.Next
Doc
is now an abstract class, rather than an interface.- Most extension methods have been changed to C#-style extension methods.
- Add
Doc.Async : Async<#Doc> -> Doc
. - #52: Fix over-eager loading of assemblies in the templating type provider, which could cause conflicts due to file locking.
WebSharper.UI.Next.Piglets
- Add
Doc.ShowErrors : View<Result<'T>> -> (list<ErrorMessage> -> Doc) -> Doc
, also as an extension method onView<Result<'T>>
. - Add
Doc.ShowSuccess : View<Result<'T>> -> ('T -> Doc) -> Doc
, also as an extension method onView<Result<'T>>
.