Skip to content

build: Use generated shaka namespace typedef in tests#10288

Merged
avelad merged 2 commits into
shaka-project:mainfrom
avelad:build
Jul 1, 2026
Merged

build: Use generated shaka namespace typedef in tests#10288
avelad merged 2 commits into
shaka-project:mainfrom
avelad:build

Conversation

@avelad

@avelad avelad commented Jun 29, 2026

Copy link
Copy Markdown
Member

Follow-up to #9596, which added a generated typedef for the shaka namespace to the externs but left the hand-maintained shakaNamespaceType typedef in place in the tests.

This generates a standalone externs file containing only the shaka namespace typedef and includes it when type-checking the tests, so the tests can refer to the whole library namespace in a type-safe way. The hand-maintained shakaNamespaceType typedef is then removed in favor of the generated shaka type.

Closes #6762

Follow-up to shaka-project#9596, which added a generated typedef for the shaka
namespace to the externs but left the hand-maintained `shakaNamespaceType`
typedef in place in the tests.

Generate a standalone externs file containing only the shaka namespace
typedef and include it when type-checking the tests, so the tests can
refer to the whole library namespace in a type-safe way. Then remove the
hand-maintained `shakaNamespaceType` typedef and use the generated `shaka`
type instead.

- generateExterns.js: add a `--namespace-typedef` flag that writes a
  standalone externs file with only the namespace typedef (no API
  re-declarations), so it can be type-checked alongside the uncompiled
  source without conflicting with the goog.provide declarations.
- check.py / compiler.py: generate this file on the fly and include it in
  the test type-check.
- Replace all uses of `shakaNamespaceType` with the generated `shaka`
  type, renaming a colliding local variable in storage_integration.js and
  extracting a typed constructor in ui_integration.js.

Closes shaka-project#6762

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@google-cla

google-cla Bot commented Jun 29, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@avelad avelad added component: build system The issue involves the build system of Shaka Player priority: P3 Useful but not urgent labels Jun 29, 2026
@avelad avelad added this to the v5.2 milestone Jun 29, 2026
@avelad avelad requested a review from a team June 29, 2026 14:58
@shaka-bot

shaka-bot commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Bundle Size Report for PR #10288

