Commit Graph

107 Commits

Author SHA1 Message Date
Spencer Ahrens c2a8e52d72 Fix source map utils
Reviewed By: javache

Differential Revision: D3302496

fbshipit-source-id: de15a289497119c7f600b8796452fc9573ea7394
2016-05-14 10:43:30 -07:00
Pieter De Baets 1b5b5d9c5b Improve error handling in route generation script
Reviewed By: sam-swarr

Differential Revision: D3282748

fbshipit-source-id: 17301c6639a7517d1171a67567f220471020b78d
2016-05-12 04:29:24 -07:00
Ben Alpert a95405f419 Update to React 15.1.0-alpha.1
Reviewed By: zpao

Differential Revision: D3283057

fbshipit-source-id: c37ea3818597e5c0f37ed3c7502c791c02183ea8
2016-05-10 15:58:24 -07:00
Pieter De Baets 2760df761d Cleanup InitializeJavascriptAppEngine
Reviewed By: davidaurelio

Differential Revision: D3235141

fb-gh-sync-id: 86fc844c5e9d9ea57d504696bac30671c2079e7a
fbshipit-source-id: 86fc844c5e9d9ea57d504696bac30671c2079e7a
2016-05-04 10:50:32 -07:00
Konstantin Raev ec5016ad8f Fixed path to regenerator-runtime
Summary:
Since 0.8.43 regenerator has regenerator-runtime dependency.
Fixes one js test in trunk
Closes https://github.com/facebook/react-native/pull/7351

Reviewed By: davidaurelio

Differential Revision: D3252699

Pulled By: bestander

fb-gh-sync-id: cedb122eb8e9f3a5e40a5313482bc2282511c71e
fbshipit-source-id: cedb122eb8e9f3a5e40a5313482bc2282511c71e
2016-05-04 05:19:31 -07:00
David Aurelio 46d98e1d68 remove support for `process.platform`
Reviewed By: javache

Differential Revision: D3252666

fb-gh-sync-id: af0e4987c34f43ec2472cbdf52fc112b81050513
fbshipit-source-id: af0e4987c34f43ec2472cbdf52fc112b81050513
2016-05-04 02:51:26 -07:00
Janic Duplessis 169cfb5a52 Remove the need for allowTopLevelThis in transform-es2015-modules-commonjs
Summary:
This make the transform behave closer to the standard for modules.

This removes the few places that a top level this was used to refer to the global space. It also clean up the usage of `GLOBAL` to use `global` instead as this is what is used everywhere else in the code base. We still define `GLOBAL` for compatibility with other modules.

**Test plan**
Clear the packager cache to make sure the transforms run again. (node ./local-cli/cli.js start --reset-cache).
Run the Movies example (UIExplorer is broken atm) and make sure there are no errors.
Closes https://github.com/facebook/react-native/pull/6255

Differential Revision: D3037227

Pulled By: mkonicek

fb-gh-sync-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
fbshipit-source-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
2016-04-29 16:15:34 -07:00
David Aurelio e6bafca39e Improve constant inlining, add `process.platform`
Reviewed By: bestander

Differential Revision: D3235716

fb-gh-sync-id: f9019ec0042827e409fa84ba74f4c426ccad1519
fbshipit-source-id: f9019ec0042827e409fa84ba74f4c426ccad1519
2016-04-28 11:23:21 -07:00
Christoph Pojer d363b1f2e2 Update Jest APIs on fbsource
Reviewed By: javache

Differential Revision: D3229435

fb-gh-sync-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
fbshipit-source-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
2016-04-27 19:16:32 -07:00
Alexander Blom 9a3a082225 Make polyfills and globals lazy
Summary:
This avoids requiring things that may never be used at all by the application such as WebSocket or Geolocation. It also stops us from asking for native modules
before we actually start the application enabling us to potentially be more lazy in the future.

Reviewed By: davidaurelio

Differential Revision: D3212802

fb-gh-sync-id: 70cf0d1a85f39fedc47758e5eb5df789a511bc9b
fbshipit-source-id: 70cf0d1a85f39fedc47758e5eb5df789a511bc9b
2016-04-27 09:57:20 -07:00
Steven Luscher dad39eb502 Move `Number` polyfills into the `/polyfills/` directory
Reviewed By: vjeux

Differential Revision: D3223317

fb-gh-sync-id: a49a14f217b27d6542b65c4780c557e73da2443f
fbshipit-source-id: a49a14f217b27d6542b65c4780c557e73da2443f
2016-04-26 11:24:42 -07:00
Mike Grabowski 6481e0ea6a Setup RCTNativeAppEventEmitter on init
Summary: Fixes #6227 as discussed in FB group, also a follow up to ide commit 6ec4d65aec

