Socket
Socket
Sign inDemoInstall

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 Versions

1
16

0.37.1

Diff

perryvw
published 0.37.0 •

Changelog

Source

0.37.0

  • [Important] Deprecated the @phantom, @extension, @metaExtension and @pureAbstract annotations. This is done because there are good alternatives in regular TypeScript, and this helps us simplify the transpiler. For now, using these annotations will result in a warning but they will still continue to function. A few months from now these annotations will no longer be supported, so upgrade if possible. See Compiler Annotations for more info.
  • Added the MultiReturn<> type and $multi() helper function as the first language extensions. This is to provide a type-safe alternative to the @tupleReturn annotation. For more information see the new Language Extensions page on the docs website.
  • Removed some class transformation code from the transpiler that was no longer used.
  • Fixed a bug causing object spread to malfunction in some cases (#898).
  • Omitted tostring for parameters of template literals (`${}`) that are already known strings.
  • Fixed a bug causing incorrect Lua syntax to be generated in some cases (#944).
perryvw
published 0.36.1 •

perryvw
published 0.36.0 •

Changelog

Source

0.36.0

  • Upgraded to TypeScript 4.0.
  • Added support for parseInt and parseFloat.
  • Added support for yield* for generator functions.
  • Added support for method, property and accessor decorators.
  • Shebangs at the top of a .ts file will now be preserved.
  • Fixed an issue causing declarations referencing their own identifier to cause a nil reference error.
perryvw
published 0.35.0 •

Changelog

Source

0.35.0

  • In preparation for some new features, some public APIs have been changed:
    • High-level APIs that read input files from the file system (transpileFiles and transpileProject) now write transpiled files by default. This behavior can be changed by providing a writeFile callback, similarly to TypeScript's program.emit.
    • transpile and emitTranspiledFiles functions have been replaced with the Transpiler class. See documentation for usage examples.
  • Fixed declarationDir option not being respected.
  • Function.length is supported now.
  • String iteration is now supported.
  • Exposed parseConfigFileWithSystem to parse tsconfig.json files as part of the tstl API.
  • Fixed string.replace incorrectly escaping some replaceValue characters (().+-*?[^$)
  • Fixed several other string operations behaving differently from JS (mostly regarding indices out of bounds and NaN arguments).
  • Fixed a bug where the length argument of String.prototype.substr was evaluated twice.
  • Fixed some missing dependencies in LuaLib classes (Map, Set, WeakMap, WeakSet)
perryvw
published 0.34.0 •

Changelog

Source

0.34.0

  • Added new "luaTarget" option value - "universal". Choosing this target makes TypeScriptToLua generate code compatible with all supported Lua targets.

    • BREAKING CHANGE: This is a new default target. If you have been depending on LuaJIT being chosen implicitly, you now have to enable it explicitly with "luaTarget": "JIT" in the tsconfig.json file.
  • TypeScript has been updated to 3.9. See release notes for details. This update includes some fixes specific to our API usage:

    • Importing a non-module using import "./file" produced a TS2307 error #35973
    • TypeScript now tries to find a call signature even in presence of type errors #36665:
      function foo(this: void, x: string) {}
      foo(1);
      
      -- Before: with 3.8 (this: void ignored due to signature mismatch)
      foo(nil, 1)
      -- Now: with 3.9
      foo(1)
      
  • Reduced memory consumption and optimized performance of generators and iterators

  • Fixed generator syntax being ignored on methods (*foo() {}) and function expressions (function*() {})

  • Fixed iteration over generators stopping at first yielded nil value

  • Fixed Array.prototype.join throwing an error when array contains anything other than strings and numbers

  • Fixed extending a class not keeping toString implementation from a super class

  • Fixed issue where CLI arguments were incorrectly removed.

  • Fixed issue where class accessors threw an error due to a missing dependency.

Under the hood:

  • Upgraded to Prettier 2.0
perryvw
published 0.33.0 •

Changelog

Source

0.33.0

  • Added support for nullish coalescing A ?? B.

  • Annotation /** @noSelf */ now also works directly on function declarations, not only on classes/interfaces.

  • Fixed incorrect file paths in source maps.

  • Fixed unknown node kind throwing an error instead of diagnostic.

  • Fixed string index with side-effects being evaluated twice.

  • Added check for node.js version when running tstl.

  • Fixed some issues with reflection class names.

  • Fixed incorrectly escaped variable names.

Under the hood:

  • Switched from TSLint to ESLint.
  • Added benchmarking capability for garbage collection.
perryvw
published 0.32.2 •

perryvw
published 0.32.1 •

perryvw
published 0.32.0 •

Changelog

Source

0.32.0

  • Deprecated: The noHoisting option has been removed, hoisting will always be done.

  • TypeScript has been updated to 3.8. See release notes for details.

  • Fixed class accessors not working when base class is lacking type information (#725)

  • Class extension code has been extracted to lualib

    class A {}
    class B extends A {}
    
    A = __TS__Class()
    B = __TS__Class()
    -B.____super = A
    -setmetatable(B, B.____super)
    -setmetatable(B.prototype, B.____super.prototype)
    +__TS__ClassExtends(A, B)
    
  • Generated code for class accessors is more dynamic now

    class A {
      get a() {
        return true;
      }
    }
    
    A = __TS__Class()
    -A.prototype.____getters = {}
    -A.prototype.__index = __TS__Index(A.prototype)
    -function A.prototype.____getters.a(self)
    -  return true
    -end
    +__TS__SetDescriptor(
    +    A.prototype,
    +    "a",
    +    {
    +        get = function(self)
    +            return true
    +        end
    +    }
    +)
    

    This change simplifies our codebase and opens a path to object accessors implementation

  • Errors reported during transpilation now are created as TypeScript diagnostics instead of being thrown as JavaScript errors. This makes TypeScriptToLua always try to generate valid code (even in presence of errors) and allows multiple errors to be reported in a single file:

    for (var x in []) {
    }
    
    $ tstl file.ts
    file.ts:1:1 - error TSTL: Iterating over arrays with 'for ... in' is not allowed.
    file.ts:1:6 - error TSTL: `var` declarations are not supported. Use `let` or `const` instead.
    
    $ cat file.lua
    for x in pairs({}) do
    end
    
  • Added tstl.luaPlugins option, allowing to specify plugins in a tsconfig.json file:

    {
      "tstl": {
        "luaPlugins": [{ "name": "./plugin.ts" }]
      }
    }
    
  • Added support for all valid TS for ... of loop variable patterns.

  • Fixed a bug where spread expressions in array literals were not correctly translated:

    - [1, ...[2, 3], 4] // --> { 1, 2, 4 }
    + [1, ...[2, 3], 4] // --> { 1, 2, 3, 4 }
    
    - ((...values) => values)(1, ...[2, 3], 4) // --> { 1, 2, 4 }
    + ((...values) => values)(1, ...[2, 3], 4) // --> { 1, 2, 3, 4 }
    
  • Fixed Lua error when left hand side of instanceof was not a table type.

  • Fixed sourcemapTraceback function returning a value different from the standard Lua result in 5.1.

  • Fixed missing LuaLib dependency for Error LuaLib function.

  • Fixed several issues with exported identifiers breaking for ... in loops and some default class code.

  • Fixed overflowing numbers transforming to undefined Infinity, instead they are now transformed to math.huge.

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