File HEAD Base Diff
controls.css 38.4 KiB (6.7 KiB) 38.4 KiB (6.7 KiB) 0.0 KiB
controls.modern.css 30.5 KiB (6.1 KiB) 30.5 KiB (6.1 KiB) 0.0 KiB
demo.compiled.debug.js 266.0 KiB (53.8 KiB) 266.0 KiB (53.8 KiB) 0.0 KiB
demo.compiled.js 266.0 KiB (53.8 KiB) 266.0 KiB (53.8 KiB) 0.0 KiB
demo.css 160.2 KiB (25.7 KiB) 160.2 KiB (25.7 KiB) 0.0 KiB
demo.modern.css 144.1 KiB (24.7 KiB) 144.1 KiB (24.7 KiB) 0.0 KiB
locales.js 44.5 KiB (11.0 KiB) 44.5 KiB (11.0 KiB) 0.0 KiB
receiver.compiled.debug.js 151.5 KiB (24.5 KiB) 151.5 KiB (24.5 KiB) 0.0 KiB
receiver.compiled.js 151.5 KiB (24.5 KiB) 151.5 KiB (24.5 KiB) 0.0 KiB
shaka-player.compiled-es2021.debug.js 1289.4 KiB (320.1 KiB) 1289.4 KiB (320.1 KiB) 0.0 KiB
shaka-player.compiled-es2021.js 681.2 KiB (229.5 KiB) 681.2 KiB (229.5 KiB) 0.0 KiB
shaka-player.compiled.debug.js 1574.1 KiB (363.0 KiB) 1574.1 KiB (363.0 KiB) +0.0 KiB
shaka-player.compiled.js 789.8 KiB (259.4 KiB) 789.8 KiB (259.4 KiB) 0.0 KiB
shaka-player.dash-es2021.debug.js 956.3 KiB (242.2 KiB) 956.3 KiB (242.2 KiB) 0.0 KiB
shaka-player.dash-es2021.js 477.1 KiB (163.9 KiB) 477.1 KiB (163.9 KiB) 0.0 KiB
shaka-player.dash.debug.js 1165.9 KiB (274.0 KiB) 1165.9 KiB (274.0 KiB) +0.0 KiB
shaka-player.dash.js 555.9 KiB (185.3 KiB) 555.9 KiB (185.3 KiB) 0.0 KiB
shaka-player.experimental-es2021.debug.js 1681.1 KiB (406.9 KiB) 1681.1 KiB (406.9 KiB) 0.0 KiB
shaka-player.experimental-es2021.js 936.2 KiB (300.8 KiB) 936.2 KiB (300.8 KiB) 0.0 KiB
shaka-player.experimental.debug.js 2032.8 KiB (459.3 KiB) 2032.8 KiB (459.3 KiB) +0.0 KiB
shaka-player.experimental.js 1068.4 KiB (336.6 KiB) 1068.4 KiB (336.6 KiB) 0.0 KiB
shaka-player.hls-es2021.debug.js 977.4 KiB (245.7 KiB) 977.4 KiB (245.7 KiB) 0.0 KiB
shaka-player.hls-es2021.js 504.3 KiB (172.5 KiB) 504.3 KiB (172.5 KiB) 0.0 KiB
shaka-player.hls.debug.js 1190.9 KiB (277.9 KiB) 1190.9 KiB (277.9 KiB) +0.0 KiB
shaka-player.hls.js 585.9 KiB (195.2 KiB) 585.9 KiB (195.2 KiB) 0.0 KiB
shaka-player.transmuxer-worker.debug.js 191.8 KiB (46.9 KiB) 191.8 KiB (46.9 KiB) -0.0 KiB
shaka-player.transmuxer-worker.js 83.6 KiB (28.5 KiB) 83.6 KiB (28.5 KiB) 0.0 KiB
shaka-player.ui-es2021.debug.js 1598.9 KiB (389.4 KiB) 1598.9 KiB (389.4 KiB) 0.0 KiB
shaka-player.ui-es2021.js 896.0 KiB (289.2 KiB) 896.0 KiB (289.2 KiB) 0.0 KiB
shaka-player.ui.debug.js 1920.5 KiB (437.8 KiB) 1920.5 KiB (437.8 KiB) +0.0 KiB
shaka-player.ui.js 1016.6 KiB (322.5 KiB) 1016.6 KiB (322.5 KiB) 0.0 KiB

@shaka-bot

Copy link
Copy Markdown
Collaborator

Incremental code coverage: No instrumented code was changed.

@avelad

avelad commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

@joeyparrish @TAhub can you review it? Thanks!

@avelad avelad merged commit 565a7c9 into shaka-project:main Jul 1, 2026
23 of 24 checks passed
@avelad avelad deleted the build branch July 1, 2026 07:31
avelad added a commit that referenced this pull request Jul 6, 2026
Follow-up to #9596, which added a generated typedef for the `shaka`
namespace to the externs but left the hand-maintained
`shakaNamespaceType` typedef in place in the tests.

This generates a standalone externs file containing only the `shaka`
namespace typedef and includes it when type-checking the tests, so the
tests can refer to the whole library namespace in a type-safe way. The
hand-maintained `shakaNamespaceType` typedef is then removed in favor of
the generated `shaka` type.

Closes #6762

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
avelad added a commit that referenced this pull request Jul 6, 2026
Follow-up to #9596, which added a generated typedef for the `shaka`
namespace to the externs but left the hand-maintained
`shakaNamespaceType` typedef in place in the tests.

This generates a standalone externs file containing only the `shaka`
namespace typedef and includes it when type-checking the tests, so the
tests can refer to the whole library namespace in a type-safe way. The
hand-maintained `shakaNamespaceType` typedef is then removed in favor of
the generated `shaka` type.

Closes #6762

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: build system The issue involves the build system of Shaka Player priority: P3 Useful but not urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add shaka namespace types to generated externs

3 participants