react-packager: Add ES6 import statement support to DependencyGraph.#386
react-packager: Add ES6 import statement support to DependencyGraph.#386pilwon wants to merge 12 commits intofacebook:masterfrom pilwon:packager-es6-import-patch
Conversation
|
Does this just work for |
|
@jgable Yes, it supports all valid ES6 import syntaxes documented in the ES6 Language Specification. You can see the result from a test ran against a comprehensive list of valid syntaxes in this gist. |
|
We also need to make the change here https://github.com/pilwon/react-native/blob/packager-es6-import-patch/packager/react-packager/src/DependencyResolver/haste/index.js#L28 |
|
@amasad Sure I can add that to PR. I have a question: Why does
|
…milar to DependencyGraph.
|
@amasad PR #368 addressed above questions. I merged the latest code into this PR branch. Fixes #368 (comment) & test passes. |
|
Thanks, will take a look shortly. |
There was a problem hiding this comment.
can you add test where there is no space between the comma and the default?
There was a problem hiding this comment.
and a test where there are no spaces between the named imports and the { }
|
Looks good, let's just add a couple more tests |
|
@amasad I updated test cases so most of them are in a more widely used spacing styles: import Default, { Foo, Bar as Baz, Qux as Norf } from 'x';I still kept some different spacing style cases such as Also added an incorrect statement |
|
Great, thanks for being very response, @pilwon! |
Summary: This PR teaches packager's `DependencyGraph` how to extract dependencies written with ES6 `import` statements. It fixes the issue where you are not able to write your app with ES6 `import` statements when your custom transformer (replacing the default [JSTransform](https://github.com/facebook/jstransform), for example, [babel](http://babeljs.io/)) already supports the ES6 `import` syntax. It will also be useful for [JSTransform](https://github.com/facebook/jstransform) later on once it implements `import` feature too. Closes facebook#386 Github Author: Pilwon Huh <pilwon@gmail.com> Test Plan: runJestTests.sh
Summary: This PR teaches packager's `DependencyGraph` how to extract dependencies written with ES6 `import` statements. It fixes the issue where you are not able to write your app with ES6 `import` statements when your custom transformer (replacing the default [JSTransform](https://github.com/facebook/jstransform), for example, [babel](http://babeljs.io/)) already supports the ES6 `import` syntax. It will also be useful for [JSTransform](https://github.com/facebook/jstransform) later on once it implements `import` feature too. Closes facebook#386 Github Author: Pilwon Huh <pilwon@gmail.com> Test Plan: runJestTests.sh
Summary: This PR teaches packager's `DependencyGraph` how to extract dependencies written with ES6 `import` statements. It fixes the issue where you are not able to write your app with ES6 `import` statements when your custom transformer (replacing the default [JSTransform](https://github.com/facebook/jstransform), for example, [babel](http://babeljs.io/)) already supports the ES6 `import` syntax. It will also be useful for [JSTransform](https://github.com/facebook/jstransform) later on once it implements `import` feature too. Closes facebook/react-native#386 Github Author: Pilwon Huh <pilwon@gmail.com> Test Plan: runJestTests.sh
* Remove 'website' from table of contents It's currently a link to /dev/null * Add link for 'Updating the Documentation'
This PR teaches packager's
DependencyGraphhow to extract dependencies written with ES6importstatements.It fixes the issue where you are not able to write your app with ES6
importstatements when your custom transformer (replacing the default JSTransform, for example, babel) already supports the ES6importsyntax.It will also be useful for JSTransform later on once it implements
importfeature too.