Skip to content

feat: play packages from the library pack's parts, not the whole bundle - #11

Merged
alekswebnet merged 2 commits into
mainfrom
feat/library-pack-parts
Nov 9, 2026
Merged

alekswebnet merged 2 commits into
mainfrom
feat/library-pack-parts

Conversation

@alekswebnet

@alekswebnet alekswebnet commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

/h5p handed startEmbed() the whole libraries.h5p (librariesPack). So the first package a visitor opened that lacked a library downloaded all of it. Since pack 1.1.0, which came in with #10, that is 15.5 MB, and 1.8 MB of it is libraries an H5P site's upload check wants, which the player never reads.

This passes startEmbed() the pack export of @missing-elements/h5p-libraries, one part per library, as sites written by h5p-embed have done since 0.8.

What changes

  • Downloads: a package downloads only the parts it needs. Each part is checked against the pack's SHA-256 and kept for every package that uses it. The library-less sample quiz now fetches a handful of parts instead of 15.5 MB.
  • Build output: /build already reads these same parts, so dist/ drops libraries.h5p and is 23 MB in all.
  • Newer library versions (behaviour change): a package that carries older libraries now plays the pack's newer versions (player 0.10, h5p-embed's default for pack). The website already says the player does this.
    • The sample quiz plays 8 of its libraries newer, for example Question Set 1.20.31 → 1.21.14.
    • &refresh-libraries=off on the address plays them as exported.
    • No learner state is affected, because this page never turns on resume.
  • Report: for such a package, the report's libraryBundle is now { url, origin, fromCache, refreshed } instead of null.
  • Type shim: src/h5p-embed.d.ts is removed. h5p-embed ships its own declarations since 1.1.0, and only those know the pack option.

Testing

  • pnpm typecheck and pnpm build pass.
  • pnpm e2e: 10 passed. The changed tests check:
    • the element's libraries is pack;
    • a library-less package fetches only its parts, all from this origin;
    • nothing is fetched from jsDelivr or the H5P hub, and never the whole bundle;
    • the framing page's report carries refreshed and an empty downgradedLibraries.
  • The website's e2e suite: 9 passed against this build (VITE_PLAYER_URL).

Order

Merge embed-my/website#6 first. Its preview reads refreshed. Without it, the live site would describe every package that carries older libraries as "exported without its libraries".

🤖 Generated with Claude Code


Summary by cubic

/h5p now passes startEmbed() the library pack's parts, one per library, instead of the whole libraries.h5p bundle, so a package exported without its libraries downloads only the parts it needs — a handful instead of 15.5 MB.

What changes

  • Each part is checked against the pack's SHA-256 and kept in the browser for every package that uses it; the build page reads the same parts, and dist/ drops libraries.h5p (23 MB in all).
  • A package that carries older libraries plays the pack's newer versions (player 0.10); &refresh-libraries=off plays them as exported, and the report's libraryBundle is now { url, origin, fromCache, refreshed } instead of null.
  • The e2e tests now listen on the browser context, not the page, so they also catch requests the Service Worker makes.
  • src/h5p-embed.d.ts is removed; h5p-embed ships its own declarations since 1.1.0.
  • Merge feat: the pages and the preview's report follow player 1.5 website#6 first: its preview reads refreshed; without it, the live site would describe every such package as "exported without its libraries".

Written for commit c680ca9. Summary will update on new commits.

View guided diff Turn on auto-fix

/h5p handed startEmbed() the whole libraries.h5p, so the first package that
lacked a library downloaded all of it: 15.5 MB since pack 1.1.0, 1.8 MB of it
libraries an H5P site's upload check wants and the player never reads. It now
passes the pack export, one part per library, as sites written by h5p-embed
have done since 0.8:

- A package downloads only the parts it needs, each checked against the
  pack's SHA-256 and kept for every package that uses it. The build page
  reads the same parts, and dist/ drops libraries.h5p: 23 MB in all.
- A package that carries older libraries plays the pack's newer versions
  (player 0.10), as the website says it does. The report names them in
  libraryBundle.refreshed; &refresh-libraries=off plays them as exported.

The local declaration of startEmbed() goes: h5p-embed ships its own since
1.1.0, and only that one knows the pack option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread e2e/player.spec.ts Resolved
@alekswebnet
alekswebnet merged commit 529d04a into main Nov 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant