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

@wartoshika/qhun-transpiler

v1.0.0-alpha.7

Published

A tool to transpiles a Typescript project into lua.

Downloads

4

Readme

Qhun Transpiler

npm version Dependencies Known Vulnerabilities

Service | Master | Dev | ---- | ---- | ---- | CI Status | Build Status | Build Status | Coverage | Coverage Status | Coverage Status |

Description

This tool helps to transpile Typescript into lua. The main goal was to support every aspect of Typescript. Typescript 2 and 3 are supported!

The following languages are currently supported:

  • LUA
  • World of Warcraft LUA Addon interpreter

Installation & Help

$ npm install -g --save-dev @wartoshika/qhun-transpiler
$ qhun-transpiler -h

Setup

You can run qhun-transpiler --init on the command line to automaticly create a qhun-transpiler.js file. This file will include the API and let you transpile all your files. The interfaces of the API are intellisense optimized and if you use a modern editor or IDE you should get information of the possible options.

This is an example of how your file could look like:

const Transpiler = require("@wartoshika/qhun-transpiler");

new Transpiler.Api("lua", {
    entrypoint: "./src/index.ts"
}).transpile().subscribe(pipeline => {

    pipeline.persistAllFiles()
        .prettyPrintResult()
        .applyPostProjectTranspile();

});

Some explanation: The first argument will tell the transpiler what your target is. The second argument is completly optional but let you configure the process of transpiling. These are the supported options:

  • entrypoint?: string: Relative path to the root file of your project
  • compilerOptions?: CompilerOptions: Advanced options used by the Typescript compiler. Use at your risk :)
  • watch?: boolean: Watches for file changes and automaticly trigger the transpiling process
  • overwrite?: complex: See the overwrite section for details.
  • configuration?: ApiConfiguration: More configuration. See below.

ApiConfiguration

  • project?: complex: Project related meta information. Missing details will be read from your package.json file.
  • printFileHeader?: boolean: Print a file header in each generated file. This include the owner, version and a description
  • targetConfig?: complex: A config block for different transpiler targets. See the documentation section for more details.
  • directoryWithSource?: string: Targets to the sub directory of your project where your sourcecode is located. Eg. src

Overwrite:

When the transpiled result does not fit your needs or you want to include a feature that is not directly supported by the transpiler, you can configure a feature overwrite within this configuration block.

This is an example where the break-keyword transpiling is overwritten:

const Transpiler = require("@wartoshika/qhun-transpiler");
const ts = require("typescript");

new Api("lua", {
    entrypoint: "./src/index.ts",
    overwrite: {
        [ts.SyntaxKind.BreakKeyword]: (node, nodeTranspiler, original) => {

            // yay, some info :)
            console.log("There was a break keyword while transpiling!");

            // use the original transpiler function to transpile a break keyword
            const originalTranspiledCode = original(node);

            // append some other transpiled sourcecode
            // the nodeTranspiler function comes from within the transpiler and
            // is able to transpile every ts.Node type object.
            const appendNewCode = nodeTranspiler(
                // this will transpile the numeric literal 2
                ts.createNumericLiteral("2")
            );

            // add the new code after the break keyword
            // the result in this example will be: break 2
            return originalTranspiledCode + " " + appendNewCode;
        }
    }
}).transpile().subscribe(pipeline => {

    pipeline.persistAllFiles().prettyPrintResult().applyPostProjectTranspile();

});

Documentation

You can find a documentation file for the desired target in the doc folder.

Known bugs in latest release

  • When using a number indexed object at default values in functions.
  • BITOPS OR does not work as expected in certain cases

License

MIT license. See LICENSE for more details.