Giter Club home page Giter Club logo

tsuml2's People

Contributors

alichry avatar demike avatar dependabot[bot] avatar lokeshdaiya avatar qszhu avatar remojansen avatar rustkas avatar zangai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tsuml2's Issues

0.4.1 release is broken?

On version 0.4.1 /dist folder is missing, while still being referenced in package.json.
image
If I downgrade to 0.4.0 it magically appears.
image

memory runs out

PS C:\XXXX-web\XXXX-next\apps\XXXX-next> tsuml2 --glob "./src/**/!(.d|.spec).ts"
parsing source files:
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/ActivityMonitor.webpack.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/AdminApp.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/CreateList.webpack.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/CreateSite.webpack.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/CreateSiteReact.webpack.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/EmbedInSPO.webpack.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/Groups.resx.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/GroupsAddOn.ts

<--- Last few GCs --->

[20524:00000235F71E8640] 321833 ms: Mark-sweep 2039.6 (2055.5) -> 2035.6 (2062.6) MB, 816.5 / 0.0 ms (average mu = 0.168, current mu = 0.055) allocation failure scavenge might not succeed
[20524:00000235F71E8640] 323030 ms: Mark-sweep 2046.0 (2065.9) -> 2042.5 (2057.5) MB, 558.9 / 0.0 ms (+ 531.7 ms in 123 steps since start of marking, biggest step 9.9 ms, walltime since start of marking 1197 ms) (average mu = 0.124, current mu = 0.089)

0: ExitFrame [pc: 00007FF78BCCCC5D]

