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

@melt-js/libs-bag-entry

v2026.11.7

Published

Unified entry package for the Vue Bag Admin runtime ecosystem.

Readme

@melt-js/libs-bag-entry

@melt-js/libs-bag-entry 是面向业务项目的统一运行时入口包。你可以只安装这一个主包,然后从同一个入口拿到宿主层、请求层、UI 组件层和插件协议层的常用能力。

安装

pnpm add @melt-js/libs-bag-entry vue vue-router pinia vue-i18n naive-ui

如果你需要官方插件,再额外安装对应插件包:

pnpm add @melt-js/comps-bag-shop @melt-js/comps-bag-sys

用法

先引入样式,再在入口里完成宿主初始化:

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'

import '@melt-js/libs-bag-entry/style.css'
import './style.css'

import { bootstrapPlugins, createHostI18n, createHostRouter, setupHttp } from '@melt-js/libs-bag-entry'
import { exampleRoutes } from './routes'

async function setupApp() {
  const app = createApp(App)
  const pinia = createPinia()
  const i18n = createHostI18n()
  const router = createHostRouter({
    routes: exampleRoutes,
    auth: false
  })

  app.use(pinia)
  app.use(i18n)
  app.use(router)

  // 如果项目已经接后端,可以在入口里统一注入请求配置。
  setupHttp({
    baseURL: import.meta.env.VITE_API_URL
  })

  await bootstrapPlugins({
    app,
    router,
    i18n,
    plugins: []
  })

  await router.isReady()
  app.mount('#app')
}

setupApp()

最小版 App.vue 可以只挂宿主容器:

<template>
  <HostApp />
</template>

<script setup lang="ts">
import { HostApp } from '@melt-js/libs-bag-entry'
</script>

如果只是轻量接入宿主壳层,可以先不提供登录页:

import type { AdminRouteRecordRaw } from '@melt-js/libs-bag-entry'

export const exampleRoutes: AdminRouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/HomeView'
  },
  {
    path: '/HomeView',
    name: 'HomeView',
    component: () => import('./views/HomeView.vue'),
    meta: {
      layout: 'default'
    }
  },
  {
    path: '/404',
    name: 'NotFound',
    component: () => import('./views/NotFound.vue'),
    meta: {
      public: true
    }
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: '/404'
  }
]

如果项目要启用默认后台登录守卫,把 auth 改成 true,并提供带 meta.public: true 的 /login 路由。

接入时通常按这个顺序来:

  1. 引入 @melt-js/libs-bag-entry/style.css
  2. 用 createHostI18n() 和 createHostRouter() 初始化宿主
  3. 如果要接后端,在入口里调用 setupHttp()
  4. 用 bootstrapPlugins() 注册插件和插件路由
  5. 在 App.vue 中挂载 HostApp

除了宿主能力,你也可以直接从主包拿请求层和 UI 组件:

import { http, PmProTable, PmProForm, PmSchemaForm } from '@melt-js/libs-bag-entry'

当前聚合范围

  • @melt-js/libs-bag-core
  • @melt-js/libs-bag-request
  • @melt-js/libs-bag-ui
  • @melt-js/libs-bag-host

配套官方插件

  • @melt-js/comps-bag-shop
  • @melt-js/comps-bag-sys

脚手架

如果你想直接生成一个宿主项目,请使用:

npx @melt-js/libs-bag-create my-admin

文档与社区

遇到接入、插件开发或中后台实践相关的问题,可以先查看使用文档;也欢迎通过下面的入口继续交流。