-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Rewrite Hub as interface #5047
Labels
Has PR
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
Priority: High
Comments
yongxu
added a commit
to yongxu/babel
that referenced
this issue
Dec 27, 2016
yongxu@459b5dc |
yongxu
added a commit
to yongxu/babel
that referenced
this issue
Dec 28, 2016
yongxu
added a commit
to yongxu/babel
that referenced
this issue
Dec 28, 2016
yongxu
added a commit
to yongxu/babel
that referenced
this issue
Dec 28, 2016
yongxu
added a commit
to yongxu/babel
that referenced
this issue
Dec 30, 2016
yongxu
added a commit
to yongxu/babel
that referenced
this issue
Dec 30, 2016
yongxu
added a commit
to yongxu/babel
that referenced
this issue
Dec 30, 2016
yongxu
added a commit
to yongxu/babel
that referenced
this issue
Jan 3, 2017
yongxu
added a commit
to yongxu/babel
that referenced
this issue
Jan 17, 2017
yongxu
added a commit
to yongxu/babel
that referenced
this issue
Jan 17, 2017
loganfsmyth
pushed a commit
that referenced
this issue
Feb 13, 2017
loganfsmyth
added a commit
that referenced
this issue
Feb 14, 2017
loganfsmyth
added a commit
that referenced
this issue
Feb 14, 2017
danez
added a commit
that referenced
this issue
Feb 14, 2017
* Add new flow preset (#5288) * Fix PathHoister hoisting JSX member expressions on "this". (#5143) The PathHoister ignored member references on "this", causing it to potentially hoist an expression above its function scope. This patch tells the hoister to watch for "this", and if seen, mark the nearest non-arrow function scope as the upper limit for hoistng. This fixes #4397 and is an alternative to #4787. * Fix PathHoister hoisting before bindings. (#5153) Fixes #5149 and enables a few additional safe hoists. * Fix linting error * feature: Support pure expressions in transform-react-constant-elements (#4812) * Fix loose for-of with label (#5298) * Rewrite Hub as interface #5047 (#5050) * Rewrite Hub as interface #5047 * Update index.js * Avoid adding unnecessary closure for block scoping (#5246) When you write ``` for (const x of l) { setTimeout(() => x); } ``` we need to add a closure because the variable is meant to be block-scoped and recreated each time the block runs. We do this. However, we also add the closure when no loop is present. This isn't necessary, because if no loop is present then each piece of code runs at most once. I changed the transform to only add a closure if a variable is referenced from within a loop. * Add greenkeeperio-bot to mention-bot blacklist (#5301) [skip ci] * Upgrade lerna to current beta. (#5300) * Revert "Upgrade lerna to current beta." (#5303) * Add charset so tests work with convert-source-map@>1.4 (#5302) * Add CHANGELOG for 6.23.0 [skip ci] (#5304) * Update babel-types README from script. * v6.23.0 * Revert change that lerna force-committed. * Revert "Rewrite Hub as interface #5047" (#5306) * v6.23.1 * Revert lerna again
existentialism
pushed a commit
that referenced
this issue
May 19, 2017
existentialism
pushed a commit
that referenced
this issue
May 19, 2017
lock
bot
added
the
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
label
May 5, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Has PR
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
Priority: High
The current
babel-traverse
implementation ofHub
will cause bugs ifthis.hub.file
does not exist, which is only injected byFile
class inbabel-core
.This means
babel-traverse
package can not be used withoutbabel-core
unless we monkey-patch hub with a fake file object. TheHub
class itself doesn't carry any useful information besides thefile
reference.Defining hub as an interface instead of an object, will make
babel-traverse
a standalone package and resolve issues #4640 #4413Solution
we can redefine Hub(or a better name maybe) as
This interface would be sufficient for the current version, and can be extended in the future.
It also can be checked by flowtype
Here are the whys, where
Hub
appearsPlease let me know if you have any suggestion, or better improvement! I will make a PR if I can get some positive faceback :)
more about hub
the current implementation of hub itself only consist 6 lines of code, and the
options
has never been used anywhere:Here are all the places hub appears, when searching keyword
hub
in package/:The text was updated successfully, but these errors were encountered: