Registry / devops / tstmlog

tstmlog

JSON →
library0.1.1jsnpmunverified

tstmlog is a TypeScript-to-Mindustry Logic (mlog) compiler and transpiler (v0.1.1). It allows developers to write Mindustry processor code in TypeScript and compile it to .mlog files. As a minimal release, it focuses core translation rather than full feature parity. It uses the TypeScript compiler API and ships its own type definitions.

npm install tstmlog
INSTALL
IMPORT
SIG · TSTMLOG
T
tstmlog
devopsjavascriptv0.1.1
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 'tstmlog'
const compile = require('tstmlog').compile
tstmlog is ESM-only; named export. CommonJS require will trigger 'ERR_REQUIRE_ESM'.
default
import tstmlog from 'tstmlog'
const tstmlog = require('tstmlog')
Default export is an object containing compile and other utilities.
CompilerOptions
import type { CompilerOptions } from 'tstmlog'
Type-only import for compiler options interface.

Compiles a simple TypeScript snippet to mlog using tstmlog in an ESM environment.

import { compile, CompilerOptions } from 'tstmlog'; const sourceCode = ` const x = 5; const y = 10; print(x + y); `; const options: CompilerOptions = { target: 'latest', minify: false }; try { const mlog = compile(sourceCode, options); console.log(mlog); } catch (error) { console.error('Compilation failed:', error); }
tstmlog --version
Debug
Known issues
gotchatstmlog requires the TypeScript compiler to be installed. If not present, the library will fail to load.
fix
Install TypeScript as a dependency: 'npm install typescript'
affects: >=0.1.0
breakingtstmlog v0.1.1 is ESM-only. Import using ESM syntax; CommonJS require() will throw an error.
fix
Use import instead of require. Ensure package.json contains \"type\": \"module\" or use .mjs extension.
affects: >=0.1.0
gotchaThe compiled mlog output may not support all TypeScript features. Language subset limited to simple expressions and functions.
fix
Refer to documentation for supported TypeScript constructs; avoid advanced features like classes, generics, async/await.
affects: >=0.1.0
deprecatedThe 'output' property in compiler options was deprecated in v0.1.1 in favor of 'target'.
fix
Use 'target' instead of 'output' when specifying mlog version.
affects: 0.1.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ...\node_modules\tstmlog\index.js not supported.
Using CommonJS require() to load an ESM-only package.
fix
Change to import syntax or configure your project as ESM.
Cannot find module 'typescript'
TypeScript is not installed as a dependency.
fix
Run 'npm install typescript' or add it to your project's dependencies.
SyntaxError: Unexpected token 'export'
Using ESM syntax (import/export) in a CommonJS script without proper configuration.
fix
Set \"type\": \"module\" in package.json or rename file to .mjs.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
typescriptrequiredrequired for TypeScript compilation and type checking
Agent activity
8 hits · last 30 days
node
8
Resources
tstmlog — npm install tstmlog · libregistry