{"library":"mini-star","title":"mini-star","description":"mini-star is a robust frontend micro-kernel framework, bundler, and loader designed to help projects implement a plugin-based architecture. It facilitates the independent development and deployment of features as separate plugins. The library, currently at version 2.1.8, supports TypeScript natively and is framework-agnostic, meaning it can be integrated with React, Vue, Angular, jQuery, or other modern web frameworks. Key differentiators include its bundler for building AMD-based plugins, automatic processing of plugin and dependency paths, dynamic asynchronous module loading to optimize project size, and a powerful mechanism for sharing common dependencies across all plugins, reducing boilerplate and bundle size. Unlike `requirejs`, `mini-star` operates at a module level, aligning with modern frontend practices, and it distinguishes itself from micro-frontend solutions like `qiankun` by prioritizing dependency reuse and an isomorphic technology stack rather than isolation for heterogeneous applications. It offers a complete toolchain encompassing CLI, runtime, and bundler functionalities. The project appears to have an active development and maintenance cadence, with recent documentation updates indicating ongoing support.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install mini-star"],"cli":{"name":"mini-star","version":null}},"imports":["import { MiniStar } from 'mini-star';","import type { MiniStarConfig } from 'mini-star';","import type { Plugin } from 'mini-star';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { MiniStar } from 'mini-star';\n\ninterface MyPluginInstance {\n  render: (selector: string) => void;\n  // ... other methods/properties exposed by the plugin\n}\n\nasync function initializeMiniStar() {\n  const ministar = new MiniStar({\n    // Optional: Configure base path for plugins, e.g., for local development or CDN\n    base: '/plugins/', \n    // Optional: Global error handler for plugin loading failures\n    errorHandler: (error, pluginName) => {\n      console.error(`Failed to load plugin ${pluginName}:`, error);\n    }\n  });\n\n  // Register shared dependencies that plugins might use, preventing duplication\n  // This should be done before loading plugins that depend on them.\n  ministar.registerShared('react', window.React || require('react'));\n  ministar.registerShared('react-dom', window.ReactDOM || require('react-dom'));\n  console.log('Shared dependencies registered.');\n\n  try {\n    // Load a plugin by its registered name or path\n    const myPlugin = await ministar.loadPlugin<MyPluginInstance>('my-plugin-entry');\n    console.log('Plugin loaded successfully:', myPlugin);\n\n    // Assume the plugin exports a render function\n    if (myPlugin && typeof myPlugin.render === 'function') {\n      myPlugin.render('#app-root');\n      console.log('Plugin rendered to #app-root');\n    }\n  } catch (error) {\n    console.error('Error during plugin loading or rendering:', error);\n  }\n}\n\n// Ensure React and ReactDOM are available globally for demonstration if not bundled\n// In a real app, these would be proper imports in your host application\n(window as any).React = require('react');\n(window as any).ReactDOM = require('react-dom');\n\ninitializeMiniStar();","lang":"typescript","description":"This quickstart demonstrates how to initialize `mini-star`, register shared dependencies like React and ReactDOM, and dynamically load a plugin. It shows basic configuration, error handling, and how a plugin's exposed methods can be invoked.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}