@renderx-plugins/host-sdk
Version:
Host SDK for RenderX plugins - provides conductor, event routing, and component mapping APIs
35 lines • 1.19 kB
JavaScript
// Standalone plugin manifest accessor for @renderx/host-sdk
// Provides a simple interface for plugins to discover other plugins without host coupling
// Simple in-memory cache
let cached = null;
// Host applications can provide the manifest via this function
export function setPluginManifest(manifest) {
cached = manifest;
}
// Plugins can use this to discover other available plugins
export async function getPluginManifest() {
if (cached) {
return cached;
}
// Try to fetch from standard location if in browser
if (typeof window !== 'undefined' && typeof fetch !== 'undefined') {
try {
const response = await fetch('/plugins/plugin-manifest.json');
if (response.ok) {
const manifest = await response.json();
cached = manifest;
return manifest;
}
}
catch {
// Fetch failed, continue to fallback
}
}
// Return empty manifest as fallback
return { plugins: [] };
}
// Synchronous accessor for cached manifest
export function getCachedPluginManifest() {
return cached;
}
//# sourceMappingURL=pluginManifest.js.map