mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 10:31:20 -08:00
refactor(audio): [PKG-AUDIO-04] migrate strict source and compatible type entries
This commit is contained in:
1 parent
9c07ea830c
commit
13c898c149
31 files changed
+18923
-90
No files matched your search
@@ -1,16 +1,17 @@
|
||||
# Audio Track maintenance
|
||||
|
||||
The default factory in src/index.js keeps the public `(option) => (art) => result`
|
||||
The default factory in src/index.ts keeps the public `(option) => (art) => result`
|
||||
contract. The result exposes the same HTMLAudioElement for its entire lifetime, a
|
||||
literal name, and synchronous update. Public declarations remain authored in types/
|
||||
until the separate type migration; do not infer new public methods from internal helpers.
|
||||
literal name, and synchronous update. Public declarations are authored in types/ and checked
|
||||
against the strict source by test/types/audio-track-source.ts. Do not infer public methods
|
||||
from internal helpers. Both source files are strict TS without ambient Node types or any escapes.
|
||||
|
||||
## Responsibilities
|
||||
|
||||
- src/index.js owns ArtPlayer subscriptions, reads host media/volume/rate, adapts public
|
||||
- src/index.ts owns ArtPlayer subscriptions, reads host media/volume/rate, adapts public
|
||||
update, and rolls back partial installation. It uses only on/off and existing media
|
||||
properties, so it does not require new core lifecycle utilities.
|
||||
- src/track.js creates the Audio element and owns URL/offset/threshold and closed state.
|
||||
- src/track.ts creates the Audio element and owns URL/offset/threshold and closed state.
|
||||
It handles synchronization, play rejection and source updates. It does not import ArtPlayer,
|
||||
inspect DOM registries or install listeners. Dependencies flow from the entry to the track.
|
||||
|
||||
@@ -39,7 +40,7 @@ change; their remaining media validation is tracked in refactor/audio-validation
|
||||
|
||||
## Change and verify
|
||||
|
||||
Edit track.js for URL/sync/media ownership and index.js for host event handling. Keep
|
||||
Edit track.ts for URL/sync/media ownership and index.ts for host event handling. Keep
|
||||
published-only defect observations in the tests when adding candidate regressions.
|
||||
|
||||
```sh
|
||||
@@ -55,4 +56,29 @@ source. These are explicit local artifacts, not isolated installed npm packages.
|
||||
The browser suite includes frozen old core/plugin combinations, real AAC/decoded video,
|
||||
source failure recovery, and old/native pause/end plus corrected candidate cleanup.
|
||||
See refactor/audio-validation.md for failed baseline probes, Windows WebKit WAV/size limits,
|
||||
physical-device gaps and the separate 04/05/06 type/combination/distribution gates.
|
||||
physical-device gaps and the remaining 05/06 combination/distribution gates.
|
||||
|
||||
## Public type compatibility
|
||||
|
||||
The default and /legacy entries preserve the original Result.update(Option) signature,
|
||||
including required URL inference in Parameters and contextual mock implementations.
|
||||
Simply widening that argument or adding overloads broke verified old consumers, even though
|
||||
ordinary old calls still compiled. Do not reintroduce that change without these fixtures.
|
||||
|
||||
The additive /runtime entry points to the exact same JS/mjs files and exposes RuntimeFactory
|
||||
and RuntimeResult.update(UpdateOption), where UpdateOption is Partial<Option>. It does not
|
||||
add a second player/plugin implementation. Result remains the legacy result type; RuntimeResult
|
||||
is the opt-in precise update contract. Both keep factory options required and update synchronous.
|
||||
The .d.cts/.d.mts bridges describe actual CJS/ESM identities; typesVersions keeps old Node10
|
||||
resolution for /legacy and /runtime. TS 4.3 and 5.9 consumers exercise both paths.
|
||||
|
||||
The editor global keeps legacy inference, with an explicit RuntimeFactory type assertion for
|
||||
scripts opting into partial-update inference. The assertion selects a contract checked against
|
||||
the same implementation; it does not bypass the plugin's strict source checks. build:ts uses
|
||||
the shared AST generator for this package and rejects standalone declaration diagnostics in
|
||||
both compilers. Do not manually edit docs/assets/ts output.
|
||||
|
||||
The package .npmignore excludes the implementation tsconfig along with src. Yarn pack must
|
||||
retain all six declaration files and every historical dist/type path. Audio-04 verified these
|
||||
files and identical JavaScript bytes to Audio-03; isolated installed consumers and the 8082
|
||||
demo still belong to Audio-06. See refactor/baselines/audio-types-validation.json for evidence.
|
||||
Reference in new issue
Block a user