UNPKG

react-exe

Version:

A powerful React component executor that renders code with external dependencies and custom styling

31 lines (30 loc) 1.11 kB
/** * CDN Package Resolver * Automatically fetches packages from esm.sh CDN when dependencies are not provided * * esm.sh is a fast, global content delivery network for ES modules. * It automatically handles: * - Module format conversion (ESM, CJS, UMD) * - TypeScript compilation * - Dependency resolution * - React externalization (uses parent app's React) */ /** * Resolves a package from esm.sh CDN with React externalization * * For packages that depend on React, we use esm.sh's external parameter * to ensure they use the parent app's React instance instead of bundling their own. * * @param packageName - The npm package name to resolve * @returns Promise resolving to the loaded module */ export declare function resolvePackageFromCDN(packageName: string, targetWindow?: Window | null): Promise<any>; /** * Clears the CDN cache */ export declare function clearCDNCache(): void; /** * Pre-loads a package into the cache * Useful for preloading commonly used packages */ export declare function preloadPackage(packageName: string, targetWindow?: Window | null): Promise<void>;