Registry / devops / plantuml-transpiler

plantuml-transpiler

JSON →
library1.0.0jsnpmunverified

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.

npm install plantuml-transpiler
INSTALL
IMPORT
SIG · PLANTUML-TRANSPILE
P
plantuml-transpiler
devopsjavascriptv1.0.0
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.

PlantUMLTranspiler
import PlantUMLTranspiler from 'plantuml-transpiler'
const PlantUMLTranspiler = require('plantuml-transpiler')
Default export; ESM import is preferred. CommonJS require works but is not officially recommended.
PlantUMLTranspiler
const { default: PlantUMLTranspiler } = require('plantuml-transpiler')
const PlantUMLTranspiler = require('plantuml-transpiler')
For CommonJS with TypeScript or ESM-style import, use destructuring. Direct require may fail in some bundlers.
TranspilerOptions
import type { TranspilerOptions } from 'plantuml-transpiler'
import { TranspilerOptions } from 'plantuml-transpiler'
TranspilerOptions is a TypeScript type only; use 'import type' in TS projects.
SupportedLanguage
import { SupportedLanguage } from 'plantuml-transpiler'
import SupportedLanguage from 'plantuml-transpiler'
Named export, not default.

Creates a transpiler instance, parses a PlantUML class diagram with classes, interface, and relationships, then generates Java and TypeScript code.

import PlantUMLTranspiler from 'plantuml-transpiler'; const transpiler = new PlantUMLTranspiler(); const plantUmlCode = ` @startuml class User { -id: int -name: String +User(id: int, name: String) +getId(): int +getName(): String } interface UserService { +findById(id: int): User +save(user: User): void } class UserServiceImpl { -userRepository: UserRepository +UserServiceImpl(userRepository: UserRepository) +findById(id: int): User +save(user: User): void } UserServiceImpl ..|> UserService UserServiceImpl --> UserRepository @enduml `; const javaCode = transpiler.transpile(plantUmlCode, 'java'); console.log(javaCode); const tsCode = transpiler.transpile(plantUmlCode, 'typescript'); console.log(tsCode);
Debug
Known issues
gotchaPlantUML syntax must be valid; invalid diagrams produce errors. Use a parser or lint first.
fix
Validate PlantUML with a PlantUML parser before transpiling.
affects: all
breakingv1.0.0 is the first stable release; API may change in minor versions before 2.0.
fix
Pin dependency to ^1.0.0 and test on upgrade.
affects: >=1.0.0 <2.0.0
deprecatedCommonJS usage is deprecated; future versions may drop support.
fix
Switch to ES module imports: import PlantUMLTranspiler from 'plantuml-transpiler'
affects: >=1.0.0
gotchaTypeScript source exports are type-only; runtime types not available in JavaScript.
fix
Use TypeScript or run tsc to generate declarations.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: PlantUMLTranspiler is not a constructor
Wrong import style; default export used as named export.
fix
Use 'import PlantUMLTranspiler from 'plantuml-transpiler'' or 'const { default: PlantUMLTranspiler } = require('plantuml-transpiler')'
Unsupported target language: ruby (use java, csharp, python, ruby, kotlin, javascript, typescript)
Language string mismatch; case-sensitive or unsupported language.
fix
Use lowercase language name: 'java', 'csharp', 'python', 'ruby', 'kotlin', 'javascript', or 'typescript'
SyntaxError: Unexpected token (expected 'class', 'interface', 'enum', ...)
Invalid PlantUML syntax in diagram.
fix
Ensure PlantUML starts with @startuml and ends with @enduml, and follows PlantUML class diagram syntax.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
plantuml-transpiler — npm install plantuml-transpiler · libregistry