Commit Graph

1098 Commits

Author SHA1 Message Date
Kevin Cooper bbd4669180 Fix suggestion to "npm start -- --reset-cache"
Summary:
As discussed in https://github.com/facebook/react-native/pull/11983. The double dash is necessary to pass through the argument to node. Based on the comments [here](https://github.com/facebook/react-native/issues/1924#issuecomment-249861004), it looks like most people use the double dash; it's unclear whether it would do anything at all if the dashes were omitted. If anyone else has better insight, let me know!
Closes https://github.com/facebook/react-native/pull/13003

Differential Revision: D4731566

Pulled By: hramos

fbshipit-source-id: 62562536db7589a03a511762117cbf0e36d3aafb
2017-03-18 12:58:05 -07:00
Jean Lauliac b6ebb8010e packager: DependencyGraph-test: add broken use case
Summary:
This changeset adds a test that verifies that the duplicate modules use case is broken. The goal is to acknowledge the problem for now, and when we update `jest-haste`, we'll simply fix what needs to be fixed in that test.

See also, https://github.com/facebook/jest/pull/3107

Reviewed By: davidaurelio

Differential Revision: D4673431

fbshipit-source-id: 05e09bdf61a2eddf2e9d1e32a33d32065c9051f1
2017-03-16 13:51:54 -07:00
Jean Lauliac e3274bdef3 packager: FBGlobalTransformCache: move the retry/error logic
Reviewed By: davidaurelio

Differential Revision: D4713585

fbshipit-source-id: 6a83f858692b8a1f6326051f3a3f4a3a549e4027
2017-03-16 13:51:43 -07:00
Jean Lauliac 62d4c6e275 packager: GlobalTransformCache: finish conversion to async/await
Reviewed By: davidaurelio

Differential Revision: D4713456

fbshipit-source-id: f65c45439d1657872e28a296f13a73ee2032ea93
2017-03-16 09:23:39 -07:00
Jean Lauliac 457966760a packager: Resolver/polyfills/require: fix nit error message
Reviewed By: davidaurelio

Differential Revision: D4713066

fbshipit-source-id: 35f09ded85472191a3f1c36b5879acee55c60b8b
2017-03-15 07:52:05 -07:00
Jean Lauliac 737bf8cffe packager: attachHMRServer.js: Flow
Summary:
The breakage fixed by changeset [1] could have been identified earlier if we had typing on `attachHMRServer`, so I spent some time on that. This has revealed in turn a few functions across the codebase that were incorrectly typed, and that are now fixed.

[1] packager: attachHMRServer.js: fix callsite of Server#getModuleForPath()

Reviewed By: davidaurelio

Differential Revision: D4706241

fbshipit-source-id: fc4285245921ae45d5781a47d626fc0559dba998
2017-03-15 06:18:00 -07:00
Liu Zhanhong d8bd24fc39 BREAKING: Remove @provides support from packager
Summary:
see d82f2553fb
Closes https://github.com/facebook/react-native/pull/12355

Differential Revision: D4710001

Pulled By: davidaurelio

fbshipit-source-id: 1c2225fa3bd2881c3eaedfd02514c29b920948b6
2017-03-14 19:25:07 -07:00
David Aurelio 300fa5b723 Update worker to match command line args passed by Buck
Reviewed By: cpojer

Differential Revision: D4673955

fbshipit-source-id: 1886cef97a96efbe0e90b02b98f03544d5f3f155
2017-03-14 15:05:33 -07:00
Alexey Lang 4a90d1178f Use performanceNow to calculate __BUNDLE_START_TIME__
Reviewed By: javache

Differential Revision: D4706142

fbshipit-source-id: aa983d9e5d5324f97ae34ec0190b1fc988d012c8
2017-03-14 13:54:38 -07:00
Jean Lauliac 79c488b9f7 packager: fix buildBundle() options
Summary: The problem with `bundleOpts` is that it discards Flow typing, so it prevents reinforcing the integration of `Bundler` into `Server`. This changeset removes the `bundleOpts` to solve that issues. Instead, it makes the options explicit so that there is less uncertaintly. I love making options explicit, because they force callsites to take a consicious decision about what is really needed, making them more robust. They also expose oddities that probably needs refatoring, for example having a `resolutionRequest` in the bundle options does not seem correct, it should be an implementation details. Likewise, `onProgress` should probably be exposed differently, as it does not affect the content of the bundle itself.

Reviewed By: davidaurelio

Differential Revision: D4697729

fbshipit-source-id: d543870ba024e7588c10b101fa51429c77cc5ddc
2017-03-14 11:07:35 -07:00
Jean Lauliac 2f208f714a packager: react-packager.js: reinforce the typing at API boundary
Reviewed By: davidaurelio

