UNPKG

bigblocks

Version:

Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React

42 lines (41 loc) 1.5 kB
/** * Runtime checks for peer dependencies * Provides helpful warnings when optional peer dependencies are missing */ export function checkPeerDependency(packageName, feature, isRequired = false) { try { // Try to resolve the package require.resolve(packageName); return true; } catch { const message = `Missing peer dependency "${packageName}" for ${feature}.`; const install = `Please install: npm install ${packageName}`; if (isRequired) { console.error(`❌ ${message}\n ${install}`); throw new Error(message); } console.warn(`⚠️ ${message}\n ${install}`); return false; } } // Check for required peer dependencies export function checkRequiredDeps() { // No longer need to check for @radix-ui/themes // All required Radix UI components are now direct dependencies } // Check for optional peer dependencies based on usage export function checkOptionalDeps(module) { switch (module) { case "market": return (checkPeerDependency("@tanstack/react-query", "market components") && checkPeerDependency("js-1sat-ord", "ordinals functionality")); case "wallet": case "social": return checkPeerDependency("@tanstack/react-query", `${module} components`); case "bap": return checkPeerDependency("sigma-protocol", "BAP encryption features"); default: return true; } }