react-native 0.82.0-rc.0 → 0.82.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/Libraries/BatchedBridge/BatchedBridge.js +1 -0
  2. package/Libraries/BatchedBridge/MessageQueue.js +1 -0
  3. package/Libraries/Core/ReactNativeVersion.js +1 -1
  4. package/Libraries/Core/Timers/JSTimers.js +1 -0
  5. package/Libraries/Core/Timers/NativeTiming.js +1 -0
  6. package/Libraries/Core/Timers/immediateShim.js +1 -0
  7. package/Libraries/Core/setUpPerformance.js +3 -5
  8. package/React/Base/RCTVersion.m +1 -1
  9. package/React/CoreModules/RCTAlertController.mm +6 -1
  10. package/React/FBReactNativeSpec/FBReactNativeSpecJSI-generated.cpp +12 -0
  11. package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +18 -0
  12. package/ReactAndroid/build.gradle.kts +7 -0
  13. package/ReactAndroid/gradle.properties +2 -1
  14. package/ReactAndroid/hermes-engine/build.gradle.kts +28 -7
  15. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +7 -1
  16. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +11 -1
  17. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +3 -1
  18. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +3 -1
  19. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +12 -1
  20. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android.kt +3 -1
  21. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +3 -1
  22. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  23. package/ReactAndroid/src/main/jni/CMakeLists.txt +5 -0
  24. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +15 -1
  25. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +4 -1
  26. package/ReactAndroid/src/main/jni/react/hermes/reactexecutor/CMakeLists.txt +4 -0
  27. package/ReactAndroid/src/main/jni/react/runtime/hermes/jni/CMakeLists.txt +4 -0
  28. package/ReactAndroid/src/main/jni/react/runtime/jni/CMakeLists.txt +4 -0
  29. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  30. package/ReactCommon/hermes/executor/CMakeLists.txt +4 -0
  31. package/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +8 -5
  32. package/ReactCommon/hermes/inspector-modern/CMakeLists.txt +4 -0
  33. package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp +2 -2
  34. package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h +2 -2
  35. package/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +2 -2
  36. package/ReactCommon/hermes/inspector-modern/chrome/Registration.h +2 -2
  37. package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +2 -0
  38. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +5 -1
  39. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +6 -1
  40. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +44 -26
  41. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +4 -2
  42. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +5 -1
  43. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +10 -1
  44. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSCanary.h +5 -1
  45. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +2 -1
  46. package/ReactCommon/react/nativemodule/defaults/CMakeLists.txt +1 -0
  47. package/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp +8 -0
  48. package/ReactCommon/react/nativemodule/defaults/React-defaultsnativemodule.podspec +1 -0
  49. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +6 -1
  50. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +3 -1
  51. package/ReactCommon/react/nativemodule/webperformance/CMakeLists.txt +1 -1
  52. package/ReactCommon/react/nativemodule/webperformance/NativePerformance.cpp +9 -9
  53. package/ReactCommon/react/nativemodule/webperformance/NativePerformance.h +3 -0
  54. package/ReactCommon/react/nativemodule/webperformance/React-webperformancenativemodule.podspec +58 -0
  55. package/ReactCommon/react/runtime/CMakeLists.txt +4 -0
  56. package/ReactCommon/react/runtime/hermes/CMakeLists.txt +4 -0
  57. package/ReactCommon/react/runtime/hermes/HermesInstance.cpp +7 -3
  58. package/ReactCommon/react/timing/primitives.h +12 -0
  59. package/flow/bom.js.flow +158 -1
  60. package/package.json +9 -8
  61. package/scripts/cocoapods/autolinking.rb +6 -0
  62. package/scripts/cocoapods/codegen_utils.rb +1 -1
  63. package/scripts/cocoapods/jsengine.rb +2 -1
  64. package/scripts/cocoapods/utils.rb +8 -2
  65. package/scripts/codegen/generate-artifacts-executor/index.js +5 -6
  66. package/scripts/codegen/generate-artifacts-executor/utils.js +41 -10
  67. package/scripts/react_native_pods.rb +1 -0
  68. package/scripts/replace-rncore-version.js +4 -2
  69. package/sdks/hermes-engine/hermes-engine.podspec +35 -12
  70. package/sdks/hermes-engine/hermes-utils.rb +41 -10
  71. package/sdks/hermes-engine/utils/build-apple-framework.sh +7 -1
  72. package/sdks/hermes-engine/utils/build-hermes-xcode.sh +8 -1
  73. package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +1 -1
  74. package/sdks/hermes-engine/utils/replace_hermes_version.js +4 -2
  75. package/sdks/hermes-engine/version.properties +1 -0
  76. package/sdks/hermesc/osx-bin/hermes +0 -0
  77. package/sdks/hermesc/osx-bin/hermesc +0 -0
  78. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  79. package/settings.gradle.kts +9 -0
  80. package/src/private/featureflags/ReactNativeFeatureFlags.js +6 -1
  81. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
  82. package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
  83. package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
  84. package/src/private/webapis/performance/EventTiming.js +34 -15
  85. package/src/private/webapis/performance/LongTasks.js +35 -2
  86. package/src/private/webapis/performance/Performance.js +49 -13
  87. package/src/private/webapis/performance/PerformanceEntry.js +21 -8
  88. package/src/private/webapis/performance/PerformanceObserver.js +30 -1
  89. package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
  90. package/src/private/webapis/performance/ResourceTiming.js +29 -18
  91. package/src/private/webapis/performance/UserTiming.js +33 -28
  92. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
  93. package/src/private/webapis/performance/specs/NativePerformance.js +2 -0
  94. package/third-party-podspecs/replace_dependencies_version.js +4 -2
