npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@re-shell/core

v0.3.2

Published

Core package for ReShell microfrontend framework

Readme

@re-shell/core

The core framework for Re-Shell microfrontend applications. This package provides the essential functionality for loading, managing, and orchestrating microfrontends in a shell application.

Features

🚀 Enhanced Microfrontend Loading

  • Multi-framework support: React, Vue, Svelte, Angular, and Vanilla JS
  • Lifecycle management: Complete mount/unmount lifecycle with hooks
  • Loading strategies: Eager, lazy, and preload options
  • Performance monitoring: Built-in metrics collection and analysis
  • Error boundaries: Robust error handling and recovery

🔄 Advanced Event System

  • Type-safe events: Enhanced event bus with TypeScript support
  • Event namespacing: Organize events by namespace
  • Event history: Debug and replay events
  • Subscription management: Easy subscribe/unsubscribe with IDs

🛣️ Routing System

  • Route-based loading: Load microfrontends based on routes
  • Route guards: Authentication and permission checks
  • Dynamic parameters: Support for route parameters and query strings
  • Navigation events: Listen to route changes

🏗️ Workspace Management

  • Monorepo support: Manage multiple workspaces
  • Dependency analysis: Analyze workspace dependencies
  • Build orchestration: Coordinate builds across workspaces
  • Package manager integration: Support for npm, yarn, and pnpm

🔧 Development Tools

  • Debug panel: Visual debugging interface
  • Hot module replacement: Live reloading support
  • Performance insights: Real-time performance monitoring
  • Event logging: Comprehensive event debugging

Installation

npm install @re-shell/core
# or
yarn add @re-shell/core
# or
pnpm add @re-shell/core

Quick Start

Basic Usage

import { loadMicrofrontend, eventBus } from '@re-shell/core';

// Load a microfrontend
await loadMicrofrontend({
  id: 'my-microfrontend',
  name: 'My Microfrontend',
  url: '/microfrontends/my-mf.js',
  containerId: 'mf-container',
  framework: 'react'
});

// Listen for events
eventBus.on('user:selected', (data) => {
  console.log('User selected:', data.payload);
});

// Emit events
eventBus.emit('app:ready', { timestamp: Date.now() });

React Integration

import React from 'react';
import { ShellProvider, MicrofrontendContainer } from '@re-shell/core';

const App = () => {
  const microfrontendConfig = {
    id: 'dashboard',
    name: 'Dashboard',
    url: '/microfrontends/dashboard.js',
    containerId: 'dashboard-container',
    framework: 'react'
  };

  return (
    <ShellProvider>
      <div className="app">
        <header>My Shell App</header>
        <main>
          <MicrofrontendContainer 
            config={microfrontendConfig}
            options={{ enablePerformanceMonitoring: true }}
          />
        </main>
      </div>
    </ShellProvider>
  );
};

Advanced Configuration

import { 
  loadMicrofrontend, 
  performanceMonitor, 
  devTools,
  router 
} from '@re-shell/core';

// Configure performance monitoring
performanceMonitor.updateConfig({
  enabled: true,
  logToConsole: true,
  thresholds: {
    loadTime: 2000, // 2 seconds
    mountTime: 500,  // 500ms
    bundleSize: 1024 * 1024 // 1MB
  }
});

// Configure development tools
devTools.updateConfig({
  enabled: process.env.NODE_ENV === 'development',
  logEvents: true,
  monitorPerformance: true,
  enableHMR: true
});

// Set up routing
router.addRoutes([
  {
    path: '/dashboard',
    microfrontendId: 'dashboard',
    exact: true
  },
  {
    path: '/users/:id',
    microfrontendId: 'user-detail',
    guards: [authGuard]
  }
]);

