fix(danmaku): browser-safe entry, yarn test wiring, AGENTS map

This commit is contained in:
noelorin 2026-09-26 23:46:21 +08:00
parent b90d7dfc55
commit 5b095d677f
6 changed files with 22 additions and 2 deletions

View File

@ -13,6 +13,7 @@
| 包 | 职责 | 依赖 | | 包 | 职责 | 依赖 |
|----|------|------| |----|------|------|
| `@app/types` | Zod 入参 schema + 共享输出类型 | zod | | `@app/types` | Zod 入参 schema + 共享输出类型 | zod |
| `@app/danmaku` | 弹幕开放协议纯函数(签名/hash/XML/匹配/过滤;`./browser` 无 node:crypto) | — |
| `@app/models` | Drizzle 表定义(唯一 schema 源) | drizzle-orm | | `@app/models` | Drizzle 表定义(唯一 schema 源) | drizzle-orm |
| `@app/db` | libSQL/Turso 客户端单例 + drizzle-kit | models | | `@app/db` | libSQL/Turso 客户端单例 + drizzle-kit | models |
| `@app/dao` | 数据访问层(`userDao` / `mountDao` / `mediaItemDao` 等) | db, models | | `@app/dao` | 数据访问层(`userDao` / `mountDao` / `mediaItemDao` 等) | db, models |
@ -29,8 +30,10 @@
``` ```
web ──► trpc ──► dao ──► db ──► models web ──► trpc ──► dao ──► db ──► models
│ │ │ │ │ │ │
│ │ └──► danmaku │
│ └─────────────────┴──► types │ └─────────────────┴──► types
├──► danmaku(浏览器侧走 ./browser)
├──► design-tokens ├──► design-tokens
├──► seo-geo ├──► seo-geo
├──► i18n ├──► i18n
@ -55,6 +58,7 @@ docs(独立,不依赖上述业务包)
```bash ```bash
yarn install yarn install
yarn test # 各包 vitest(turbo run test)
yarn typecheck # 全仓 typecheck yarn typecheck # 全仓 typecheck
yarn lint # Biome yarn lint # Biome
yarn build # 全仓 build(依赖拓扑) yarn build # 全仓 build(依赖拓扑)

View File

@ -4,7 +4,7 @@ import {
serializeDanmakuXml, serializeDanmakuXml,
type DanmakuComment, type DanmakuComment,
type FilterOptions, type FilterOptions,
} from "@app/danmaku"; } from "@app/danmaku/browser";
export { filterComments, parseDanmakuXml, serializeDanmakuXml }; export { filterComments, parseDanmakuXml, serializeDanmakuXml };
export type { DanmakuComment, FilterOptions }; export type { DanmakuComment, FilterOptions };

View File

@ -20,6 +20,7 @@
"docs:dev": "yarn workspace @app/docs dev", "docs:dev": "yarn workspace @app/docs dev",
"docs:build": "yarn workspace @app/docs build", "docs:build": "yarn workspace @app/docs build",
"typecheck": "turbo run typecheck", "typecheck": "turbo run typecheck",
"test": "turbo run test",
"test:e2e": "playwright test", "test:e2e": "playwright test",
"lint": "turbo run lint", "lint": "turbo run lint",
"clean": "turbo run clean", "clean": "turbo run clean",

View File

@ -9,6 +9,10 @@
".": { ".": {
"import": "./dist/index.js", "import": "./dist/index.js",
"types": "./dist/index.d.ts" "types": "./dist/index.d.ts"
},
"./browser": {
"import": "./dist/browser.js",
"types": "./dist/browser.d.ts"
} }
}, },
"scripts": { "scripts": {

View File

@ -0,0 +1,7 @@
/** 浏览器安全入口:不含 node:crypto(hash/signature)与 fetch 客户端(client)。 */
export { openCommentsToXml, parseDanmakuXml, serializeDanmakuXml } from "./xml.js";
export { filterComments, modeToKind } from "./filter.js";
export type { FilterOptions } from "./filter.js";
export { parseMatchOutcome, rankCandidates } from "./match.js";
export type { OpenMatchOutcome } from "./match.js";
export type { DanmakuComment, MatchCandidate } from "./types.js";

View File

@ -27,6 +27,10 @@
"lint": { "lint": {
"outputs": [] "outputs": []
}, },
"test": {
"dependsOn": ["^build"],
"outputs": []
},
"db:generate": { "db:generate": {
"cache": false, "cache": false,
"dependsOn": ["^build"] "dependsOn": ["^build"]