37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
// Metro module 3924 (f3925).
|
|
import { TurboModuleRegistry } from "react-native";
|
|
import * as _Module3925 from "./Module3925";
|
|
import { ModuleNotFoundError } from "./ModuleNotFoundError";
|
|
let r31, enforcing;
|
|
const getInstalledNitro = function getInstalledNitro() {
|
|
return global.NitroModulesProxy;
|
|
};
|
|
const r24 = getInstalledNitro();
|
|
if (r24 != null) {
|
|
const version = r24.version;
|
|
r31 = r24;
|
|
if (version !== _Module3925.version) {
|
|
throw new Error(`Nitro was installed twice: once with native version ${r24.version} and once with JS version ${_Module3925.version}. This usually means react-native-nitro-modules exists multiple times in node_modules (e.g. in monorepos or double-linked setups).`);
|
|
}
|
|
} else {
|
|
try {
|
|
enforcing = TurboModuleRegistry.getEnforcing("NitroModules");
|
|
} catch ($e) {
|
|
throw new ModuleNotFoundError($e);
|
|
}
|
|
const r30 = enforcing.install();
|
|
if (r30 != null) {
|
|
throw new Error(`Failed to install Nitro: ${r30}`);
|
|
}
|
|
r31 = getInstalledNitro();
|
|
if (r31 == null) {
|
|
throw new ModuleNotFoundError(new Error("NitroModules was installed, but `global.NitroModulesProxy` was null!"));
|
|
}
|
|
}
|
|
export { r31 as NitroModules };
|
|
export function isRuntimeAlive() {
|
|
const __nitroJsiCache = globalThis.globalThis.__nitroJsiCache;
|
|
const __nitroDispatcher = globalThis.globalThis.__nitroDispatcher;
|
|
return __nitroJsiCache != null && __nitroDispatcher != null;
|
|
}
|