Registry / developer-tools / lua-format

lua-format

JSON →
library1.6.1-bjsnpmunverified

Lua beautifier and minifier written in JavaScript, supporting Lua 5.1-5.4, FiveM hashed strings, and partial Luau. Current version is 1.6.1-b, with sporadic releases. Key differentiators: supports variable renaming, math solving, and custom indentation. Unlike other Lua formatters that require Lua runtime, this runs entirely in Node.js, making it suitable for build pipelines and online tools.

developer-tools
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Package uses named exports; default export is not available.

import { Beautify } from 'lua-format'

Both ESM and CJS are supported.

import { Minify } from 'lua-format'

CJS require() works; ESM namespace import also works.

import * as luamin from 'lua-format'

Demonstrates both beautify and minify operations with common configuration options.

import { Beautify, Minify } from 'lua-format'; const code = `local x = 10 + 20 print('hello')`; const beautified = Beautify(code, { RenameVariables: true, RenameGlobals: false, SolveMath: true, Indentation: ' ' }); const minified = Minify(code, { RenameVariables: false }); console.log('Beautified:', beautified); console.log('Minified:', minified);
Debug
Known footguns
gotchaMinify may produce invalid Lua when RenameGlobals is enabled if code uses dynamic global access.
gotchaSolveMath may simplify expressions in ways that break expected type coercion (e.g., string concatenation vs arithmetic).
gotchaThe package has no TypeScript definitions; any TypeScript usage will require custom type declarations.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources