pahen / madge

Create graphs from your CommonJS, AMD or ES6 module dependencies
MIT License
9.08k stars 317 forks source link

SyntaxError: Unexpected token, expected "}" #440

Open crystalfp opened 2 months ago

crystalfp commented 2 months ago

Running madge 8.0.0 this way:

madge --extensions ts,vue --ts-config tsconfig.json -i madge.png --warning src

Generates the following error:

✖ SyntaxError: Unexpected token, expected "}" (8:14)
    at constructor (C:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@babel\parser\lib\index.js:349:19)
    at FlowParserMixin.raise (C:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@babel\parser\lib\index.js:3247:19)
    at FlowParserMixin.unexpected (C:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@babel\parser\lib\index.js:3267:16)
    at FlowParserMixin.expect (C:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@babel\parser\lib\index.js:3577:12)
    at FlowParserMixin.jsxParseExpressionContainer (C:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@babel\parser\lib\index.js:6675:10)
    at FlowParserMixin.jsxParseElementAt (C:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@babel\parser\lib\index.js:6749:36)
    at FlowParserMixin.jsxParseElement (C:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@babel\parser\lib\index.js:6787:17)
    at FlowParserMixin.parseExprAtom (C:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@babel\parser\lib\index.js:6797:19)
    at FlowParserMixin.parseExprSubscripts (C:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@babel\parser\lib\index.js:10562:23)
    at FlowParserMixin.parseUpdate (C:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@babel\parser\lib\index.js:10547:21)

Really don't know what changed from my previous issue except node that is v22.5.1 Thanks for looking! mario

crystalfp commented 2 months ago

Strange. This happens only if I run a npm script launching madge. That is:

  "scripts": {
    "madge": "madge --extensions ts,vue --ts-config tsconfig.json -i madge.png --warning src"
}

Instead if I run from the commend prompt

madge --extensions ts,vue --ts-config tsconfig.json -i madge.png --warning src

or

npx madge --extensions ts,vue --ts-config tsconfig.json -i madge.png --warning src

Simply does not find any file as in #434

Jassmin586 commented 2 months ago

Same problem with ts and vue files. But I have a little bit different error.

Madge version: 8.0.0

SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? (5:0)
    at constructor (/home/frontend/madge/node_modules/@babel/parser/lib/index.js:362:19)
    at FlowParserMixin.raise (/home/frontend/madge/node_modules/@babel/parser/lib/index.js:3260:19)
    at FlowParserMixin.jsxParseElementAt (/home/frontend/madge/node_modules/@babel/parser/lib/index.js:6793:18)
    at FlowParserMixin.jsxParseElement (/home/frontend/madge/node_modules/@babel/parser/lib/index.js:6800:17)
    at FlowParserMixin.parseExprAtom (/home/frontend/madge/node_modules/@babel/parser/lib/index.js:6810:19)
    at FlowParserMixin.parseExprSubscripts (/home/frontend/madge/node_modules/@babel/parser/lib/index.js:10584:23)
    at FlowParserMixin.parseUpdate (/home/frontend/madge/node_modules/@babel/parser/lib/index.js:10569:21)
    at FlowParserMixin.parseMaybeUnary (/home/frontend/madge/node_modules/@babel/parser/lib/index.js:10549:23)
    at FlowParserMixin.parseMaybeUnaryOrPrivate (/home/frontend/madge/node_modules/@babel/parser/lib/index.js:10403:61)
    at FlowParserMixin.parseExprOps (/home/frontend/madge/node_modules/@babel/parser/lib/index.js:10408:23)