@@ -57,6 +57,19 @@ export class PerformanceObserverEntryList {
57
57
  }
58
58
  }
59
59
 
60
+ export const PerformanceObserverEntryList_public: typeof PerformanceObserverEntryList =
61
+ /* eslint-disable no-shadow */
62
+ // $FlowExpectedError[incompatible-type]
63
+ function PerformanceObserverEntryList() {
64
+ throw new TypeError(
65
+ "Failed to construct 'PerformanceObserverEntryList': Illegal constructor",
66
+ );
67
+ };
68
+
69
+ // $FlowExpectedError[prop-missing]
70
+ PerformanceObserverEntryList_public.prototype =
71
+ PerformanceObserverEntryList.prototype;
72
+
60
73
  export type PerformanceObserverCallbackOptions = {
61
74
  droppedEntriesCount: number,
62
75
  };
@@ -145,6 +158,22 @@ export class PerformanceObserver {
145
158
  NativePerformance.disconnect(this.#nativeObserverHandle);
146
159
  }
147
160
 
161
+ takeRecords(): PerformanceEntryList {
162
+ let entries: PerformanceEntryList = [];
163
+
164
+ if (this.#nativeObserverHandle != null) {
165
+ const rawEntries = NativePerformance.takeRecords(
166
+ this.#nativeObserverHandle,
167
+ true,
168
+ );
169
+ if (rawEntries && rawEntries.length > 0) {
170
+ entries = rawEntries.map(rawToPerformanceEntry);
171
+ }
172
+ }
173
+
174
+ return entries;
175
+ }
176
+
148
177
  #createNativeObserver(): OpaqueNativeObserverHandle | null {
149
178
  this.#calledAtLeastOnce = false;
150
179
 
@@ -154,7 +183,7 @@ export class PerformanceObserver {
154
183
  observerHandle,
155
184
  true, // sort records
156
185
  );
157
- if (!rawEntries) {
186
+ if (!rawEntries || rawEntries.length === 0) {
158
187
  return;
159
188
  }
160
189
 
@@ -16,9 +16,7 @@ type ReactNativeStartupTimingLike = {
16
16
  startTime: ?number,
17
17
  endTime: ?number,
18
18
  initializeRuntimeStart: ?number,
19
- initializeRuntimeEnd: ?number,
20
19
  executeJavaScriptBundleEntryPointStart: ?number,
21
- executeJavaScriptBundleEntryPointEnd: ?number,
22
20
  };
23
21
 
24
22
  // Read-only object with RN startup timing information.
@@ -29,22 +27,17 @@ export default class ReactNativeStartupTiming {
29
27
  // 1. The `ReactNativeStartupTiming` is non-standard API
30
28
  // 2. The timing information is relative to the time origin, which means `0` has valid meaning
31
29
  #startTime: ?number;
32
- #endTime: ?number;
33
30
  #initializeRuntimeStart: ?number;
34
- #initializeRuntimeEnd: ?number;
35
31
  #executeJavaScriptBundleEntryPointStart: ?number;
36
- #executeJavaScriptBundleEntryPointEnd: ?number;
32
+ #endTime: ?number;
37
33
 
38
34
  constructor(startUpTiming: ?ReactNativeStartupTimingLike) {
39
35
  if (startUpTiming != null) {
40
36
  this.#startTime = startUpTiming.startTime;
41
- this.#endTime = startUpTiming.endTime;
42
37
  this.#initializeRuntimeStart = startUpTiming.initializeRuntimeStart;
43
- this.#initializeRuntimeEnd = startUpTiming.initializeRuntimeEnd;
44
38
  this.#executeJavaScriptBundleEntryPointStart =
45
39
  startUpTiming.executeJavaScriptBundleEntryPointStart;
46
- this.#executeJavaScriptBundleEntryPointEnd =
47
- startUpTiming.executeJavaScriptBundleEntryPointEnd;
40
+ this.#endTime = startUpTiming.endTime;
48
41
  }
49
42
  }
50
43
 
@@ -56,7 +49,7 @@ export default class ReactNativeStartupTiming {
56
49
  }
57
50
 
58
51
  /**
59
- * End time of the RN app startup process. This is equal to `executeJavaScriptBundleEntryPointEnd`.
52
+ * End time of the RN app startup process.
60
53
  */
61
54
  get endTime(): ?number {
62
55
  return this.#endTime;
@@ -69,26 +62,12 @@ export default class ReactNativeStartupTiming {
69
62
  return this.#initializeRuntimeStart;
70
63
  }
71
64
 
72
- /**
73
- * End time when RN runtime get initialized. This is the last marker before ends of the app startup process.
74
- */
75
- get initializeRuntimeEnd(): ?number {
76
- return this.#initializeRuntimeEnd;
77
- }
78
-
79
65
  /**
80
66
  * Start time of JS bundle being executed. This indicates the RN JS bundle is loaded and start to be evaluated.
81
67
  */
82
68
  get executeJavaScriptBundleEntryPointStart(): ?number {
83
69
  return this.#executeJavaScriptBundleEntryPointStart;
84
70
  }
85
-
86
- /**
87
- * End time of JS bundle being executed. This indicates all the synchronous entry point jobs are finished.
88
- */
89
- get executeJavaScriptBundleEntryPointEnd(): ?number {
90
- return this.#executeJavaScriptBundleEntryPointEnd;
91
- }
92
71
  }
93
72
 
94
73
  setPlatformObject(ReactNativeStartupTiming);
@@ -29,6 +29,19 @@ export type PerformanceResourceTimingJSON = {
29
29
  ...
30
30
  };
31
31
 
32
+ export interface PerformanceResourceTimingInit {
33
+ +name: string;
34
+ +startTime: DOMHighResTimeStamp;
35
+ +duration: DOMHighResTimeStamp;
36
+ +fetchStart: DOMHighResTimeStamp;
37
+ +requestStart: DOMHighResTimeStamp;
38
+ +connectStart: DOMHighResTimeStamp;
39
+ +connectEnd: DOMHighResTimeStamp;
40
+ +responseStart: DOMHighResTimeStamp;
41
+ +responseEnd: DOMHighResTimeStamp;
42
+ +responseStatus?: number;
43
+ }
44
+
32
45
  export class PerformanceResourceTiming extends PerformanceEntry {
33
46
  #fetchStart: DOMHighResTimeStamp;
34
47
  #requestStart: DOMHighResTimeStamp;
@@ -38,24 +51,9 @@ export class PerformanceResourceTiming extends PerformanceEntry {
38
51
  #responseEnd: DOMHighResTimeStamp;
39
52
  #responseStatus: ?number;
40
53
 
41
- constructor(init: {
42
- name: string,
43
- startTime: DOMHighResTimeStamp,
44
- duration: DOMHighResTimeStamp,
45
- fetchStart: DOMHighResTimeStamp,
46
- requestStart: DOMHighResTimeStamp,
47
- connectStart: DOMHighResTimeStamp,
48
- connectEnd: DOMHighResTimeStamp,
49
- responseStart: DOMHighResTimeStamp,
50
- responseEnd: DOMHighResTimeStamp,
51
- responseStatus?: number,
52
- }) {
53
- super({
54
- name: init.name,
55
- entryType: 'resource',
56
- startTime: init.startTime,
57
- duration: init.duration,
58
- });
54
+ constructor(init: PerformanceResourceTimingInit) {
55
+ super('resource', init);
56
+
59
57
  this.#fetchStart = init.fetchStart;
60
58
  this.#requestStart = init.requestStart;
61
59
  this.#connectStart = init.connectStart;
@@ -106,3 +104,16 @@ export class PerformanceResourceTiming extends PerformanceEntry {
106
104
  };
107
105
  }
108
106
  }
107
+
108
+ export const PerformanceResourceTiming_public: typeof PerformanceResourceTiming =
109
+ /* eslint-disable no-shadow */
110
+ // $FlowExpectedError[incompatible-type]
111
+ function PerformanceResourceTiming() {
112
+ throw new TypeError(
113
+ "Failed to construct 'PerformanceResourceTiming': Illegal constructor",
114
+ );
115
+ };
116
+
117
+ // $FlowExpectedError[prop-missing]
118
+ PerformanceResourceTiming_public.prototype =
119
+ PerformanceResourceTiming.prototype;
@@ -9,8 +9,10 @@
9
9
  */
10
10
 
11
11
  // flowlint unsafe-getters-setters:off
12
-
13
- import type {DOMHighResTimeStamp} from './PerformanceEntry';
12
+ import type {
13
+ DOMHighResTimeStamp,
14
+ PerformanceEntryInit,
15
+ } from './PerformanceEntry';
14
16
  import type {
15
17
  ExtensionMarkerPayload,
16
18
  ExtensionTrackEntryPayload,
@@ -25,18 +27,16 @@ export type DetailType =
25
27
  // but we'll use it as documentation for how to use the extensibility API.
26
28
  | {devtools?: ExtensionMarkerPayload | ExtensionTrackEntryPayload, ...};
27
29
 
28
- export type PerformanceMarkOptions = $ReadOnly<{
29
- detail?: DetailType,
30
- startTime?: DOMHighResTimeStamp,
31
- }>;
30
+ export interface PerformanceMarkOptions {
31
+ +detail?: DetailType;
32
+ +startTime?: DOMHighResTimeStamp;
33
+ }
32
34
 
33
35
  export type TimeStampOrName = DOMHighResTimeStamp | string;
34
36
 
35
- export type PerformanceMeasureInit = $ReadOnly<{
36
- detail?: DetailType,
37
- startTime: DOMHighResTimeStamp,
38
- duration: DOMHighResTimeStamp,
39
- }>;
37
+ export interface PerformanceMeasureInit extends PerformanceEntryInit {
38
+ +detail?: DetailType;
39
+ }
40
40
 
41
41
  class PerformanceMarkTemplate extends PerformanceEntry {
42
42
  // We don't use private fields because they're significantly slower to
@@ -45,9 +45,8 @@ class PerformanceMarkTemplate extends PerformanceEntry {
45
45
 
46
46
  // This constructor isn't really used. See `PerformanceMark` below.
47
47
  constructor(markName: string, markOptions?: PerformanceMarkOptions) {
48
- super({
48
+ super('mark', {
49
49
  name: markName,
50
- entryType: 'mark',
51
50
  startTime: markOptions?.startTime ?? getCurrentTimeStamp(),
52
51
  duration: 0,
53
52
  });
@@ -72,8 +71,8 @@ export const PerformanceMark: typeof PerformanceMarkTemplate =
72
71
  markName: string,
73
72
  markOptions?: PerformanceMarkOptions,
74
73
  ) {
75
- this.__name = markName;
76
74
  this.__entryType = 'mark';
75
+ this.__name = markName;
77
76
  this.__startTime = markOptions?.startTime ?? getCurrentTimeStamp();
78
77
  this.__duration = 0;
79
78
 
@@ -89,15 +88,10 @@ class PerformanceMeasureTemplate extends PerformanceEntry {
89
88
  __detail: DetailType;
90
89
 
91
90
  // This constructor isn't really used. See `PerformanceMeasure` below.
92
- constructor(measureName: string, measureOptions: PerformanceMeasureInit) {
93
- super({
94
- name: measureName,
95
- entryType: 'measure',
96
- startTime: measureOptions.startTime,
97
- duration: measureOptions.duration,
98
- });
91
+ constructor(init: PerformanceMeasureInit) {
92
+ super('measure', init);
99
93
 
100
- this.__detail = measureOptions?.detail ?? null;
94
+ this.__detail = init?.detail ?? null;
101
95
  }
102
96
 
103
97
  get detail(): DetailType {
@@ -110,16 +104,27 @@ export const PerformanceMeasure: typeof PerformanceMeasureTemplate =
110
104
  // $FlowExpectedError[incompatible-type]
111
105
  function PerformanceMeasure(
112
106
  this: PerformanceMeasureTemplate,
113
- measureName: string,
114
- measureOptions: PerformanceMeasureInit,
107
+ init: PerformanceMeasureInit,
115
108
  ) {
116
- this.__name = measureName;
117
109
  this.__entryType = 'measure';
118
- this.__startTime = measureOptions.startTime;
119
- this.__duration = measureOptions.duration;
110
+ this.__name = init.name;
111
+ this.__startTime = init.startTime;
112
+ this.__duration = init.duration;
120
113
 
121
- this.__detail = measureOptions.detail ?? null;
114
+ this.__detail = init.detail ?? null;
122
115
  };
123
116
 
124
117
  // $FlowExpectedError[prop-missing]
125
118
  PerformanceMeasure.prototype = PerformanceMeasureTemplate.prototype;
119
+
120
+ export const PerformanceMeasure_public: typeof PerformanceMeasure =
121
+ /* eslint-disable no-shadow */
122
+ // $FlowExpectedError[incompatible-type]
123
+ function PerformanceMeasure() {
124
+ throw new TypeError(
125
+ "Failed to construct 'PerformanceMeasure': Illegal constructor",
126
+ );
127
+ };
128
+
129
+ // $FlowExpectedError[prop-missing]
130
+ PerformanceMeasure_public.prototype = PerformanceMeasure.prototype;
@@ -44,7 +44,6 @@ export function rawToPerformanceEntry(
44
44
  case RawPerformanceEntryTypeValues.LONGTASK:
45
45
  return new PerformanceLongTaskTiming({
46
46
  name: entry.name,
47
- entryType: rawToPerformanceEntryType(entry.entryType),
48
47
  startTime: entry.startTime,
49
48
  duration: entry.duration,
50
49
  });
@@ -53,7 +52,8 @@ export function rawToPerformanceEntry(
53
52
  startTime: entry.startTime,
54
53
  });
55
54
  case RawPerformanceEntryTypeValues.MEASURE:
56
- return new PerformanceMeasure(entry.name, {
55
+ return new PerformanceMeasure({
56
+ name: entry.name,
57
57
  startTime: entry.startTime,
58
58
  duration: entry.duration,
59
59
  });
@@ -71,9 +71,8 @@ export function rawToPerformanceEntry(
71
71
  responseStatus: entry.responseStatus,
72
72
  });
73
73
  default:
74
- return new PerformanceEntry({
74
+ return new PerformanceEntry(rawToPerformanceEntryType(entry.entryType), {
75
75
  name: entry.name,
76
- entryType: rawToPerformanceEntryType(entry.entryType),
77
76
  startTime: entry.startTime,
78
77
  duration: entry.duration,
79
78
  });
@@ -54,6 +54,8 @@ export type PerformanceObserverInit = {
54
54
 
55
55
  export interface Spec extends TurboModule {
56
56
  +now: () => number;
57
+ +timeOrigin?: () => number;
58
+
57
59
  +reportMark: (name: string, startTime: number, entry: mixed) => void;
58
60
  +reportMeasure: (
59
61
  name: string,
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const {execSync} = require('child_process');
13
+ const {spawnSync} = require('child_process');
14
14
  const fs = require('fs');
15
15
  const yargs = require('yargs');
16
16
 
@@ -66,7 +66,9 @@ function replaceRNDepsConfiguration(
66
66
  fs.mkdirSync(finalLocation, {recursive: true});
67
67
 
68
68
  console.log('Extracting the tarball', tarballURLPath);
69
- execSync(`tar -xf ${tarballURLPath} -C ${finalLocation}`);
69
+ spawnSync('tar', ['-xf', tarballURLPath, '-C', finalLocation], {
70
+ stdio: 'inherit',
71
+ });
70
72
 
71
73
  // Now we need to remove the extra third-party folder as we do in the podspec's prepare-script
72
74
  // We need to take the ReactNativeDependencies.xcframework folder and move it up one level