tstl-export-rename
v1.0.1
Published
TypeScriptToLua plugin that renames the `___exports` variable
Downloads
4
Readme
tstl-export-rename
TypeScriptToLua plugin that renames the ___exports
variable for cosmetic reasons.
:exclamation: Use this and any code transformation plugin with caution. Mistakes are possible.
Example
local ____exports = {}
____exports.foo = 10
____exports.bar = function(self)
...
end
return ____exports
Becomes:
local M = {}
M.foo = 10
M.bar = function(self)
...
end
return M
Installation
Requires TSTL >= 1.22.0.
- Install this plugin
yarn add tstl-export-rename -D
# or
npm install tstl-export-rename --save-dev
Add
tstl-export-rename
totstl.luaPlugins
intsconfig.json
Define
match
, which will only apply the transformation to files if their output (Lua file) path matches.Define
exportRename
, which will be used to replace___exports
{
"tstl": {
"luaPlugins": [
+ {
+ "name": "tstl-export-rename",
+ "match": ".*\\..*.lua$",
+ "exportRename": "M"
+ }
],
}
}
License
CC0