{"id":41436,"library":"lua-format","title":"lua-format (luamin.js)","description":"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.","status":"active","version":"1.6.1-b","language":"javascript","source_language":"en","source_url":"https://github.com/Herrtt/luamin.js","tags":["javascript","luamin","lua-format","prettifier","beautifier","uglifier","minfier","lua","formatter"],"install":[{"cmd":"npm install lua-format","lang":"bash","label":"npm"},{"cmd":"yarn add lua-format","lang":"bash","label":"yarn"},{"cmd":"pnpm add lua-format","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package uses named exports; default export is not available.","wrong":"import luamin from 'lua-format'","symbol":"Beautify","correct":"import { Beautify } from 'lua-format'"},{"note":"Both ESM and CJS are supported.","wrong":"const { Minify } = require('lua-format') // Also valid, but ESM import preferred","symbol":"Minify","correct":"import { Minify } from 'lua-format'"},{"note":"CJS require() works; ESM namespace import also works.","wrong":"const luamin = require('lua-format'); // CJS pattern is fine but not ESM","symbol":"luamin","correct":"import * as luamin from 'lua-format'"}],"quickstart":{"code":"import { Beautify, Minify } from 'lua-format';\n\nconst code = `local x = 10 + 20\nprint('hello')`;\n\nconst beautified = Beautify(code, {\n  RenameVariables: true,\n  RenameGlobals: false,\n  SolveMath: true,\n  Indentation: '  '\n});\n\nconst minified = Minify(code, {\n  RenameVariables: false\n});\n\nconsole.log('Beautified:', beautified);\nconsole.log('Minified:', minified);","lang":"javascript","description":"Demonstrates both beautify and minify operations with common configuration options."},"warnings":[{"fix":"Set RenameGlobals to false or ensure all globals are statically referenced.","message":"Minify may produce invalid Lua when RenameGlobals is enabled if code uses dynamic global access.","severity":"gotcha","affected_versions":"all"},{"fix":"Disable SolveMath if mathematical transformations are undesired.","message":"SolveMath may simplify expressions in ways that break expected type coercion (e.g., string concatenation vs arithmetic).","severity":"gotcha","affected_versions":"all"},{"fix":"Create a .d.ts file with 'declare module \"lua-format\" { export function Beautify(code: string, options?: any): string; export function Minify(code: string, options?: any): string; }'","message":"The package has no TypeScript definitions; any TypeScript usage will require custom type declarations.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'-5.4':15 '1.6.1':25 '5.1':14 'b':26 'beautifi':6,68 'build':57 'current':22 'custom':38 'differenti':31 'entir':50 'fivem':16 'format':3,66 'formatt':43,72 'hash':17 'indent':39 'javascript':11,62 'key':30 'lua':2,5,13,42,46,65,71 'lua-format':1,64 'luamin':63 'luamin.js':4 'luau':21 'make':53 'math':35 'minfier':70 'minifi':8 'node.js':52 'onlin':60 'partial':20 'pipelin':58 'prettifi':67 'releas':29 'renam':34 'requir':45 'run':49 'runtim':47 'solv':36 'sporad':28 'string':18 'suitabl':55 'support':12,32 'tool':61 'uglifi':69 'unlik':40 'variabl':33 'version':23 'written':9","created_at":"2026-06-04T18:52:24.438561+00:00","updated_at":"2026-06-04T18:52:24.438561+00:00","problems":[{"fix":"npm install lua-format","cause":"Package not installed.","error":"Cannot find module 'lua-format'"},{"fix":"Use named import: import { Beautify } from 'lua-format'","cause":"Default import used incorrectly.","error":"TypeError: luamin.Beautify is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Herrtt/luamin.js#readme","github":"https://github.com/Herrtt/luamin.js","docs":null,"changelog":null,"pypi":null,"npm":"lua-format","openapi_spec":null,"status_page":null,"smithery":null,"categories":["developer-tools"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}