refactor(danmuku): [PKG-DANMUKU-06] migrate runtime and preserve public types

This commit is contained in:
Harvey Zhao committed 2026-09-13 22:06:00 +08:00
1 parent abc8008da7
commit 24b883d862
64 files changed
+14020 -633

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import type { Option, Result } from 'artplayer-plugin-danmuku'
import danmuku from 'artplayer-plugin-danmuku'
import legacy from 'artplayer-plugin-danmuku/legacy'
const legacyFactory: typeof danmuku = legacy
const rootFactory: typeof legacy = danmuku
const option: Option = { danmuku: [], points: [{ time: 1, value: 2 }] }
danmuku(option)
legacy(option)
declare const result: Result
const synchronous: Result = result.emit({ text: 'historical declaration' })
void [legacyFactory, rootFactory, synchronous]
// @ts-expect-error The published root requires its option argument.
danmuku()
// @ts-expect-error The published root requires danmuku in Option.
danmuku({})
// @ts-expect-error Preserve historical object points at the root.
danmuku({ danmuku: [], points: [[1, 2]] })
// @ts-expect-error Root emit keeps its published synchronous Result shape.
const asynchronous: Promise<Result> = result.emit({ text: 'old emit' })
void asynchronous