From 21dc5c8e99d111a4959bc8c6e1090041bca5fb92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Fri, 7 Oct 2022 07:18:42 -0700 Subject: [PATCH] Remove import cycle from Systrace module Summary: Replaced import cycle with Flow type cycle, which will remove the warnings from Metro. Changelog: [internal] Reviewed By: motiz88 Differential Revision: D40177136 fbshipit-source-id: e63986d8918e48e8c4cd8014d306d68fcbd2cf10 --- Libraries/Performance/Systrace.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Libraries/Performance/Systrace.js b/Libraries/Performance/Systrace.js index 1bd52e6e112860..581db4b375d698 100644 --- a/Libraries/Performance/Systrace.js +++ b/Libraries/Performance/Systrace.js @@ -8,7 +8,7 @@ * @format */ -import * as Systrace from './Systrace'; +import typeof * as SystraceModule from './Systrace'; const TRACE_TAG_REACT_APPS = 1 << 17; // eslint-disable-line no-bitwise @@ -123,6 +123,16 @@ export function counterEvent(eventName: EventName, value: number): void { } if (__DEV__) { + const Systrace: SystraceModule = { + isEnabled, + setEnabled, + beginEvent, + endEvent, + beginAsyncEvent, + endAsyncEvent, + counterEvent, + }; + // The metro require polyfill can not have dependencies (true for all polyfills). // Ensure that `Systrace` is available in polyfill by exposing it globally. global[(global.__METRO_GLOBAL_PREFIX__ || '') + '__SYSTRACE'] = Systrace;