Registry / devops / mlogx
library2.7.2jsnpmunverified

MLOGX is a transpiler and toolchain for Mindustry Logic (MLOG), the scripting language of the game Mindustry. Version 2.7.2 provides validation, readability improvements (e.g., infix operators, printf), compiler constants, loops, and multi-file support. It is actively maintained with frequent releases. Unlike raw MLOG, MLOGX catches invalid commands and type mismatches at compile time. It ships TypeScript types and supports both CLI and API usage.

npm install mlogx
INSTALL
IMPORT
SIG · MLOGX
M
mlogx
devopsjavascriptv2.7.2
harness data pending
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.

compile
import { compile } from 'mlogx'
const { compile } = require('mlogx')
The package is ESM-only since v2. Use dynamic import() if you need CJS.
default (transpile function)
import transpile from 'mlogx'
const mlogx = require('mlogx')
Default export is the main transpile function. Named export 'compile' is preferred.
type CompileOptions
import type { CompileOptions } from 'mlogx'
TypeScript users should import types with 'import type' to avoid runtime inclusion.

Compiles an MLOGX file to MLOG, showing the basic API usage.

import { compile, writeOutput } from 'mlogx'; import { readFileSync } from 'fs'; const source = readFileSync('example.mlogx', 'utf8'); const result = compile(source, { filename: 'example.mlogx', targetVersion: 7, format: 'mlog' }); console.log(result.code); writeOutput(result, './out/output.txt'); // Output: compiled MLOG with error checks
mlogx --version
Debug
Known issues
breakingThe CLI changed from `mlogx <file>` to `mlogx compile <file>` in v2.0, and the API changed from synchronous to asynchronous.
fix
Update CLI usage: `mlogx compile input.mlogx -o output.mlog`. If using the API, switch to async `compile(source, options)`.
affects: >=2.0.0
breakingDefault export removed in v2. Use named import `{ compile }` instead.
fix
Change `import mlogx from 'mlogx'` to `import { compile } from 'mlogx'`.
affects: >=2.0.0
gotchaThe `writeOutput` function expects an object with `code` and optionally `warnings` – not a raw string.
fix
Always pass the full result object from `compile()` to `writeOutput()`.
affects: >=2.0.0
deprecated`mlogx port` command is deprecated in favor of `mlogx convert`.
fix
Use `mlogx convert input.mlog -o output.mlogx` instead of `mlogx port`.
affects: >=2.5.0
Errors
Common errors & fixes
ReferenceError: mlogx is not defined
Using `require('mlogx')` in an ESM context.
fix
Use `import mlogx from 'mlogx'` or `const { compile } = await import('mlogx')`.
Module 'mlogx' has no exported member 'transpile'
The main function is named `compile`, not `transpile`.
fix
Replace `import { transpile } from 'mlogx'` with `import { compile } from 'mlogx'`.
mlogx: command not found
Global installation missing or PATH not set.
fix
Run `npm install -g mlogx` or use `npx mlogx`.
Upgrade
Version history
2.7.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
mlogx — npm install mlogx · libregistry