Access 3600+ libraries from C# and let Bridge.NET compile your project into JavaScript.
Clone or download
Permalink
Failed to load latest commit information.
.github Update ISSUE_TEMPLATE.md Apr 26, 2018
.gitignore Initial commit May 11, 2017
LICENSE.md Add Apache License Version 2.0 Sep 18, 2017
README.md Update README.md Apr 24, 2018

README.md

Retyped logo

Access 2600+ JavaScript libraries from C#


NuGet Status Join the chat at https://gitter.im/bridgedotnet/Bridge

Getting Started

Retyped can be added to any existing Bridge.NET C# Class Library project.

Check out the Retyped announcement blog post.

If you haven't already done so, the first step is to create a Bridge C# Class Library project. The following tutorials demonstrate three techniques for creating a Bridge project.

Install Technique Video Tutorial
Visual Studio Extension youtube
NuGet Package Manager youtube
NuGet Package Console youtube

See the Bridge Getting Started documentation for more details.

Once you have Bridge installed to your project, Retyped is added using NuGet.

Search for Retyped within the NuGet Package Manager, or by running the following command within your NuGet Package Console:

install-package retyped

The base Retyped package adds support for the entire JavaScript ES5 and DOM API. This includes all JavaScript types, functions, classes, and events. Everything.

PRO TIP: Use Deck.NET to experiment with the Retyped base packages. Currently, only the dom, es5, and jquery packages are supported on Deck. We're planning to add configurable support for every Retyped package soon.

Several thousand JavaScript libraries are supported by Retyped. Search for available libraries on the retyped.com or bridge.net websites.

install-nuget-package

Each Retyped library has been created as a NuGet Package and can be found through the NuGet Package Manager, or by using the pattern of retyped.{library_name} in the NuGet Package Console, or by searching the NuGet website. It's really easy to find the library you're looking for.

For example, to install Node:

install-package retyped.node

To install jQuery:

install-package retyped.jquery

About

The Retyped parser is built on top of ANTLR, Mono.Cecil, and the .NET Roslyn Compiler Platform.

Retyped reads TypeScript declaration files (.d.ts) and creates a NuGet Package for each library. The TypeScript Definition files are sourced from several locations including Definitely Typed, GitHub, and directly from the original author through NPM.

A TypeScript declaration file is written in TypeScript and represents the public (exported) members and types of a JavaScript library. If you are familiar with C++ you can think of a declaration file as a header file (.h). It contains interfaces and definitions, but there are no implementation details.

Retyped is built and professionally supported by the team at Bridge.NET (website | forums | github | twitter).

Package Structure

Retyped reads declaration files, compiles each into an individual C# Class Library project, and creates a NuGet Package for each. These are considered Binding Libraries for Bridge.NET projects.

Each Retyped package also embeds the source .d.ts declaration file. That file (or files) will be emitted to your output folder if the corresponding generateTypeScript setting is configured in your projects bridge.json file:

"generateTypeScript": true

In a future release, Retyped packages will also contain all required JavaScript (.js) source files. This is a priority item on our roadmap. Once this feature is supported, that would make the installation process as smooth as possible. For now, the JavaScript .js source file or Module for a particular library must be added to your .html file manually.

Package Versioning

The version number for Retyped packages follow the pattern of MAJOR.MINOR.DDDD with DDDD being the number of days since 2000–01–01 UTC.

The DDDD calculation is simple and a Deck is available to easily determine the DDDD value based on any given date.

For example, the package Retyped.node 7.0.6477 was created from the Node 7.0 release and published by Retyped on 6477, which was September 24, 2017.

// Determine publish date 6477
new DateTime(2000, 1, 1).AddDays(6477)

This versioning scheme allows for quick referencing of the particular JavaScript libraries version and easy lookup of the publish date, while conforming to the NuGet package versioning spec.

FAQ

  1. Question: I've found a mistake in the Retyped package {library_name}. How can it be fixed?
    Answer: Since Retyped parses original TypeScript declaration files, please double check the error does not originate from the original .d.ts file. If it does, please report the issue (or submit a PR) to the DefinitelyTyped repository. Once the issue is fixed, Retyped will recompile the library and publish a NuGet package.

  2. Question: I've found an issue related to incorrect JavaScript being emitted, or the C# API doesn't correspond to the source declaration file. The source .d.ts file appears to be correct.
    Answer: Please report the issue and we will investigate right away.

  3. Question: I have a proposal for simplifying or enhancing Retyped syntax. Where can we discuss?
    Answer: We really appreciate your feedback and ideas. Please create an issue so we can review and discuss with you.

  4. Question: I need a Retyped package for {library_name}. The library is available in the DefinitelyTyped repository but I cannot find a Retyped package for it?
    Answer: Sorry for that. We do our best to support all the libraries from the DefinitelyTyped repository. However, some libraries can't be compiled due to specific syntax that is not currently supported by Retyped compiler, or the library contains a defect.
    Another possible reason is that your library has just been added, and in this case, a Retyped package is on its way. Either way, please report the issue to draw our attention to the problem. Don't hesitate to add your comment or reaction, if the issue already exists.

  5. Question: I need a Retyped package for a library that is not in the DefinitelyTyped repository. Can we get a custom Retyped package made?
    Answer: The simplest process is to add that library into the DefinitelyTyped repository. On the next recompile by Retyped, the library will be available and can be searched on the retyped.com website.
    If the library is private and cannot be released publicly, please send an email to hello@object.net and we'll try to help.

Badges

Show your support by adding a built with Retyped badge to your project's README or website.

Built with Retyped

Markdown

[![Built with Retyped](https://img.shields.io/badge/built%20with-Retyped-blue.svg)](http://retyped.com/)

HTML

<a href="http://retyped.com/">
    <img src="https://img.shields.io/badge/built%20with-Retyped-blue.svg" title="Built with Retyped" />
</a>

License

Licensing for use of the individual JavaScript libraries should be sourced from the original JavaScript library.

Retyped packages are licensed under Apache-2.0 licence and are free to use in both commercial and open-source projects.

Currently, the original C# source code generated for each library by Retyped are not publicly available. We hope to release these at some point in the future, but for now, they're private. The NuGet Packages are public, the C# source code for each package is private.

The Retyped tooling, including the parser and compiler source code is private.