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

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 (59) 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/ReactAndroid/build.gradle.kts +7 -0
  11. package/ReactAndroid/gradle.properties +3 -1
  12. package/ReactAndroid/hermes-engine/build.gradle.kts +28 -7
  13. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  14. package/ReactAndroid/src/main/jni/CMakeLists.txt +2 -0
  15. package/ReactAndroid/src/main/jni/react/hermes/reactexecutor/CMakeLists.txt +4 -0
  16. package/ReactAndroid/src/main/jni/react/runtime/hermes/jni/CMakeLists.txt +4 -0
  17. package/ReactAndroid/src/main/jni/react/runtime/jni/CMakeLists.txt +4 -0
  18. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  19. package/ReactCommon/hermes/executor/CMakeLists.txt +4 -0
  20. package/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +8 -5
  21. package/ReactCommon/hermes/inspector-modern/CMakeLists.txt +4 -0
  22. package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp +2 -2
  23. package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h +2 -2
  24. package/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +2 -2
  25. package/ReactCommon/hermes/inspector-modern/chrome/Registration.h +2 -2
  26. package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +2 -0
  27. package/ReactCommon/react/runtime/CMakeLists.txt +4 -0
  28. package/ReactCommon/react/runtime/hermes/CMakeLists.txt +4 -0
  29. package/ReactCommon/react/runtime/hermes/HermesInstance.cpp +7 -3
  30. package/flow/bom.js.flow +157 -0
  31. package/package.json +8 -8
  32. package/scripts/cocoapods/autolinking.rb +6 -0
  33. package/scripts/cocoapods/codegen_utils.rb +1 -1
  34. package/scripts/cocoapods/jsengine.rb +2 -1
  35. package/scripts/cocoapods/utils.rb +8 -2
  36. package/scripts/codegen/generate-artifacts-executor/index.js +5 -1
  37. package/scripts/codegen/generate-artifacts-executor/utils.js +41 -10
  38. package/scripts/replace-rncore-version.js +4 -2
  39. package/sdks/hermes-engine/hermes-engine.podspec +30 -12
  40. package/sdks/hermes-engine/hermes-utils.rb +41 -10
  41. package/sdks/hermes-engine/utils/build-apple-framework.sh +7 -1
  42. package/sdks/hermes-engine/utils/build-hermes-xcode.sh +8 -1
  43. package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +1 -1
  44. package/sdks/hermes-engine/utils/replace_hermes_version.js +4 -2
  45. package/sdks/hermesc/osx-bin/hermes +0 -0
  46. package/sdks/hermesc/osx-bin/hermesc +0 -0
  47. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  48. package/settings.gradle.kts +9 -0
  49. package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
  50. package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
  51. package/src/private/webapis/performance/EventTiming.js +34 -15
  52. package/src/private/webapis/performance/LongTasks.js +35 -2
  53. package/src/private/webapis/performance/Performance.js +23 -6
  54. package/src/private/webapis/performance/PerformanceEntry.js +21 -8
  55. package/src/private/webapis/performance/PerformanceObserver.js +30 -1
  56. package/src/private/webapis/performance/ResourceTiming.js +29 -18
  57. package/src/private/webapis/performance/UserTiming.js +33 -28
  58. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
  59. package/third-party-podspecs/replace_dependencies_version.js +4 -2
@@ -9,8 +9,10 @@
9
9
  */
10
10
 
11
11
  // flowlint unsafe-getters-setters:off
12
-
13
- import type {PerformanceEntryJSON} from './PerformanceEntry';
12
+ import type {
13
+ PerformanceEntryInit,
14
+ PerformanceEntryJSON,
15
+ } from './PerformanceEntry';
14
16
 
15
17
  import {PerformanceEntry} from './PerformanceEntry';
16
18
 
@@ -22,10 +24,28 @@ export type PerformanceLongTaskTimingJSON = {
22
24
 
23
25
  export class TaskAttributionTiming extends PerformanceEntry {}
24
26
 
27
+ export const TaskAttributionTiming_public: typeof TaskAttributionTiming =
28
+ /* eslint-disable no-shadow */
29
+ // $FlowExpectedError[incompatible-type]
30
+ function TaskAttributionTiming() {
31
+ throw new TypeError(
32
+ "Failed to construct 'TaskAttributionTiming': Illegal constructor",
33
+ );
34
+ };
35
+
36
+ // $FlowExpectedError[prop-missing]
37
+ TaskAttributionTiming_public.prototype = TaskAttributionTiming.prototype;
38
+
25
39
  const EMPTY_ATTRIBUTION: $ReadOnlyArray<TaskAttributionTiming> =
26
40
  Object.preventExtensions([]);
27
41
 
42
+ export interface PerformanceLongTaskTimingInit extends PerformanceEntryInit {}
43
+
28
44
  export class PerformanceLongTaskTiming extends PerformanceEntry {
45
+ constructor(init: PerformanceEntryInit) {
46
+ super('longtask', init);
47
+ }
48
+
29
49
  get attribution(): $ReadOnlyArray<TaskAttributionTiming> {
30
50
  return EMPTY_ATTRIBUTION;
31
51
  }
@@ -37,3 +57,16 @@ export class PerformanceLongTaskTiming extends PerformanceEntry {
37
57
  };
38
58
  }
39
59
  }
60
+
61
+ export const PerformanceLongTaskTiming_public: typeof PerformanceLongTaskTiming =
62
+ /* eslint-disable no-shadow */
63
+ // $FlowExpectedError[incompatible-type]
64
+ function PerformanceLongTaskTiming() {
65
+ throw new TypeError(
66
+ "Failed to construct 'PerformanceLongTaskTiming': Illegal constructor",
67
+ );
68
+ };
69
+
70
+ // $FlowExpectedError[prop-missing]
71
+ PerformanceLongTaskTiming_public.prototype =
72
+ PerformanceLongTaskTiming.prototype;
@@ -64,12 +64,13 @@ const cachedGetMarkTime = NativePerformance.getMarkTime;
64
64
  const cachedNativeClearMarks = NativePerformance.clearMarks;
