{"id":26044,"library":"onelang","title":"OneLang","description":"OneLang is a source-to-source transpiler framework that enables writing code in multiple programming languages simultaneously. Currently at version 0.0.7, it is in early development with no stable release cadence. Unlike traditional transpilers, OneLang has its own type system and AST, and does not fully respect the syntax of input languages. It targets developers who want to generate code in multiple languages from a single source, but requires mastery of both target languages and OneLang itself. Key differentiators: self-defined rules, strong typing, and generic support, but limited maturity and documentation.","status":"active","version":"0.0.7","language":"javascript","source_language":"en","source_url":"https://github.com/onelang/OneLang","tags":["javascript","onelang","transpiler","source-to-source","programming-language","typescript"],"install":[{"cmd":"npm install onelang","lang":"bash","label":"npm"},{"cmd":"yarn add onelang","lang":"bash","label":"yarn"},{"cmd":"pnpm add onelang","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; no CommonJS support.","wrong":"const onelang = require('onelang')","symbol":"OneLang","correct":"import { OneLang } from 'onelang'"},{"note":"Main class for transpilation tasks.","wrong":"","symbol":"Transpiler","correct":"import { Transpiler } from 'onelang'"},{"note":"ASTNode is a type-only export; use 'import type' for TypeScript.","wrong":"import { ASTNode } from 'onelang'","symbol":"ASTNode","correct":"import type { ASTNode } from 'onelang'"}],"quickstart":{"code":"import { OneLang } from 'onelang';\n\nconst oneLang = new OneLang();\noneLang.addSource('example.ts', `\nfunction greet(name: string): string {\n  return 'Hello, ' + name;\n}\n`);\n// Transpile to JavaScript\nconst result = oneLang.transpile('example.ts', 'javascript');\nconsole.log(result);\n// Expected output: 'function greet(name) { return \"Hello, \" + name; }'","lang":"typescript","description":"Creates a OneLang instance, adds a TypeScript source file, and transpiles it to JavaScript."},"warnings":[{"fix":"Pin to specific version and test upgrades.","message":"Major API changes expected as project is in alpha stage.","severity":"breaking","affected_versions":"0.0.x"},{"fix":"Review OneLang documentation for syntax deviations.","message":"Input language syntax may not be fully respected; custom rules apply.","severity":"gotcha","affected_versions":"all"},{"fix":"Use with caution for production.","message":"No stable release; API may change without notice.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'import { OneLang } from 'onelang'' in an ESM context.","cause":"Using CommonJS require instead of ESM import.","error":"TypeError: OneLang is not a constructor"},{"fix":"Run 'npm install onelang' and ensure import path is correct.","cause":"Package not installed or incorrect import path.","error":"Module not found: Can't resolve 'onelang'"},{"fix":"Check supported languages in documentation.","cause":"Target language not supported by current version.","error":"Error: Unsupported language 'python'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}