dyatko / arkit

JavaScript architecture diagrams and dependency graphs
https://arkit.pro
MIT License
952 stars 43 forks source link

Using `class` in a Vue template causes parsing error #145

Open onlyjsmith opened 5 years ago

onlyjsmith commented 5 years ago

Bug description

Including class on a template element (even commented-out) results in a parsing error, and file to be missing from output SVG.

[2019-08-29 06:10:00.902 +0000] ERROR: Error parsing <...>/src/views/Test.vue

To Reproduce

  1. Operating system: macOS 10.14.6

  2. Arkit version and CLI arguments: v1.6.2

    • arkit -e "node_modules" src/views
  3. Arkit config, if any was used: none

  4. Source code example, if it's possible:

src/views/Test.vue

FAIL

<template>
  <div class='thing'></div>
</template>

<script>
</script>

PASS

<template>
  <div></div>
</template>

<script>
</script>
danivalls commented 4 years ago

Any updates on this?

clorichel commented 4 years ago

Exact same scenario here: can't get any .vue file to be parsed if this file's template contains a class. An App.vue that is parsed without a problem:

<template>
  <div></div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';

@Component
export default class App extends Vue {}
</script>

An App.vue that can't be parsed (notice the only addition is class="whatever" on the template div):

<template>
  <div class="whatever"></div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';

@Component
export default class App extends Vue {}
</script>

Here is the LEVEL=info error detail:

[2020-04-17 09:43:20.696 +0000] WARN : Unexpected scenario where a(n) OpenBraceToken was not found.
    Error: Unexpected scenario where a(n) OpenBraceToken was not found.
        at getTokenEnd (/myproject/node_modules/ts-morph/dist/ts-morph.js:1109:23)
        at Function.getContainerBodyPos (/myproject/node_modules/ts-morph/dist/ts-morph.js:1101:20)
        at isStatementMemberOrPropertyHoldingSyntaxList (/myproject/node_modules/ts-morph/dist/ts-morph.js:1325:38)
        at Function.getCompilerChildren (/myproject/node_modules/ts-morph/dist/ts-morph.js:1309:13)
        at SyntaxList._getCompilerChildren (/myproject/node_modules/ts-morph/dist/ts-morph.js:3773:31)
        at SyntaxList._getCompilerChildrenFast (/myproject/node_modules/ts-morph/dist/ts-morph.js:3779:58)
        at SyntaxList._getChildrenInCacheIterator (/myproject/node_modules/ts-morph/dist/ts-morph.js:3111:31)
        at _getChildrenInCacheIterator.next (<anonymous>)
        at CompilerFactory.initializeNode (/myproject/node_modules/ts-morph/dist/ts-morph.js:18282:28)
        at /myproject/node_modules/ts-morph/dist/ts-morph.js:18249:28
[2020-04-17 09:43:20.718 +0000] ERROR: Error parsing /myproject/src/App.vue

@dyatko would you need help on this one, say a reproduction repo, or maybe I might try and figure out a failing test case? Please feel free to share any pointer anyways 🤗

Looking forward to get my WOW diagram ❤️

jackyang9451 commented 4 years ago

Any updates on this?

badihi commented 4 years ago

On this update any?!

badihi commented 4 years ago

I could somehow workaround this problem, by some modifications: https://github.com/badihi/arkit/commit/335e27aea10a53eac07ae760d3c350d553fa3404

I'm not sure that this will be eligible to be merged to master, but at least can be used as a workaround.