Skip to content
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

Merged
merged 1 commit into from
Sep 21, 2018
Merged

Update babel parser #1114

merged 1 commit into from
Sep 21, 2018

Conversation

vicapow
Copy link
Contributor

@vicapow vicapow commented Aug 3, 2018

update babel parser (goal is to support optional chaining in our codebase)

@coveralls
Copy link

coveralls commented Aug 3, 2018

Coverage Status

Coverage decreased (-0.8%) to 85.163% when pulling c804df4 on vicapow:update-babel into fb2595e on documentationjs:master.

@tmcw
Copy link
Member

tmcw commented Aug 3, 2018

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.

@ganapativs
Copy link

@vicapow
Copy link
Contributor Author

vicapow commented Aug 24, 2018

I'm attempting to tackle this now.

plugins: [
require('babel-plugin-transform-decorators-legacy').default,
// Required to support webpack's System.import
// https://github.com/documentationjs/documentation/issues/578
Copy link
Contributor Author

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.

@vicapow vicapow force-pushed the update-babel branch 2 times, most recently from b8c88a6 to e31c575 Compare August 24, 2018 23:15
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"
Copy link
Contributor Author

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

@vicapow vicapow force-pushed the update-babel branch 4 times, most recently from 2b8f4ef to 64de473 Compare August 25, 2018 20:29
@@ -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
Copy link
Contributor Author

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?

Copy link
Member

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'.

@vicapow vicapow force-pushed the update-babel branch 4 times, most recently from ce66789 to a69e352 Compare August 25, 2018 22:06
@tmcw
Copy link
Member

tmcw commented Aug 26, 2018

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()

@vicapow
Copy link
Contributor Author

vicapow commented Aug 26, 2018

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.

@vicapow
Copy link
Contributor Author

vicapow commented Aug 26, 2018

I guess I can either follow up with a separate diff to add back dynamic imports or continue on this branch. Any preference?

@vicapow
Copy link
Contributor Author

vicapow commented Aug 29, 2018

Following up. How would like me to proceed? Also, if you're willing, I'm happy to be a collaborator for this project.

@tmcw
Copy link
Member

tmcw commented Sep 2, 2018

I guess I can either follow up with a separate diff to add back dynamic imports or continue on this branch. Any preference?

Let's continue on this branch without dynamic imports for now, as long as that sounds good to you.

@vihanb vihanb mentioned this pull request Sep 20, 2018
@tmcw tmcw merged commit 0713ce7 into documentationjs:master Sep 21, 2018
tmcw pushed a commit that referenced this pull request Sep 21, 2018
@kopax
Copy link

kopax commented Feb 8, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants