Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tplant

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tplant - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

24

convertToPlant.js

@@ -0,1 +1,2 @@

"use strict";

@@ -18,4 +19,14 @@ var os = require("os");

lines.push("class " + c.name + " {");
let heritage = "";
if (c.extends) {
heritage += " extends " + c.extends;
}
if (c.implements) {
heritage += " implements " + c.implements.join(", ");
}
lines.push(c.structure + " " + c.name + heritage + " {");
c.members.forEach(function (m) {

@@ -45,13 +56,2 @@

tsjs.forEach(function (c) {
if (c.extends) {
lines.push(c.name + " --|> " + c.extends);
}
if (c.implements) {
c.implements.forEach(function (implement) {
lines.push(c.name + " --|> " + implement);
});
}
});
lines.push("@enduml");

@@ -58,0 +58,0 @@

@@ -26,4 +26,7 @@ "use strict";

for (const sourceFile of program.getSourceFiles()) {
// Walk the tree to search for classes
ts.forEachChild(sourceFile, visit);
if (!isInternalTypeScriptFile(sourceFile)) {
// Walk the tree to search for classes
ts.forEachChild(sourceFile, visit);
}
}

@@ -34,3 +37,8 @@

return;
/** don't use interfaces from typescript */
function isInternalTypeScriptFile(sourceFile) {
return sourceFile.fileName.endsWith("/tplant/node_modules/typescript/lib/lib.d.ts");
}
/** visit nodes finding exported classes */

@@ -48,2 +56,5 @@ function visit(node) {

// cannot be exported
} else if (node.kind === ts.SyntaxKind.InterfaceDeclaration) {
let symbol = checker.getSymbolAtLocation(node.name);
output.push(serializeInterface(symbol));
}

@@ -120,2 +131,4 @@ else if (node.kind === ts.SyntaxKind.ModuleDeclaration) {

if (kind === ts.SyntaxKind.PropertyDeclaration) {

@@ -125,2 +138,6 @@ return PROPERTY_TYPE;

return METHOD_TYPE;
} else if (kind === ts.SyntaxKind.MethodSignature) {
return METHOD_TYPE;
} else if (kind === ts.SyntaxKind.PropertySignature) {
return PROPERTY_TYPE;
}

@@ -163,2 +180,16 @@

function serializeInterface(symbol) {
var result = {
structure: "interface",
name: symbol.name,
members: []
};
for (var memberName in symbol.members) {
result.members.push(serializeMember(symbol.members[memberName]));
}
return result;
}
/** Serialize a class symbol infomration */

@@ -168,2 +199,4 @@ function serializeClass(symbol) {

details.structure = "class";
if (symbol.valueDeclaration && symbol.valueDeclaration.heritageClauses &&

@@ -170,0 +203,0 @@ symbol.valueDeclaration.heritageClauses.length) {

{
"name": "tplant",
"version": "1.0.1",
"version": "1.0.2",
"description": "Typescript to plantuml",

@@ -5,0 +5,0 @@ "main": "index.js",

import { Class } from "./Class";
import { Test } from "./Class";
interface Interface {
someAttribute(): void;
someProperty: number;
}
class SubClass extends Class implements Interface {
class SubClass extends Test implements Interface {
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc