INNER CODE UNIT · TypeScript
resolveAndroidFQN
margelo/react-native-runtimes · packages/core/plugin/src/index.ts:90
function resolveAndroidFQN(pkgName: string): string {
let pkgJson: RuntimesPackageMetadata;
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
pkgJson = require(`${pkgName}/package.json`) as RuntimesPackageMetadata;
} catch {
throw new Error(
`[@react-native-runtimes/core] Could not resolve '${pkgName}/package.json'. ` +
`Make sure '${pkgName}' is installed in your project.`,
);
}
const fqn = pkgJson.reactNativeRuntimes?.android?.package;
if (!fqn) {
throw new Error(
`[@react-native-runtimes/core] '${pkgName}' does not declare ` +
'`reactNativeRuntimes.android.package` in its package.json. ' +
'Ask the package author to add it, or list the FQN under `androidPackages` instead.',
);