Commit Graph
123 Commits
Author SHA1 Message Date
Lorenzo Sciandra af79164b58 [0.57.8] Bump version numbers 2018-12-13 10:23:26 +00:00
Lorenzo Sciandra 2151c30474 [0.57.7] Bump version numbers 2018-11-27 13:10:20 +00:00
Lorenzo Sciandra d5332fbad2 [0.57.6] Bump version numbers 2018-11-26 17:19:28 +00:00
Lorenzo Sciandra 44bfffb116 [0.57.5] Bump version numbers 2018-11-13 15:07:04 +00:00
Rafael OlezaandLorenzo Sciandra 53616e67db Fix polyfilling of regeneratorRuntime to avoid setting it to undefined in some situations
Summary:
This diff fixes an issue that caused the problem with `regeneratorRuntime` last Friday (more info: https://fb.facebook.com/groups/frontendsupport/permalink/2427883350560427/).

The root issue is that both `InitializeCore` and `FBInitializeCore` are included in the same bundle, this fix just prevents the bundle from being invalid once this happens..

*copied from: https://our.intern.facebook.com/intern/diff/D10444264/?transaction_id=595485237532887*

The way that `regeneratorRuntime` is polyfilled is not correct:

```
polyfillGlobal('regeneratorRuntime', () => {
  // The require just sets up the global, so make sure when we first
  // invoke it the global does not exist
  delete global.regeneratorRuntime;
  require('regenerator-runtime/runtime');
  return global.regeneratorRuntime;
});
```

Since a `require`d module is only evaluated once (no matter how many times it's required), defining (and calling) a getter for `global.regeneratorRuntime` twice will end up storing `undefined` to `global.regeneratorRuntime`.

There were no issues before this diff because the ordering of requires made things work by coincidence, e.g the following code will work:

```
// Set up regenerator for the first time
polyfillGlobal('regeneratorRuntime', () => {
  delete global.regeneratorRuntime;
  require('regenerator-runtime/runtime');
  return global.regeneratorRuntime;
});

// Set up regenerator for the second time. This will just override the previous getter (which has not even got executed so
// the `regenerator-runtime/runtime` module has not been evaluated yet.
polyfillGlobal('regeneratorRuntime', () => {
  // The require just sets up the global, so make sure when we first
  // invoke it the global does not exist
  delete global.regeneratorRuntime;
  require('regenerator-runtime/runtime');
  return global.regeneratorRuntime;
});

// Now access regenerator
global.regeneratorRuntime;
```

But the following code won't work:

```
// Set up regenerator for the first time
polyfillGlobal('regeneratorRuntime', () => {
  delete global.regeneratorRuntime;
  require('regenerator-runtime/runtime');
  return global.regeneratorRuntime;
});

// Access regenerator. This will cause the previous getter to be called, and the `regenerator-runtime/runtime` module will get evaluated.
// Here, `global.regeneratorRuntime` will have a correct value.
global.regeneratorRuntime;

// Set up regenerator for the second time. This will define a new getter for `global.regeneratorRuntime`, which will delete `delete global.regeneratorRuntime`
// and return undefined (note that `require('regenerator-runtime/runtime');` is a noop since the module has been already evaluated).
polyfillGlobal('regeneratorRuntime', () => {
  // The require just sets up the global, so make sure when we first
  // invoke it the global does not exist
  delete global.regeneratorRuntime;
  require('regenerator-runtime/runtime');
  return global.regeneratorRuntime;
});
```

Reviewed By: fromcelticpark

Differential Revision: D10483975

fbshipit-source-id: 5b3ef6e11c4fc4f79e3857c1ade9e7bc2beb6a39
2018-11-07 10:07:06 +00:00
Emily JanzerandLorenzo Sciandra 12f2733592 Fix flow in InitializeCore
Reviewed By: yungsters

Differential Revision: D10115867

fbshipit-source-id: be619b9d6fc30e318cbc0e0fc6e741d80dd94a4b
2018-11-07 10:06:45 +00:00
Lorenzo Sciandra 468161232e [0.57.4] Bump version numbers 2018-10-25 17:52:59 +01:00
Lorenzo Sciandra 8fd5bcc888 [0.57.3] Bump version numbers 2018-10-12 12:19:21 +01:00
Lorenzo Sciandra 46bb737b98 Revert "[0.57.3] Bump version numbers"
This reverts commit 56cde24863.
2018-10-12 10:28:20 +01:00
Mike Grabowski 56cde24863 [0.57.3] Bump version numbers 2018-10-11 23:39:41 +02:00
Hector Ramos 4a440f4018 [0.57.2] Bump version numbers 2018-10-04 13:29:30 -07:00
Hector Ramos 67dca8bbf9 Revert "[0.57.2] Bump version numbers"
This reverts commit b7437639df.
2018-10-04 13:29:04 -07:00
Hector Ramos b7437639df [0.57.2] Bump version numbers 2018-10-04 11:40:58 -07:00
Hector Ramos e4607a4ec3 Revert "[0.57.2] Bump version numbers"
This reverts commit 8e810838a2.
2018-10-04 11:40:24 -07:00
Mike Grabowski 8e810838a2 [0.57.2] Bump version numbers 2018-10-04 17:01:57 +02:00
Mike Grabowski 29fb119404 Revert "[0.57.2] Bump version numbers"
This reverts commit 4aec7c953e.
2018-10-04 17:01:51 +02:00
Mike Grabowski 4aec7c953e [0.57.2] Bump version numbers 2018-10-02 14:39:35 +02:00
Mike Grabowski 63cf888161 Revert "[0.57.2] Bump version numbers"
This reverts commit aae1e296e9.
2018-10-02 14:38:01 +02:00
Mike Grabowski aae1e296e9 [0.57.2] Bump version numbers 2018-10-02 14:30:15 +02:00
Hector Ramos ba89bf4252 [0.57.1] Bump version numbers 2018-09-21 09:22:17 -07:00
Mike Grabowski 3008c3ccba [0.57.0] Bump version numbers 2018-09-12 13:21:38 +02:00
Hector Ramos 8402c97f83 [0.57.0-rc.4] Bump version numbers 2018-09-06 16:13:03 -07:00
Hector Ramos cb471c7b3e Revert "[0.57.0-rc.4] Bump version numbers"
This reverts commit 9dcc39586c.
2018-09-06 16:12:06 -07:00
Hector Ramos 9dcc39586c [0.57.0-rc.4] Bump version numbers 2018-09-06 15:28:55 -07:00
Hector Ramos 5ffa4b319b Revert "[0.57.0-rc.4] Bump version numbers"
This reverts commit 9974d4f1e7.
2018-09-06 15:28:49 -07:00
Mike Grabowski 9974d4f1e7 [0.57.0-rc.4] Bump version numbers 2018-09-03 11:07:32 +02:00
Mike Grabowski f28a6bbc44 Revert "[0.57.0-rc.4] Bump version numbers"
This reverts commit 6d4970f886.
2018-09-03 11:06:17 +02:00
Mike Grabowski 6d4970f886 [0.57.0-rc.4] Bump version numbers 2018-09-02 19:13:46 +02:00
Hector Ramos a8aa8b673c [0.57.0-rc.3] Bump version numbers 2018-08-24 14:51:24 -07:00
Hector Ramos f7fc381eda [0.57.0-rc.2] Bump version numbers 2018-08-22 14:55:35 -07:00
Hector Ramos a92bb3b06e [0.57.0-rc.1] Bump version numbers 2018-08-22 13:20:20 -07:00
Hector Ramos 2739bf45cc Revert "[0.57.0-rc.1] Bump version numbers"
This reverts commit 8cd5be67ff.
2018-08-22 13:19:59 -07:00
Hector Ramos 8cd5be67ff [0.57.0-rc.1] Bump version numbers 2018-08-22 12:54:21 -07:00
Mike Grabowski 074845106d [0.57.0-rc.0] Bump version numbers 2018-08-14 13:07:16 +02:00
Wayne ChengandLorenzo Sciandra 43ded753b1 Adding flow strict local to remaining possible files in xplat/JS
Summary:
ag -L --ignore __snapshots__ 'flow strict|noflow|generated|The controller you requested could not be found.' | ag '\.js$' | xargs ag -l 'flow' | sort > ~/temp
  cat ~/temp | xargs ag -L 'flow strict' | xargs sed -i '' 's/flow$/flow strict-local/'
  until flow check; do flow check --json | jq -r '.errors[].message[0].path' | sort | uniq | xargs hg revert; done

allow_many_files
The controller you requested could not be found.
The controller you requested could not be found.

Reviewed By: TheSavior

Differential Revision: D9004573

fbshipit-source-id: 936bd5741706b781be06bf08b6ad805a69407dfd
2018-08-13 21:38:57 +01:00
Kirill NikolaevandFacebook Github Bot 52f431b4bb Eliminate circular dependency between MessageQueue and JSTimers modules. (#19526)
Summary:
This makes JSTimers actively register a callback for callImmediates.

Besides being generally tricky, circular dependency prevent compiling React Native code with bundlers that rely on concatenating module sources rather that evaluating code at the time of requiring, like Google Closure Compiler.

Sadly, Google Closure Compiler setup that prompted this change is complicated and brittle. And there are no good public tools to find circular dependencies among Haste-style modules (with unqualified require paths).

So some advice on a good test plan would be useful. Does Facebook have any tools to find circular dependencies with Haste-style requires?

FWIW, a check that worked for me was to replace all import paths in React Native from Haste style to normal relative paths (which I needed anyway) and then run [`madge`](https://www.npmjs.com/package/madge) on the code base:

```
$ ~/node_modules/.bin/madge --circular react-native/Libraries
Processed 390 files (7.4s) (81 warnings)

✖ Found 2 circular dependencies!

1) BatchedBridge/NativeModules.js > BatchedBridge/BatchedBridge.js > BatchedBridge/MessageQueue.js > Core/Timers/JSTimers.js
2) StyleSheet/flattenStyle.js > StyleSheet/StyleSheet.js
```

(The second cycle is already eliminated in https://github.com/facebook/react-native/commit/a8e3c7f5780516eb0297830632862484ad032c10).

[GENERAL] [MINOR] [MessageQueue] - MessageQueue implementation doesn't have a circular dependency on JSTimers.
Closes https://github.com/facebook/react-native/pull/19526

Reviewed By: hramos

Differential Revision: D8458755

Pulled By: yungsters

fbshipit-source-id: e753139b920ba1ad1a6db10f974c03ca195340c7
2018-06-15 17:06:29 -07:00
Eli WhiteandFacebook Github Bot d01ab66b47 Prettier React Native Libraries
Reviewed By: sahrens

Differential Revision: D7961488

fbshipit-source-id: 05f9b8b0b91ae77f9040a5321ccc18f7c3c1ce9a
2018-05-10 19:10:38 -07:00
Eli WhiteandFacebook Github Bot 8f5ebe5952 Convert react-native-github/Libraries to let/const
Reviewed By: sahrens

Differential Revision: D7956042

fbshipit-source-id: 221851aa311f3cdd6326497352b366048db0a1bb
2018-05-10 16:16:35 -07:00
Alex DvornikovandFacebook Github Bot 333602b9f2 Introduce "Options" argument to "fetchSegment()" function
Reviewed By: jeanlauliac

Differential Revision: D7791186

fbshipit-source-id: e3954a525e6e3b02a48ac19f78cc3716969dd6bf
2018-04-27 15:14:36 -07:00
Rubén NorteandFacebook Github Bot d5e9e55fa3 Remove @providesModule from all modules
Summary:
This PR removes the need for having the `providesModule` tags in all the modules in the repository.

It configures Flow, Jest and Metro to get the module names from the filenames (`Libraries/Animated/src/nodes/AnimatedInterpolation.js` => `AnimatedInterpolation`)

* Checked the Flow configuration by running flow on the project root (no errors):

```
yarn flow
```

* Checked the Jest configuration by running the tests with a clean cache:

```
yarn jest --clearCache && yarn test
```

* Checked the Metro configuration by starting the server with a clean cache and requesting some bundles:

```
yarn run start --reset-cache
curl 'localhost:8081/IntegrationTests/AccessibilityManagerTest.bundle?platform=android'
curl 'localhost:8081/Libraries/Alert/Alert.bundle?platform=ios'
```

[INTERNAL] [FEATURE] [All] - Removed providesModule from all modules and configured tools.
Closes https://github.com/facebook/react-native/pull/18995

Reviewed By: mjesun

Differential Revision: D7729509

Pulled By: rubennorte

fbshipit-source-id: 892f760a05ce1fddb088ff0cd2e97e521fb8e825
2018-04-25 07:37:10 -07:00
Nat MoteandFacebook Github Bot 931930ae63 Remove non-top-level export from JSTimers
Reviewed By: davidaurelio

Differential Revision: D7705416

fbshipit-source-id: 1252789c2cd59b8666b57edcf17948c102e63888
2018-04-20 11:03:39 -07:00
Alex DvornikovandFacebook Github Bot 20fcf4779c Make fetchSegment native hook name consistent with __ prefix
Reviewed By: jeanlauliac

Differential Revision: D7205472

fbshipit-source-id: 4cef66539167ed47cf0ac8d3665c20114ffff375
2018-03-09 08:55:51 -08:00
Andrew Chen (Eng)andFacebook Github Bot 8cdc7d3e02 Don't assume the SourceCode native module exists
Reviewed By: yungsters

Differential Revision: D7185837

fbshipit-source-id: e8efc22ac0af092dbc1fdf616b0b3f111390dd5d
2018-03-07 18:57:42 -08:00
Tim YungandFacebook Github Bot 973ef9728c RN: Remove React Stack Systrace Logic
Reviewed By: sophiebits

Differential Revision: D7027263

fbshipit-source-id: f4eb3fab402eda337f464e4ebb0771202a9b93f2
2018-02-19 22:32:36 -08:00
Caleb MeredithandFacebook Github Bot da3424c929 @allow-large-files Upgrade xplat/js to Flow v0.66
Reviewed By: gabelevi

Differential Revision: D7016717

fbshipit-source-id: 2bd2fd67074ba5d405ecd63a1aeb37354f8634c9
2018-02-16 20:24:57 -08:00
Sophie AlpertandFacebook Github Bot 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Alex DvornikovandFacebook Github Bot f7f5dc6649 Extract polyfillGlobal from InitializeCore
Reviewed By: jeanlauliac

Differential Revision: D6987657

fbshipit-source-id: 8762732de671418520376a98bdd724bbb24e4e36
2018-02-15 04:23:43 -08:00
Andres SuarezandFacebook Github Bot 9d214967d2 Fix ESLint upgrade "parsing error"
Reviewed By: adamjernst

Differential Revision: D6959356

fbshipit-source-id: 77c61998f23a6acd7cdfe2c87d8760a23d957800
2018-02-10 10:51:14 -08:00
Satyajit SahooandFacebook Github Bot be56a3efee Implement Blob support for XMLHttpRequest
Summary:
This PR is a followup to https://github.com/facebook/react-native/pull/11417 and should be merged after that one is merged.

  1. Add support for creating blobs from strings, not just other blobs
  1. Add the `File` constructor which is a superset of `Blob`
  1. Add the `FileReader` API which can be used to read blobs as strings or data url (base64)
  1. Add support for uploading and downloading blobs via `XMLHttpRequest` and `fetch`
  1. Add ability to download local files on Android so you can do `fetch(uri).then(res => res.blob())` to get a blob for a local file (iOS already supported this)

  1. Clone the repo https://github.com/expo/react-native-blob-test
  1. Change the `package.json` and update `react-native` dependency to point to this branch, then run `npm install`
  1. Run the `server.js` file with `node server.js`
  1. Open the `index.common.js` file and replace `localhost` with your computer's IP address
  1. Start the packager with `yarn start` and run the app on your device

If everything went well, all tests should pass, and you should see a screen like this:

![screen shot 2017-06-08 at 7 53 08 pm](https://user-images.githubusercontent.com/1174278/26936407-435bbce2-4c8c-11e7-9ae3-eb104e46961e.png)!

Pull to rerun all tests or tap on specific test to re-run it

  [GENERAL] [FEATURE] [Blob] - Implement blob support for XMLHttpRequest
Closes https://github.com/facebook/react-native/pull/11573

Reviewed By: shergin

Differential Revision: D6082054

Pulled By: hramos

fbshipit-source-id: cc9c174fdefdfaf6e5d9fd7b300120a01a50e8c1
2018-01-26 09:17:11 -08:00
David VaccaandFacebook Github Bot 4d3519cc6a Adding JS hierarchy information when a StackOverflowException is thrown in Dev mode
Reviewed By: achen1

Differential Revision: D6716309

fbshipit-source-id: 23458cd126d13fec3aa9c09420f7cdd230ec8dd0
2018-01-19 13:02:41 -08:00