{"id":26083,"library":"plantuml-transpiler","title":"PlantUML Transpiler","description":"A Node.js library (v1.0.0, MIT) that converts PlantUML class diagrams into code for Java, C#, Python, Ruby, Kotlin, JavaScript, and TypeScript. Supports classes, interfaces, enums, abstract classes, generics, visibility modifiers, static/final members, and package/namespace handling. Key differentiators: multi-language output from a single PlantUML source, language-specific idioms, and type system mapping. Actively maintained with monthly releases.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","plantuml","transpiler","code-generation","uml","diagrams"],"install":[{"cmd":"npm install plantuml-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add plantuml-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add plantuml-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export; ESM import is preferred. CommonJS require works but is not officially recommended.","wrong":"const PlantUMLTranspiler = require('plantuml-transpiler')","symbol":"PlantUMLTranspiler","correct":"import PlantUMLTranspiler from 'plantuml-transpiler'"},{"note":"For CommonJS with TypeScript or ESM-style import, use destructuring. Direct require may fail in some bundlers.","wrong":"const PlantUMLTranspiler = require('plantuml-transpiler')","symbol":"PlantUMLTranspiler","correct":"const { default: PlantUMLTranspiler } = require('plantuml-transpiler')"},{"note":"TranspilerOptions is a TypeScript type only; use 'import type' in TS projects.","wrong":"import { TranspilerOptions } from 'plantuml-transpiler'","symbol":"TranspilerOptions","correct":"import type { TranspilerOptions } from 'plantuml-transpiler'"},{"note":"Named export, not default.","wrong":"import SupportedLanguage from 'plantuml-transpiler'","symbol":"SupportedLanguage","correct":"import { SupportedLanguage } from 'plantuml-transpiler'"}],"quickstart":{"code":"import PlantUMLTranspiler from 'plantuml-transpiler';\n\nconst transpiler = new PlantUMLTranspiler();\n\nconst plantUmlCode = `\n@startuml\nclass User {\n  -id: int\n  -name: String\n  +User(id: int, name: String)\n  +getId(): int\n  +getName(): String\n}\n\ninterface UserService {\n  +findById(id: int): User\n  +save(user: User): void\n}\n\nclass UserServiceImpl {\n  -userRepository: UserRepository\n  +UserServiceImpl(userRepository: UserRepository)\n  +findById(id: int): User\n  +save(user: User): void\n}\n\nUserServiceImpl ..|> UserService\nUserServiceImpl --> UserRepository\n@enduml\n`;\n\nconst javaCode = transpiler.transpile(plantUmlCode, 'java');\nconsole.log(javaCode);\n\nconst tsCode = transpiler.transpile(plantUmlCode, 'typescript');\nconsole.log(tsCode);","lang":"javascript","description":"Creates a transpiler instance, parses a PlantUML class diagram with classes, interface, and relationships, then generates Java and TypeScript code."},"warnings":[{"fix":"Validate PlantUML with a PlantUML parser before transpiling.","message":"PlantUML syntax must be valid; invalid diagrams produce errors. Use a parser or lint first.","severity":"gotcha","affected_versions":"all"},{"fix":"Pin dependency to ^1.0.0 and test on upgrade.","message":"v1.0.0 is the first stable release; API may change in minor versions before 2.0.","severity":"breaking","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Switch to ES module imports: import PlantUMLTranspiler from 'plantuml-transpiler'","message":"CommonJS usage is deprecated; future versions may drop support.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use TypeScript or run tsc to generate declarations.","message":"TypeScript source exports are type-only; runtime types not available in JavaScript.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'import PlantUMLTranspiler from 'plantuml-transpiler'' or 'const { default: PlantUMLTranspiler } = require('plantuml-transpiler')'","cause":"Wrong import style; default export used as named export.","error":"TypeError: PlantUMLTranspiler is not a constructor"},{"fix":"Use lowercase language name: 'java', 'csharp', 'python', 'ruby', 'kotlin', 'javascript', or 'typescript'","cause":"Language string mismatch; case-sensitive or unsupported language.","error":"Unsupported target language: ruby (use java, csharp, python, ruby, kotlin, javascript, typescript)"},{"fix":"Ensure PlantUML starts with @startuml and ends with @enduml, and follows PlantUML class diagram syntax.","cause":"Invalid PlantUML syntax in diagram.","error":"SyntaxError: Unexpected token (expected 'class', 'interface', 'enum', ...)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}