Repository navigation
fix(core): the npm package no longer ships the unminified media sync runtime - #6515
Conversation
Edit accuracy: accurate 271 (base branch 271), smooth 111 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (2)
|
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 nits
Scope
Read the full diff, including 3afaf9a, which only trims comments. Compared the files in core's tsc build on main and on this branch with tsc --listFilesOnly. Exactly four drop out: runtime/media, preloadMedia, timedClipHide and adapters/seek-dispatch. mediaSteer stays. No package exports any of the dropped files, and none is deep-imported through @hyperframes/core. The readElementPlaybackStart → readMediaStart swap is the same function: the old one only wrapped the new one. CI, regression, Windows, Comments and PR captures are green at this head.
What
@hyperframes/core's npm package no longer ships the unminified browser media sync (dist/runtime/media.jsand three files only it imports). The package is 57 KB smaller unpacked and 17 KB smaller packed, and every published entry point still resolves.Why
src/runtimeis excluded from core'stscbuild: the runtime reaches users as the minified bundles (./runtime,./runtime-script), and a runtime file only reachesdistwhen a module in the build imports it. Three such imports pulledruntime/media.tsin by accident:runtime/timeline.tsimported twoplaybackRate.tshelpers throughmedia.ts's re-exports;runtime/state.tstype-importedRuntimeMediaClipfrommedia.ts(a type-only import still adds the file to the program, so it is emitted);runtime/clock.tsimported theMEDIA_HARD_SYNC_SECONDSconstant frommedia.ts.So core shipped the media sync loop as plain source next to the bundles, and every change to it counted against core's size budget about three times. A playback fix on top of this one was refused by the merge queue for exactly that: its code fit the bundles, but the extra unminified copy pushed core over its budget.
How
timeline.tsimportsreadElementPlaybackRateandreadMediaStartfromplaybackRate.ts(where they are defined).RuntimeMediaClipmoves toruntime/types.ts;media.tsre-exports it, so every existing import keeps working.MEDIA_HARD_SYNC_SECONDSmoves tomediaSteer.ts, besideMEDIA_SYNC_TOLERANCE_SECONDS;media.tsandclock.tsimport it from there.mediaSteer.tsjoins core'stsconfig.jsonfiles, because the published./runtime/media-steersubpath needs it and it no longer arrives throughmedia.ts.No runtime behaviour changes: the bundles are built from the same sources, and only where a type and a constant are declared moves.
What I measured
npm pack --dry-runinpackages/core, main against this branch, both built from clean:Files that leave the package:
dist/runtime/media,preloadMedia,timedClipHideandadapters/seek-dispatch(.jsand.d.tseach). None is a published subpath, and no remaining file in the tarball references them../runtime/media-steerfrom the packed tarball in a clean consumer: resolves and exportsMEDIA_HARD_SYNC_SECONDS,MEDIA_SYNC_TOLERANCE_SECONDS,forgetSteering,isSteering,steerMedia.verify:packed-manifests: 185 packed exports resolved, 175 Node exports executed, NodeNext declaration check and size budgets pass.check:package-subpaths,check-package-cycles, oxfmt, oxlint, comment ratchet and fallow audit clean.typecheck(including the runtime config);tsc --noEmitin player, engine and studio.vitest run: 249 files, 5457 tests, 3 runs in a row.What I did NOT exercise
npm packand the packed-consumer install thatverify:packed-manifestsdoes.Test plan
npm pack --dry-run./runtime/media-steerverify:packed-manifests, subpath and cycle checks