<commit_before># Netjs

Netjs is a .NET to TypeScript and JavaScript compiler.

<img src="Images/Explanation.png" />

## Installation

### Install Netjs

Download it:

	git clone https://github.com/praeclarum/Netjs.git

#### Mac

	sudo make install

This will install a soft link called `netjs` in `/usr/bin` to the script `netjs.sh`.

#### Windows

	msbuild

`Netjs.exe` will be built in `Netjs\bin\Debug`. You can copy this executable to someplace in your PATH to make it readily available.


### Install Node

[http://nodejs.org/download/](http://nodejs.org/download/)

Node is needed by the TypeScript compiler.

### Install TypeScript

	sudo npm install -g typescript




## Compiling Code

Netjs works with .NET assemblies built with any compiler ([limitations][Limitations] not withstanding).

### Compile to TypeScript

	netjs Library.dll

This will output a TypeScript file named `Library.ts` containing all the code from `Library.dll` and any other assemblies referenced in its directory.

### Compile to JavaScript

	tsc -t ES5 Library.ts mscorlib.ts --out Library.js 

This compiles the library code along with a small implementation of mscorlib. The files are merged and output as a single JavaScript file `Library.js`.



## Limitations

* **Namespaces are ignored**
* mscorlib.ts is a **small subset** of the full BCL
* **Virtual overloaded methods** do not work
* **Async** does not work
* **Gotos** only sometimes work
<commit_msg>More limitations in README<commit_after># Netjs

Netjs is a .NET to TypeScript and JavaScript compiler.

<img src="Images/Explanation.png" />

## Installation

### Install Netjs

Download it:

	git clone https://github.com/praeclarum/Netjs.git

#### Mac

	sudo make install

This will install a soft link called `netjs` in `/usr/bin` to the script `netjs.sh`.

#### Windows

	msbuild

`Netjs.exe` will be built in `Netjs\bin\Debug`. You can copy this executable to someplace in your PATH to make it readily available.


### Install Node

[http://nodejs.org/download/](http://nodejs.org/download/)

Node is needed by the TypeScript compiler.

### Install TypeScript

	sudo npm install -g typescript




## Compiling Code

Netjs works with .NET assemblies built with any compiler ([limitations][Limitations] not withstanding).

### Compile to TypeScript

	netjs Library.dll

This will output a TypeScript file named `Library.ts` containing all the code from `Library.dll` and any other assemblies referenced in its directory.

### Compile to JavaScript

	tsc -t ES5 Library.ts mscorlib.ts --out Library.js 

This compiles the library code along with a small implementation of mscorlib. The files are merged and output as a single JavaScript file `Library.js`.



## Limitations

* **Namespaces are ignored**
* mscorlib.ts is a **tiny subset** of the full BCL
* **Virtual overloaded methods** do not work
* **Async** does not work
* **Gotos** only sometimes work
* **Named groups** in regular expressions don't work.
* Seriously, watch it with those overloads.



{'fraction_non_alphanumeric': 0.09707446808510638, 'fraction_numerical': 0.0006648936170212766, 'mean_word_length': 4.074198988195615, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4678403', 'n_tokens_mistral': 927, 'n_tokens_neox': 858, 'n_words': 378}