-
Notifications
You must be signed in to change notification settings - Fork 486
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
Update babel parser #1114
Update babel parser #1114
Conversation
The babel situation is kind of tricky at this point - since January, we've had an open issue about updating to Babel 7, and my stance was/is that the project should wait until 7 is out of beta. Because documentation.js uses babelify to figure out dependency trees, updating the babylon/babel-parser dependency without using that parser in babelify won't do much good: we'd be able to parse new syntax, but the documentation generation would fail before it gets there. Maybe the right tactic is to just switch to Babel 7. Which, I'm not sure - it'd likely introduce some problems for people using documentation.js with babel 6 configurations. But it seems like Babel 7's beta status is becoming less of a real thing now that it's been in beta for over a year. |
I'm attempting to tackle this now. |
src/input/dependency.js
Outdated
plugins: [ | ||
require('babel-plugin-transform-decorators-legacy').default, | ||
// Required to support webpack's System.import | ||
// https://github.com/documentationjs/documentation/issues/578 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth pointing out I couldn't find a Babel 7 version of the system-import-transformer plugin so I removed it.
b8c88a6
to
e31c575
Compare
package.json
Outdated
@@ -57,14 +73,16 @@ | |||
"vue-template-compiler": "^2.5.16", | |||
"yargs": "^9.0.1" | |||
}, | |||
"resolutions": { | |||
"@babel/plugin-syntax-pipeline-operator": "7.0.0-rc.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a workaround for babel/babel#8532
2b8f4ef
to
64de473
Compare
@@ -6,6 +6,10 @@ const mockRepo = require('../utils').mockRepo; | |||
const parse = require('../../src/parsers/javascript'); | |||
const github = require('../../src/github'); | |||
|
|||
// mock-fs is causing some unusual side effects with jest-resolve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would appreciate a close look at this. Is this okay temporarily?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can suss out the mock-fs details if the rest looks fine. It's tricky in a 'nesting git repositories' sense, but I can think of some workarounds, like instead of mocking these fs calls storing the files and writing them temporarily for the tests to access 'for real'.
ce66789
to
a69e352
Compare
Dropping System.import() support is a-ok with me. We should continue to support dynamic import(), but no reason to support the webpack-specific flavor that is System.import() |
Got it. In that case, this may still require some work to support dynamic imports. The current implementation relies on babel-plugin-system-import-transformer to transpile dynamic imports to commonJS style require statements. This is then read by detective which only handles require statements, not import statements. |
I guess I can either follow up with a separate diff to add back dynamic imports or continue on this branch. Any preference? |
Following up. How would like me to proceed? Also, if you're willing, I'm happy to be a collaborator for this project. |
a69e352
to
c804df4
Compare
Let's continue on this branch without dynamic imports for now, as long as that sounds good to you. |
I am trying to track what plugin we depend and which is not available for babel7. Is there any update about this? All our features are now using webpack chunking and we cannot generate documentation using documentationjs. |
update babel parser (goal is to support optional chaining in our codebase)