https://github.com/wasm-fmt/lua_fmt
A WASM Based Lua Formatter
https://github.com/wasm-fmt/lua_fmt
Last synced: 3 months ago
JSON representation
A WASM Based Lua Formatter
- Host: GitHub
- URL: https://github.com/wasm-fmt/lua_fmt
- Owner: wasm-fmt
- License: mit
- Created: 2024-02-29T15:58:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-10T16:46:24.000Z (3 months ago)
- Last Synced: 2025-04-10T18:08:37.212Z (3 months ago)
- Language: Rust
- Homepage:
- Size: 160 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/wasm-fmt/lua_fmt/actions/workflows/test.yml)
# Install
[](https://www.npmjs.com/package/@wasm-fmt/lua_fmt)
```bash
npm install @wasm-fmt/lua_fmt
```[](https://jsr.io/@fmt/lua-fmt)
```bash
npx jsr add @fmt/lua-fmt
```# Usage
```javascript
import init, { format } from "@wasm-fmt/lua_fmt";await init();
const input = `print "Hello World"`;
const formatted = format(input, "main.lua");
console.log(formatted);
```For Vite users:
Add `"@wasm-fmt/lua_fmt"` to `optimizeDeps.exclude` in your vite config:
```JSON
{
"optimizeDeps": {
"exclude": ["@wasm-fmt/lua_fmt"]
}
}
```If you cannot change the vite config, you can use another import entry
```JavaScript
import init, { format } from "@wasm-fmt/lua_fmt/vite";// ...
```# Credits
Thanks to:
- The [StyLua](https://github.com/JohnnyMorganz/StyLua) project created by [@JohnnyMorganz](https://github.com/JohnnyMorganz)