Repository navigation
embed: plan the SCORM zip's parts with the player's ./plan, not copies (#109) - #112
Merged
Merged
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #109.
What
The player adds to
./planwhat the SCORM writer still copied, so the module now carries the whole of its library rules:reachableFolder,resolveLibraryFolder,findMissingLibraries,libraryFolderNames,parseLibraryFolder,indexLibraryFoldersand theLibraryFoldertype, moved out ofsw/package-reader.tsintosrc/shared/library-folders.ts, pure and free of zip.js.PackageManifestmoves toshared/content-libraries.tswith them.walkDependencies: the walkPackageReader.checkDependenciesmakes through eachlibrary.json'spreloadedDependencies, a level at a time, as a function overlocateandreadcallbacks. 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 areadcallback.PackageReader.ownLibrariesdelegates to it.The reader behaves as before.
dist/h5p-plan.jsgrows from 7.7 to 12.1 kB.embed imports those, with
planPack,dependenciesInandlibrariesNamedIn, from@missing-elements/h5p-offline-player/plan, and drops its nine copies (261 lines):dependenciesIn,servingFolder,missingLibraries,librariesNamedIn,addonPatterns,textMatches,ownLibraries,planParts, and most ofpackLibraries, which now only adapts the pack's index into the plan's shape with each part's file. The writer runsplanPackwithrefresh: false,fill: trueand nothing provided, as the launch page has the element run it, andwalkDependenciesoverreachableFolderfor the refusal. The zip'sindex.json, its parts, the build stamp and the error message come out as before.workspace:*), as h5p-author does since h5p-author: export the library loader and the text checks, on the player's library rules #106:./planis not covered by docs/compatibility.md, which now names both dependents.scripts/check-player-published.mjsrefuses 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.typesscript runs the player'stsc -bfirst, so its typecheck works on its own.Checks
pnpm typecheck, including thenodenextconsumer check, which now importsreachableFolder,walkDependenciesandownLibraries. Unit suite 364, six new:reachableFolder(the four cases that were embed'sservingFoldertest, plusdowngrade),walkDependencies(a tree with a missing leaf, eachlibrary.jsonread once, a read that fails ends the walk) andownLibraries(with and without a read). Browserpack.test.tsandlibraries.test.ts, 39.servingFolderunit test moved to the player.scorm.test.tsis otherwise as it was, the acceptance test among them: the parts the element fetched compared with the parts the writer planned.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