-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Make babel-relay-plugin run before other transforms #714
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,25 @@ function babelAdapter( | |
): mixed { | ||
if (Plugin == null) { | ||
// Babel 6. | ||
return visitorsBuilder(t); | ||
const { visitor: { Program, TaggedTemplateExpression } } = visitorsBuilder(t); | ||
|
||
const taggedTemplateExpressionVisitor = { | ||
TaggedTemplateExpression(path) { | ||
return TaggedTemplateExpression(path, this); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is In other words, why can't we just use:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, the way I understand it is that Honestly, I'm not a super Babel expert either -- I followed what @thejameskyle did here: https://phabricator.babeljs.io/rBC0b264aa38af5ba7fb121b216be2fb69eece7217c |
||
} | ||
} | ||
|
||
/** | ||
* Run both transforms on Program, to make sure that they run before other plugins | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Omit comma and add a period. |
||
*/ | ||
return { | ||
visitor: { | ||
Program(path, state) { | ||
Program(path, state); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a super Babel expert, and better safe than sorry. Does the return value never matter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, after a second look, it doesn't matter. Will fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in skevy@f748816 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @skevy is the (void) return value here intentional? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @josephsavona I'm not sure why it didn't invalidate the commit...but I removed the return. It's not needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. awesome, thanks for confirming. |
||
path.traverse(taggedTemplateExpressionVisitor, state); | ||
} | ||
} | ||
} | ||
} | ||
// Babel 5. | ||
const legacyT = { | ||
|
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.
Nit: Omit space inside curly braces.