0.0.1 • Published 1 year ago

ts-ucode v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ts-ucode

TypeScript tools for OpenWRT ucode.


This is a WIP. It does work, but there is a lot to be done and a lot to improve. PR are welcome!


Usage

Install ts2ucode globally

npm install -g ts-ucode

Initialize a project dir (for completion and npm scripts)

# within the directory to initialize
ts2ucode init

Transform TypeScript sources into ucode:

If ran from a ts-ucode initialized directory:

ts2ucode

or from anywhere else:

ts2ucode <source-dir> <out-dir>

Features

  • compiler
    • compile source dir to target dir
    • compile standalone source file
    • user friendly errors using TS diagnostics
  • initialize project
    • create a package.json (improvements needed)
    • create a tsconfig.json (improvements needed)
    • ...
  • Typings/IDE completions
    • removed standard JS lib
    • ucode core functions
    • uloop (some fixes/improvements needed)
    • ubus (some fixes/improvements needed)
    • fs (incomplete?)
    • uci (incomplete for packages)
    • math
    • nl80211
    • resolv
    • struct
    • rtnl
  • transformers
    • default parameters
    • undefined => null
    • methods to functions
    • arrow function compatibility
    • exports grouped at the end
    • for (.. of ..) => for (.. in ..)
    • throw
    • fixes import paths
    • destructuring arrays
    • destructuring objects
    • classes
      • private/protected/public members (static or not)
      • constructor (as well as members in parameters)
      • member initializers
      • inheritance
      • super keyword
    • decorators
      • functions
      • class
      • class members
  • test runner (WIP, not even in this repo but to be imported from private closed sources)
    • run on docker
    • run on specific device