shaka-ts 5.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE ADDED
@@ -0,0 +1,16 @@
1
+ shaka-ts
2
+ Copyright 2026 Julian Tellez
3
+
4
+ This product transpiles and redistributes a derivative work of:
5
+
6
+ Shaka Player
7
+ Copyright 2016 Google LLC
8
+ https://github.com/shaka-project/shaka-player
9
+ Licensed under the Apache License, Version 2.0
10
+
11
+ Shaka Player is a trademark of Google LLC. This project is not affiliated with,
12
+ endorsed by, or supported by Google LLC.
13
+
14
+ Source files derived from Shaka Player retain their original copyright headers
15
+ and SPDX-License-Identifier declarations. A copy of the Apache License, Version
16
+ 2.0 is included in the LICENSE file at the root of this repository.
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # shaka-ts
2
+
3
+ Transpile [Shaka Player](https://github.com/shaka-project/shaka-player) from Closure annotated
4
+ JavaScript into real TypeScript, with no Google Closure Compiler and no generated blob.
5
+
6
+ > **Unofficial.** This project is not affiliated with, endorsed by, or supported by Google.
7
+ > Shaka Player is a trademark of Google LLC. Please report Shaka Player bugs
8
+ > [upstream](https://github.com/shaka-project/shaka-player/issues), not here.
9
+
10
+ ## Why
11
+
12
+ Shaka Player is excellent, but consuming it means accepting the Closure toolchain: a Java
13
+ compiler driven by Python build scripts, type information locked inside JSDoc comments, and a
14
+ published artifact that is an opaque minified bundle. TypeScript consumers get definitions
15
+ generated by a separate tool rather than types that came from the source.
16
+
17
+ This repository is not a fork. It is a **pipeline**: it fetches a pinned upstream release,
18
+ transpiles it, and proves the result still works by running Shaka's own test suite against it.
19
+ When a new Shaka version ships, you retarget it with one command instead of hand merging a
20
+ diverged fork.
21
+
22
+ ## How it works
23
+
24
+ ```
25
+ pinned upstream release (fetched, never committed here)
26
+ |
27
+ v
28
+ module transform goog.provide / goog.require -> ES modules
29
+ |
30
+ v
31
+ runtime shims goog.asserts, goog.DEBUG, goog.Uri
32
+ |
33
+ v
34
+ type translation Closure JSDoc -> TypeScript syntax
35
+ |
36
+ v
37
+ patch overlay the residue that is not worth automating
38
+ |
39
+ v
40
+ esbuild + tsc bundle and .d.ts, no Closure Compiler
41
+ |
42
+ v
43
+ Shaka's own test suite <- the correctness oracle
44
+ ```
45
+
46
+ Upstream Shaka source is never committed to this repository. It is fetched at build time and
47
+ verified against a recorded checksum.
48
+
49
+ ## Testing
50
+
51
+ There are two tiers.
52
+
53
+ The **oracle** runs Shaka's own unmodified util unit specs in a DOM-like environment without a real
54
+ browser, so it fits in the normal test pass and gates every build. If the transform changed
55
+ behaviour in that layer, the oracle goes red.
56
+
57
+ The **suite** loads the whole transpiled library as a global in real headless Chrome through Karma
58
+ and asserts its public surface resolves on `window.shaka`, one spec per symbol, plus that the
59
+ polyfills install without throwing. This is the real browser check the oracle cannot be: it runs the
60
+ library's top level module initialisation the way a consumer's browser does. That is how it earns
61
+ its keep. It found a transpiler bug on the first run: a polyfill's static self reference bound to a
62
+ shadowing parameter, so the library threw during initialisation before `window.shaka` was ever set.
63
+ The check would have failed on it, and now guards against the whole class.
64
+
65
+ Running Shaka's own behavioural specs against the library is the next tier. Those specs are written
66
+ for Shaka's test harness (the `shaka.test.*` helpers, custom matchers and asset servers) and are
67
+ coupled to each other and to a real playback pipeline, so standing them up is a port in its own
68
+ right, tracked separately. This surface check is the first tier of that work: it proves the library
69
+ loads and initialises in the real runtime.
70
+
71
+ Run it with `npm run build` then `npm run test:suite`.
72
+
73
+ ## Why it is tractable
74
+
75
+ The obvious objection is that rewriting 125,000 lines of someone else's player is madness.
76
+ Measured against Shaka 4.16.5, it is more mechanical than it looks:
77
+
78
+ - **The Closure Library surface is tiny.** Across `lib` and `ui` the entire `goog.*` usage is
79
+ `goog.require`, `goog.provide`, `goog.asserts.assert`, `goog.requireType`, `goog.Uri`,
80
+ `goog.DEBUG` and a single `goog.exportSymbol`. There is no `goog.array`, `goog.string`,
81
+ `goog.object`, `goog.events` or inheritance helper anywhere.
82
+ - **The dependency graph is acyclic.** 291 files, 1552 hard require edges, and zero cycles.
83
+ Upstream already uses `goog.requireType` to break the 69 type only edges. Cycles are what
84
+ normally make a Closure to ES modules conversion painful, and they are simply not present.
85
+ - **The source is already modern.** 344 symbols are plain ES2015 `class` declarations. There is
86
+ no `goog.inherits` and no prototype surgery.
87
+ - **Half the type translation already exists.** Upstream's own `build/generateTsDefs.py` runs
88
+ `@teppeis/clutz` over its externs to produce TypeScript definitions, which gives both prior art
89
+ and a reference to diff our output against.
90
+ - **The tests come free.** 192 spec files and 99,543 lines of Jasmine tests that we do not modify
91
+ and that tell us whether the transform preserved behaviour.
92
+
93
+ The known risk is bundle size. Closure's property renaming and dead code elimination produce a
94
+ 786 KB player build from roughly 3.8 MB of source, and esbuild will not match that. Measuring the
95
+ regression is an early milestone rather than a late surprise.
96
+
97
+ ## Versions
98
+
99
+ Rather than one pinned release, the toolchain transpiles several Shaka versions and publishes each
100
+ to npm under the same version as upstream. So `shaka-ts@4.16.43` is Shaka 4.16.43 transpiled, and a
101
+ consumer picks the version that matches the Shaka they were on. The published set lives in
102
+ [`src/versions.json`](src/versions.json); today it is the recent 4.x line:
103
+
104
+ - 4.15.55
105
+ - 4.16.5
106
+ - 4.16.43
107
+
108
+ Each entry records the checksum of the exact upstream source it builds from and its own strict
109
+ `checkJs` ratchet ceiling, both measured from that release. Every entry builds and passes the
110
+ oracle. The 5.x line is not published yet: its device detection modules do not transpile cleanly,
111
+ so it needs transpiler work before it can be trusted.
112
+
113
+ Adding a version is one entry in that file plus its recorded checksum and baseline. The
114
+ `Publish versions` workflow builds and verifies every target and publishes any that are not already
115
+ on npm.
116
+
117
+ ## Keeping current
118
+
119
+ A weekly workflow checks whether upstream Shaka has released a version newer than the pin. It always
120
+ opens a tracking issue. When an npm token is configured it also retargets the pipeline at the new
121
+ version, builds it, and publishes `shaka-ts@<version>` on its own, then opens a pull request that
122
+ records the new checksum and baseline so the repository tracks what is on npm. Two guardrails stop a
123
+ bad release from shipping: the oracle must still pass, and the `checkJs` count must stay under a
124
+ ceiling, so a version that does not transpile cleanly fails loudly instead of publishing. With no
125
+ token the publish step stays dormant and only the tracking issue is opened.
126
+
127
+ ## Status
128
+
129
+ The pipeline is built and the roadmap through the multi-version publishing milestone is done.
130
+ Publishing is wired but not switched on: nothing is on npm until an automation token is added to the
131
+ repository, so treat the package as not yet installable. Progress is tracked in the open:
132
+
133
+ - [Project board](https://github.com/users/juliantellez/projects/1)
134
+ - [Milestones](https://github.com/juliantellez/shaka-ts/milestones)
135
+
136
+ ## Licence
137
+
138
+ This project is licensed under the [Apache License 2.0](LICENSE), matching Shaka Player.
139
+
140
+ Output produced by this pipeline is a derivative work of Shaka Player, also Apache 2.0. Upstream
141
+ copyright headers are preserved through the transform. See [NOTICE](NOTICE) for attribution.
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "shaka-ts",
3
+ "version": "5.2.4",
4
+ "description": "Shaka Player transpiled from Closure JavaScript to TypeScript. Unofficial, not affiliated with Google.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "main": "shaka-player.min.js",
8
+ "types": "shaka-player.d.ts",
9
+ "files": [
10
+ "shaka-player.min.js",
11
+ "shaka-player.d.ts",
12
+ "NOTICE"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/juliantellez/shaka-ts.git"
17
+ },
18
+ "keywords": [
19
+ "shaka",
20
+ "dash",
21
+ "hls",
22
+ "video",
23
+ "player",
24
+ "typescript"
25
+ ]
26
+ }
@@ -0,0 +1,82 @@
1
+ export { Deprecate } from './lib/deprecate/deprecate.ts';
2
+ export { Player } from './lib/player.ts';
3
+ export { SimpleAbrManager } from './lib/abr/simple_abr_manager.ts';
4
+ export { AdManager } from './lib/ads/ad_manager.ts';
5
+ export { CastProxy } from './lib/cast/cast_proxy.ts';
6
+ export { CastReceiver } from './lib/cast/cast_receiver.ts';
7
+ export { DashJsonParser } from './lib/dash/dash_json_parser.ts';
8
+ export { DashParser } from './lib/dash/dash_parser.ts';
9
+ export { AllDevices } from './lib/device/all.ts';
10
+ export { FairPlay } from './lib/drm/fairplay.ts';
11
+ export { HlsParser } from './lib/hls/hls_parser.ts';
12
+ export { log } from './lib/debug/log.ts';
13
+ export { InitSegmentReference } from './lib/media/segment_reference.ts';
14
+ export { ManifestParser } from './lib/media/manifest_parser.ts';
15
+ export { PreferenceBasedCriteria } from './lib/media/preference_based_criteria.ts';
16
+ export { PresentationTimeline } from './lib/media/presentation_timeline.ts';
17
+ export { SegmentIndex } from './lib/media/segment_index.ts';
18
+ export { SegmentReference } from './lib/media/segment_reference.ts';
19
+ export { Id3Utils } from './lib/metadata/id3_utils.ts';
20
+ export { Id3V1Utils } from './lib/metadata/id3v1_utils.ts';
21
+ export { IlstUtils } from './lib/metadata/ilst_utils.ts';
22
+ export { Metadata } from './lib/metadata/metadata.ts';
23
+ export { VorbisUtils } from './lib/metadata/vorbis_utils.ts';
24
+ export { MSFParser } from './lib/msf/msf_parser.ts';
25
+ export { DataUriPlugin } from './lib/net/data_uri_plugin.ts';
26
+ export { HttpFetchPlugin } from './lib/net/http_fetch_plugin.ts';
27
+ export { HttpXHRPlugin } from './lib/net/http_xhr_plugin.ts';
28
+ export { QueueManager } from './lib/queue/queue_manager.ts';
29
+ export { OfflineManifestParser } from './lib/offline/offline_manifest_parser.ts';
30
+ export { OfflineScheme } from './lib/offline/offline_scheme.ts';
31
+ export { Storage } from './lib/offline/storage.ts';
32
+ export { StorageMechanism } from './lib/offline/indexeddb/storage_mechanism.ts';
33
+ export { Aria } from './lib/polyfill/aria.ts';
34
+ export { EmeEncryptionScheme } from './lib/polyfill/eme_encryption_scheme.ts';
35
+ export { Fullscreen } from './lib/polyfill/fullscreen.ts';
36
+ export { PolyfillMap } from './lib/polyfill/map.ts';
37
+ export { MCapEncryptionScheme } from './lib/polyfill/mcap_encryption_scheme.ts';
38
+ export { MediaSource } from './lib/polyfill/mediasource.ts';
39
+ export { MediaCapabilities } from './lib/polyfill/media_capabilities.ts';
40
+ export { Orientation } from './lib/polyfill/orientation.ts';
41
+ export { PatchedMediaKeysApple } from './lib/polyfill/patchedmediakeys_apple.ts';
42
+ export { PatchedMediaKeysWebkit } from './lib/polyfill/patchedmediakeys_webkit.ts';
43
+ export { PiPWebkit } from './lib/polyfill/pip_webkit.ts';
44
+ export { RandomUUID } from './lib/polyfill/random_uuid.ts';
45
+ export { PolyfillSymbol } from './lib/polyfill/symbol.ts';
46
+ export { TypedArray } from './lib/polyfill/typed_array.ts';
47
+ export { URLSearchParams } from './lib/polyfill/url_search_params.ts';
48
+ export { VTTCue } from './lib/polyfill/vttcue.ts';
49
+ export { VideoFrameCallback } from './lib/polyfill/videoframecallback.ts';
50
+ export { VideoPlayPromise } from './lib/polyfill/video_play_promise.ts';
51
+ export { VideoPlaybackQuality } from './lib/polyfill/videoplaybackquality.ts';
52
+ export { polyfill } from './lib/polyfill/all.ts';
53
+ export { Cue } from './lib/text/cue.ts';
54
+ export { Mp4TtmlParser } from './lib/text/mp4_ttml_parser.ts';
55
+ export { Mp4VttParser } from './lib/text/mp4_vtt_parser.ts';
56
+ export { TextEngine } from './lib/text/text_engine.ts';
57
+ export { SpeechToText } from './lib/text/speech_to_text.ts';
58
+ export { SrtTextParser } from './lib/text/srt_text_parser.ts';
59
+ export { TtmlTextParser } from './lib/text/ttml_text_parser.ts';
60
+ export { VttTextParser } from './lib/text/vtt_text_parser.ts';
61
+ export { WebVttGenerator } from './lib/text/web_vtt_generator.ts';
62
+ export { CeaDecoder } from './lib/cea/cea_decoder.ts';
63
+ export { Mp4CeaParser } from './lib/cea/mp4_cea_parser.ts';
64
+ export { TsCeaParser } from './lib/cea/ts_cea_parser.ts';
65
+ export { AacTransmuxer } from './lib/transmuxer/aac_transmuxer.ts';
66
+ export { Ac3 } from './lib/transmuxer/ac3.ts';
67
+ export { Ac3Transmuxer } from './lib/transmuxer/ac3_transmuxer.ts';
68
+ export { ADTS } from './lib/transmuxer/adts.ts';
69
+ export { Ec3 } from './lib/transmuxer/ec3.ts';
70
+ export { Ec3Transmuxer } from './lib/transmuxer/ec3_transmuxer.ts';
71
+ export { H264 } from './lib/transmuxer/h264.ts';
72
+ export { H265 } from './lib/transmuxer/h265.ts';
73
+ export { LocTransmuxer } from './lib/transmuxer/loc_transmuxer.ts';
74
+ export { Mp3Transmuxer } from './lib/transmuxer/mp3_transmuxer.ts';
75
+ export { MpegAudio } from './lib/transmuxer/mpeg_audio.ts';
76
+ export { MpegTsTransmuxer } from './lib/transmuxer/mpeg_ts_transmuxer.ts';
77
+ export { Opus } from './lib/transmuxer/opus.ts';
78
+ export { TransmuxerEngine } from './lib/transmuxer/transmuxer_engine.ts';
79
+ export { TsTransmuxer } from './lib/transmuxer/ts_transmuxer.ts';
80
+ export { Dom } from './lib/util/dom_utils.ts';
81
+ export { UtilError } from './lib/util/error.ts';
82
+ export { Iterables } from './lib/util/iterables.ts';