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/module

v0.3.0-beta.11

Published

Proteus 模块化(module-plan):模块契约 defineModule + 校验(B1)——业务域声明式边界,编译期依赖图谱/分包的地基

Readme

@proteus-vue/module

Proteus 模块化(module-plan)——模块契约 defineModule + 校验(B1)+ 依赖图谱 / 分包评估 / 重复检测。业务域声明式边界,是编译期依赖图谱与分包规划的地基。

导出

| API | 说明 | |-----|------| | defineModule(config) | 模块契约声明:id / requires(依赖模块)/ pages / api 边界 + 编译期校验 | | validateModuleConfig(input) | 纯校验(ModuleValidationIssue[] 结果) | | scanModuleConfigs / loadModuleConfig / walkModuleConfigs / formatModuleCheck | 扫描 / 加载 / 遍历模块配置(CLI module:check 共用) | | DependencyGraph / buildModuleGraphManifest / moduleGraphToMermaid | 依赖图构建 + Manifest + Mermaid 可视化(循环依赖 CycleError、版本冲突检测) | | createModuleSystem / createModuleEventBus | 模块系统运行时(按契约加载实例 + 事件总线),satisfies / parseSemver 语义化版本比对 | | generateRollupOptions(options) | 模块化 Web 产物 codegen(按依赖图拆分 chunk) | | SUBPACKAGE_LIMITS / scanSubPackages / evaluateSubPackageSizes | 小程序分包规划:主包/分包大小评估(2MB/20MB 限制) | | readSubPackageRoots / scanDuplicateModules | 分包根扫描 + 跨分包重复模块检测 | | auditModule(module) | 模块审计(依赖/边界/大小) |

使用

import { defineModule, validateModuleConfig, DependencyGraph } from '@proteus-vue/module'

// 1. 模块契约(proteus-module.config.ts)
const cart = defineModule({
  id: 'cart',
  requires: ['catalog', 'user'],
  pages: ['pages/cart/index'],
  api: { expose: ['addItem'], consume: ['catalog.getSku'] },
})

// 2. 校验(纯函数)
const result = validateModuleConfig({ id: 'cart', requires: ['catalog'] })
if (!result.ok) console.error(result.errors)

// 3. 依赖图 + 循环检测
const graph = new DependencyGraph()
for (const cfg of allConfigs) graph.addModule(cfg)
console.log(graph.detectCycles()) // CycleError[]

子路径

| 子路径 | 说明 | |--------|------| | @proteus-vue/module/contract | 契约声明 + 校验(defineModule / validateModuleConfig) | | @proteus-vue/module/scan | 配置扫描 / 汇总(node 工具) |

设计要点

  • 模块边界声明式:requires 显式依赖、api.expose/consume 接口边界——编译期即可检查越权引用
  • 分包规划与重复检测为构建期工具能力,业务代码不直接依赖