Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typescript-to-lua

Package Overview
Dependencies
Maintainers
2
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-to-lua - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

dist/targets/Transpiler.51.js

31

dist/Compiler.js

@@ -8,4 +8,11 @@ #!/usr/bin/env node

var CommandLineParser_1 = require("./CommandLineParser");
var Transpiler_51_1 = require("./targets/Transpiler.51");
var Transpiler_52_1 = require("./targets/Transpiler.52");
var Transpiler_53_1 = require("./targets/Transpiler.53");
var Transpiler_JIT_1 = require("./targets/Transpiler.JIT");
var Transpiler_1 = require("./Transpiler");
function compile(fileNames, options) {
if (!options.luaTarget) {
options.luaTarget = Transpiler_1.LuaTarget.LuaJIT;
}
var program = ts.createProgram(fileNames, options);

@@ -35,3 +42,3 @@ var checker = program.getTypeChecker();

// Transpile AST
var lua = Transpiler_1.LuaTranspiler.transpileSourceFile(sourceFile, checker, options);
var lua = createTranspiler(checker, options, sourceFile).transpileSourceFile();
var outPath = sourceFile.fileName;

@@ -80,2 +87,24 @@ if (options.outDir !== options.rootDir) {

exports.compile = compile;
function createTranspiler(checker, options, sourceFile) {
var luaTargetTranspiler;
switch (options.luaTarget) {
case Transpiler_1.LuaTarget.LuaJIT:
luaTargetTranspiler = new Transpiler_JIT_1.LuaTranspilerJIT(checker, options, sourceFile);
break;
case Transpiler_1.LuaTarget.Lua51:
luaTargetTranspiler = new Transpiler_51_1.LuaTranspiler51(checker, options, sourceFile);
break;
case Transpiler_1.LuaTarget.Lua52:
luaTargetTranspiler = new Transpiler_52_1.LuaTranspiler52(checker, options, sourceFile);
break;
case Transpiler_1.LuaTarget.Lua53:
luaTargetTranspiler = new Transpiler_53_1.LuaTranspiler53(checker, options, sourceFile);
break;
default:
// should not happen
throw Error("No luaTarget Specified please ensure a target is set!");
}
return luaTargetTranspiler;
}
exports.createTranspiler = createTranspiler;
function execCommandLine(argv) {

@@ -82,0 +111,0 @@ argv = argv ? argv : process.argv.slice(2);

@@ -41,2 +41,5 @@ "use strict";

};
TSHelper.isInDestructingAssignment = function (node) {
return node.parent && ts.isVariableDeclaration(node.parent) && ts.isArrayBindingPattern(node.parent.name);
};
TSHelper.isStringType = function (type) {

@@ -49,3 +52,3 @@ return (type.flags & ts.TypeFlags.String) !== 0

var typeNode = checker.typeToTypeNode(type);
return typeNode && typeNode.kind === ts.SyntaxKind.ArrayType;
return typeNode && (typeNode.kind === ts.SyntaxKind.ArrayType || typeNode.kind === ts.SyntaxKind.TupleType);
};

@@ -77,2 +80,11 @@ TSHelper.isTupleType = function (type, checker) {

};
TSHelper.isTupleReturnCall = function (node, checker) {
if (ts.isCallExpression(node)) {
var type = checker.getTypeAtLocation(node.expression);
return this.isTupleReturnFunction(type, checker);
}
else {
return false;
}
};
TSHelper.isTupleReturnFunction = function (type, checker) {

@@ -79,0 +91,0 @@ return type.symbol

2

package.json
{
"name": "typescript-to-lua",
"license": "MIT",
"version": "0.2.1",
"version": "0.3.0",
"repository": "https://github.com/Perryvw/TypescriptToLua",

@@ -6,0 +6,0 @@ "scripts": {

@@ -9,2 +9,3 @@ # TypescriptToLua

[![Coverage](https://codecov.io/gh/perryvw/typescripttolua/branch/master/graph/badge.svg)](https://codecov.io/gh/perryvw/typescripttolua)
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/TypescriptToLua/Lobby)

@@ -11,0 +12,0 @@ ## Documentation

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc