New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vc-shell/framework

Package Overview
Dependencies
Maintainers
0
Versions
299
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vc-shell/framework

  • 1.0.340
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
48
decreased by-85.28%
Maintainers
0
Weekly downloads
 
Created
Source

Modularity Plugin

The Modularity Plugin provides two main features:

  • Dynamic Module Loading
  • Extensions System

Dynamic Module Loading

The Dynamic Module Loading system allows you to load Vue.js modules at runtime.

Usage

import { useDynamicModules } from '@framework/core/plugins/modularity';
import { createApp } from 'vue';
import { createRouter } from 'vue-router';
const app = createApp(App);
const router = createRouter(/ router config /);
const { load, extensionsHelper } = useDynamicModules(app, {
    router,
    appName: 'your-app-name'
  }, 
  {
    baseUrl: 'https://your-modules-host.com/',
    manifestFileName: 'manifest.json', // optional, default: 'manifest.json'
  });
// Load all modules
await load();

Module Structure

Each module should have:

  1. A manifest file (manifest.json) describing module files generated by Vite during build time
  2. An entry point file that exports a Vue plugin
  3. Optional CSS files

Example manifest.json:

{
  "entry": {
  "file": "index.js",
    "isEntry": true
  },
  "styles": {
    "file": "styles.css"
  }
}

Example module:

export default {
  install(app, options) {
  // Plugin installation code
  },
  extensions: {
  // Optional extensions configuration
  }
}

Extensions System

The Extensions System enables communication between the application and its modules.

Types of Extensions

  1. Inbound Extensions: Extensions that allow the application to customize and extend the module's functionality
  2. Outbound Extensions: Extensions that the module provides to extend the application's functionality

Registering Extensions

// In your module
export default {
  install(app) {
  // Plugin installation code
  },
  extensions: {
    inbound: {
      'customization-point': {
        // Extensions that this module accepts
        someConfig: true
      }
    },
    outbound: {
      'extension-point': [
        // Extensions this module provides
        {
          id: 'MyExtension',
          component: MyComponent,
        }
      ]
    }
  }
}

Using Extensions Helper

import { useExtensionsHelper } from '@vc-shell/framework';
import { inject } from 'vue';

// In your component setup
const extensionsHelper = inject(extensionsHelperSymbol);
// Get extensions provided by other modules
const outboundExtensions = extensionsHelper.getOutboundExtensions('extension-point');
// Get extensions configured for your module
const inboundExtensions = extensionsHelper.getInboundExtensions('your-module-id', 'customization-point');
// Get all extensions for a module
const moduleExtensions = extensionsHelper.getModuleExtensions('your-module-id');

Extension Types

  1. Component Extensions
interface ExtensionPoint = {
  id: string;
  component: Component;
}
  1. Composable Function Extensions
interface ComposableFunction = {
  id: string;
  fn: (...args: unknown[]) => unknown;
}
  1. Configuration Object Extensions
type Extension = Record<string, unknown>;

Best Practices

  1. Always provide unique IDs for extensions
  2. Document your module's extension points
  3. Handle missing or failed extensions gracefully
  4. Use TypeScript interfaces for type safety
  5. Keep extension configurations simple and serializable

FAQs

Package last updated on 06 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc