https://github.com/thinknathan/tstl-remove-debug
TypeScriptToLua plugin that removes debugging expressions
https://github.com/thinknathan/tstl-remove-debug
code-cleaner lua tstl tstl-extension tstl-plugin typescript
Last synced: 6 months ago
JSON representation
TypeScriptToLua plugin that removes debugging expressions
- Host: GitHub
- URL: https://github.com/thinknathan/tstl-remove-debug
- Owner: thinknathan
- License: cc0-1.0
- Created: 2023-12-24T18:57:18.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-01T07:31:32.000Z (8 months ago)
- Last Synced: 2025-07-04T18:11:54.653Z (7 months ago)
- Topics: code-cleaner, lua, tstl, tstl-extension, tstl-plugin, typescript
- Language: TypeScript
- Homepage:
- Size: 346 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tstl-remove-debug
[](https://github.com/thinknathan/tstl-remove-debug/actions/workflows/ci.yml) 
TypeScriptToLua plugin that strips calls to `print`, `pprint`, `assert`, and any functions attached to `profiler` and `debug`. Also replaces the statement `sys.get_engine_info().is_debug` with `false`.
The purpose is to reduce code size for production builds.
:exclamation: Use this and any code transformation plugin with caution. Mistakes are possible.
## Example
```ts
print(foo);
pprint(foo);
assert(foo === '');
profiler.start();
debug.draw_text('');
const is_debug = sys.get_engine_info().is_debug;
```
Becomes:
```lua
-- (This space intentionally left blank)
local is_debug = false
```
## Installation
Requires TSTL >= 1.22.0.
1. Install this plugin
```bash
yarn add tstl-remove-debug -D
# or
npm install tstl-remove-debug --save-dev
```
2. Add `tstl-remove-debug` to `tstl.luaPlugins` in `tsconfig.json`
```diff
{
"tstl": {
"luaPlugins": [
+ { "name": "tstl-remove-debug" }
],
}
}
```
## License
CC0