Differential Revision: D3041185

Pulled By: javache

fb-gh-sync-id: 544c55b14d238eb8bfed3ab1588c6e48d164943e
shipit-source-id: 544c55b14d238eb8bfed3ab1588c6e48d164943e
2016-03-15 03:45:33 -07:00
Martín Bigio 179ac1e359 Remove HMRClient out of the bundle
Reviewed By: elynde

Differential Revision: D3024020

fb-gh-sync-id: 26e8be8a1b2c1986e4ca7b510aac263f1a2ced1c
shipit-source-id: 26e8be8a1b2c1986e4ca7b510aac263f1a2ced1c
2016-03-08 13:27:32 -08:00
David Aurelio ad8a335864 Remove knowledge of fbjs from the packager
Summary:Follow-up to https://github.com/facebook/react-native/pull/5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
2016-03-02 04:28:38 -08:00
Janic Duplessis 44fcf22074 Fix crash when passing null to clearImmediate
Summary:Passing `undefined` or `null` to `clearImmediate` caused apps to crash. It it caused because we try to find the index of the null/undefined timer when we should just do nothing when passed these values.

It is already handled properly in the other Timer functions.

**Test plan**
Calling `clearImmediate` with `undefined` or `null` should do nothing.
Closes https://github.com/facebook/react-native/pull/6192

Differential Revision: D2987778

Pulled By: vjeux

fb-gh-sync-id: 6fd38cfa3c10012caa2afb27cbdab95df696a769
shipit-source-id: 6fd38cfa3c10012caa2afb27cbdab95df696a769
2016-02-28 11:41:33 -08:00
Dave Miller d1e9fc0737 Fix SourceMap loading on Android
Reviewed By: martinbigio

Differential Revision: D2891405

fb-gh-sync-id: 8fa38e530952c6e7fda48557ea6386b4b456efb0
2016-02-02 12:21:34 -08:00
Martín Bigio c56f280af2 Disable Flow on Packager
Reviewed By: frantic

Differential Revision: D2870105

fb-gh-sync-id: c95db83e40b3558c53614b08240a5361c14e0e6c
2016-01-27 15:33:31 -08:00
Martín Bigio f2438b440d Hot Loading Sourcemaps
Summary:
public

To make sourcemaps work on Hot Loading work, we'll need to be able to serve them for each module that is dynamically replaced. To do so we introduced a new parameter to the bundler, namely `entryModuleOnly` to decide whether or not to process the full dependency tree or just the module associated to the entry file. Also we need to add `//sourceMappingURL` to the HMR updates so that in case of an error the runtime retrieves the sourcemaps for the file on which an error occurred from the server.

Finally, we need to refactor a bit how we load the HMR updates into JSC. Unfortunately, if the code is eval'ed when an error is thrown, the line and column number are missing. This is a bug/missing feature in JSC. To walkaround the issue we need to eval the code on native. This adds a bit of complexity to HMR as for both platforms we'll have to have a thin module to inject code but I don't see any other alternative. when debugging this is not needed as Chrome supports sourceMappingURLs on eval'ed code

Reviewed By: javache

Differential Revision: D2841788

fb-gh-sync-id: ad9370d26894527a151cea722463e694c670227e
2016-01-27 14:55:36 -08:00
Satyajit Sahoo 0007bff977 Use promises in 'SourceCodeModule'
Summary: Closes https://github.com/facebook/react-native/pull/5504

Reviewed By: svcscm

Differential Revision: D2861158

Pulled By: dmmiller

fb-gh-sync-id: 3e9c257288539183f6156b8d360b54dc570bc7ad
2016-01-25 12:34:31 -08:00
David Aurelio 2902701566 Remove now unnecessary tweaking of global
Summary:
public

When we were debugging in the main window JS context in Chrome, the global environment had to be tweaked so that DOM features wouldn’t be detected.

Since we switched to debugging within a web worker, we don’t need to do this tweaks any more.

Reviewed By: bestander

Differential Revision: D2850239

fb-gh-sync-id: 886f2f7ac5c579c3fd4a424d5341bc6bc0432c0d
2016-01-21 10:26:33 -08:00
Janic Duplessis d33b554f5d Make the packager work with babel strict mode transform
Summary:
At the moment we have to disable strict mode for the transform-es2015-modules-commonjs because strict mode leaks to the global scope and breaks the bridge. It was due to the way the polyfills were bundled in the package. To fix it, I wrapped the polyfill modules in an IIFE. Then when strict mode was enabled some polyfills were broken due to strict mode errors so that was fixed too. Also removed the IIFE from the polyfills that included one.

