mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
refactor(hls): [PKG-HLS-04] migrate modules and compatible types
This commit is contained in:
1 parent
ba93b98be5
commit
2f9bee4ee0
34 files changed
+4860
-88
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,71 @@
|
||||
# PKG-HLS-04:HLS 严格 TypeScript 与兼容声明
|
||||
|
||||
## 实现与兼容边界
|
||||
|
||||
上一任务建立的入口、映射、菜单、SDK 订阅模块迁移到 .ts,新增 types.ts 描述窄宿主、
|
||||
SDK 可选能力和选择模型。五个自有模块均纳入 strict/noUncheckedIndexedAccess,
|
||||
不引入 any、通配模块声明或 Hls 生产依赖。源码直接复用公开 Option/Result 类型,
|
||||
独立消费夹具校验源码工厂与公开工厂相互可赋值。实际模块地图见包内 ARCHITECTURE.md。
|
||||
|
||||
公开工厂、字面量 name、同步 update、控件名/图标、DOM/CSS 和运行时根/legacy 路径不变。
|
||||
getName 保留原 SDK 对象身份和普通函数调用,索引准确标为可选;默认质量/音轨字段可以推断,
|
||||
调用方可用泛型或回调注解选择真实 SDK 类型。旧 object 参数 formatter 仍可赋值。
|
||||
新增可选配置重载支持原来运行时就允许的省略/undefined;保留最后的必填重载,
|
||||
以兼容旧 Parameters<typeof factory>[0]['quality'] 类型提取,不将其改成可能 undefined。
|
||||
旧声明的 name 已是字面量,本次没有新增 name 写入限制。
|
||||
|
||||
.d.ts 继续为历史类型入口,.d.cts/.d.mts 提供 callable CommonJS/ESM 默认和命名类型桥,
|
||||
legacy 的 typesVersions 支持 TS 4.3 Node10 查找。没有改变三个 JavaScript 文件的路径,
|
||||
没有提前升级版本;逐包 next-major 与最终安装包检查继续由发布任务及 HLS-06 执行。
|
||||
|
||||
有限断言均有边界说明:入口承接外部附加的 art.hls,仍通过历史 errorHandle/media 检查;
|
||||
SDK on/off 断言位于函数能力检查之后;选择项索引位于相等长度检查之后。它们不验证全部
|
||||
外部 SDK 结构,不能替代运行时契约测试。新增的局部对象别名保持原方法接收者。
|
||||
|
||||
## 在线编辑器修复
|
||||
|
||||
旧生成方式保留 default/named exports 又附加 export=,严格编译生成结果会报告 TS2309。
|
||||
新增 scripts/plugin-editor-types.mjs 使用 AST 为 HLS 生成私有定义和 callable/global 类型桥,
|
||||
保留泛型默认和重载,拒绝未知 import/export,不静默删除依赖。build:ts 在写入该声明前
|
||||
以 TS 4.3.5/5.9.3 对核心+插件独立语义检查,skipLibCheck=false。
|
||||
生成器暂仅应用已验证的 HLS,其他插件按各自迁移任务接续;未手改 docs/assets/ts。
|
||||
|
||||
新测试检查输出可再生成、三条错误用法确实拒绝、损坏声明/未解析依赖不会被隐藏。
|
||||
真实 Monaco worker 用例在三个浏览器中加载实际生成文件,验证默认字段、旧类型提取、
|
||||
错误 formatter 诊断,并执行编译后的插件工厂。原核心 Monaco 示例也重跑并播放成功。
|
||||
HLS 编辑器用例自身只执行工厂,不宣称播放;实际播放由独立 HLS SDK 矩阵验证。
|
||||
首轮编辑器测试把重载错误预期写成 2322;实际 worker 正确返回 2769,无其他正例诊断。
|
||||
按真实重载语义纠正断言后,最终六项全部通过,没有修改声明来容忍非法返回。
|
||||
|
||||
## 验收证据
|
||||
|
||||
冻结文件为 [hls-types-validation.json](../baselines/hls-types-validation.json),保留源码/类型/
|
||||
生成脚本及产物指纹、浏览器输入与各用例结果、CI 日志摘要;旧任务冻结证据不覆盖。
|
||||
|
||||
| 项目 | 本次结果 |
|
||||
| --- | --- |
|
||||
| 结构与类型 | HLS 五个 TS 模块;全仓实际已迁移生产 TS 254 个严格检查通过 |
|
||||
| 旧/新类型消费者 | TS 5.9 Node10 CJS、NodeNext CJS/ESM、Bundler ESM 和 TS 4.3 Node10 CJS 正例零诊断,每组八条非法用法拒绝;另检查 CJS 命名空间与源码工厂 |
|
||||
| 实际 SDK 类型 | 真实 Hls.js 1.5.17 的 Level/MediaPlaylist 泛型消费;TS 5.9 零错误,TS 4.3 与 SDK-only 对照均仅两个既有 DOM 类型错误,插件无新增 |
|
||||
| Node 与产物 | 源码/发布专项 56 通过;加 main/legacy/ESM 构建共享契约累计 83 通过 |
|
||||
| 实际播放 | modern/legacy 各 35 passed、16 skipped、0 failed/retry,输入 SHA 与最终构建一致;覆盖新旧核心和插件四组合、选择/切源/失败/销毁/SDK 事件同步 |
|
||||
| 编辑器 | 核心+HLS 在 Chromium/Firefox/WebKit 共六项通过,无失败/重试/跳过 |
|
||||
| 完整本地 CI | yarn ci:check:536 项通过,496 单元、11 工程、29 基线;现有生成核心 editor unused eslint-disable 警告未手改 |
|
||||
| 构建 | yarn build artplayer-plugin-hls-control、yarn build:ts 通过;三份 dist 与 docs/compiled 字节一致 |
|
||||
|
||||
main 为 5266 raw / 2539 gzip9 字节,legacy 5322 / 2564,ESM 9649 / 3117。
|
||||
与上一任务相比只有局部别名/类型擦除后的微小变化,类型依赖未进入运行包,不声称体积优化。
|
||||
|
||||
## 未覆盖范围与交接
|
||||
|
||||
TS 4.3 的 MediaDecodingConfiguration/MediaCapabilitiesDecodingInfo 缺失来自真实 SDK
|
||||
声明与旧 lib.dom 组合;保留明确对照,不加虚假 DOM 定义,不以 skipLibCheck 隐藏。
|
||||
独立插件的旧编译器验收仍严格零诊断。SDK-01 和 HLS-ENV-01 保持 open。
|
||||
Windows WebKit 的 16 个播放跳过源于已确认缺少 MSE;能力/失败清理及 Monaco 测试照常运行。
|
||||
Safari/native、SDK worker/版本/分组轨道、官方示例及隔离 tarball 为 HLS-05/06 和发布门槛。
|
||||
|
||||
本步没有新增依赖;改进现有 build:ts、typecheck,新增生成 helper 和专项测试,已纳入
|
||||
现有 test:baseline/ci:check。包内文档、类型入口和生成产物随源码一起更新。
|
||||
本任务独立提交主题:refactor(hls): [PKG-HLS-04] migrate modules and compatible types。
|
||||
回退该 commit 可恢复上一任务四模块 JS 和旧类型/生成行为;保留 HLS-01~03 的基线与修复。
|
||||
提交并核实 Git 状态后进入 PKG-HLS-05。全项目目标继续,没有 push/tag/publish/merge。
|
||||
@@ -59,8 +59,20 @@ EX-03、REL-09/REVIEW-02 接续,SDK-01/HLS-ENV-01 保持 open。
|
||||
Safari/native fallback、更多 SDK 版本、安装包及示例页面全部组合不是本轮完成内容。
|
||||
显式安装产物映射暂不接受 HLS 源码回退;HLS-06 必须加入 HLS 包对应映射和隔离 tarball 消费。
|
||||
|
||||
## 后续实施
|
||||
## PKG-HLS-03/04 后续验证
|
||||
|
||||
PKG-HLS-03 拆出映射、UI 提交/删除、Hls 订阅与生命周期;把上述缺陷变成候选修复断言,
|
||||
保留发布版观察。PKG-HLS-04 迁移自有模块和公开类型,修正可选 option、getName 对象与可选 index,
|
||||
保持旧声明接受范围及分发路径。PKG-HLS-05/06 完成实际 SDK、浏览器、示例及安装包验收。
|
||||
PKG-HLS-03 已拆出映射、UI 提交/删除、Hls 订阅与生命周期;旧缺陷成为候选修复断言,
|
||||
保留发布版观察。该步最终 Node 专项 56 通过,三格式共享契约累计 83 通过,modern/legacy
|
||||
浏览器各 35 通过、16 跳过;以上早期 02 结果保持其原始范围,不冒充当前源码结果。
|
||||
|
||||
PKG-HLS-04 把五个模块迁移为严格 TS,公开类型保留旧调用和类型提取习惯,补齐默认字段、
|
||||
SDK 泛型、可选 index 和 CJS/ESM/legacy 声明路径。在线编辑器声明从公开源生成,构建时用
|
||||
TS 4.3/5.9 严格校验;真实 Monaco 验证推断、错误提示及编译后的工厂执行。
|
||||
这些编辑器用例不声称执行 HLS 播放,实际播放仍由 hls-control.spec.js 负责。
|
||||
本步结果见 [类型迁移记录](changes/2026-09-12-PKG-HLS-04-types.md) 和
|
||||
[冻结证据](baselines/hls-types-validation.json)。
|
||||
|
||||
实际 Hls.js 1.5.17 声明在 TS 4.3 缺少 MediaDecodingConfiguration 和
|
||||
MediaCapabilitiesDecodingInfo;仅 SDK 的消费者也出现相同两个诊断。插件无新增诊断,
|
||||
不注入虚假 DOM 定义或打开 skipLibCheck。独立插件五组类型模式均要求零诊断。
|
||||
PKG-HLS-05/06 继续完整 SDK、浏览器、示例及安装包验收,SDK-01/HLS-ENV-01 仍开放。
|
||||
+3
-2
@@ -4,7 +4,7 @@
|
||||
|
||||
基线:`40fcda6a37d0049d42e49c1e64e70d4fd9ba5f7f`。总任务 215 项,范围 22 个包及工作区/示例。
|
||||
|
||||
状态:todo 151 / doing 0 / blocked 0 / done 64 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。
|
||||
状态:todo 150 / doing 0 / blocked 0 / done 65 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。
|
||||
|
||||
前置依赖是启动条件;验收是完成条件。任务可以继续拆分,但不能复用或悄悄删除旧 ID。
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
| PKG-HLS-01 | artplayer-plugin-hls-control<br>核对包契约与历史用法 | BASE-05 | quality/audio 配置、getName、update、控件名及 Hls 实例绑定 | 源码/声明/README/demo/发布包差异已登记;公开形状和版本范围冻结 | H | done |
|
||||
| PKG-HLS-02 | artplayer-plugin-hls-control<br>建立特有行为与错误测试 | PKG-HLS-01, ENG-03, ENG-05 | Auto/手动实际 level、音轨、去重/过滤和拓扑变化 | 旧版本行为可重跑,成功/失败/切源/销毁有必要断言 | H | done |
|
||||
| PKG-HLS-03 | artplayer-plugin-hls-control<br>整理内部职责与资源 | PKG-HLS-02, CORE-11, CORE-14 | 映射计算与 selector 更新/删除、Hls 事件订阅分离 | 结构变化和缺陷修复分开记录;原 API/事件/资源生命周期通过 | H | done |
|
||||
| PKG-HLS-04 | artplayer-plugin-hls-control<br>迁移自有源码和公开类型 | PKG-HLS-03, ENG-04, ENG-06, CORE-07 | HLS 能力适配类型、回调上下文和旧 getName 参数 | 严格类型检查、旧消费样例通过;声明路径/导出和同步异步兼容 | H | todo |
|
||||
| PKG-HLS-04 | artplayer-plugin-hls-control<br>迁移自有源码和公开类型 | PKG-HLS-03, ENG-04, ENG-06, CORE-07 | HLS 能力适配类型、回调上下文和旧 getName 参数 | 严格类型检查、旧消费样例通过;声明路径/导出和同步异步兼容 | H | done |
|
||||
| PKG-HLS-05 | artplayer-plugin-hls-control<br>验证新旧核心和组合 | PKG-HLS-04, CORE-22 | 本地多码率 HLS、换成无轨道来源、旧核心和最终核心 | 最终核心与原支持范围核心分别通过;设备/SDK 缺证据不能标完成 | H | todo |
|
||||
| PKG-HLS-06 | artplayer-plugin-hls-control<br>验证分发并同步文档 | PKG-HLS-05, ENG-07 | hls.control.js、依赖范围与回退记录 | tarball 入口/资源、类型、8082 demo 和 README 一致,有回退记录 | H | todo |
|
||||
|
||||
@@ -468,3 +468,4 @@
|
||||
- PKG-HLS-01: [记录](baselines/hls-control-contract.md) [记录](baselines/hls-control-release.json) [记录](changes/2026-09-11-PKG-HLS-01-contract.md)
|
||||
- PKG-HLS-02: [记录](hls-validation.md) [记录](baselines/hls-sdk.json) [记录](baselines/hls-validation.json) [记录](changes/2026-09-11-PKG-HLS-02-tests.md)
|
||||
- PKG-HLS-03: [记录](changes/2026-09-12-PKG-HLS-03-modules.md) [记录](baselines/hls-modules-validation.json) [记录](hls-validation.md)
|
||||
- PKG-HLS-04: [记录](changes/2026-09-12-PKG-HLS-04-types.md) [记录](baselines/hls-types-validation.json) [记录](hls-validation.md)
|
||||
@@ -1,5 +1,20 @@
|
||||
# 进度与证据
|
||||
|
||||
## 最新完成:PKG-HLS-04 严格 TS 与公开类型
|
||||
|
||||
HLS 五个自有模块已迁移严格 TS;公开声明保留旧 object formatter、Parameters 配置提取、
|
||||
同步 update 及运行时入口,补齐默认字段、SDK 泛型、可选索引和 CJS/ESM/legacy 类型桥。
|
||||
在线编辑器由公开声明生成全局桥,并在 build:ts 内做双编译器严格语义检查。
|
||||
|
||||
完整本地 CI 536 项、254 个生产 TS 文件通过;HLS Node 专项 56 项,三格式累计 83 项通过。
|
||||
modern/legacy 浏览器各 35 通过、16 跳过,核心+HLS Monaco 六项通过;无失败/重试。
|
||||
最终产物输入指纹一致。实际 SDK 在 TS 4.3 的两个 DOM 类型缺失诊断有 SDK-only 对照,
|
||||
不隐藏或称为全 SDK 支持;Windows WebKit 的 MSE/Safari 缺口依然开放。
|
||||
|
||||
见 [交付记录](changes/2026-09-12-PKG-HLS-04-types.md)、[冻结证据](baselines/hls-types-validation.json)
|
||||
和包内 ARCHITECTURE.md。65 done、150 todo;本任务独立本地 commit,核实后进入 PKG-HLS-05。
|
||||
完整 SDK/组合/安装包、其余生态包、性能/CI/CD/版本/复盘继续执行原计划,没有公开发布。
|
||||
|
||||
## 最新完成:PKG-HLS-03 源码分层与生命周期修复
|
||||
|
||||
HLS control 已拆为入口、选择映射、菜单管理、SDK 订阅四个 JS 模块,保持公开入口和同步调用;修复空轨道旧菜单、过期回调、Auto 标签、重复组丢失选中态,并补事件同步、销毁/订阅失败恢复及重入保护。公开类型和严格 TS 迁移属于下一步 04。
|
||||
|
||||
+1
-1
@@ -610,7 +610,7 @@
|
||||
"EX-03"
|
||||
],
|
||||
"evidence": [
|
||||
"packages/artplayer-plugin-hls-control/src/index.js",
|
||||
"packages/artplayer-plugin-hls-control/src/index.ts",
|
||||
"docs/assets/example/hls.control.js",
|
||||
"refactor/hls-validation.md"
|
||||
],
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
// eslint-disable-next-line test/no-import-node-test -- Use the repository's built-in baseline runner.
|
||||
import test from 'node:test'
|
||||
import { ESLint } from 'eslint'
|
||||
import ts from 'typescript'
|
||||
import compat from 'typescript-compat'
|
||||
import { checkPluginEditorDeclaration, generatePluginEditorDeclaration } from '../../scripts/plugin-editor-types.mjs'
|
||||
import { checkConsumer } from '../../scripts/typecheck.mjs'
|
||||
import { ensureArchive, readMember, refactorDir } from './releases.mjs'
|
||||
|
||||
test('HLS generated editor types are reproducible, standalone and reject invalid formatter uses', async () => {
|
||||
const source = fs.readFileSync(new URL('../../packages/artplayer-plugin-hls-control/types/artplayer-plugin-hls-control.d.ts', import.meta.url), 'utf8')
|
||||
const generated = generatePluginEditorDeclaration(source, 'artplayerPluginHlsControl')
|
||||
const file = 'docs/assets/ts/artplayer-plugin-hls-control.d.ts'
|
||||
const [formatted] = await new ESLint({ fix: true, fixTypes: ['layout'] }).lintText(generated, { filePath: file })
|
||||
assert.equal(formatted.errorCount, 0)
|
||||
assert.equal(fs.readFileSync(file, 'utf8').replaceAll('\r\n', '\n'), formatted.output || generated, 'Run yarn build:ts')
|
||||
const core = fs.readFileSync('docs/assets/ts/artplayer.d.ts', 'utf8')
|
||||
const consumer = `
|
||||
const option: artplayerPluginHlsControl.Option = { quality: { getName: (level, index) => level.height + ':' + index }, audio: { getName: track => track.name } }
|
||||
const legacyOption: NonNullable<Parameters<typeof artplayerPluginHlsControl>[0]['quality']> = { getName: (value: object) => String(value) }
|
||||
const plugin: (art: Artplayer) => artplayerPluginHlsControl.Result = artplayerPluginHlsControl(option)
|
||||
artplayerPluginHlsControl()
|
||||
artplayerPluginHlsControl(undefined)
|
||||
artplayerPluginHlsControl({ quality: { getName: (value: { bitrate: number }) => String(value.bitrate) } })
|
||||
// @ts-expect-error Formatter must return a string.
|
||||
artplayerPluginHlsControl({ quality: { getName: level => level.height } })
|
||||
// @ts-expect-error Default quality type cannot silently become any.
|
||||
artplayerPluginHlsControl({ quality: { getName: level => level.missing } })
|
||||
// @ts-expect-error Private definitions must not leak into globals.
|
||||
const hidden: artplayerPluginHlsControlDefinitions.Option = {}
|
||||
void [legacyOption, plugin, hidden]
|
||||
`
|
||||
for (const compiler of [ts, compat]) {
|
||||
assert.deepEqual(checkPluginEditorDeclaration(generated, core, consumer, compiler), [], compiler.version)
|
||||
assert.equal(checkPluginEditorDeclaration(generated, core, consumer.replaceAll(/\/\/ @ts-expect-error[^\n]*\n/g, ''), compiler).length, 3)
|
||||
assert(checkPluginEditorDeclaration(`${generated}\nexport interface Broken { value: MissingType }`, core, '', compiler).some(item => item.code === 2309), 'Do not hide incompatible export assignment or unresolved declarations')
|
||||
}
|
||||
assert.throws(() => generatePluginEditorDeclaration(source.replace('from \'artplayer\'', 'from \'missing-sdk\''), 'artplayerPluginHlsControl'), /Unsupported plugin editor import/)
|
||||
assert.throws(() => generatePluginEditorDeclaration(`${source}\nexport { Missing } from './missing'`, 'artplayerPluginHlsControl'), /Unsupported plugin editor declaration/)
|
||||
assert.throws(() => generatePluginEditorDeclaration('export interface {', 'plugin'), /Invalid plugin declaration syntax/)
|
||||
})
|
||||
|
||||
test('HLS root, legacy, named types and callback inference work across old and modern compilers', () => {
|
||||
const source = fs.readFileSync(path.join(refactorDir, '../test/types/hls-control.ts'), 'utf8')
|
||||
for (const [compiler, mode] of [[ts, 'node10-commonjs'], [ts, 'nodenext-cjs'], [ts, 'nodenext-esm'], [ts, 'bundler-esm'], [compat, 'node10-commonjs']]) {
|
||||
assert.deepEqual(checkConsumer(compiler, mode, source), [], `${compiler.version} ${mode}`)
|
||||
const invalid = source.replaceAll(/\/\/ @ts-expect-error[^\n]*\n/g, '')
|
||||
assert.equal(checkConsumer(compiler, mode, invalid).length, 8, `${compiler.version} ${mode} must reject all invalid uses`)
|
||||
}
|
||||
const cjs = 'import hls = require(\'artplayer-plugin-hls-control\'); import legacy = require(\'artplayer-plugin-hls-control/legacy\'); const option: hls.Option = { audio: { getName: track => track.name } }; hls(option); legacy();'
|
||||
assert.deepEqual(checkConsumer(ts, 'nodenext-cjs', cjs), [])
|
||||
})
|
||||
|
||||
test('HLS callback generics accept actual pinned SDK declarations without a runtime dependency', async () => {
|
||||
const { release } = JSON.parse(fs.readFileSync(path.join(refactorDir, 'baselines/hls-sdk.json')))
|
||||
const archive = await ensureArchive(release)
|
||||
const directory = fs.mkdtempSync(path.join(refactorDir, '.cache/hls-types-'))
|
||||
try {
|
||||
fs.writeFileSync(path.join(directory, 'sdk.d.ts'), readMember(archive, 'package/dist/hls.js.d.ts'))
|
||||
const filename = path.join(directory, 'consumer.ts')
|
||||
fs.writeFileSync(filename, `import type { Level, MediaPlaylist } from './sdk';
|
||||
import hls from 'artplayer-plugin-hls-control';
|
||||
hls<Level, MediaPlaylist>({ quality: { getName: level => String(level.bitrate) }, audio: { getName: track => track.name } });
|
||||
hls({ quality: { getName: (level: Level, index?: number) => level.height + ':' + index }, audio: { getName: (track: MediaPlaylist) => track.groupId } });
|
||||
`)
|
||||
for (const compiler of [ts, compat]) {
|
||||
const program = compiler.createProgram([filename], { strict: true, noEmit: true, skipLibCheck: false, types: [], esModuleInterop: true, module: compiler.ModuleKind.CommonJS, moduleResolution: compiler.ModuleResolutionKind.NodeJs, target: compiler.ScriptTarget.ES2020, lib: ['lib.es2020.d.ts', 'lib.dom.d.ts'] })
|
||||
const describe = program => compiler.getPreEmitDiagnostics(program).map(item => ({ file: item.file && path.basename(item.file.fileName), code: item.code, message: compiler.flattenDiagnosticMessageText(item.messageText, '\n') }))
|
||||
const expected = compiler === compat
|
||||
? [
|
||||
{ file: 'sdk.d.ts', code: 2304, message: 'Cannot find name \'MediaDecodingConfiguration\'.' },
|
||||
{ file: 'sdk.d.ts', code: 2304, message: 'Cannot find name \'MediaCapabilitiesDecodingInfo\'.' },
|
||||
]
|
||||
: []
|
||||
assert.deepEqual(describe(program), expected, `Actual Hls.js types / TS ${compiler.version}`)
|
||||
const sdkOnly = path.join(directory, 'sdk-only.ts')
|
||||
fs.writeFileSync(sdkOnly, 'import type { Level, MediaPlaylist } from \'./sdk\'; export type Inputs = [Level, MediaPlaylist];\n')
|
||||
const control = compiler.createProgram([sdkOnly], program.getCompilerOptions())
|
||||
assert.deepEqual(describe(control), expected, 'Old DOM library errors must originate in the SDK alone, not the plugin')
|
||||
assert(program.getSourceFiles().some(file => path.resolve(file.fileName) === path.join(directory, 'sdk.d.ts')))
|
||||
}
|
||||
}
|
||||
finally {
|
||||
const resolved = fs.realpathSync(directory)
|
||||
assert.equal(path.dirname(resolved), fs.realpathSync(path.join(refactorDir, '.cache')))
|
||||
assert(path.basename(resolved).startsWith('hls-types-'))
|
||||
fs.rmSync(resolved, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
+6
-2
@@ -1850,11 +1850,15 @@
|
||||
"ENG-06",
|
||||
"CORE-07"
|
||||
],
|
||||
"status": "todo",
|
||||
"status": "done",
|
||||
"risk": "H",
|
||||
"deliverable": "HLS 能力适配类型、回调上下文和旧 getName 参数",
|
||||
"acceptance": "严格类型检查、旧消费样例通过;声明路径/导出和同步异步兼容",
|
||||
"evidence": []
|
||||
"evidence": [
|
||||
"changes/2026-09-12-PKG-HLS-04-types.md",
|
||||
"baselines/hls-types-validation.json",
|
||||
"hls-validation.md"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PKG-HLS-05",
|
||||
|
||||
@@ -1027,10 +1027,10 @@
|
||||
"EX-03"
|
||||
],
|
||||
"sourceFiles": [
|
||||
"packages/artplayer-plugin-hls-control/src/index.js",
|
||||
"packages/artplayer-plugin-hls-control/src/mapping.js",
|
||||
"packages/artplayer-plugin-hls-control/src/menu.js",
|
||||
"packages/artplayer-plugin-hls-control/src/sdk-events.js",
|
||||
"packages/artplayer-plugin-hls-control/src/index.ts",
|
||||
"packages/artplayer-plugin-hls-control/src/mapping.ts",
|
||||
"packages/artplayer-plugin-hls-control/src/menu.ts",
|
||||
"packages/artplayer-plugin-hls-control/src/sdk-events.ts",
|
||||
"docs/assets/example/hls.control.js"
|
||||
],
|
||||
"contract": "Caller supplies art.hls; homepage demo loads hls.js 1.5.17. Preserve quality/audio selectors and old core integration.",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# 已实现的类型检查与迁移入口
|
||||
|
||||
PKG-HLS-04 增加 HLS 的 5 个严格 TS 源模块,公开声明保留历史 .d.ts 并增加 CJS/ESM 条件桥。
|
||||
test/types/hls-control.ts 覆盖配置省略、旧 Parameters 提取、默认字段和 SDK 泛型、同步返回,
|
||||
hls-source.ts 检查源码工厂与公开工厂可相互赋值。hls-types.test.mjs 对五组编译模式检查正反例,
|
||||
并消费实际 Hls.js 1.5.17 声明。TS 4.3 的两个 SDK 自有 DOM 缺失诊断有 SDK-only 对照,
|
||||
不作插件通过的豁免;独立插件消费者仍要求零错误。
|
||||
scripts/plugin-editor-types.mjs 与 build:ts 负责 HLS 全局声明生成和双编译器语义校验,
|
||||
真实 Monaco 用例为 test/browser/hls-editor-types.spec.js;它验证类型和编译后工厂执行,
|
||||
实际 HLS 播放由 hls-control.spec.js 验证。详见 changes/2026-09-12-PKG-HLS-04-types.md。
|
||||
下方按原任务保留历史计数;当前执行统计以本次冻结证据和 typecheck 输出为准。
|
||||
|
||||
CORE-21 已完成声明与消费者验收。核心公开声明源已迁至 packages/artplayer/public/,
|
||||
使用 yarn build:types 生成历史 types/ 路径;yarn check:types 只读检查漂移、
|
||||
源错误和内部依赖,已接入 ci:check。public/ 与 src/ 分别纳入严格检查,
|
||||
|
||||
Reference in new issue
Block a user