apps/api 单独嵌套 typescript ^7.0.2,`bun run --filter '@oj2/api' typecheck`
从此跑的是原生版;根和 apps/web 留在 5.9.3。api 在 TS 7 下 0 error,
另外塞了个故意写错的文件复检过,确认它真在报错、不是静默跳过。
前端升不了:vue-tsc 启动时要 require.resolve("typescript/lib/tsc"),
而 TS 7 的 exports 里已经没有这个子路径,直接
ERR_PACKAGE_PATH_NOT_EXPORTED。vue-tsc@latest 就是仓库里的 3.3.11,
还没有支持 TS 7 的版本 —— 它 peer 写的是 typescript >=5.0.0,范围太松,
装上去不报冲突、一跑就炸。读源码看到 resolveTscPath 里唯一的适配分支是认
@typescript/typescript6,可见 Vue 侧目前给的路只到 6。硬上的代价是丢掉
刚清零的前端类型门禁,不值得。
顺带清掉一处假配置:apps/web 原本声明着 "typescript": "^7.0.2",是
ae1fb32 从 ojnext 原样搬过来的,**从来没生效过** —— vue-tsc 被 hoist 在根
node_modules/,解析 typescript 时看的是根上那份 5.9.3,压根看不见
apps/web 里嵌套的 7.0.2。留着它有两个坏处:白拉 20 个
@typescript/typescript-* 平台包;哪天 bun 换个 hoist 策略把它提到根上,
vue-tsc 就会以那个看不懂的 ERR_PACKAGE_PATH_NOT_EXPORTED 挂掉。改成显式
跟随根版本。
所以现在的分工是:**vue-tsc 把根上的 typescript 钉死在 5.x**,谁要升根
版本谁先解决 vue-tsc。等 vue-tsc 支持 TS 7,把 apps/api 那行删掉、
根上升到 7 即可。
验证(删空 node_modules 重装后):apps/api tsc 7.0.2 下 0 error、
check:routes 167 条无遮蔽、apps/web vue-tsc 0 error、vite build 通过、
drizzle-kit v0.31.10 正常。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
40 lines
1.1 KiB
JSON
40 lines
1.1 KiB
JSON
{
|
|
"name": "@oj2/api",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "bun run --parallel dev:http dev:worker",
|
|
"dev:http": "bun --watch src/main.ts serve",
|
|
"dev:worker": "bun --watch src/main.ts worker",
|
|
"start": "bun src/main.ts serve",
|
|
"worker": "bun src/main.ts worker",
|
|
"build": "bun build --compile --target=bun-linux-x64 src/main.ts --outfile ../../dist/oj2-api",
|
|
"seed:dev": "bun src/scripts/seed-dev.ts",
|
|
"typecheck": "tsc --noEmit",
|
|
"check:routes": "bun src/scripts/check-route-shadowing.ts",
|
|
"db:pull": "drizzle-kit pull"
|
|
},
|
|
"dependencies": {
|
|
"@node-rs/jieba": "^2.0.2",
|
|
"@node-rs/jieba-linux-x64-gnu": "2.0.2",
|
|
"@oj2/contract": "workspace:*",
|
|
"bullmq": "^6.2.2",
|
|
"drizzle-orm": "^0.45.2",
|
|
"fflate": "^0.8.3",
|
|
"hono": "^4.13.4",
|
|
"ioredis": "^6.0.0",
|
|
"postgres": "^3.4.9",
|
|
"sql.js": "^1.14.2",
|
|
"tree-sitter-c": "^0.24.1",
|
|
"tree-sitter-python": "^0.25.0",
|
|
"web-tree-sitter": "^0.26.13",
|
|
"zod": "^4.4.3"
|
|
},
|
|
"devDependencies": {
|
|
"@types/sql.js": "^1.4.11",
|
|
"drizzle-kit": "^0.31.10",
|
|
"typescript": "^7.0.2"
|
|
}
|
|
}
|