chore(依赖): 前后端依赖升到最新,补上机房 Chrome 105 缺的两个 polyfill

几处随升级改的:
- VueUse 15 的 useNow 不再收 interval,不传 scheduler 默认逐帧刷新。比赛列表(1 秒)
  和后台建比赛(15 秒)改成用 useIntervalFn 当调度器,频率不变。
- 重新探测 modernPolyfills:mermaid 12 用了 Object.groupBy(Chrome 117),core-js 新数据
  把 URL.parse(Chrome 126)也算进来了,不补的话机房老机器上静默报 TypeError。清单 52 项。
- vue-router 5.4 弃用了导航守卫里的 next(),全局守卫改成返回值。
- web-tree-sitter 0.27:AST 规则在 dev 和编译后的二进制里各跑过一遍,判过、判不过都对;
  jieba 2.0.4 原生模块在仓库外起二进制能正常分词。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-12 14:03:34 +08:00
1 parent 6f47ad8358
commit e6c02dce33
7 files changed
+242 -199

No files matched your search

+8 -8
View File
@@ -21,25 +21,25 @@
"db:migrate": "bun --env-file=../../.env src/main.ts migrate"
},
"dependencies": {
"@node-rs/jieba": "^2.0.2",
"@node-rs/jieba-linux-x64-gnu": "2.0.2",
"@node-rs/jieba": "^2.0.4",
"@node-rs/jieba-linux-x64-gnu": "2.0.4",
"@oj2/contract": "workspace:*",
"bullmq": "^6.2.2",
"drizzle-orm": "^0.45.2",
"bullmq": "^6.3.12",
"drizzle-orm": "^0.45.4",
"fflate": "^0.8.3",
"hono": "^4.13.4",
"hono": "^4.13.13",
"ioredis": "^6.0.0",
"postgres": "^3.4.9",
"sql.js": "^1.14.2",
"tree-sitter-c": "^0.24.1",
"tree-sitter-cpp": "^0.23.4",
"tree-sitter-python": "^0.25.0",
"web-tree-sitter": "^0.26.13",
"zod": "^4.4.3"
"web-tree-sitter": "^0.27.1",
"zod": "^4.6.6"
},
"devDependencies": {
"@types/sql.js": "^1.4.11",
"drizzle-kit": "^0.31.10",
"drizzle-kit": "^0.31.11",
"typescript": "^7.0.2"
}
}
+22 -22
View File
@@ -16,10 +16,10 @@
"@codemirror/lang-markdown": "^6.5.2",
"@codemirror/lang-python": "^6.2.1",
"@codemirror/lang-sql": "^6.10.0",
"@codemirror/language": "^6.12.4",
"@codemirror/state": "^6.7.1",
"@codemirror/view": "^6.43.9",
"@lezer/highlight": "^1.2.3",
"@codemirror/language": "^6.13.1",
"@codemirror/state": "^6.7.6",
"@codemirror/view": "^6.43.14",
"@lezer/highlight": "^1.2.5",
"@oj2/contract": "workspace:*",
"@vue-flow/background": "^1.3.2",
"@vue-flow/controls": "^1.1.3",
@@ -27,11 +27,11 @@
"@vue-flow/minimap": "^1.5.4",
"@vue-flow/node-resizer": "^1.5.1",
"@vue-flow/node-toolbar": "^1.1.1",
"@vueuse/core": "^14.4.0",
"@vueuse/router": "^14.4.0",
"@wangeditor-next/editor": "^6.2.0",
"@wangeditor-next/editor-for-vue": "^6.2.0",
"axios": "^1.19.0",
"@vueuse/core": "^15.0.0",
"@vueuse/router": "^15.0.0",
"@wangeditor-next/editor": "^6.5.0",
"@wangeditor-next/editor-for-vue": "^6.5.0",
"axios": "^1.20.0",
"canvas-confetti": "^1.9.4",
"chart.js": "^4.5.1",
"chartjs-chart-wordcloud": "^4.4.5",
@@ -40,33 +40,33 @@
"date-fns": "^4.4.0",
"fflate": "^0.8.3",
"highlight.js": "^11.12.0",
"lib0": "0.2.117",
"lib0": "0.2.119",
"markdown-it": "^14.3.0",
"mermaid": "^11.17.2",
"naive-ui": "^2.45.2",
"nanoid": "^6.0.1",
"mermaid": "^12.1.0",
"naive-ui": "^2.45.3",
"nanoid": "^6.0.2",
"normalize.css": "^8.0.1",
"pinia": "^4.0.3",
"pinyin-pro": "^3.29.3",
"vue": "^3.5.41",
"pinyin-pro": "^3.29.5",
"vue": "^3.5.43",
"vue-chartjs": "^5.3.4",
"vue-codemirror": "^6.1.1",
"vue-router": "^5.2.0",
"vue-router": "^5.4.0",
"y-codemirror.next": "^0.3.6",
"y-protocols": "1.0.7",
"yjs": "^13.6.32"
"yjs": "^13.6.33"
},
"devDependencies": {
"@iconify/vue": "^5.0.1",
"@iconify/vue": "^5.0.3",
"@types/canvas-confetti": "^1.9.0",
"@types/markdown-it": "^14.1.2",
"@types/node": "^26.3.0",
"@types/node": "^26.6.5",
"@vitejs/plugin-legacy": "^8.2.3",
"@vitejs/plugin-vue": "^6.0.8",
"@vitejs/plugin-vue": "^6.0.10",
"@vue/tsconfig": "^0.9.1",
"unplugin-auto-import": "^21.1.0",
"unplugin-vue-components": "^32.1.0",
"vite": "^8.2.2",
"vue-tsc": "^3.3.11"
"vite": "^8.3.4",
"vue-tsc": "^3.3.13"
}
}
+2 -1
View File
@@ -61,7 +61,8 @@ const customDuration = ref(false)
const pickedStart = ref(toPickerValue(Date.now() + 10 * 60_000))
// 「10 分钟后」跟着钟走:老师在这页磨蹭几分钟再保存,开始时间也还是保存时的 10 分钟后
const now = useNow({ interval: 15_000 })
// VueUse 15 起 useNow 不收 interval 了,不传 scheduler 默认是逐帧刷新
const now = useNow({ scheduler: (cb) => useIntervalFn(cb, 15_000) })
function roundedNow() {
const ms = now.value.getTime()
return ms - (ms % 60_000)
+8 -15
View File
@@ -26,13 +26,13 @@ import { useUserStore } from "./shared/store/user"
const authStore = useAuthModalStore()
router.beforeEach(async (to, _from, next) => {
// vue-router 5.4 起 next() 回调已弃用,改成返回值:返回 "/" 就是跳回首页,什么都不返回就是放行
router.beforeEach(async (to) => {
// 检查是否需要认证
if (to.matched.some((record) => record.meta.requiresAuth)) {
if (!storage.get(STORAGE_KEY.AUTHED)) {
authStore.openLoginModal()
next("/")
return
return "/"
}
}
@@ -47,8 +47,7 @@ router.beforeEach(async (to, _from, next) => {
) {
if (!storage.get(STORAGE_KEY.AUTHED)) {
authStore.openLoginModal()
next("/")
return
return "/"
}
const userStore = useUserStore()
@@ -56,29 +55,23 @@ router.beforeEach(async (to, _from, next) => {
try {
await userStore.getMyProfile()
} catch {
next("/")
return
return "/"
}
}
if (to.matched.some((record) => record.meta.requiresSuperAdmin)) {
if (!userStore.isSuperAdmin) {
next("/")
return
return "/"
}
} else if (to.matched.some((record) => record.meta.requiresTeacherAdmin)) {
if (!userStore.isTeacherOrAbove) {
next("/")
return
return "/"
}
} else if (to.matched.some((record) => record.meta.requiresProblemPermission)) {
if (!userStore.hasProblemPermission) {
next("/")
return
return "/"
}
}
}
next()
})
app.mount("#app")
+2 -1
View File
@@ -89,7 +89,8 @@ onMounted(() => {
watchDebounced(() => query.keyword, listContests, { debounce: 500, maxWait: 1000 })
watch(() => [query.page, query.limit, query.scope], listContests)
const now = useNow({ interval: 1000 })
// VueUse 15 起 useNow 不收 interval 了,不传 scheduler 默认是逐帧刷新
const now = useNow({ scheduler: (cb) => useIntervalFn(cb, 1000) })
function remaining(contest: Contest) {
const seconds = Math.floor((Date.parse(contest.endTime) - now.value.getTime()) / 1000)
const text = secondsToDuration(Math.max(0, seconds))
+3 -1
View File
@@ -9,7 +9,7 @@ import { NaiveUiResolver } from "unplugin-vue-components/resolvers"
// 但比 vite 8 的默认构建 target(chrome111)低。所以这个插件必须留着:它同时管两件事
// —— 把 build.target 压到 chrome105/es2020,再给现代产物补 core-js 的 API polyfill。
//
// 下面这份清单是 `modernPolyfills: true` 自动探测出来的 50 项,抄下来写死:自动探测要
// 下面这份清单是 `modernPolyfills: true` 自动探测出来的 52 项,抄下来写死:自动探测要
// 对每个产物跑一遍 Babel 扫描,构建从 3 秒涨到 12 秒。**升级前端依赖后重新审计一次**:
// DEBUG=vite:legacy bun run build # 会打印 modern polyfills 的全集
// 少一项就是老机器上一个静默的 TypeError(这批缺的大多是 Chrome 110+ 的
@@ -39,6 +39,7 @@ const polyfills = [
"es.json.stringify",
"es.map.get-or-insert",
"es.map.get-or-insert-computed",
"es.object.group-by",
"es.regexp.escape",
"es.regexp.flags",
"es.set.difference.v2",
@@ -65,6 +66,7 @@ const polyfills = [
"web.url-search-params.has",
"web.url-search-params.size",
"web.url.can-parse",
"web.url.parse",
]
// MaxKB 脚本**不要**在这里注入 index.html。