Skip to content

Utility functions and transformers for MTASA Typescript To Lua compilation

License

Notifications You must be signed in to change notification settings

websharik/mtasa-lua-utils

 
 

Repository files navigation

MTASA Lua Utils for TypeScript compilation

The repository provides the transformer and post-build, pre-build utilities.

These utilities and transformers can be used with TypescriptToLua package.

Transformer

The transformer provides:

  • TypeScript import removing: Result Lua file should not have any requires calls

  • TypeScript export (and inlined export) replace: All exported statements will be written to Lua's _G. Example

  • File side checking: You cannot mix import ... from '.../client' and import ... from '.../server'

How to use

Insert into tsconfig.json:

{
  "compilerOptions": {
    // ...

    "plugins": [
      {
        "transform": "mtasa-lua-utils/transformer",
        "after": false,
        "externalImports": true, //dont remove non mta imports (Default: false)
        "globalExports": false //dont replace exports to global (Default: true)
      }
    ],
    
    // ...
  }
}

PostBuild

Checks compiled lua files correctness:

  • Are the files provided in meta.xml

How to use

Insert into package.json:

{
  // ...

  "scripts": {
    "postbuild": "mtasa-utils-postbuild",
  },   
          
  // ...
}

About

Utility functions and transformers for MTASA Typescript To Lua compilation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 76.1%
  • JavaScript 23.9%