feat: implement build version check and update build info handling

This commit is contained in:
2026-02-25 15:53:00 +00:00
parent f6f565bbcb
commit e13e696253
10 changed files with 186 additions and 66 deletions

View File

@@ -50,40 +50,22 @@ const publishLocation = (_p?: string) => {
}
if (typeof history !== "undefined") {
if (typeof Proxy !== "undefined") {
// modern browser
const historyApply = (
target: (this: any, ...args: readonly any[]) => unknown,
thisArg: any,
argumentsList: string | readonly any[]
) => {
publishLocation(argumentsList && argumentsList.length >= 2 && argumentsList[2])
Reflect.apply(target, thisArg, argumentsList)
}
history.pushState = new Proxy(history.pushState, {
apply: historyApply,
})
history.replaceState = new Proxy(history.replaceState, {
apply: historyApply,
})
} else {
// ie11
const pushStateFn = history.pushState
const replaceStateFn = history.replaceState
history.pushState = function (data: any, title: string, url?: string) {
publishLocation(url)
// @ts-ignore
return pushStateFn.apply(history, arguments)
}
history.replaceState = function (data: any, title: string, url?: string) {
publishLocation(url)
// @ts-ignore
return replaceStateFn.apply(history, arguments)
}
const historyApply = (
target: (this: any, ...args: readonly any[]) => unknown,
thisArg: any,
argumentsList: string | readonly any[]
) => {
publishLocation(argumentsList && argumentsList.length >= 2 && argumentsList[2])
Reflect.apply(target, thisArg, argumentsList)
}
history.pushState = new Proxy(history.pushState, {
apply: historyApply,
})
history.replaceState = new Proxy(history.replaceState, {
apply: historyApply,
})
} // else ssr -> no history handling
typeof window !== "undefined" &&