// Load with lifecycle hooks
await loadMicrofrontend(
  {
    id: 'dashboard',
    name: 'Dashboard',
    url: '/microfrontends/dashboard.js',
    containerId: 'dashboard-container',
    framework: 'react'
  },
  {
    enablePerformanceMonitoring: true,
    loadingStrategy: 'lazy'
  },
  {
    beforeMount: async (config) => {
      console.log('About to mount:', config.name);
    },
    afterMount: async (config) => {
      console.log('Mounted:', config.name);
    },
    onError: (error, config) => {
      console.error('Error loading:', config.name, error);
    }
  }
);

API Reference

Core Functions

loadMicrofrontend(config, options?, hooks?)

Load a single microfrontend with enhanced lifecycle management.

loadMicrofrontends(configs, options?, hooks?)

Load multiple microfrontends concurrently.

unmountMicrofrontend(id, hooks?)

Unmount a specific microfrontend.

reloadMicrofrontend(id, options?, hooks?)

Reload a microfrontend (unmount then load).

Event Bus

eventBus.on<T>(event, handler)

Subscribe to events with type safety.

eventBus.emit<T>(event, payload, options?)

Emit events with enhanced data structure.

eventBus.once<T>(event, handler)

Subscribe to an event once.

eventBus.off(subscriptionId)

Unsubscribe using subscription ID.

Performance Monitoring

performanceMonitor.updateConfig(config)

Update performance monitoring configuration.

performanceMonitor.getMetrics(microfrontendId)

Get performance metrics for a specific microfrontend.

performanceMonitor.getSummary()

Get overall performance summary.

Routing

router.addRoute(route)

Add a single route configuration.

router.navigate(path, options?)

Navigate to a specific path.

router.getCurrentRoute()

Get the current active route.

Workspace Management

workspaceManager.registerWorkspace(config)

Register a workspace configuration.

workspaceManager.analyzeWorkspaces()

Analyze workspace dependencies and relationships.

workspaceManager.getBuildOrder()

Get optimal build order for workspaces.

Framework Support

React

  • Full TypeScript support
  • Hook-based integration
  • Error boundaries
  • Hot module replacement

Vue 3

  • Composition API support
  • TypeScript integration
  • Single File Components
  • Reactive state management

Svelte

  • SvelteKit compatibility
  • TypeScript preprocessing
  • Reactive statements
  • Scoped styling

Angular

  • Standalone components
  • Dependency injection
  • TypeScript support
  • Zone.js integration

Vanilla JavaScript

  • No framework dependencies
  • Custom element support
  • ES modules
  • Legacy compatibility

Development Tools

Access development tools via window.__RE_SHELL_DEV__ in development mode:

// Show debug panel
window.__RE_SHELL_DEV__.showDebugPanel();

// Get performance metrics
window.__RE_SHELL_DEV__.getPerformanceMetrics();

// Enable event logging
window.__RE_SHELL_DEV__.enableEventLogging();

// Get event history
window.__RE_SHELL_DEV__.getEventHistory();

Performance Optimization

Loading Strategies

  • Eager: Load immediately (default)
  • Lazy: Load when container becomes visible
  • Preload: Preload script but defer execution

Bundle Optimization

  • Code splitting support
  • Tree shaking compatibility
  • Asset optimization
  • Compression support

Memory Management

  • Automatic cleanup on unmount
  • Memory leak detection
  • Garbage collection optimization
  • Resource pooling

Migration Guide

From v0.2.x to v0.3.x

  1. Event Bus Changes:

    // Old
    eventBus.emit('event', { data: 'value' });
       
    // New
    eventBus.emit('event', { data: 'value' }, { source: 'my-app' });
  2. Loading Function Signature:

    // Old
    loadMicrofrontend(config, options);
       
    // New
    loadMicrofrontend(config, options, hooks);
  3. Performance Monitoring:

    // Enable in options
    loadMicrofrontend(config, { enablePerformanceMonitoring: true });

Contributing

See the main Contributing Guide for details on how to contribute to this project.

License

MIT License - see LICENSE for details.