Skip to content

Commit 5c4144f

Browse files
committed
perf: 删除无用函数
1 parent defce70 commit 5c4144f

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

packages/core/src/context.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -415,34 +415,6 @@ export class PageContext {
415415
return writeDeclaration(this, this.options.dts)
416416
}
417417

418-
private async writePagesJSONFile(pagesJson: string, retry = 3): Promise<void> {
419-
if (retry <= 0) {
420-
debug.error(`${this.resolvedPagesJSONPath} 获取文件锁失败,写入失败`)
421-
return
422-
}
423-
424-
let relase: () => Promise<void> | undefined
425-
426-
try {
427-
try {
428-
// 获取文件锁
429-
relase = await lockfile.lock(this.resolvedPagesJSONPath, { realpath: false })
430-
}
431-
catch {
432-
// 获取文件锁失败
433-
return this.writePagesJSONFile(pagesJson, retry - 1)
434-
}
435-
await fs.promises.writeFile(this.resolvedPagesJSONPath, pagesJson, { encoding: 'utf-8' }) // 执行写入操作
436-
}
437-
finally {
438-
// eslint-disable-next-line ts/ban-ts-comment
439-
// @ts-expect-error'
440-
if (relase) {
441-
await relase() // 释放文件锁
442-
}
443-
}
444-
}
445-
446418
private async genratePagesJSON() {
447419
const content = await fs.promises.readFile(this.resolvedPagesJSONPath, { encoding: 'utf-8' }).catch(() => '')
448420

0 commit comments

Comments
 (0)