{"id":26541,"library":"tstmlog","title":"tstmlog","description":"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.","status":"active","version":"0.1.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","ts","typescript","compiler","transpiler"],"install":[{"cmd":"npm install tstmlog","lang":"bash","label":"npm"},{"cmd":"yarn add tstmlog","lang":"bash","label":"yarn"},{"cmd":"pnpm add tstmlog","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"required for TypeScript compilation and type checking","package":"typescript","optional":false}],"imports":[{"note":"tstmlog is ESM-only; named export. CommonJS require will trigger 'ERR_REQUIRE_ESM'.","wrong":"const compile = require('tstmlog').compile","symbol":"compile","correct":"import { compile } from 'tstmlog'"},{"note":"Default export is an object containing compile and other utilities.","wrong":"const tstmlog = require('tstmlog')","symbol":"default","correct":"import tstmlog from 'tstmlog'"},{"note":"Type-only import for compiler options interface.","wrong":"","symbol":"CompilerOptions","correct":"import type { CompilerOptions } from 'tstmlog'"}],"quickstart":{"code":"import { compile, CompilerOptions } from 'tstmlog';\nconst sourceCode = `\nconst x = 5;\nconst y = 10;\nprint(x + y);\n`;\nconst options: CompilerOptions = {\n  target: 'latest',\n  minify: false\n};\ntry {\n  const mlog = compile(sourceCode, options);\n  console.log(mlog);\n} catch (error) {\n  console.error('Compilation failed:', error);\n}\n","lang":"typescript","description":"Compiles a simple TypeScript snippet to mlog using tstmlog in an ESM environment."},"warnings":[{"fix":"Install TypeScript as a dependency: 'npm install typescript'","message":"tstmlog requires the TypeScript compiler to be installed. If not present, the library will fail to load.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use import instead of require. Ensure package.json contains \\\"type\\\": \\\"module\\\" or use .mjs extension.","message":"tstmlog v0.1.1 is ESM-only. Import using ESM syntax; CommonJS require() will throw an error.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Refer to documentation for supported TypeScript constructs; avoid advanced features like classes, generics, async/await.","message":"The compiled mlog output may not support all TypeScript features. Language subset limited to simple expressions and functions.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use 'target' instead of 'output' when specifying mlog version.","message":"The 'output' property in compiler options was deprecated in v0.1.1 in favor of 'target'.","severity":"deprecated","affected_versions":"0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change to import syntax or configure your project as ESM.","cause":"Using CommonJS require() to load an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ...\\node_modules\\tstmlog\\index.js not supported."},{"fix":"Run 'npm install typescript' or add it to your project's dependencies.","cause":"TypeScript is not installed as a dependency.","error":"Cannot find module 'typescript'"},{"fix":"Set \\\"type\\\": \\\"module\\\" in package.json or rename file to .mjs.","cause":"Using ESM syntax (import/export) in a CommonJS script without proper configuration.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}