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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cmmv/vue

v0.0.5

Published

CMMV module for generating RPC functions for Vue2 and Vue3

Downloads

19

Readme

Description

The @cmmv/vue module provides seamless integration between CMMV and Vue applications, offering a transpiler to generate mixins for Vue 2 and composables for Vue 3 based on CMMV contracts. This module enables efficient RPC function usage and provides transparent reading and writing of data using Protobuf contracts.

With @cmmv/vue, you can quickly connect your Vue applications to the CMMV framework, allowing full utilization of RPC functionalities with minimal setup.

Installation

Install the @cmmv/vue package via npm:

$ pnpm add @cmmv/vue

Features

  • RPC Integration: Easily connect Vue applications with CMMV RPC functions.
  • Automatic Protobuf Parsing: Provides transparent handling of Protobuf contracts for reading and writing data.
  • Mixins for Vue 2: Automatically generated mixins simplify RPC integration.
  • Composables for Vue 3: Leverage Vue's Composition API with generated composables for better reactivity and code organization.
  • Dynamic Contract Updates: Automatically updates when contracts are modified on the server side.

Quick Start

Vue 2

For Vue 2, the module generates mixins for handling RPC methods. Here's an example:

import Vue from 'vue';
import RPCMixins from '/assets/rpc-mixins.js';

// Register RPC Mixins globally
Vue.mixin(RPCMixins);

new Vue({
  el: '#app',
  data: {
    message: '',
  },
  async created() {
    // Example RPC call
    this.message = await this.rpc.getMessage({ id: 1 });
  },
});

Vue 3

For Vue 3, the module generates composables for streamlined integration with the Composition API:

import { createApp } from 'vue';
import { useRPC } from '/assets/rpc-composables.js';

const app = createApp({
  setup() {
    const rpc = useRPC();
    const message = ref('');

    onMounted(async () => {
      message.value = await rpc.getMessage({ id: 1 });
    });

    return { message };
  },
});

app.mount('#app');

Nuxt

In the plugins/ directory, create a file named rpc.client.ts to register the RPC composables globally.

import { defineNuxtPlugin } from '#app';
import { useRPC } from '/assets/rpc-composables.js';

export default defineNuxtPlugin(() => {
    return {
        provide: {
            rpc: useRPC(),
        },
    };
});

Example Component: pages/index.vue

<template>
  <div>
    <h1>Tasks</h1>
    <ul>
      <li v-for="task in tasks" :key="task.id">
        {{ task.label }} - {{ task.checked ? 'Completed' : 'Pending' }}
      </li>
    </ul>
    <button @click="fetchTasks">Load Tasks</button>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const tasks = ref([]);
const { $rpc } = useNuxtApp();

const fetchTasks = async () => {
  try {
    tasks.value = await $rpc.GetTasksList();
  } catch (error) {
    console.error('Error fetching tasks:', error);
  }
};
</script>