-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES6 tests failing #61
Comments
Why not use Babel to parse the files? Getting some issues with ES6 as well. |
What version of Node.js are you running and on what platform? |
I'm using grunt-madge v0.0.6 in Node v0.12.2. I'm getting parsing errors with things like arrow functions, for..Of, template strings,... "Error while parsing file: foo.js" I have no issues using let and const. EDIT: I can run all tests in green. If I change the es6 examples to use arrow functions, they still work. However, if I change the AMD examples to use arrow functions they break.
Might it be that when using AMD, there is a different parser being use or something like that? My project uses AMD for module loading but uses other ES6 features. I believe amdetective doesn't support ES6 features. |
I believe my issues with AMD and ES6 this should be fixed by mixu/amdetective#3 |
Can we update amdetective dependency to v0.1.0? Would be nice to update grunt-madge as well to include ES6 support for AMD modules as well. Thanks! |
I have an alternate detective for amd that also has es6 and jsx support (uses acorn under the hood): https://github.com/mrjoelkemp/node-detective-amd. In addition, it accepts as AST (or a file's contents) to avoid double parsing. Happy to help integrate it into madge. |
Btw, madge is also using my detective-es6 plugin which also supports jsx and an AST source. Just as an fyi, I wrote precinct: https://github.com/mrjoelkemp/node-precinct to avoid worrying about module types and get the dependencies of any JS file (es6, cjs, amd) with an AST or file content source. It also supports SASS/Stylus (Less would be easy to add). It's a detective factory. May remove a lot of logic from madge core. |
@mrjoelkemp - Precinct === Detective Factory - that's hilarious. I'm stuck on JSX right now—I'll tie my work to this issue, and see if using precinct (at least for JSX) helps.. |
@deanius JSX with ES6? Try updating the detective-es6 version in madge to 1.1.3 since 1.1.2 didn't have JSX support. Let me know if that works. |
Issue pahen#61 prefer detective-es6-1.1.3 Revert to esold Updated shrinkwrap
@mrjoelkemp - any thoughts on how to do this with files that need babel precompilation? I've got react files that use object-rest-spread babel plugin and they break madge. |
@deanius you should probably compile those files with Babel first. Then, point madge to the folder were your Babel output files are. That should do the trick. |
Detective-es6 could benefit from using babylon (babel's parser) instead of Acorn directly for parsing files that use features at various acceptance stages. This would be a breaking (but I'm definitely open to it) change in node-source-walk. After that, we'd push the version bump to detective-es6 and then bump the version of detective-es6 in madge. Another option is to have node-source-walk accept a configurable parser (with acorn as the default). This seems unnecessary since babylon is a superset of Acorn (if I remember correctly). For now, precompiling your code is a work around. |
Thanks @rafayepes @mrjoelkemp |
I made the fix to detective-es6 (more specifically to node-source-walk) to support all available ES7 plugins: https://github.com/babel/babylon#plugins. The goal is to always be able to parse a JS file for the dependencies – regardless of the syntax. This should be fixed when #83 is merged. |
I was trying to analyse dependencies written in es6 syntax and had some trouble and then discovered that the es6 related tests are failing. This is on master sha 3b4957b
after checkout out the repo I ran
npm install
andnpm test
and got the following output.(there is more output, but i figure this should be easy to reproduce).
Thanks
The text was updated successfully, but these errors were encountered: