Граф коммитов

57 Коммитов

Автор SHA1 Сообщение Дата
Jordan Brown 6064fd0600 Presuppress xplat and upgrade to 0.178.1
Summary:
This diff upgrades xplat to 0.178.1 and pre-suppresses errors from turning on constrained writes.

To generate this diff I:
* Modified every `env_mode=constrain_writes` to `env_mode=ssa` and made a commit (this is so our upgrade script will work)
* Ran   scripts/flow/upgrade.sh 0.178.1 to upgrade all the flowconfigs to 178.1 and suppress new-env errors
* Modified arvr/js/flowconfig.ejs to use 0.178.1 and ran `scripts/gen-flowconfig/gen-flowconfig --project arvr`
* Modified xplat/js/flowconfig.ejs to use 0.178.1 and ran `scripts/gen-flowconfig/gen-flowconfig --project xplat`
* Unstacked from the commit in point 1

Reviewed By: SamChou19815

Differential Revision: D36676019

fbshipit-source-id: c3032f18ed838afc327f00de563e7f20713bdc26
2022-05-26 12:59:52 -07:00
Dmytro Voronkevych 12a67425ab Adding string annotations to markEvent
Summary:
Adding string annotations support to markEvent API in ReactNative

Changelog:
[Internal][Change] - markEvent API now supports string annotations

Differential Revision: D33795346

fbshipit-source-id: 414cbd08ce5ff6045e2f35ae77059be5add3d834
2022-01-27 04:47:33 -08:00
Dmytro Voronkevych 0e39b95a45 Adding markEvent to the ReactNative QPL
Summary:
QPL in ReactNative were missing markEvent API - adding it in this diff. In the next diff I will add support for annotations.

Customer request: https://fb.workplace.com/groups/QPL.QandA/posts/1228789167531266/

Changelog:
[Internal][Change] - Adding markEvent API to QuickPerformanceLogger

Differential Revision: D33789590

fbshipit-source-id: 3e9dfde9d413943281d6aa7e85b9feeafc3bef7a
2022-01-27 04:47:33 -08:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Evan Yeung 037e346197 Add LTI annotations to xplat/js
Summary:
This diff runs the codemod to add type annotations to function parameters in preparation for Flow's local type inference (LTI) project. I ran the codemod over xplat/js and reverted any files that had flow errors in them. See the list of commands run to see the regeneration of various files.

Changelog:
[Internal][Changed] - Added type annotations

Reviewed By: yungsters

Differential Revision: D32075270

fbshipit-source-id: 6a9cd85aab120b4d9e690bac142a415525dbf298
2021-11-10 15:40:15 -08:00
Tim Yung 77ecc7ede1 JS: Format with Prettier v2.4.1 [3/n]
Summary:
Changelog:
[General][Internal]

Reviewed By: zertosh

Differential Revision: D31883447

fbshipit-source-id: cbbf85e4bf935096d242336f41bf0cc5d6f92359
2021-11-02 22:14:16 -07:00
Mark Bridges aa98978302 Adding metadata to React Native QPL points
Summary:
Changelog:
[General][Added] - Added data field to markerPoint to allow callers to add additional arbitrary string data to logged points

Reviewed By: dmitry-voronkevich

Differential Revision: D29764274

fbshipit-source-id: b0d21e3b20a5353351424afb10c950f3e8689887
2021-07-21 10:34:27 -07:00
Evan Yeung efd4dafc54 Update xplat to Flow v0.155.0
Summary:
Update flow version to v0.155.0

Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D29641055

fbshipit-source-id: 601a82fe4fa4ce548a790347a84aea4014c418d9
2021-07-14 09:13:29 -07:00
Shelly Willard 3671712df5 Deprecate markerCancel
Summary:
We have migrated most markerCancel calls to markerDrop. This diff removes the last bit (QPLBase API and bindings)

Changelog: [Internal]

Differential Revision: D26945891

fbshipit-source-id: 09b727809b316286930ced8533f9c79007350687
2021-03-22 06:46:00 -07:00
Micha Reiser 93377ff508 Remove "use strict" directive from ES Modules
Summary:
ES Modules implicitly enable strict mode. Adding the "use strict" directive is, therefore, not required.

This diff removes all "use strict" directives from ES modules.

Changelog:

[Internal]