This diff doesn't enable the strict mode transform since some internal facebook modules depend on it not being enabled. When #5214 lands we could make the default babel config shipped with OSS react-native use strict mode modules and facebook could just modify the babel config to disable it if needed.

This will allow removing `"strict": false` from https://github.com/facebook/react-native/blob/master/packager/react-packager/.babelrc#L16

Fixes #5316
Closes https://github.com/facebook/react-native/pull/5422

Reviewed By: svcscm

Differential Revision: D2846422

Pulled By: davidaurelio

fb-gh-sync-id: a3e2f8909aa87dabab2b872c61b887e80220fb56
2016-01-21 07:23:34 -08:00
Nick Lockwood cb45eaa0e8 Made Map & Set polyfills available globally
Summary:
public

Map and Set are a standard JavaScript features, but are only supported in a subset of JSC versions that we target (e.g. iOS 7's JSC doesn't support Set).

The consequence of this is that failing to require('Set') before using it won't error during testing on a modern OS, but will fail on older OS versions. This diff makes the Map and Set polyfills available globally to all RN apps to avoid that problem.

Reviewed By: davidaurelio

Differential Revision: D2833997

fb-gh-sync-id: 713d8b69f6a1bce2472a1b2e6b84f69d75f30289
2016-01-20 08:27:38 -08:00
Martin Konicek 1dc56a6758 Add support for global alert() on Android
Summary:
Use the new cross-platform [`Alert`](https://github.com/facebook/react-native/blob/master/Libraries/Utilities/Alert.js) API to implement global `alert()`.

public

Reviewed By: vjeux

Differential Revision: D2773589

fb-gh-sync-id: 4297c5dce6a55391af89d2675f2b9ac4dc715bb6
2016-01-08 10:12:29 -08:00
Martín Bigio 4ffb241647 Hot Loading E2E basic flow
Summary:
public

Implement all the necessary glue code for several diffs submitted before to get Hot Loading work end to end:

- Simplify `HMRClient`: we don't need to make it stateful allowing to enable and disable it because both when we enable and disable the interface we need to reload the bundle.
- On the native side we introduced a singleton to process the bundle URL. This new class might alter the url to include the `hot` attribute. I'm not 100% sure this is the best way to implement this but we cannot use `CTLSettings` for this as it's are not available on oss and I didn't want to contaminate `RCTBridge` with something specific to hot loading. Also, we could potentially use this processor for other things in the future. Please let me know if you don't like this approach or you have a better idea :).
- Use this processor to alter the default bundle URL and request a `hot` bundle when hot loading is enabled. Also make sure to enable the HMR interface when the client activates it on the dev menu.
- Add packager `hot` option.
- Include gaeron's `react-transform` on Facebook's JS transformer.

The current implementation couples a bit React Native to this feature because `react-transform-hmr` is required on `InitializeJavaScriptAppEngine`. Ideally, the packager should accept an additional list of requires and include them on the bundle among all their dependencies. Note this is not the same as the option `runBeforeMainModule` as that one only adds a require to the provided module but doesn't include all the dependencies that module amy have that the entry point doesn't. I'll address this in a follow up task to enable asap hot loading (9536142)

I had to remove 2 `.babelrc` files from `react-proxy` and `react-deep-force-update`. There's an internal task for fixing the underlaying issue to avoid doing this horrible hack (t9515889).

Reviewed By: vjeux

Differential Revision: D2790806

fb-gh-sync-id: d4b78a2acfa071d6b3accc2e6716ef5611ad4fda
2015-12-28 16:44:59 -08:00
Milen Dzhumerov 1304e78136 Inline require ExceptionsManager dependencies
Summary:
Inline require `ExceptionsManager` dependencies which are eagerly loaded on app startup (via `setUpConsole()` which is called from `InitializeJavaScriptAppEngine.js`) even though it's necessary until an exception needs to be reported.

This can save about 30-40ms on an iOS device.

public

Reviewed By: nicklockwood, tadeuzagallo, jspahrsummers

Differential Revision: D2755161

fb-gh-sync-id: d4cbfebf04d861b3a70558346a395d3d3ee87cc6
2015-12-16 04:02:30 -08:00
Justas Brazauskas 0e8b207cc3 Bugfix - Typos
Summary:
Fixed few typos in `./Examples` and `./Libraries` folders.
Closes https://github.com/facebook/react-native/pull/4788

Reviewed By: svcscm

Differential Revision: D2759918

Pulled By: androidtrunkagent