65
65
  const cachedNativeClearMeasures = NativePerformance.clearMeasures;
66
66
 
67
- const MARK_OPTIONS_REUSABLE_OBJECT: {...PerformanceMarkOptions} = {
67
+ const MARK_OPTIONS_REUSABLE_OBJECT: PerformanceMarkOptions = {
68
68
  startTime: 0,
69
69
  detail: undefined,
70
70
  };
71
71
 
72
- const MEASURE_OPTIONS_REUSABLE_OBJECT: {...PerformanceMeasureInit} = {
72
+ const MEASURE_OPTIONS_REUSABLE_OBJECT: PerformanceMeasureInit = {
73
+ name: '',
73
74
  startTime: 0,
74
75
  duration: 0,
75
76
  detail: undefined,
@@ -189,7 +190,9 @@ export default class Performance {
189
190
  resolvedDetail = structuredClone(detail);
190
191
  }
191
192
 
193
+ // $FlowExpectedError[cannot-write]
192
194
  MARK_OPTIONS_REUSABLE_OBJECT.startTime = resolvedStartTime;
195
+ // $FlowExpectedError[cannot-write]
193
196
  MARK_OPTIONS_REUSABLE_OBJECT.detail = resolvedDetail;
194
197
 
195
198
  const entry = new PerformanceMark(
@@ -367,14 +370,16 @@ export default class Performance {
367
370
  }
368
371
  }
369
372
 
373
+ // $FlowExpectedError[cannot-write]
374
+ MEASURE_OPTIONS_REUSABLE_OBJECT.name = resolvedMeasureName;
375
+ // $FlowExpectedError[cannot-write]
370
376
  MEASURE_OPTIONS_REUSABLE_OBJECT.startTime = resolvedStartTime;
377
+ // $FlowExpectedError[cannot-write]
371
378
  MEASURE_OPTIONS_REUSABLE_OBJECT.duration = resolvedDuration;
379
+ // $FlowExpectedError[cannot-write]
372
380
  MEASURE_OPTIONS_REUSABLE_OBJECT.detail = resolvedDetail;
373
381
 
374
- const entry = new PerformanceMeasure(
375
- resolvedMeasureName,
376
- MEASURE_OPTIONS_REUSABLE_OBJECT,
377
- );
382
+ const entry = new PerformanceMeasure(MEASURE_OPTIONS_REUSABLE_OBJECT);
378
383
 
379
384
  cachedReportMeasure(
380
385
  resolvedMeasureName,
@@ -438,4 +443,16 @@ export default class Performance {
438
443
  }
439
444
  }
440
445
 
446
+ export const Performance_public: typeof Performance =
447
+ /* eslint-disable no-shadow */
448
+ // $FlowExpectedError[incompatible-type]
449
+ function Performance() {
450
+ throw new TypeError(
451
+ "Failed to construct 'Performance': Illegal constructor",
452
+ );
453
+ };
454
+
455
+ // $FlowExpectedError[prop-missing]
456
+ Performance_public.prototype = Performance.prototype;
457
+
441
458
  setPlatformObject(Performance);
@@ -28,24 +28,25 @@ export type PerformanceEntryJSON = {
28
28
  ...
29
29
  };
30
30
 
31
+ export interface PerformanceEntryInit {
32
+ +name: string;
33
+ +startTime: DOMHighResTimeStamp;
34
+ +duration: DOMHighResTimeStamp;
35
+ }
36
+
31
37
  export class PerformanceEntry {
32
38
  // We don't use private fields because they're significantly slower to
33
39
  // initialize on construction and to access.
34
40
  // We also need these to be protected so they can be initialized in subclasses
35
41
  // where we avoid calling `super()` for performance reasons.
36
- __name: string;
37
42
  __entryType: PerformanceEntryType;
43
+ __name: string;
38
44
  __startTime: DOMHighResTimeStamp;
39
45
  __duration: DOMHighResTimeStamp;
40
46
 
41
- constructor(init: {
42
- name: string,
43
- entryType: PerformanceEntryType,
44
- startTime: DOMHighResTimeStamp,
45
- duration: DOMHighResTimeStamp,
46
- }) {
47
+ constructor(entryType: PerformanceEntryType, init: PerformanceEntryInit) {
48
+ this.__entryType = entryType;
47
49
  this.__name = init.name;
48
- this.__entryType = init.entryType;
49
50
  this.__startTime = init.startTime;
50
51
  this.__duration = init.duration;
51
52
  }
@@ -76,6 +77,18 @@ export class PerformanceEntry {
76
77
  }
77
78
  }
78
79
 
80
+ export const PerformanceEntry_public: typeof PerformanceEntry =
81
+ /* eslint-disable no-shadow */
82
+ // $FlowExpectedError[incompatible-type]
83
+ function PerformanceEntry() {
84
+ throw new TypeError(
85
+ "Failed to construct 'PerformanceEntry': Illegal constructor",
86
+ );
87
+ };
88
+
89
+ // $FlowExpectedError[prop-missing]
90
+ PerformanceEntry_public.prototype = PerformanceEntry.prototype;
91
+
79
92
  setPlatformObject(PerformanceEntry);
80
93
 
81
94
  export type PerformanceEntryList = $ReadOnlyArray<PerformanceEntry>;
@@ -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
 
@@ -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
  });
@@ -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