Reviewed By: motiz88

Differential Revision: D26172715

fbshipit-source-id: 57957bcbb672c4c3e62b1db633cf425c1c9d6430
2021-02-02 11:12:56 -08:00
Micha Reiser 306edff62c Pass Systrace and Refresh as globals
Summary:
The `Systrace` and `Refresh` dependencies are injected into the `metroRequire` implementation by assigning the values to e.g. `require.Systrace = ...`.

The issue with this approach is that some `require` implementations might not support extending the `require` object or doing so results in a degraded performance. An example where this is the case is Hermes where changing the `require` object forces Hermes to opt out of the static require optimization.

This diff extends Metro so that the `Systrace` and `Refresh` implementation can either be injected by assigning to `require.Systrace` or by exposing the implementation in the global scope. It further changes the `Systrace` and `Refresh` modules to inject the instances using the global scope instead of extending `require`.

Changelog:
[Internal][Changed] - Expose Systrace and ReactRefresh as globals instead of extending require.

Reviewed By: motiz88

Differential Revision: D25693381

fbshipit-source-id: 254d66d43e7a56d3310cf1a17d5146b8d1307562
2021-01-04 07:40:19 -08:00
Rubén Norte 4409642811 Migrate large amount of modules to flow strict and strict-local
Summary:
| Group | Before | After | Change |
| Untyped | 50 | 49 | -1 |
| flow | 197 | 155 | -42 |
| flow strict-local | 226 | 185 | -41 |
| flow strict | 33 | 117 | +84

