From 920b7c1736ed07cf1fc235806d4a15b0aef201ce Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Fri, 20 Nov 2026 08:52:30 +0200 Subject: [PATCH] Pin h5p-author 0.14.0, and copy the build tool from the author package The rest of the toolkit's 1.7.0 release, h5p-libraries 1.1.1, h5p-offline-player 1.7.0 and h5p-runtime 1.0.2, came in by Dependabot (#75, #76, #77). With the author at 0.14.0 the lockfile drops the copies 0.13.0 kept: libraries 1.1.0, player 1.6.0 and normalize 1.4.0. The bundles step copies dist/h5p-author.mjs and its licence list from the author package instead of bundling the command line with this site's Vite, so the bytes route 3 runs are the npm package's. Closes #78. --- package.json | 2 +- pnpm-lock.yaml | 43 +++++++++++-------------------------------- vite.config.ts | 38 ++++++++++++-------------------------- 3 files changed, 24 insertions(+), 59 deletions(-) diff --git a/package.json b/package.json index b92b986..54ea608 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@codemirror/state": "6.7.6", "@codemirror/view": "6.43.15", "@lezer/highlight": "1.2.5", - "@missing-elements/h5p-author": "0.13.0", + "@missing-elements/h5p-author": "0.14.0", "@missing-elements/h5p-libraries": "1.1.1", "@missing-elements/h5p-offline-player": "1.7.0", "@missing-elements/h5p-runtime": "1.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e43a2dc..538f30a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,8 +33,8 @@ importers: specifier: 1.2.5 version: 1.2.5 '@missing-elements/h5p-author': - specifier: 0.13.0 - version: 0.13.0(@missing-elements/h5p-runtime@1.0.2) + specifier: 0.14.0 + version: 0.14.0(@missing-elements/h5p-runtime@1.0.2) '@missing-elements/h5p-libraries': specifier: 1.1.1 version: 1.1.1 @@ -164,33 +164,20 @@ packages: '@marijn/find-cluster-break@1.0.4': resolution: {integrity: sha512-Wy0V7+SGUjnF9/TkiM1hKVDPj7jKXduPNboMVtHTA8dySMURWqfg/JZ9E2Sq8JgSJmkl7k7Qe9FLeMSrSraWmQ==} - '@missing-elements/h5p-author@0.13.0': - resolution: {integrity: sha512-cPdQrADIVyz3Ut0OQzU35kJMly301pF8cG+KICAPL81YZSlxqMmatSqV3EnMfbb+O3EWNh8RazSYKRMg6aFXsQ==} + '@missing-elements/h5p-author@0.14.0': + resolution: {integrity: sha512-zRyknhCLbCJDHZjXftEFVj72sfZ7btSoEStW8uQhWSkO115aCzHwR3IHgp8mpdxmOwl2bV2hkTTJ0ueCeyBPWA==} engines: {node: '>=22'} hasBin: true - '@missing-elements/h5p-libraries@1.1.0': - resolution: {integrity: sha512-gH4Qpvms3hDKzxSjAHg0UXQqUlkNPravGoMDmJH04XqVuNo41FG3JuxsuTzUV6k9LO3sD72XJ34K0VwThKGcTg==} - engines: {node: '>=20'} - '@missing-elements/h5p-libraries@1.1.1': resolution: {integrity: sha512-JS7sNI45exXa9Dgb7QBoNFMmzGnc21yw0RJMzW8ym9OCKMFOar6tdYfCp55O9RzLVHUhhtwO0Os2OhGLePzoww==} engines: {node: '>=20'} - '@missing-elements/h5p-normalize@1.4.0': - resolution: {integrity: sha512-r4hZOtlwyRcUPMV21ATMMZD5ImY19fu6+PSWJtcSvILhRU8mxRWd6X+zx350cnl8g3TaCiY6CuvNZWsYVzJFzQ==} + '@missing-elements/h5p-normalize@1.4.1': + resolution: {integrity: sha512-uXk7fBcFaCUtaB5emKatHwcOaTXUhHJi5nxEDIIRHnnHdrT/PKb1Ypd9PQZI5qodTvlXQkNeQ1OOIVISVrcHZw==} engines: {node: '>=22'} hasBin: true - '@missing-elements/h5p-offline-player@1.6.0': - resolution: {integrity: sha512-Kn5jZBLZSYIiRNbiEVMdFzyatLTy2PPZyzwEBZ9iA8YvMqohRAfC+IKbDkwdbl+Y3pIYFtCnnIbDZy1aTRJgmQ==} - engines: {node: '>=20'} - peerDependencies: - '@missing-elements/h5p-runtime': ^1.0.0 - peerDependenciesMeta: - '@missing-elements/h5p-runtime': - optional: true - '@missing-elements/h5p-offline-player@1.7.0': resolution: {integrity: sha512-G76LLCO8op2Ea6GrH4LHaPUhBAdWIBu6oq2b4WiPU+Pfn3cqe7Y6mIFu/ajBBLoJzjWX1+pOYsFFWWBFW2nNQw==} engines: {node: '>=20'} @@ -1291,30 +1278,22 @@ snapshots: '@marijn/find-cluster-break@1.0.4': {} - '@missing-elements/h5p-author@0.13.0(@missing-elements/h5p-runtime@1.0.2)': + '@missing-elements/h5p-author@0.14.0(@missing-elements/h5p-runtime@1.0.2)': dependencies: - '@missing-elements/h5p-libraries': 1.1.0 - '@missing-elements/h5p-normalize': 1.4.0 - '@missing-elements/h5p-offline-player': 1.6.0(@missing-elements/h5p-runtime@1.0.2) + '@missing-elements/h5p-libraries': 1.1.1 + '@missing-elements/h5p-normalize': 1.4.1 + '@missing-elements/h5p-offline-player': 1.7.0(@missing-elements/h5p-runtime@1.0.2) '@zip.js/zip.js': 2.25.0 zod: 4.6.7 transitivePeerDependencies: - '@missing-elements/h5p-runtime' - '@missing-elements/h5p-libraries@1.1.0': {} - '@missing-elements/h5p-libraries@1.1.1': {} - '@missing-elements/h5p-normalize@1.4.0': + '@missing-elements/h5p-normalize@1.4.1': dependencies: '@zip.js/zip.js': 2.25.0 - '@missing-elements/h5p-offline-player@1.6.0(@missing-elements/h5p-runtime@1.0.2)': - dependencies: - '@zip.js/zip.js': 2.25.0 - optionalDependencies: - '@missing-elements/h5p-runtime': 1.0.2 - '@missing-elements/h5p-offline-player@1.7.0(@missing-elements/h5p-runtime@1.0.2)': dependencies: '@zip.js/zip.js': 2.25.0 diff --git a/vite.config.ts b/vite.config.ts index 52e7df1..4ffa550 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url' import { gzipSync } from 'node:zlib' import { buildPackage, writeBundles } from '@missing-elements/h5p-author' import { Uint8ArrayReader, Uint8ArrayWriter, ZipWriter } from '@zip.js/zip.js' -import { build, defineConfig, type Plugin } from 'vite' +import { defineConfig, type Plugin } from 'vite' /* * The site's H5P part, `/h5p/`, which Vite builds into `_site/` once Eleventy has written the pages @@ -154,21 +154,22 @@ function sample(): Plugin { * 2026-11-13, its `npx` having timed out. * - `parts/`: every part of the pack under its own name, and its index. A bundle holds no addon, * so a build whose text calls for one stops and names its part, which the chat fetches from here. - * - `h5p-author.mjs`: the command line as one file, everything it imports bundled in by Vite, so it - * runs with nothing installed. It takes `--libraries`: the npm package's pinned pack is not with - * it. Since 0.9.8 its `--version` prints the versions from copies of the two package.json files - * Vite writes in (h5p-toolkit#198); before, it crashed, finding neither beside it. The + * - `h5p-author.mjs`: the command line as one file, everything it imports bundled in, so it runs + * with nothing installed. Copied as the author package ships it (`dist/`, built by its + * `prepack` since 0.14.0, h5p-toolkit#247), so the bytes a chat runs are the npm package's, + * which its provenance covers, and this site's build tools never touch them. It takes + * `--libraries`: the npm package's pinned pack is not with it. Its `--version` prints the + * versions from copies of the two package.json files bundled into it (h5p-toolkit#198). The * build runs it and stops where it does not print the versions `index.json` says. - * - `h5p-author-LICENSES.txt`: every package bundled into `h5p-author.mjs` with its licence, as - * Vite lists them, since MIT and BSD-3-Clause ask their notices to travel with copies (zod came - * in with h5p-author 0.12.0; zip.js was in already). It goes into the archive with the tool. + * - `h5p-author-LICENSES.txt`: every package bundled into `h5p-author.mjs` with its licence, + * shipped beside it, since MIT and BSD-3-Clause ask their notices to travel with copies. It goes + * into the archive with the tool. * - `index.json`: the author's and the pack's versions, and each bundle's file, size and parts. * - `libraries.txt`: the pack's licence list, which asks to travel with its libraries. * * Written after the page, from the packages the lockfile pins: `_site/` holds them, git does not. */ function bundles(): Plugin { - const root = fileURLToPath(new URL('.', import.meta.url)) const author = new URL('./node_modules/@missing-elements/h5p-author/', import.meta.url) const libraries = new URL('./node_modules/@missing-elements/h5p-libraries/', import.meta.url) const version = async (from: URL) => (JSON.parse(await readFile(new URL('package.json', from), 'utf8')) as { version: string }).version @@ -188,23 +189,8 @@ function bundles(): Plugin { for (const { folder: part } of index.libraries) await copyFile(new URL(`parts/${part}.h5p`, libraries), join(parts, `${part}.h5p`)) await copyFile(new URL('parts/index.json', libraries), join(parts, 'index.json')) await copyFile(new URL('libraries.txt', libraries), join(folder, 'libraries.txt')) - await build({ - configFile: false, - root, - logLevel: 'warn', - publicDir: false, - build: { - ssr: fileURLToPath(new URL('bin/h5p-author.mjs', author)), - outDir: folder, - emptyOutDir: false, - copyPublicDir: false, - minify: false, - license: { fileName: 'h5p-author-LICENSES.txt' }, - reportCompressedSize: false, - rolldownOptions: { output: { entryFileNames: 'h5p-author.mjs', format: 'es', codeSplitting: false } } - }, - ssr: { noExternal: true, target: 'node' } - }) + // The command line as one file and its licence list, as the author package ships them. + for (const file of ['h5p-author.mjs', 'h5p-author-LICENSES.txt']) await copyFile(new URL(`dist/${file}`, author), join(folder, file)) // The tool says its own versions, as a model checking it first asks: those this site pins. const expected = `@missing-elements/h5p-author ${await version(author)}, library pack ${await version(libraries)}` const printed = execFileSync(process.execPath, [join(folder, 'h5p-author.mjs'), '--version'], { encoding: 'utf8' }).trim()