Repository navigation
Carry the editor libraries an H5P site's upload check wants, so h5p-author packages install on a fresh Moodle - #147
Merged
Merged
Conversation
…e h5p-author write it H5P core's validator, which Moodle, WordPress and Drupal run on an upload, wants every library a package carries to have its preloaded, dynamic and editor dependencies with it at the exact major.minor. The pack dropped H5PEditor.* and kept one minor per major, so a Moodle with no library installed refused 28 of the 32 type files' examples (#146). The pack (1.1.0) keeps the closure beside the newest minor of each major: 37 editor libraries and four older minors, 41 parts and 1.8 MB, marked installOnly in parts/index.json, which now also carries editorDependencies and dynamicDependencies; the pack export lists what the player serves, and ./install the whole pack. The player's plan never takes a marked part, and its pinned index is stamped without them. h5p-author writes the closure after the content, at the exact versions; the CLI says how many, buildPackage returns them as install, and missingForInstall is the rule as a check. The VS Code extension copies only the served parts. Checked in a fresh Moodle 4.5.15: all 32 examples accepted as an admin, and every one still plays. A package with the run after the content costs no request more over a Range host. Closes #146
…handling and upload checks
…oad check requirements
This was referenced Nov 6, 2026
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 #146.
What changes
@missing-elements/h5p-libraries1.1.0, keeps beside the newest minor of each major what H5P core's upload check wants of them, at the exact versions: 37H5PEditor.*libraries and four older minors (H5P.Audio1.2,H5P.DragNBar1.4,H5P.Question1.4,H5P.ImageHotspots1.10), 41 parts and 1.9 MB. They are markedinstallOnlyinparts/index.json, which now also carries each library'seditorDependenciesanddynamicDependencies. Every one is MIT: declared, or read from its repository wherelibrary.jsonsays nothing (UNDECLARED). The runtime parts' bytes are unchanged.packexport (index.js) lists what the player serves, as before, so a bundler, the installable app's precache and the extension's copy stay at 105 parts; a new./installexport has the whole pack, for a page that writes packages.planPack),packLibrariesInkeeps the mark and the two lists, and the pinnedPACK_INDEXis stamped without the marked parts. The pin moved to pack 1.1.0.lib/install.mjs) carries the closure after the content, where nothing reads it as the package plays;h5p.jsonlists what plays, as the platforms' exports write it. The CLI says "… 3 more for installing on an H5P site",buildPackagereturns them asinstall, andmissingForInstall(libraries)is the rule as a check (./core). In Node the pack is read fromparts/index.json; in a pageopenPacktakes@missing-elements/h5p-libraries/install'spack, and a build from the plain one is refused naming the first library and where the pack with them is. A package with media goes through the normalizer, which sorts library folders beforecontent/, so there the run precedescontent.json.h5p-embed'slibraries/) copy only the served parts, with an index of them: the.vsixstays 13.79 MB and an embed site'slibraries/13.8 MB.pnpm demo:content):build-demo-content.mjsfollows the preloaded, dynamic and editor dependencies of the libraries it takes from the hub's bundle, at their exact versions, writes them after the libraries that play, and refuses to write a packagemissingForInstallfinds short. The quiz, the video and the glossary changed, 0.13, 2.7 and 0.01 MB larger (8.3 MB for the four); how-it-works and markup needed nothing;formulas.h5pstays content only on purpose. The quiz also took the hub's newer patches of five libraries, which the pack has had since 1.0.1.design/libraries.md, a bullet indesign/author.md, the demo's note indesign/demo.md, the index line, the layout map,docs/compatibility.md, both READMEs, the skill's delivery note.Checked
notes/moodle-upload/fresh-admin-branch-examples.json. Moodle is the one site tried; WordPress and Drupal run the same upload check.H5PEditor.*and are accepted. That is 5 of 6,formulas.h5pbeing content only (it needs Question Set installed, as an h5p.com export does), and 6 of 6 once Moodle's hub task has run. All five that carry libraries play with their own and against the pack, with no errors or warnings (h5p-verify). Every suite that reads the demo's packages passes with them: verify 27, embed 81, author 142, extension 24, demo 21, skills 73. One test had the quiz's size,1.5 MB, written in (the SCORM page's row); it takes it from the file now.apps/skills: every example builds, passesmissingForInstall, checks as saved content unchanged, and plays trusted and untrusted (73 tests). Author 142 tests (141 in Node, the page build in a browser), three new; player unit 386, with new tests of the plan and the index shape;range-requests.test.tson the newinstallable.h5pfixture: a package with the run after the content costs the same four requests over aRangehost (probe, tail, head, warm).pnpm sweep, every content type against the largerlibraries.h5p: 110 of 110 plays, untrusted and trusted.pnpm build:demostill emits 105 parts, and the demo's tests (the installable app, the sweep's content rules) pass, 21.h5p-embed: a new assertion that a site'slibraries/holds exactly the served parts, which fails without the change; the extension's unit tests pass, 24.Costs, plainly
Rangethe warm pulls the run with the rest, one request either way, so a Course Presentation's warm is 3.6 MB larger, as a Moodle export's already is. On a host withoutRangea package without media boots before the run arrives; one with media goes through the normalizer, whoseorderEntriessorts library folders beforecontent/, so it boots after the run: the demo's video has 4.1 MB before its content, where it had 1.5. Keeping the run last takes an option in the normalizer,last: that is Normalizer: an option to write named library folders after the media #148, built apart from this pull request as Normalizer: write named library folders after the media (last) #149. Once both are merged and the normalizer is released, h5p-author's Node build and the demo script pass it, which puts the video's content back at 1.5 MB (from a host paced to 1 MB/s that ignoresRangeit is ready at 2.3 s instead of 4.5).libraries.h5pwhole as a bundle downloads 1.8 MB more (13.7 to 15.5 MB), which its player never reads; the parts the player fetches are unchanged.editorDependenciesanddynamicDependenciesfor every library, and nothing reads them: h5p-author reads each part's ownlibrary.json. They are 10.7 kB more in each of the Service Worker's pinned index,index.jsand a site'sindex.json. Dropping them costs nothing while 1.1.0 is unpublished; say if you want that here.H5P.SingleChoiceSet1.11 (patch 88 to 89, 180 kB) from the pack, its bundle having an older patch than the pack.H5P.Audio1.2 beside 1.5) has the older refreshed to the pack's 1.5 as any older minor is, one small part downloaded that the package's own 1.5 could have answered for. Left as is: one part in a rare case, against a rule in the plan and a refresh reported that fetched nothing.Release order: the pack first (
check-library-packrefuses the player until its pinned index is on jsDelivr), then the player as a minor (the pin moved), then h5p-author as a minor (installin the result,missingForInstall); the extension and h5p-embed (a patch: its site stops copying the parts the player never serves) with the player.