Differential Revision: D4698256

fbshipit-source-id: 7a42e9b79744f599e92b5d3d91c41cdd0de2ece5
2017-03-14 11:07:34 -07:00
Jean Lauliac 915ab18d53 packager: Server: make buildBundle() async
Summary: Also remove the unnecessary await of the resolver, because `_bundler.bundle()` already does that.

Reviewed By: davidaurelio

Differential Revision: D4689448

fbshipit-source-id: 3b4fd73b1368f8b00c6eb7483e751387d9856ce9
2017-03-13 06:20:43 -07:00
Jean Lauliac bdacb9595b packager: Bundler: refactor the maxWorkerCount
Summary: The function giving the worker count was duplicated, let's just pass it down from a central place, the Bundler. Also, I simplified the function to use a simple formula rather than arbitrary ranges (it's still arbitrary, just a tad bit less :D ).

Reviewed By: davidaurelio

Differential Revision: D4689366

fbshipit-source-id: fe5b349396f1a07858f4f80ccaa63c375122fac8
2017-03-13 05:21:26 -07:00
Jean Lauliac 4e106d45c3 packager: verify validity of TTY before using it
Reviewed By: mkonicek

Differential Revision: D4689779

fbshipit-source-id: 9bc2c1447bd64ec392adef772b1189a782f83545
2017-03-10 10:51:34 -08:00
Jean Lauliac da94f5e5af packager: Resolver: remove opt defaults, simplify load()
Summary: Not having default everywhere (keeping them at the top level instead) makes for a code that is easier to understand, and more robust as different pieces of code cannot default to different values. This changeset also unifies the option types (ex. `platform`).

Reviewed By: cpojer

Differential Revision: D4688882

fbshipit-source-id: b5f407601386336f937a0ac1f68c666acc89dfd8
2017-03-10 08:36:24 -08:00
Jean Lauliac e1a2633f69 packager: node-haste: async load()
Reviewed By: cpojer

Differential Revision: D4673384

fbshipit-source-id: 816529f8947079b4003c8e91443e221184fd589d
2017-03-10 04:06:34 -08:00
Jean Lauliac e2ffd8d08b packager: Resolver: make the Resolver construction a Promise
Reviewed By: cpojer

Differential Revision: D4681614

fbshipit-source-id: 5da558280edf300f67042e72c65b272e49351871
2017-03-10 03:52:56 -08:00
Jean Lauliac de192dace8 packager: node-haste: cleanup the load() function
Reviewed By: davidaurelio

Differential Revision: D4659391

fbshipit-source-id: a83e218ba89ad459fed07a4dfb61c422a6b4db5d
2017-03-08 10:53:13 -08:00
Jean Lauliac 23adbec139 packager: node-haste: remove use of HasteMap class
Reviewed By: davidaurelio

Differential Revision: D4658741

fbshipit-source-id: 951c96df174c79a00b3cff102b3dda75abd4ef99
2017-03-08 10:53:13 -08:00
sonaye 2c79f214ea Support for defineEnumerableProperties
Summary:
**Motivation**
detailed in #12702.