Changelog: [Changed] Improved Flow typing of multiple modules (with migrations to `flow strict` and `flow strict-local`

Reviewed By: motiz88

Differential Revision: D22549140

fbshipit-source-id: ed29415332cfce15b244ee4dea9e13d035543175
2020-07-22 09:46:16 -07:00
Emilis Baliukonis 232517a574 Implement nativePerformanceNow to improve Profiler API results (#27885)
Summary:
When experimenting with React Profiler API (https://reactjs.org/docs/profiler.html), I noticed that durations are integers without a debugger, but they are doubles with higher precision when debugger is attached. After digging into React Profiler code, I found out that it's using `performance.now()` to accumulate execution times of individual units of work. Since this method does not exist in React Native, it falls back to Javascript `Date`, leading to imprecise results.

This PR introduces `global.nativePerformanceNow` function which returns precise native time, and a very basic `performance` polyfill with `now` function.

This will greatly improve React Profiler API results, which is essential for profiling and benchmark tools.

Solves https://github.com/facebook/react-native/issues/27274

## Changelog

[General] [Added] - Implement `nativePerformanceNow` and `performance.now()`
Pull Request resolved: https://github.com/facebook/react-native/pull/27885

Test Plan:
```
const initialTime = global.performance.now();
setTimeout(() => {
  const newTime = global.performance.now();
  console.warn('duration', newTime - initialTime);
}, 1000);
```

### Android + Hermes

![Screenshot_1580198068](https://user-images.githubusercontent.com/13116854/73245757-af0d6c80-41b5-11ea-8130-dde14ebd41a3.png)

### Android + JSC

![Screenshot_1580199089](https://user-images.githubusercontent.com/13116854/73246157-92256900-41b6-11ea-87a6-ac222383200c.png)

### iOS

![Simulator Screen Shot - iPhone 8 - 2020-01-28 at 10 06 49](https://user-images.githubusercontent.com/13116854/73245871-f136ae00-41b5-11ea-9e31-b1eff5717e62.png)

Reviewed By: ejanzer

Differential Revision: D19888289

Pulled By: rickhanlonii

fbshipit-source-id: ab8152382da9aee9b4b3c76f096e45d40f55da6c
2020-03-31 10:23:51 -07:00
Michael Bolin 0b9ea60b4f Back out "Upgrade Prettier from 1.17 to 2.0.2."
Differential Revision: D20639755

fbshipit-source-id: 5028563f9cf0527a30b4259daac50cdc03934bfd
2020-03-24 21:47:35 -07:00
Michael Bolin cf44650b3f Upgrade Prettier from 1.17 to 2.0.2.
Summary:
This gets us on the latest Prettier 2.x:
https://prettier.io/blog/2020/03/21/2.0.0.html

Notably, this adds support for TypeScript 3.8,
which introduces new syntax, such as `import type`.

Reviewed By: zertosh

Differential Revision: D20636268

fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
2020-03-24 20:24:47 -07:00
Max Kareta c38318d084 deleting marker cancel 2/N. [DO NOT LAND]
Summary: Added markerDrop API that will replace markerCancel in future.

Reviewed By: furdei

Differential Revision: D20003457

fbshipit-source-id: 38cf68455d9274761a49014d9cbb50d82f4e9437
2020-03-10 07:11:42 -07:00
Eli White e362470305 Convert easy files to flow strict-local
Summary:
This diff was generated by this script used by WWW
https://our.intern.facebook.com/intern/diffusion/WWW/browse/master/scripts/flow/upgrade_to_flow_strict_local.sh?lines=0

Changelog:
[Internal] Upgrade flow to flow strict-local

Reviewed By: zackargyle, rickhanlonii

Differential Revision: D18833630

fbshipit-source-id: e64d4e9a49a0db5e6bf70a0c489567862b578d7f
2019-12-05 16:06:46 -08:00
George Zahariev 8553e1acc4 Exact-by-default codemod for react-native-github
Summary:
We are rolling out exact-by-default syntax to xplat/js.

I had to manually move around some comments to preserve proper placement.

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D18633611

fbshipit-source-id: 48f7468dcc55b1d00985419d035a61c6820b3abe
2019-11-21 09:42:57 -08:00
Kevin Gozali fb627dac6a TM JS: Revert to import from TurboModuleRegistry.js
Summary:
Changelog: [Internal]

Reverting the import to the previous local module style since importing from react-native seems to introduce some perf regression. We'll revisit this later in the future.

Reviewed By: yungsters

Differential Revision: D18383893

fbshipit-source-id: f11d46a4545768f39199fd6fd22fcf14905d0a74
2019-11-08 11:44:16 -08:00
Kevin Gozali dd06f85bd0 TM JS: cleaned up TurboModuleRegistry types [2]
Summary:
Changelog: [Internal]

Moved the imports for `TurboModuleRegistry` and `TurboModule` from `react-native`. This was a jscodeshift with the script: P120688078

Reviewed By: yungsters

Differential Revision: D18262538

fbshipit-source-id: 48fac15229c897408928511c5ecbb42f17ec7b42
2019-11-04 18:51:05 -08:00
Logan Daniels 91f139b941 xplat/js/react-native-github
Reviewed By: panagosg7

Differential Revision: D16657770

fbshipit-source-id: 4e260842c838a35317515044c54ccf55a083da33
2019-08-09 10:11:15 -07:00
Dominique d'Argent b07bbab392 Remove markerNote from JS bindings
Summary: This diff removes the unused `markerNote` method from QPL.

Differential Revision: D16331769

fbshipit-source-id: c35006af03d6129dc690cfd05bc1bc1c4a0856ba
2019-07-18 03:52:44 -07:00
James Ide a7a7970e54 Replace more Haste imports with path-based imports (#25001)
Summary:
This is another step in moving RN towards standard path-based requires, updating more code to use path-based requires. See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail.

## Changelog

[General] [Changed] - Replace more Haste imports with path-based imports
Pull Request resolved: https://github.com/facebook/react-native/pull/25001

Differential Revision: D15467829

Pulled By: cpojer

fbshipit-source-id: 58c364bb4c1c757689907d5ed0d0f3fac0e22f3f
2019-05-23 00:51:31 -07:00
Eric Lewis 6c573f71f1 spec for JSCSamplingProfiler (#24903)
Summary:
part of #24875.

## Changelog

[General] [Added] - Add TM spec for JSCSamplingProfiler
Pull Request resolved: https://github.com/facebook/react-native/pull/24903

Reviewed By: RSNara

Differential Revision: D15421649

Pulled By: fkgozali

fbshipit-source-id: 3d5a04a135aa7640495a0eb682b9c2300636db8e
2019-05-20 18:05:54 -07:00
James Ide 0ee5f68929 Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749)
Summary:
This is the next step in moving RN towards standard path-based requires. All the requires in `Libraries` have been rewritten to use relative requires with a few exceptions, namely, `vendor` and `Renderer/oss` since those need to be changed upstream. This commit uses relative requires instead of `react-native/...` so that if Facebook were to stop syncing out certain folders and therefore remove code from the react-native package, internal code at Facebook would not need to change.

See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail.

[General] [Changed] - Migrate "Libraries" from Haste to standard path-based requires
Pull Request resolved: https://github.com/facebook/react-native/pull/24749

Differential Revision: D15258017

Pulled By: cpojer

fbshipit-source-id: a1f480ea36c05c659b6f37c8f02f6f9216d5a323
2019-05-08 08:48:59 -07:00
Christoph Nakazawa 4148976a83 Use `invariant` instead of `fbjs/lib/invariant`
Summary: This is one more step to remove `fbjs` from `react-native-github`. This changes both the internal and external code to use `invariant` from zertosh instead of the copy in fbjs.

Reviewed By: yungsters

Differential Revision: D13195941

fbshipit-source-id: 73564ca1715110e7da9c7ef56dc57374d61377e0
2018-12-03 00:07:02 -08:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Wayne Cheng f536a0c268 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-09 08:54:44 -07:00
Eli White eea4842972 Flow strictify possible files in RN core
Summary:
This was done by running the command on: https://our.intern.facebook.com/intern/wiki/Flow_Strict/

```
ag -L --ignore __snapshots__ 'flow strict$|noflow|generated|partially-generated' | ag '\.js$' | xargs ag -l 'flow' | sort > ~/temp
cat ~/temp | xargs ag -L 'flow strict' | xargs sed -i 's/flow$/flow strict/'
cat ~/temp | xargs ag -L 'flow strict$' | xargs sed -i 's/flow strict-local$/flow strict/'
until flow; do flow --json | jq -r '.errors[].message[0].path' | sort | uniq | xargs hg revert; done
```

Reviewed By: sahrens

Differential Revision: D8530207

fbshipit-source-id: c28c7ac5ed3e9b80f3d126d5f30463be8a8a744d
2018-06-20 00:47:21 -07:00
Oleksandr Sokolov 078d6e3a9d QuickPerformanceLogger.js: markerPoint + iOS/Android JS binding
Reviewed By: alexeylang

Differential Revision: D8125546

fbshipit-source-id: bb02921c7d89faba64001bff3b9aaf13f64a7f8b
2018-06-08 08:32:05 -07:00
Eli White d01ab66b47 Prettier React Native Libraries
Reviewed By: sahrens

Differential Revision: D7961488

fbshipit-source-id: 05f9b8b0b91ae77f9040a5321ccc18f7c3c1ce9a
2018-05-10 19:10:38 -07:00
Spencer Ahrens 5b2a2bee7a PureComponentDebug
Summary:
Drop in replacement for `React.PureComponent` or can replace `React.PureComponent` for all components.

Logs out what exactly triggered a re-render of a `PureComponent` to make it easier to track down why a component is re-rendering. With some other changes we'll also get component stacks in the YellowBox to make it even easier.

I thought about logging the values, but it's too easy to render something gross or cyclical like react components, so I figured people could break in the debugger to get more detail as needed.

Special flow type should cause errors if people try to commit any usage of this - it should only be used for local debugging.

Reviewed By: yungsters

Differential Revision: D7826325

fbshipit-source-id: fdf7910336452ac1c7acd328c04d441dfb186b59
2018-05-01 19:47:52 -07:00
Rubén Norte 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
Tim Yung 3e141cb6c9 RN: Delete Systrace.swizzleJSON
Reviewed By: TheSavior

Differential Revision: D7207460

fbshipit-source-id: 14b1174d6a5c75e1acba7272376d1c462bc13cb6
2018-03-08 23:43:26 -08:00
Tim Yung a8c4b630fc RN: Delete Systrace for RelayClassic
Reviewed By: TheSavior

Differential Revision: D7207462

fbshipit-source-id: 6dd5c5fd22c0a5a7d77331d6adf7b362c3d3e037
2018-03-08 23:43:26 -08:00
Tim Yung 118521c20b RN: Prettify Systrace
Reviewed By: TheSavior

Differential Revision: D7207468

fbshipit-source-id: 05ae6e003ae3e55bc2d3a905f41c28f7041dd7f0
2018-03-08 23:43:26 -08:00
Tim Yung 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
Sophie Alpert 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
Alexey Lang bcfbdf4fbe Add flow typing to QuickPerformanceLogger
Reviewed By: cwdick

Differential Revision: D6613292

fbshipit-source-id: 58e41507a3c7cf9fbc6b972e327ae76d294d6807
2018-01-22 05:30:54 -08:00
Semen Zhydenko d2c569795c Typos in comments and log messages
Summary:
No code changes, no testing required.

alligned -> aligned
allignment -> alignment
completly -> completely
conseptually -> conceptually
decendents -> descendants
indefinetly -> indefinitely
dimention -> dimension
doesnt -> doesn't
safegaurd -> safeguard
intialization -> initialization
hierachy -> hierarchy
happend -> happened
gaurd -> guard
programatically -> programmatically
initalized -> initialized
immidiately -> immediately
occured -> occurred
unkown -> unknown
neccessary -> necessary
neccesarily -> necessarily
occuring -> occurring
comoponent -> component
propogate -> propagate
recieved -> received
referece -> reference
perfomance -> performance
recieving -> receiving
subsquently -> subsequently
scoll -> scroll
suprisingly -> surprisingly
targetting -> targeting
tranform -> transform
symetrical -> symmetrical
wtih -> with
Closes https://github.com/facebook/react-native/pull/17578

Differential Revision: D6718791

Pulled By: shergin

fbshipit-source-id: 4ab79c1131ec5971d35a0c7199eba7ec0a0918ad
2018-01-12 22:18:45 -08:00
Alexey Lang a9032a20ad Log query name for fetchRelayQuery
Reviewed By: yisun

Differential Revision: D6692869

fbshipit-source-id: 5484070be9995c5294197b0c2766690fd7accefa
2018-01-11 04:47:57 -08:00
Alexey Lang dfebcb70a5 Don't set global.performance to undefined if it was initialized already
Reviewed By: gaearon

Differential Revision: D6448731

fbshipit-source-id: 8c8c6ff393e452c863f54c83c2e4394fd535dfc5
2017-12-01 02:46:18 -08:00
David Detlefs 05e862d48d Add Systrace-based telemetry to Hermes GC.
Reviewed By: amnn

Differential Revision: D6393879

fbshipit-source-id: d35a4647d000356dc99bce3187acc50d3a69ddeb
2017-11-23 15:15:54 -08:00
Ashok Menon 52e3ae9063 Unify Systrace native hook argument passing.
Reviewed By: javache

Differential Revision: D6316024

fbshipit-source-id: c1b315fac2c3cf8558d0c9eb0eb2c7d3efe5c64f
2017-11-16 08:01:06 -08:00
Alexey Lang f11f00197d Gate more code with if (__DEV__) { }
Reviewed By: amnn

Differential Revision: D5621165

fbshipit-source-id: ee8b3df523858323a3ce4484ab56fcae0da3d633
2017-08-14 07:19:00 -07:00
Alexey Lang 3a031cc93a Bring back React Stack support
Reviewed By: javache

Differential Revision: D5547208

fbshipit-source-id: 25cef6aa27fc4f17b26e1088256819ea235f79cf
2017-08-10 04:17:27 -07:00
Pieter De Baets ec14db1abc Cleanup ifdef's in JSCExecutor
Reviewed By: kathryngray

Differential Revision: D5433407

fbshipit-source-id: 104e8e5589d9c5e09c6702992eac3db2e6b4ab1a
2017-07-25 05:02:03 -07:00
Pieter De Baets ed3c018ee4 Remove legacy JSC profiler
Reviewed By: bnham

Differential Revision: D5433406

fbshipit-source-id: 8cbea8b9b46a0d9f29c57a5bcf605e6bb61ed8a7
2017-07-20 04:21:16 -07:00
Pieter De Baets 94d9f00dd6 Remove unused RCTRenderingPerf
Reviewed By: josephsavona

Differential Revision: D5292898

fbshipit-source-id: 33605c994c3457134556acc328542611a2247d27
2017-06-22 09:01:04 -07:00
Dan Abramov 32a0ee0975 Implement Systrace integration for Fiber
Reviewed By: bvaughn

Differential Revision: D5210738

fbshipit-source-id: db7df5ca7a1b4944f86719361d22ec3cc2ce8f22
2017-06-08 14:31:52 -07:00