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

as3-to-ts

v0.3.3

Published

Tool to help porting ActionScript 3.0 code to TypeScript.

Downloads

18

Readme

as3-to-ts

A tool that helps porting as3 codebase to typescript

This fork has major improvements parsing and emitting code. It has also a "bridge" feature that allows implementing custom node visitors.

This project is a fork of simonbuchan/as3-to-typescript, which is a fork of the original as3-to-typescript implementation.

Installation

Option 1: via npm::

npm install -g as3-to-ts

Option 2: building the source:

Make sure you have Node v6+ installed.

  • Clone the repository
  • Run npm link

You should have as3-to-ts now globaly available in your commandline.

Usage

as3-to-ts <sourceDir> <outputDir> [--commonjs] [--bridge createjs] [--interactive] [--overwrite]

Options:

  • --commonjs: export .ts files using CommonJS's import style.
  • --bridge [name]: use custom visitor. implemented under src/bridge/[name]
  • --overwrite: force overwrite of previously-converted files.
  • --interactive: if you've manually changed a generated .ts file, you'll be asked if you want to overwrite it or not.

Known issues

  • super calls on constructor need to be moved as the first call after conversion.
  • having a comment on extends statement causes infinite loop parsint the .as file.
  • having break without a semicolon results in infinite loop parsing the .as file.
  • having a method without access level will throw Error: invalid consume. (usually this is result of bad copy & paste without renaming the class constructor)
  • having inline multiline comment break the parser (var i = (/*comment*/true))
  • namespaces can't have TypeScript keywords, such as enum, class, etc. (not an issue if transpiled using --commonjs)
  • multiple property definitions generate invalid syntax (public var velocityX:Number, velocityY:Number;)

Note

This tool will not magicly transform your as3 codebase into perfect typescript, the goal is to transform the sources into syntacticly correct typescript, and even this goal is not perfectly respected. It also won't try to provide javascript implementation for flash libraries.

However unlike most attempts that I have seen this tool is based on a true actionscript parser, and so should be able to handle most of as3 constructs and greatly ease the pain of porting a large code base written in as3 to typescript.