fb-gh-sync-id: d692b5c7f561822353e522f9d4dfde7e60b491cf
2015-12-15 09:09:32 -08:00
Tadeu Zagallo 3549ff049c Rename BridgeProfiling to Systrace for consistency
Summary:
public

Rename the `BridgeProfiling` JS module to `Systrace`, since it's actually just
an API to Systrace markers.

This should make it clearer as we add more perf tooling.

Reviewed By: jspahrsummers

Differential Revision: D2734001

fb-gh-sync-id: 642848fa7340c545067f2a7cf5cef8af1c8a69a2
2015-12-11 03:53:19 -08:00
Huang Yu 0a3694ce48 fix several lint warnings
Summary: fix some ling warnings from several files
Closes https://github.com/facebook/react-native/pull/4450

Reviewed By: svcscm

Differential Revision: D2707606

Pulled By: mkonicek

fb-gh-sync-id: 410ccacf061ac7b0f6e44d1a5e4621a9d1d606fc
2015-12-01 07:26:29 -08:00
Chester Wood e966cd1041 Set navigator.product to ReactNative
Summary: Fix for [Issue 1331](https://github.com/facebook/react-native/issues/1331). Sets navigator.product to ReactNative and navigator.productSub to the version string in package.json.

Note that the code requires package.json, which works fine in the RN packager, but webpack users will probably a need to configure a json loader in their config file.

Tested using UIExplorer and console.log printout of the product variables in xcode and Chrome debugger.
Closes https://github.com/facebook/react-native/pull/4083

Reviewed By: svcscm

Differential Revision: D2696881

Pulled By: vjeux

fb-gh-sync-id: 511446432dcd0ec658100715129c77153e743423
2015-11-25 12:45:28 -08:00
Milen Dzhumerov a663d4d8d5 Use for-loop instead of forEach() in a hot path
Summary: public

Replaces the usage of forEach() with a for loop on a hot code path

Reviewed By: tadeuzagallo

Differential Revision: D2690727

fb-gh-sync-id: b7cbcda5cf80a0e31753f49c01e145abb789f3e5
2015-11-25 07:24:31 -08:00
Sebastian Markbage 64675dc078 Move RelayProfiler Decoupled Initialization to use Double Dispatch
Reviewed By: josephsavona

Differential Revision: D2689433

fb-gh-sync-id: 966b3d855a5a0a755fd55fb583e31ba648de2a7a
2015-11-23 19:24:27 -08:00
Milen Dzhumerov 7febd13676 Attach to all RelayProfiler events
Summary: public

Dynamically profile events from RelayProfiler if available. This will expose time spent in Relay in the systraces.

Reviewed By: tadeuzagallo

Differential Revision: D2674215

fb-gh-sync-id: d5f9d529b86d267a80b0cda2223f6a28a08ac385
2015-11-20 10:06:28 -08:00
Milen Dzhumerov c8fd9f7588 Split immediate into multiple passes
Reviewed By: tadeuzagallo

Differential Revision: D2663957

fb-gh-sync-id: d7f0041fc98edb46e518f684527effe2f5201240
2015-11-19 03:33:26 -08:00
Tadeu Zagallo 7a794cc72b Strip dev only modules
Summary: public

Make sure some modules that are only available in dev mode are only
included in dev bundles.

Depends on: D2663838

Reviewed By: davidaurelio

Differential Revision: D2663889

fb-gh-sync-id: 42be40b865ef305828b3519556125af090ec61f4
2015-11-18 09:12:29 -08:00
Pieter De Baets 478a712d20 Ensure exceptions from route generation are reported
Reviewed By: swarr

Differential Revision: D2631395

fb-gh-sync-id: cf59a290a4b447122c36ec20176b563a38bee630
2015-11-09 09:13:27 -08:00
Pieter De Baets 0c83407dd2 Simplify logging exceptions from JS to native
Reviewed By: vjeux

Differential Revision: D2615559

fb-gh-sync-id: ee931b3691251c8b6276699c6f927e47d8e8fd97
2015-11-05 12:51:47 -08:00
Pawel Sienkowski 4e1f2f4e0f Fixed: Move out setupDevtools call from renderApplication function
Reviewed By: sahrens

Differential Revision: D2620876

fb-gh-sync-id: 8971a1c523c06966dd11280e19272429aa3f9c8d
2015-11-05 08:50:29 -08:00
Christoph Pojer 7041a22bd0 Update jest to 0.7.1
Reviewed By: frantic

Differential Revision: D2614935

fb-gh-sync-id: 64cc4fb439f0c53f0eb0588c22e0291813a7e334
2015-11-04 14:42:13 -08:00
Pawel Sienkowski 9bfadb7e1e Revert moving out setupDevtools call
Reviewed By: menglu

Differential Revision: D2609340

fb-gh-sync-id: 3b27b3e18805660bd19ae705916ce4e51120f7f3
2015-11-02 18:34:25 -08:00
Pawel Sienkowski 7021918fe5 Move out setupDevtools call from renderApplication function
Reviewed By: frantic

Differential Revision: D2600393

fb-gh-sync-id: edac2fa3281314fb02a0951c342c2c1ae9b0441a
2015-11-02 15:37:38 -08:00
Tadeu Zagallo d33e84dde5 Use nativeTrace(Begin|End)Section directly from BridgeProfiling
Summary: public

Call the native bindings explicitly from BridgeProfiling instead of polyfill'ing `console.profile` with
a function that has a different signature.

Reviewed By: vjeux

Differential Revision: D2602313

fb-gh-sync-id: 9295eff9458f2caa35b7e982c0f7c06dbe65fd09
2015-10-31 16:43:28 -07:00
James Ide 6ec4d65aec Set up the RN JS environment before requiring other modules
Summary: Set up the polyfills for console and process before initializing other modules. Some modules do work (e.g. call `invariant`) when they are first required, so requiring the DefaultInjection module at the beginning ensures we have a consistent JS environment.
Closes https://github.com/facebook/react-native/pull/3526

Reviewed By: spicyj

Differential Revision: D2560340

Pulled By: frantic

fb-gh-sync-id: 44c743e3212ff1dcdbe0169041dfd3ea8f1a54f7
2015-10-22 15:48:28 -07:00
Bill Glover 8fb9cc8fc1 Fix 16 linter warnings in Examples/
Summary: Partially fixes #3316 by addressing 16 linter warnings:
 - Strings should be singlequote
 - Missing semicolon

Travis build jobs 1.1 through 1.4 complete successfully. 1.5 fails through what appears to be an unrelated issue on master.
Closes https://github.com/facebook/react-native/pull/3332

Reviewed By: @​svcscm

Differential Revision: D2531718

Pulled By: @javache

fb-gh-sync-id: ca22fbeac5fe3b4f725775a72f21b6dd7a75d94b
2015-10-16 04:03:23 -07:00
Christopher Chedeau da359c312a Fix jest test that runs the polyfill 10 times
Summary: @​public

jest is running the polyfill multiple times on the same environment (cc @cpojer, need to fix that!). By default jest doesn't have XMLHttpRequest polyfilled so it'll define a property with writable to be false. It'll fatal the second time it tries to override XMLHttpRequest.

The hacky workaround is to make properties that do not exist with writable: true. But the long term fix would be to make jest stop running the polyfill multiple times.

Reviewed By: @javache

Differential Revision: D2532019

fb-gh-sync-id: a82abf69541781a64a0744798c736f90833e28cb
2015-10-12 11:52:28 -07:00
Ian MacLeod c612d830bb Preserve original global properties when polyfilling them
Summary: Fixes #934.
Closes https://github.com/facebook/react-native/pull/3293

Reviewed By: @​svcscm

Differential Revision: D2525598

Pulled By: @vjeux

fb-gh-sync-id: 90672550f723a183897456dc9512851bfa34807a
2015-10-09 14:41:23 -07:00
Christopher Chedeau de717a8379 Polyfill Number.EPSILON and Number.MIN/MAX_SAFE_INTEGER
Summary: Those three properties have been ratified as ES6 but are not yet implementd in JSCore. This polyfills them.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON

@​public

Reviewed By: @sahrens

Differential Revision: D2497528
2015-10-01 15:05:33 -07:00
Tadeu Zagallo d96748492f Fix ReactPerf markers in Systrace
Reviewed By: @spicyj

Differential Revision: D2468107
2015-10-01 15:05:28 -07:00
Alex Kotliarskyi 34d57afc32 Handle errors that are not `Error` instances
Reviewed By: @sahrens

Differential Revision: D1799587
2015-09-23 19:29:19 -07:00
James Ide 4fd03ba21a Finish up the work to send through the error cookie
Summary: - Includes the error cookie with soft exceptions as well since they too can be updated (requires tiny Android change too)
- Passes the error cookie through instead of leaving it unused
Closes https://github.com/facebook/react-native/pull/2198

Reviewed By: @​svcscm

Differential Revision: D2455391

Pulled By: @sahrens
2015-09-17 18:15:27 -07:00
Alex Kotliarskyi c7b1509615 [react-native] Fix tests and re-enable CI 2015-08-26 20:58:24 -08:00