npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fable-compiler-netcore

v0.7.42

Published

F# to JavaScript compiler

Downloads

78

Readme

F# |> BABEL

The compiler that emits JavaScript you can be proud of!

Mono Build Status .NET Build Status npm Join the chat at https://gitter.im/fable-compiler/Fable

RELEASE NOTES · Follow us on Twitter!

Fable brings together the power of the F# compiler and Babel to make JavaScript a true backend for F#. Some of its main features are:

  • Works directly on F# source code, no compilation to .NET bytecode needed
  • Optimizes F# code to generate as clean JavaScript as possible
  • Passes location data to Babel to generate source maps
  • Compatible with all Babel plugins and other JS development tools, like Webpack
  • Support for most of the F# core library and a bit of .NET Base Class Library
  • Tiny core library included (around 20KB minified and gzipped) with no runtime
  • Organizes code using ES6 modules
  • Interacts seamlessly with other JavaScript libraries
  • Bonus: compile NUnit tests to Mocha

Usage

Fable is distributed through npm! You can install and run it just by typing:

npm install -g fable-compiler
fable path/to/your/project.fsproj

Note the package name is fable-compiler while the command is just fable

You can find more detailed instructions about F# to JS compilation in the docs. Also you can have a look at the samples or download them from here.

Requirements

You must have F# 4 and node 4.4 or higher installed in your computer.

If you are having problems to use Fable under Windows, try the following:

  • Make sure fsc.exe is added to the path.
  • Install MSBuild tools 2013.

Contributing

Just by using Fable you're already contributing! You can help a lot the community by sharing examples and experiences in your personal blog or by sending a PR to Fable's website (see this for more info).

Send bug reports (ideally with minimal code to reproduce the problem) and feature requests to the GitHub repository. Issues with the label discussion will be also added to ask the opinion of the community on different topics like the logo, roadmap, etc. For more immediate comments you can use the Gitter chat.

A plugin system is also available to allow you extend Fable according to you needs.

Caveats

  • Options are erased in compiled code. This has several benefits like removing overhead and interacting with native JS functions in a safer way (null will be None). However, it will lead to unexpected results if you do weird things like wrapping null in Some. For practical purposes, Fable considers null, undefined, None and unit to be the same thing.

  • Information about generic types is not included in the generated JavaScript, so code that depends on this information to be known at runtime for method dispatching may have unexpected behaviour.

To know more, read Compatibility.

Acknowledgements

Of course, this project wouldn't have been possible without the fantastic work of the F# compiler and Babel teams. I hope they feel proud seeing how their work has met in a very unexpected way, giving developers even more possibilities to build great apps.

The awesome F# community has played a big role in making this possible. I've met incredible people and it's impossible to list all the names without forgetting anyone, but I'd like to give a particular mention to Zach Bray for his work on FunScript, Don Syme (the fact that the designer of the language himself shows interest in your work, no matter how humble it is, is really a big push!) and Krzysztof Cieślak (I always have to look up the name to spell it correctly) because he's shown that F# is a perfect fit for a big project targeting JS.

And finally I'd like to thank my partner (is it too old-fashioned to say wife?) for bearing with me everyday.