Package Exports
- @vortex-browser/shared
- @vortex-browser/shared/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@vortex-browser/shared) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@vortex-browser/shared
Vortex 单子项目共享的类型与协议常量。纯类型 / 常量包,无运行时副作用。所有上游(extension / server / cli / mcp)都从这里导入,避免协议分裂。
内容
| 文件 | 内容 |
|---|---|
actions.ts |
全部 action 名常量(PageActions.NAVIGATE = "page.navigate" 等),按模块分组的枚举 |
protocol.ts |
VtxRequest / VtxResponse / VtxEvent / NmRequest / NmResponse 等线缆消息类型 |
errors.ts |
VtxErrorCode 枚举(TIMEOUT、NOT_FOUND、PERMISSION_DENIED 等) |
index.ts |
统一 re-export |
使用
import {
PageActions, DomActions,
type VtxRequest, type VtxResponse,
VtxErrorCode,
} from "@vortex-browser/shared";
const req: VtxRequest = {
id: "x",
action: PageActions.NAVIGATE,
params: { url: "https://example.com" },
};添加/修改 action
- 在
actions.ts对应模块枚举里新增条目 - extension 端在
packages/extension/src/handlers/<mod>.ts注册处理函数 - 如需新错误码:在
errors.ts加VtxErrorCode成员
构建
pnpm build # tsc 一次
pnpm dev # tsc --watch下游包通过 workspace 协议引用:"@vortex-browser/shared": "workspace:*",改动后无需 publish 即生效。