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

@proteus-vue/router

v0.3.0-beta.28

Published

Proteus 路由:createRouter 工厂 + 守卫 + Skyline 转场 + <route> 扫描/校验/树构建(M1/M2)

Readme

@proteus-vue/router

Proteus 路由(router-plan M1/M2 + B11)——createRouter 工厂 + 守卫 + Skyline 转场 + <route> 扫描/校验/树构建。只依赖 @proteus-vue/shared 接口,禁止直连 wx(执行规则 4)。

导出

| API | 说明 | |-----|------| | createRouter(routes, options?) | 路由工厂:注入路由表(应用侧由 gen-routes 生成的 auto-routes 提供)+ 可选 auth 检查器——不再全局单例 | | router.beforeEach(guard) / router.afterEach(guard) | 实例级守卫注册(M6 三端一致;requiresAuth 自动守卫见 B11) | | navigateTo / navigateBack / redirectTo / switchTab / reLaunch 等 | 导航方法(MP 走 adapter,Web 走 history) | | WEB_TRANSITION_MAP / MP_ROUTE_TYPE_MAP / webTransitionName / mpRouteType / isTransition | Skyline 转场映射:业务声明式转场 → 双端实际转场类型(transform-transition) | | isSkyline / navigateWithCustomRoute | Skyline 自定义路由(wx.router)探测与导航 | | generateWebRoutes / generateMpConfig / mergeAppJson / flattenNodes / toPageConfig | 路由表 → Web routes / 小程序 app.json 配置 codegen | | StackSemantic / StylePlatform | 导航栈语义(stack-diff 补丁 / 样式平台对齐) | | computeRoutePatch / applyRoutePatch | 页面栈 diff 计算与应用(转场/返回一致性) | | parseDeepLinkUrl / matchPattern / isDeepLinkAllowed / resolveDeepLink / buildColdStartStack | 深链(B11 超级应用):冷启动路由栈构建 + 白名单校验 |

子路径

| 子路径 | 说明 | |--------|------| | @proteus-vue/router/types | 路由类型(RouteRecord / RouteParams / NavigateOptions) | | @proteus-vue/router/scan | <route> 块扫描(SFC / router 目录) | | @proteus-vue/router/tree | 路由树构建 | | @proteus-vue/router/rules | 路由规则校验 | | @proteus-vue/router/schema | 路由 schema | | @proteus-vue/router/merge | 路由配置合并 | | @proteus-vue/router/codegen | 路由表 codegen(Web routes / app.json) | | @proteus-vue/router/navigation / stack-diff / deep-link | 导航栈语义 / 栈 diff / 深链 | | @proteus-vue/router/transforms/transform-transition | Skyline 转场映射 |

使用

import { createRouter } from '@proteus-vue/router'
import routes from './router/auto-routes' // gen-routes 生成

const router = createRouter(routes, {
  auth: () => Boolean(getToken()), // requiresAuth 自动守卫(B11)
})

router.beforeEach((to, from) => {
  if (to.meta?.needLogin && !isLogin()) return false // 拦截
})

await router.navigateTo('/pages/cart', { transition: 'slide' }) // 双端转场一致

设计要点

  • 工厂化(拆包步骤 4):路由表由调用方注入,无全局单例——可测试、可多实例(微前端/子应用)
  • 禁止直连 wx:平台差异收敛在 @proteus-vue/shared adapter,路由层零平台分支