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

ts2nim

v0.0.31

Published

typescript to Nim transpiler

Downloads

23

Readme

ts2nim

Build Status Total alerts Language grade: JavaScript Npm Version npm: total downloads Types Dep license

Typescript to Nim transpiler

It also can translate js code with the Nim type auto as typescript-estree compatible with the js estree.

It identified the .d.ts file if the ast node is TSMethodSignature it will add importcpp pragma to translated proc, so it could be used as a wrapper generator.

Motivation

Transpile nodejs modules, write in Typescript and transpile it to Nim, expand the Nim-Javascript backend ecosystem and so on.

Current goal is translating Typescript syntax into valid and pretty looking nim code. you may manually modify nim sources after translation. it just translate source code exclude dependency,even modules in nodejs std.

demo transpiled project:
vscode-uri

It can be easy to translate library processes like string manipulation, images, bytes and all these things.

RoadMap

This project has two routes

  1. Generate nim js bridge through typescript type difinition file.
  2. Generate nim source code through typescript source file.

Todos

  • [ ] Inferring js type (object or others)
  • [ ] Inferring native type (eg. number is int or float)

Limitations

assemblyscript basics described well, share same theory.

Installation

npm i ts2nim or
yarn add ts2nim

Usage

ts2nim -i inputFileOrDir -o outFileOrDir

without param it will transpile current directory in place with extension .nim

Translation

| origin | to | description | | :-------------: | :----------: | :----------- | | number | float | | | boolean | bool | | | interface,type,class | type | | | Example() | newExample() | constructor for a class | | let,var,const | var | const no-object -> const,others var | | this | self | | | null,undefinded | nil | | | optinal param | none(T) | options module | | T|null,T|undefinded | T | ref type| | RestElement param | openArray[T] | | | switch | case of | | | Array | seq | | | StringTemplate | fmt | strformat module | | do while | doWhile | doWhile template | | raise new T() | raise newException(T) | | | .length | .len | | | .push | .add | | | fs.readFileSync | readFile | os module | | path.join | / | os module | | .some | .any | sequtils module | | .sort | .sorted | algorithm module | | async | {.async.} | asyncdispatch or asyncjs module | | === | == | | | !== | != | | | && | and | | | || | or | | | ! | not | | | + | & or + | depends on a literal string or number found | | delete | assign to nil | | | extends A,B| ref object of A,B | Multiple Inheritance not supported in Nim |

Related Projects

mcclure/dts2nim

Projects use ts2nim

Add by you