**Test plan**
1) running [a piece of code](https://github.com/mobxjs/mobx/issues/839#issuecomment-284153126) that utilizes the helper without any modifications on the react native package results an error being thrown.

![b589a71c-0041-11e7-9d47-cb79efff3ba5](https://cloud.githubusercontent.com/assets/23000873/23579517/3c8fe992-0100-11e7-9eb5-93c47f3df3e0.png)

2) updating the list of helpers available by adding the definition of `defineEnumerableProperties` as provided by babel [babel/babel/packages/babel-helpers/src/helpers.js](https://github.com/babel/babel/blob/master/packages/babel-helpers/src/helpers.js#L275-L285) results no errors.

![kapture 2017-03-04 at 16 48 35](https://cloud.githubusercontent.com/assets/23000873/23579520/457b8ca0-0100-11e7-8ca4-c704c6e9631f.gif)
Closes https://github.com/facebook/react-native/pull/12703

Differential Revision: D4658120

Pulled By: ericvicenti

fbshipit-source-id: 914aed4d313b3cc4f7ab99049d05d0aef269a3be
2017-03-06 16:05:49 -08:00
Jean Lauliac a826db50a8 packager: node-haste: remove getHasteMap()
Reviewed By: davidaurelio

Differential Revision: D4597906

fbshipit-source-id: 4e239d0278fd79a8c60944b71e127e5a335b066f
2017-03-06 06:50:28 -08:00
Jean Lauliac ee705f2352 packager: minimize terminal.log() work
Reviewed By: davidaurelio

Differential Revision: D4650441

fbshipit-source-id: 2de2c8e5bea29179fd04ef8db67ac385b3f0a06b
2017-03-03 11:06:22 -08:00
Jean Lauliac 52580cb4c7 packager: make DependencyGraph.processFileChange private
Reviewed By: davidaurelio

Differential Revision: D4635645

fbshipit-source-id: baf3ec75927dfa2d1b29d6548a13453370f434ba
2017-03-02 08:46:08 -08:00
Jean Lauliac 6e71c2e30a packager: ResolutionRequest: use moduleMap instead of hasteMap
Reviewed By: cpojer

Differential Revision: D4605535

fbshipit-source-id: bc8394eb296f3fbeda5d8f0f3c17790db8691033
2017-03-02 08:46:08 -08:00
Jean Lauliac 17c6ca3484 packager: DependencyGraph-test: fix tests
Reviewed By: davidaurelio

Differential Revision: D4635348

fbshipit-source-id: 0130496e20d54f5ddf6546823b7a6cba3118917d
2017-03-02 08:46:08 -08:00
Christoph Pojer 20da966546 Bring back polyfill test
Reviewed By: jeanlauliac

Differential Revision: D4642517

fbshipit-source-id: 0882f453eb91c9f12a9e507ccfa60873106d2d71
2017-03-02 05:50:16 -08:00
Janic Duplessis 4681082e17 Packager - Fix absolute imports on Windows
Summary:
Absolute imports on Windows were broken, I'm not 100% sure when this happens but when I tested Exponent on Windows which uses `rn-cli.config.js` with
```js
getTransformOptions() {
    return {
      reactNativePath: path.resolve('./node_modules/react-native'),
      reactPath: path.resolve('./node_modules/react'),
    };
  }
```
it seemed to use absolute paths for these modules.

I also tested absolute paths in node repl and it does work for absolute paths of different formats. `C:/root/test.js`, `/root/test.js`, `C:\root\test.js` all do resolve properly to the same module.

To fix this I resolve the absolute path using `path.resolve` on Windows. Noop on other platforms to avoid the overhead since it's not necessary.

**Test plan**
- Tested that it fixed the bug I had when running Exponent on Windows.
- Updated the absolute path test to use forward slashes since this is what happens in practice when using `getTransformOptions`. We can't test all cases on linux since adding the drive letter au
Closes https://github.com/facebook/react-native/pull/12530

Differential Revision: D4634699

Pulled By: jeanlauliac

fbshipit-source-id: 0cf6528069b79cba2e0f79f48f5a524d59b7091e
2017-03-01 08:21:37 -08:00
Christoph Pojer 77d8cbc68a Fix lint errors 2/2
Reviewed By: jeanlauliac

Differential Revision: D4628330

fbshipit-source-id: 94fad1294e22fa0073e15843f94241ae778112a0
2017-03-01 08:08:55 -08:00
Jean Lauliac 9aa1215e21 packager: DependencyGraph-test: go through fs.watch mock rather than manual API
Reviewed By: davidaurelio

Differential Revision: D4628593

fbshipit-source-id: 43ccdb038bd387e87096f2a7020c98d915fa5bba
2017-03-01 07:57:00 -08:00
cpojer 556c432260 Use Yarn with lerna. 2017-03-01 11:01:35 +00:00
Christoph Pojer b31f88c9f3 Fix lint errors 1/n
Reviewed By: davidaurelio

Differential Revision: D4627645

fbshipit-source-id: 3cf368c6a24a555b7d0a39045f6ba6fd92ae34e1
2017-02-28 09:05:59 -08:00
Christoph Pojer eda81c0439 Remove outdated file
Reviewed By: jeanlauliac

Differential Revision: D4627603

fbshipit-source-id: 9b6187725335d17f65a18c9fdcd7e73d7141f551
2017-02-28 08:21:55 -08:00
Jean Lauliac 933f63478a packager: terminal: split status too big to fit in screen
Reviewed By: cpojer

Differential Revision: D4627512

fbshipit-source-id: 6e7b5f3a6e2d012a44373014f93ab17ef4f290a2
2017-02-28 06:52:09 -08:00
Jean Lauliac c1a81571fc packager: simplify fs.stat mocks
Reviewed By: davidaurelio

Differential Revision: D4620080

fbshipit-source-id: f78b20d2f728ddd32413f27dba85cb825ec7c9a9
2017-02-28 06:22:21 -08:00
cpojer 84ee9a488e Repo updates. 2017-02-28 11:45:45 +00:00
Bhuwan Khattar 9442ec2bf3 Introduce HasteImpl
Summary:
Similar to https://github.com/facebook/jest/pull/2877, this introduces an optional config `HasteImpl` of type `{getHasteName(filePath: string): (string|void)}` that returns the haste name for a module at filePath if it is a haste module or undefined otherwise.

This allows us to inject a custom implementation of haste's module id resolution rather than only relying on `providesModule` annotations

Reviewed By: davidaurelio

Differential Revision: D4589372

fbshipit-source-id: 4d1983dfbf09c9d67faf725e86ae86ab42433b7d
2017-02-27 10:52:58 -08:00
David Aurelio d7dbcfc478 Symbolicate stack traces off the main process
Summary:
Moves stack trace symbolication to a worker process.

The worker process is spawned laziliy, and is treated as an exclusive resource (requests are queued).

This helps keeping the server process responsive when symbolicating.

Reviewed By: cpojer

Differential Revision: D4602722

fbshipit-source-id: 5da97e53afd9a1ab981c5ba4b02a7d1d869dee71
2017-02-27 10:52:57 -08:00
Christoph Pojer cd85f9a5c2 Fix flow errors
Reviewed By: davidaurelio

Differential Revision: D4619990

fbshipit-source-id: 80355b8f0d0c3f84691098a05cdf2ba136c4bf53
2017-02-27 08:05:47 -08:00
cpojer d513738abe Fix flow errors. 2017-02-27 10:41:38 +00:00
cpojer f1c1984cc7 Update eslint settings. 2017-02-25 08:25:05 +00:00
Gabe Levi 7cb3d9499a Deploy v0.40.0
Reviewed By: yungsters

Differential Revision: D4612331

fbshipit-source-id: 3eaa2f99d3181227166064cbee29b9245401a775
2017-02-24 12:51:16 -08:00
Christoph Pojer a26d3c43ef Fix a bunch of flow annotations
Reviewed By: jeanlauliac

Differential Revision: D4611846

fbshipit-source-id: c2fe468e34a3b1eba7fcd2596020aad136285363
2017-02-24 11:25:20 -08:00
cpojer 33c594508e Add suppression comments. 2017-02-24 13:58:08 +00:00
Christoph Pojer 62c959a05a Fix typo in ResolutionRequest
Reviewed By: davidaurelio

Differential Revision: D4605569

fbshipit-source-id: 5cd942e35faa8c653c4b709edb026eac0636a32a
2017-02-23 10:51:19 -08:00
Bhuwan Khattar b936a8d20e Remove @providesModule from polyfills
Summary:
These are not modules and don't need a `providesModule` annotation.

`sed -i -e '/providesModule/d' packager/src/Resolver/polyfills/*.js`

Reviewed By: cpojer

Differential Revision: D4605374

fbshipit-source-id: 5045a9664bc105dab15936f408d373da8d9322fe
2017-02-23 09:06:29 -08:00
cpojer c27751d4c3 Update package.json 2017-02-23 16:38:25 +00:00
cpojer 294850f364 Add spread transform. 2017-02-23 16:16:00 +00:00
Jean Lauliac a8570b6b98 packager: node-haste: do not expose HasteMap
Reviewed By: davidaurelio

Differential Revision: D4598085

fbshipit-source-id: d993be8e3bdcfda018a898b4adb32b53c1f0a948
2017-02-23 03:36:28 -08:00
David Aurelio 6fa8dedfb5 Discard protocol, host, and port of URLs in bundle options
Summary:
HTTP request URLs don’t include protocol, host and port. Stack frames URLs, on the other hand, contain full URLs. These full URLs are used to get the correct bundle to build the source map from.

The method that creates option objects from URLs therefore now discards leading protocol, host and port to ensure that cached bundles can be reused for symbolication rather than triggering rebuilds.

Reviewed By: jeanlauliac, cpojer

Differential Revision: D4598077

fbshipit-source-id: 262df187bcdf7099011371e8b55ae692c6e1a942
2017-02-23 02:37:25 -08:00
Christoph Pojer 7e8ab0d237 Add dependencies to package.json
Summary:
I extracted all the dependencies (using jest-haste-map) and copied them from the package.json in react-native to RNP. There is some duplication here for now but we can later go back and remove the duplicated dependencies from react-native that aren't needed there.

I also removed a mock file that hasn't been in use for a long time.

Reviewed By: jeanlauliac

Differential Revision: D4598155

fbshipit-source-id: 850b6dfa6fc2eec138ebdd7208cd34bee21f7927
2017-02-23 01:07:28 -08:00