-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add "importRuntime" option to "transform-runtime" #356
Conversation
When "importRuntime" is true, regenerator doesn't assume that `regeneratorRuntime` is available globally, but it injects an `import` statement (or `require`, depending on the source type)
package.json
Outdated
"regenerator-transform": "^0.13.3", | ||
"regenerator-preset": "file:packages/regenerator-preset", | ||
"regenerator-runtime": "file:packages/regenerator-runtime", | ||
"regenerator-transform": "file:packages/regenerator-transform", |
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 changes were made by lerna I think.
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.
Should we revert the lerna changes?
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 seems like the right direction, though I have one substantive suggestion.
export function runtimeProperty(name) { | ||
const runtimeNames = new WeakMap(); | ||
|
||
export function runtimeProperty(name, scope, opts) { |
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.
Now that runtimeProperty
takes options and does more than just construct a member expression, I think we should move it out of util.js
and make it a method of the Emitter
class. That way we won't need to pass the options explicitly, since they're stored as a property of the Emitter
object now. From what I can tell, everywhere runtimeProperty
was previously called, we have access to an Emitter
instance, so this change should be pretty straightforward. What do you think @nicolo-ribaudo?
This removes the file:... versions from package-lock.json, which I believe have been causing Travis CI tests to fail for PR facebook#356.
To throw it out there, I don't have a problem with landing this if you want, but I don't think it's something we'd recommend people use on the Babel side since |
Closing since this is now handled by |
Example output:
I had to update the Babel deps because I hit babel/babel#8508 and babel/babel#8722.