Security context: 0x0077b44008d1
1: split [00000077B440CD51](this=0x00864fb0bd31 <String[89]: XXXX-web/XXXX-next/apps/XXXX-next/node_modules/@ms/utilities-objects/lib/graft/graft.d.ts>,0x0222b3352481 <String[#1]: />)
2: toPath(aka toPath) [00000112E5400799] [C:\Users\victor\AppData\Local\nvs\node\12.22.1\x64\node_modules\tsuml2\node_modules\typescript\lib\typescript.js:~100332] [p...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF78B09285F napi_wrap+119263
2: 00007FF78B039526 v8::internal::OrderedHashTablev8::internal::OrderedHashSet,1::NextTableOffset+38102
3: 00007FF78B03A326 node::OnFatalError+438
4: 00007FF78B877AAE v8::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF78B85FC61 v8::SharedArrayBuffer::Externalize+833
6: 00007FF78B71143C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436
7: 00007FF78B71C680 v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312
8: 00007FF78B719194 v8::internal::Heap::PageFlagsAreConsistent+3204
9: 00007FF78B70E993 v8::internal::Heap::CollectGarbage+1283
10: 00007FF78B70D004 v8::internal::Heap::AddRetainedMap+2500
11: 00007FF78B72E48B v8::internal::Factory::NewFixedArrayWithFiller+107
12: 00007FF78B72FFA2 v8::internal::Factory::NewJSArrayStorage+210
13: 00007FF78B72F96A v8::internal::Factory::NewJSArray+154
14: 00007FF78B46DC35 v8::internal::DeclarationScope::was_lazily_parsed+31925
15: 00007FF78BCCCC5D v8::internal::SetupIsolateDelegate::SetupHeap+546925
16: 00007FF78BCBA37D v8::internal::SetupIsolateDelegate::SetupHeap+470925
17: 000001F81CFC5B69

Does not work with export default class

First, thank you @demike for developing this nice and useful project! :)

However, it does not work well with export default class. That is:

  • names are erased (set to "default")
  • if there is more than one default export, they overshadow each other.

I prepared a minimal example, https://github.com/stared/tsuml2-default-export-error-example (commit 7e2a479 for the version resulting in an error):

import Person from './person'
import { Vector, Color } from './structures'

export default class MainClass {
  constructor(public color: Color, public v: Vector, public person: Person) {}
}
export default class Person {
  constructor(public name: string, public surname: string) {}
}
export interface Vector {
  x: number
  y: number
}

export interface Color {
  r: number
  g: number
  b: number
}

I run tsuml2 --glob "./src/**/*.ts" -m and get:

Screenshot 2023-02-15 at 12 55 28

Changing to non-default export makes it work (stared/tsuml2-default-export-error-example@c9d15ec):

Screenshot 2023-02-15 at 12 59 56

My project has plenty of default exports. To create a diagram I need to manually change them not non-default exports (and consequently, non-default imports).

Is there a way to make it work?

Could not compute path to class / interface definition

Seems that classes and interface definitions are expected to be in single source files named by id. While this is good practice - this is not always the case, could this logic be expanded to link to the parsed source file - irrespective of whether it matches the id ?

https://github.com/demike/TsUML2/blob/master/src/core/model.ts#L65

export class NamedType {
    public name: string;
    public id: string;

    constructor(options: {name: string, id: string}) {
        this.name = options.name;
        this.id = options.id;
    }

    getRelativeFilePath(fromFile: string) {
        const rx = /"(.*)"/;
        const result = rx.exec(this.id);
        if(!result) {
            console.log(chalk.redBright("Could not compute path to class / interface definition: " + this.id));
            return "";
        }
        fromFile = resolve(dirname(fromFile));
        const toFile = resolve(result[1] + '.ts');
        
        
        let rel = relative(fromFile,toFile);
        
        return rel;
         
    }
}

Add documentation to generate programmatically .

This library is npm package and has capability to use in other node applications.

There should be documentation how this can be used in NodeJS programs

Example:

const {createNomnomlSVG} = require('tsuml2')

createNomnomlSVG({glob: `./src/app/**/!(*.d|*.spec).ts`,outFile: 'd:/apps/src/demo.svg'});

Line ending conflicts on MacOS

I've installed 0.2.0 version of the package. I'm also running macOS Catalina 10.15.7 (19H524).
The issues i'm getting is

env: node\r: No such file or directory

As far as I know, it' related to line endings.
Will there be a fix or what is workaround?

Expecting 'IDENT', '[', got 'EOF'

PS C:\XXXX-web\XXXX-next\apps\XXXX-next> tsuml2 --glob "./src/XXXX-next/controls/!(.d|.spec).ts"
parsing source files:
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/controls/FabricIcons.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/controls/FabricIconsDeferred.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/controls/FluentHybridIcons.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/controls/OdDeferredFont.scss.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/controls/ODFabric.scss.ts

emitting declarations:
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/controls/FabricIcons.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/controls/FabricIconsDeferred.ts
C:/XXXX-web/XXXX-next/apps/XXXX-next/src/XXXX-next/controls/FluentHybridIcons.ts
^
Expecting 'IDENT', '[', got 'EOF'
at Parser.parseError (C:\Users\victor\AppData\Local\nvs\node\12.22.1\x64\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:1397:21)
at Parser.parse (C:\Users\victor\AppData\Local\nvs\node\12.22.1\x64\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:1464:22)
at Object.intermediateParse (C:\Users\victor\AppData\Local\nvs\node\12.22.1\x64\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:340:34)
at Object.parse (C:\Users\victor\AppData\Local\nvs\node\12.22.1\x64\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:271:33)
at Object.renderSvg (C:\Users\victor\AppData\Local\nvs\node\12.22.1\x64\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:215:37)
at Object.renderNomnomlSVG (C:\Users\victor\AppData\Local\nvs\node\12.22.1\x64\node_modules\tsuml2\dist\core\io.js:6:20)
at Object.createNomnomlSVG (C:\Users\victor\AppData\Local\nvs\node\12.22.1\x64\node_modules\tsuml2\dist\core\index.js:59:20)
at C:\Users\victor\AppData\Local\nvs\node\12.22.1\x64\node_modules\tsuml2\dist\bin\index.js:24:20
at Generator.next ()
at C:\Users\victor\AppData\Local\nvs\node\12.22.1\x64\node_modules\tsuml2\dist\bin\index.js:9:71 {
hash: {
text: '',
token: 'EOF',
line: 0,
loc: { first_line: 1, first_column: 0, last_line: 1, last_column: 0 },
expected: [ "'IDENT'", "'['" ]
}
}
PS C:\XXXX-web\XXXX-next\apps\XXXX-next>

TypeScript intersection types not working

Hi,
The TypeScript support for type intersection does not seem to work. For example, if I have the two types defined below:

export type Type1 = {
propA: string;
};

export type Type2 = Type1 & {
propB: string;
};

The generator only shows a representation of Type1.
image

Expected: Both types and the relationship between them to be represented.

Thank you!

ParseError: Parse error at ..., expected "]" but got end of file - angular (v0.10.0)

I have an angular application I'm trying to run against tsuml2 am experiencing an issue when I run the following command:

tsuml2 --glob "./src/app/**/!(.d|.spec).ts"

It appears there's an issue in the nomnoml library with the following stack trace:

Error: Parse error at line 57 column 169, expected "]" but got end of file ParseError: Parse error at line 57 column 169, expected "]" but got end of file
at error (z:\mypath\npm\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:913:19)
at parseNode (z:\mypath\npm\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:824:13)
at parseNodesAndAssocs (z:\mypath\npm\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:737:24)
at parsePart (z:\mypath\npm\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:715:39)
at parseNode (z:\mypath\npm\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:815:28)
at parseNodesAndAssocs (z:\mypath\npm\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:737:24)
at parsePart (z:\mypath\npm\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:715:39)
at parseNode (z:\mypath\npm\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:815:28)
at parseNodesAndAssocs (z:\mypath\npm\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml.js:737:24)
at parsePart (z:\mypath\npm\node_modules\tsuml2\node_modules\nomnoml\dist\nomnoml

TIA

TypeError: Cannot read properties of undefined (reading 'getName')

Hi there,

While trying to run tsuml2 --glob test.ts, the following exception was thrown TypeError: Cannot read properties of undefined (reading 'getName'). Here is a reproducible example:

# test.ts
export interface ITest {
  run(): void;
  hide(): void;
}

export type ITransformedTest = {
  [m in string &  keyof ITest as `shouldI${Capitalize<m>}`]: boolean;
} & { // remove this and no exception would be thrown
  shouldIFight(): boolean; 
}

export class Should implements ITransformedTest {
  shouldIRun: boolean = true;
  shouldIHide: boolean = false;

  shouldIFight() {
    return ! this.shouldIRun && ! this.shouldIHide;
  }
}

Is it possible to model Typescript `type`s not just interface and Classes

I am using types instead of interfaces and classes eg.

type Something = {
   name: string
   value: number
   user: User
}```

with many types containing other types (eg. a hierarchy similar to the demo) but when running tsuml I get the following (as though it can't parse it, but it is valid Typescript):

render to svg
Error: Parse error on line 3:

^
Expecting 'IDENT', '[', got 'EOF' Error: Parse error on line 3:

^
Expecting 'IDENT', '[', got 'EOF'
at Parser.parseError (/Users/.../node_modules/nomnoml/dist/nomnoml.js:806:25)
at Parser.parse (/Users/.../node_modules/nomnoml/dist/nomnoml.js:867:26)
at intermediateParse (/Users/.../node_modules/nomnoml/dist/nomnoml.js:1392:34)
at parse (/Users/.../node_modules/nomnoml/dist/nomnoml.js:1312:25)
at parseAndRender (/Users/.../node_modules/nomnoml/dist/nomnoml.js:2159:29)
at Object.renderSvg (/Users/.../node_modules/nomnoml/dist/nomnoml.js:2175:34)
at renderNomnomlSVG (/Users/.../node_modules/tsuml2/dist/core/io.js:30:20)
at createNomnomlSVG (/Users/.../node_modules/tsuml2/dist/core/index.js:93:41)
at /Users/.../node_modules/tsuml2/dist/bin/index.js:18:41
at Object. (/Users/.../node_modules/tsuml2/dist/bin/index.js:24:3) {
hash: {
text: '',
token: 'EOF',
line: 2,
loc: { first_line: 1, last_line: 3, first_column: 0, last_column: 0 },
expected: [ "'IDENT'", "'['" ]
}
}```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.