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-host

v2026.11.7

Published

`@melt-js/libs-bag-host` 是这套后台框架里的宿主层。它不承载具体业务,而是把一套后台应用真正跑起来需要的东西收在一起:默认布局、菜单状态、标签页缓存、权限指令、i18n 初始化、插件注册和路由引导。

Readme

@melt-js/libs-bag-host

@melt-js/libs-bag-host 是这套后台框架里的宿主层。它不承载具体业务,而是把一套后台应用真正跑起来需要的东西收在一起:默认布局、菜单状态、标签页缓存、权限指令、i18n 初始化、插件注册和路由引导。

如果把 @melt-js/libs-bag-core 理解成协议层,那 @melt-js/libs-bag-host 更像是“协议的执行器”。

安装

pnpm add @melt-js/libs-bag-host @melt-js/libs-bag-core @melt-js/libs-bag-request @melt-js/libs-bag-ui

@melt-js/libs-bag-host 依赖宿主项目自行提供 vue、vue-router、pinia、vue-i18n 和 naive-ui。如果你是通过 create-vue-bag-admin 初始化项目,这部分依赖会直接给你带好。

它负责什么

  • 创建宿主路由,并接管登录态与权限前置校验
  • 启动插件,把插件的 routes、menus、locales 和 install 钩子挂进应用
  • 提供默认后台壳层 HostApp
  • 暴露宿主 store,比如 useUserStore、useMenuStore、useTabBarStore
  • 提供 v-permission 指令和 PermissionAccess 组件

快速接入

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import {
  HostApp,
  PermissionAccess,
  bootstrapPlugins,
  createHostI18n,
  createHostRouter,
  registerPermissionDirective
} from '@melt-js/libs-bag-host'

完整入口可以参考示例应用 tpl-vue3-admin-naive-bag/src/main.ts。

如果你使用默认壳层,记得同时引入样式入口:

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

当前公开能力

  • HostApp
  • PermissionAccess
  • createHostI18n()
  • createHostRouter({ routes, auth })
  • bootstrapPlugins({ app, router, i18n, plugins })
  • registerPermissionDirective(app)
  • useAppConfigStore()
  • useMenuStore()
  • useTabBarStore()
  • useUserStore()

设计边界

  • 这个包自带一套默认后台布局,适合先跑起来,再按项目风格替换。
  • 路由鉴权支持 auth: false、auth: true 和自定义 auth 配置;轻量接入不再要求必须提供 /login 页面。
  • 现在已经提供可发布的包入口、类型产物和样式入口;后续演进重点会放在宿主适配能力,而不是继续堆叠业务模块。

推荐搭配

  • @melt-js/libs-bag-core: 插件协议、Schema 协议、字典协议
  • @melt-js/libs-bag-ui: Schema 组件层
  • @melt-js/libs-bag-request: HTTP / WS 能力
  • @melt-js/libs-bag-entry: 初始化宿主工程