Skip to content

embed: plan the SCORM zip's parts with the player's ./plan, not copies (#109) - #112

Merged
alekswebnet merged 1 commit into
mainfrom
feat/embed-plan-imports
Nov 2, 2026
Merged

alekswebnet merged 1 commit into
mainfrom
feat/embed-plan-imports

Conversation

@alekswebnet

Copy link
Copy Markdown
Contributor

Closes #109.

What

The player adds to ./plan what the SCORM writer still copied, so the module now carries the whole of its library rules:

  • reachableFolder, resolveLibraryFolder, findMissingLibraries, libraryFolderNames, parseLibraryFolder, indexLibraryFolders and the LibraryFolder type, moved out of sw/package-reader.ts into src/shared/library-folders.ts, pure and free of zip.js. PackageManifest moves to shared/content-libraries.ts with them.
  • walkDependencies: the walk PackageReader.checkDependencies makes through each library.json's preloadedDependencies, a level at a time, as a function over locate and read callbacks. The reader's check runs it and reports the downgrades from what it found.
  • ownLibraries: what a package carries of its libraries, as a function over its library folders and a read callback. PackageReader.ownLibraries delegates to it.

The reader behaves as before. dist/h5p-plan.js grows from 7.7 to 12.1 kB.

embed imports those, with planPack, dependenciesIn and librariesNamedIn, from @missing-elements/h5p-offline-player/plan, and drops its nine copies (261 lines): dependenciesIn, servingFolder, missingLibraries, librariesNamedIn, addonPatterns, textMatches, ownLibraries, planParts, and most of packLibraries, which now only adapts the pack's index into the plan's shape with each part's file. The writer runs planPack with refresh: false, fill: true and nothing provided, as the launch page has the element run it, and walkDependencies over reachableFolder for the refusal. The zip's index.json, its parts, the build stamp and the error message come out as before.

  • embed depends on the player's exact version (workspace:*), as h5p-author does since h5p-author: export the library loader and the text checks, on the player's library rules #106: ./plan is not covered by docs/compatibility.md, which now names both dependents.
  • scripts/check-player-published.mjs refuses to publish until the pinned player version is on npm and exports ./plan, as h5p-author's guard does. Run today it refuses, correctly: 1.2.0 is on npm without ./plan.
  • embed's types script runs the player's tsc -b first, so its typecheck works on its own.

Checks

  • Player: pnpm typecheck, including the nodenext consumer check, which now imports reachableFolder, walkDependencies and ownLibraries. Unit suite 364, six new: reachableFolder (the four cases that were embed's servingFolder test, plus downgrade), walkDependencies (a tree with a missing leaf, each library.json read once, a read that fails ends the walk) and ownLibraries (with and without a read). Browser pack.test.ts and libraries.test.ts, 39.
  • embed: typecheck; 48 tests, one fewer than before because the servingFolder unit test moved to the player. scorm.test.ts is otherwise as it was, the acceptance test among them: the parts the element fetched compared with the parts the writer planned.
  • h5p-author: 109. Root pnpm typecheck.

The full browser suite in all three engines is left to CI.

Release

Publish the player before embed and h5p-author: both pin it exactly and need a version with this ./plan.

🤖 Generated with Claude Code

… not copies (#109)

The player's ./plan gains what the SCORM writer still copied: reachableFolder, resolveLibraryFolder, findMissingLibraries and the folder helpers, out of package-reader.ts into src/shared/library-folders.ts, pure and free of zip.js; walkDependencies, the walk checkDependencies makes through each library.json's preloadedDependencies, as a function over locate and read; and ownLibraries, what a package carries of its libraries, as a function over its folders and read. PackageManifest moves to shared/content-libraries.ts. The reader delegates to them and behaves as before: its unit suite, and the pack and libraries browser tests, pass.

embed's SCORM writer imports them with planPack, dependenciesIn and librariesNamedIn, and drops its nine copies. It pins the player exactly, as h5p-author does, since ./plan is not covered by docs/compatibility.md, and scripts/check-player-published.mjs refuses to publish until the pinned version is on npm and exports ./plan. Its types script runs the player's tsc -b first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@alekswebnet
alekswebnet added this pull request to stack #114 November 2, 2026 20:20
@alekswebnet
alekswebnet merged commit d9d8c82 into main Nov 2, 2026
9 checks passed
@alekswebnet
alekswebnet deleted the feat/embed-plan-imports branch November 3, 2026 11:11
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.

embed: plan the SCORM zip's parts with the player's own functions, not copies

1 participant