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

@toplocs/plugin-sdk

v1.1.0

Published

Official SDK for developing plugins for the TopLocs decentralized community platform

Readme

TopLocs Plugin SDK

Official SDK for developing plugins for the TopLocs decentralized community platform

npm version TypeScript License: MIT

The TopLocs Plugin SDK provides a complete development environment for building, testing, and deploying plugins for the TopLocs platform. It includes hot module reloading, TypeScript support, and a visual development environment that simulates the TopLocs plugin system.

🚀 Features

  • 🔥 Hot Module Reloading - Instant feedback during development
  • 🧩 Module Federation - Production-ready plugin architecture
  • 📦 TypeScript First - Full type safety and IntelliSense support
  • 🎨 Tailwind CSS - Pre-configured styling system
  • 🖼️ Visual Dev Environment - See your plugin in context
  • 🔧 Zero Config - Works out of the box

📦 Installation

npm install @toplocs/plugin-sdk
# or
pnpm add @toplocs/plugin-sdk
# or
yarn add @toplocs/plugin-sdk

🏁 Quick Start

1. Create Your Plugin Structure

// dev.ts
import { createPluginDevelopmentEnvironment } from '@toplocs/plugin-sdk';
import pluginConfig from './plugin.config';
import TopicContent from './components/TopicContent.vue';
import TopicSidebar from './components/TopicSidebar.vue';

const app = createPluginDevelopmentEnvironment({
  pluginConfig,
  components: {
    TopicContent,
    TopicSidebar
  }
});

app.mount('#app');

2. Define Plugin Configuration

// plugin.config.ts
import type { BasePluginConfig } from '@toplocs/plugin-sdk';

const config: BasePluginConfig = {
  id: 'my-awesome-plugin',
  name: 'My Awesome Plugin',
  url: 'http://localhost:3006/assets/plugin.js',
  version: '1.0.0',
  description: 'Adds awesome features to TopLocs',
  author: 'Your Name',
  slots: [
    {
      entity: 'Topic',
      page: 'Info',
      slot: 'Content',
      component: 'TopicContent'
    },
    {
      entity: 'Topic',
      page: 'Info', 
      slot: 'Sidebar',
      component: 'TopicSidebar'
    }
  ]
};

export default config;

3. Configure Vite

// vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import federation from '@originjs/vite-plugin-federation';

export default defineConfig({
  plugins: [
    vue(),
    federation({
      name: 'my-awesome-plugin',
      filename: 'plugin.js',
      exposes: {
        './TopicContent': './src/components/TopicContent.vue',
        './TopicSidebar': './src/components/TopicSidebar.vue'
      },
      shared: ['vue', 'vue-router']
    })
  ]
});

🏗️ Plugin Architecture

Slot System

TopLocs plugins integrate into specific "slots" within the platform:

| Entity | Pages | Available Slots | |--------|-------|----------------| | Topic | Info, Settings | Content, Sidebar | | Location | Info, Settings | Content, Sidebar |

Component Props

Every plugin component receives standardized props:

interface PluginComponentProps {
  parentId: string;      // ID of the parent entity (topic/location)
  query: LocationQuery;  // Route query parameters
}

Example Component

<template>
  <div class="plugin-content">
    <h2>{{ title }}</h2>
    <p>Viewing {{ entityType }} with ID: {{ parentId }}</p>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue';

const props = defineProps<{
  parentId: string;
  query: Record<string, any>;
}>();

const entityType = computed(() => 
  props.parentId.startsWith('topic-') ? 'Topic' : 'Location'
);

const title = computed(() => 
  `My Plugin - ${entityType.value}`
);
</script>

🛠️ Development Workflow

Development Mode

npm run dev
  • Starts development server with HMR
  • Visual environment at http://localhost:5173
  • Instant component updates
  • Vue DevTools support

Preview Mode

npm run build
npm run preview
  • Tests production build
  • Module Federation enabled
  • Simulates real plugin loading

Development Environment Features

The SDK provides a visual development environment with:

  • Entity Selector: Switch between Topic/Location contexts
  • Page Navigation: Test different page contexts (Info/Settings)
  • Slot Visualization: See how your components fit
  • Live Reload: Instant updates as you code

📚 API Reference

Main Functions

createPluginDevelopmentEnvironment(config)

Creates a Vue application configured for plugin development.

function createPluginDevelopmentEnvironment(config: PluginDevConfig): App<Element>

Parameters:

  • config.pluginConfig: Your plugin configuration
  • config.components: Map of component names to Vue components
  • config.importPaths: (Optional) Custom import paths

Returns: Configured Vue application instance

TypeScript Types

export interface BasePluginConfig {
  id: string;
  name: string;
  url: string;
  version?: string;
  description?: string;
  author?: string;
  slots: PluginSlot[];
}

export interface PluginSlot {
  entity: 'Topic' | 'Location';
  page: 'Info' | 'Settings';
  slot: 'Content' | 'Sidebar';
  component: string;
}

export interface PluginDevConfig {
  pluginConfig?: BasePluginConfig;
  components?: Record<string, any>;
  importPaths?: {
    configPath?: string;
    sidebarPath?: string;
    contentPath?: string;
  };
}

Exported Components

  • PluginEnvironment: Main development environment component
  • DirectComponent: Direct component renderer (dev mode)
  • PluginComponent: Federation component loader (preview mode)

🎯 Best Practices

  1. Component Organization

    src/
    ├── components/
    │   ├── TopicContent.vue
    │   ├── TopicSidebar.vue
    │   └── shared/
    ├── plugin.config.ts
    └── dev.ts
  2. State Management

    • Use Vue 3 Composition API
    • Leverage provide/inject for plugin-wide state
    • Keep components self-contained
  3. Styling

    • Use Tailwind classes for consistency
    • Scope custom styles to avoid conflicts
    • Follow TopLocs design system
  4. Performance

    • Lazy load heavy components
    • Optimize bundle size
    • Use Vue's async components

🔧 Troubleshooting

Common Issues

Module Federation Errors

# Clear cache and rebuild
rm -rf node_modules/.vite
npm run build

Type Errors

# Ensure TypeScript is configured correctly
npm run type-check

HMR Not Working

  • Check Vite config
  • Ensure components are properly exported
  • Verify dev server is running

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

MIT © TopLocs Team

🔗 Links


Made with ❤️ by the TopLocs team