Skip to content

包结构总览 ​

v0.2 起,原有的 24 个细粒度 npm 包收敛为 5 个发布包 + 2 个私有工具包。所有子模块通过 package.json exports 的子路径提供,按需引入、摇树友好。

packages/
├── core/        @ng-mfe/core        引擎内核 + 沙箱 + 事件总线 + 共享状态 + 工具
├── services/    @ng-mfe/services    11 项界面无关企业服务
├── adapters/    @ng-mfe/adapters    Angular / Vue / React 框架适配器
├── ui/          @ng-mfe/ui          chart / map / schema-form / smart-table
├── testing/     @ng-mfe/testing     测试辅助(公开)
├── devtools/    @ng-mfe/devtools    调试面板(私有)
└── cli/         @ng-mfe/cli         脚手架(私有)

子路径索引 ​

包子路径
@ng-mfe/core.(引擎) · /sandbox · /event-bus · /shared-state · /util
@ng-mfe/services.(全量重导出) · /acl · /auth · /cache · /feature-flag · /http-pipeline · /logger · /mock · /notification · /storage · /theme · /websocket
@ng-mfe/adapters.(= angular) · /angular · /vue · /react
@ng-mfe/ui.(仅版本号) · /chart · /map · /schema-form · /smart-table

依赖方向(分层单向) ​

examples/apps ──▶ @ng-mfe/ui ──▶ @ng-mfe/services ──▶ @ng-mfe/core
       └────────▶ @ng-mfe/adapters ──────────┘
  • core 不依赖任何上层包(仅内部引用自身子模块);
  • services 仅依赖 core;
  • adapters 依赖 core + services,框架依赖(react/vue)为可选 peer;
  • ui 无运行时依赖 — echarts / maplibre-gl 均为运行时动态 import(),未安装时静默降级。

约束由 Nx enforce-module-boundaries + scope 标签(scope:core / scope:service / scope:adapter / scope:biz / scope:util)强制。

从 v0.1 迁移 ​

v0.1 旧包v0.2 新导入
@ng-mfe/sandbox @ng-mfe/event-bus @ng-mfe/shared-state @ng-mfe/util@ng-mfe/core/sandbox @ng-mfe/core/event-bus @ng-mfe/core/shared-state @ng-mfe/core/util
@ng-mfe/acl @ng-mfe/auth @ng-mfe/cache 等全部服务包@ng-mfe/services/acl @ng-mfe/services/auth @ng-mfe/services/cache …
@ng-mfe/angular-adapter @ng-mfe/vue-adapter @ng-mfe/react-adapter@ng-mfe/adapters/angular @ng-mfe/adapters/vue @ng-mfe/adapters/react
@ng-mfe/chart @ng-mfe/map @ng-mfe/schema-form @ng-mfe/smart-table@ng-mfe/ui/chart @ng-mfe/ui/map @ng-mfe/ui/schema-form @ng-mfe/ui/smart-table

包名迁移是纯机械替换:源码 API 保持不变。

基于 MIT License 发布