@beff/aula-cli 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/dist/src/aula-render.core.wasm +0 -0
  3. package/dist/src/{chunk-3IBMAZRS.js → chunk-46KT47TH.js} +1 -1
  4. package/dist/src/{chunk-SDFXIMLW.js → chunk-7KT36JRP.js} +312 -113
  5. package/dist/src/chunk-BMP6H3SZ.js +104 -0
  6. package/dist/src/{chunk-OMBYV6CK.js → chunk-D2BDOCX7.js} +56 -14
  7. package/dist/src/{chunk-UREQAEFC.js → chunk-PSI7MMGP.js} +9 -226
  8. package/dist/src/{chunk-EYXQ2I7K.js → chunk-SW5BNPAM.js} +10 -36
  9. package/dist/src/cli.js +81 -16
  10. package/dist/src/{commands-VDGWDVWT.js → commands-CEBO6WWE.js} +6 -7
  11. package/dist/src/problems-FFAR72WZ.js +12 -0
  12. package/dist/src/{project-M63R4ENB.js → project-NWT5MDQI.js} +2 -2
  13. package/dist/src/{run-CY72QGZJ.js → run-DU2H6FZI.js} +10 -10
  14. package/dist/src/{server-ZG6K7Z7H.js → server-7AN6XCTF.js} +6 -66
  15. package/dist/web/app/assets/__vite-browser-external-B6HdzU1j.js +1 -0
  16. package/dist/web/app/assets/aula-method.js +1 -1
  17. package/dist/web/app/assets/{aula-voice-worker-BL6WcrSe.js → aula-voice-worker-DNzLI-en.js} +10 -10
  18. package/dist/web/app/assets/{aula.core5-BdGB-M10.wasm → aula.core5-BmrvjVro.wasm} +0 -0
  19. package/dist/web/app/assets/aula.js +1 -1
  20. package/dist/web/app/assets/build-worker.js +8 -9
  21. package/dist/web/app/assets/index-D6yaOVRx.js +53 -0
  22. package/dist/web/app/assets/index-cL-Dm_aw.css +2 -0
  23. package/dist/web/app/assets/protocol-CDkth-6D.js +15 -0
  24. package/dist/web/app/assets/{src-BbJ5r410.js → src-B22P60S6.js} +6 -6
  25. package/dist/web/app/index.html +4 -4
  26. package/package.json +2 -2
  27. package/dist/src/chunk-KLE5UOUB.js +0 -57
  28. package/dist/src/chunk-PYRORQA5.js +0 -88
  29. package/dist/src/chunk-X3HJY34X.js +0 -81
  30. package/dist/src/problems-OGUR4BLZ.js +0 -12
  31. package/dist/web/app/assets/__vite-browser-external-Bbi05A7N.js +0 -1
  32. package/dist/web/app/assets/index-BVQqteYG.js +0 -53
  33. package/dist/web/app/assets/index-CS60sOpp.css +0 -2
  34. package/dist/web/app/assets/protocol-Ds4jI5bY.js +0 -15
@@ -4,11 +4,11 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Aula videos</title>
7
- <script type="module" crossorigin src="/assets/index-BVQqteYG.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-D6yaOVRx.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-BLXQ4ufn.js">
9
- <link rel="modulepreload" crossorigin href="/assets/src-BbJ5r410.js">
10
- <link rel="modulepreload" crossorigin href="/assets/protocol-Ds4jI5bY.js">
11
- <link rel="stylesheet" crossorigin href="/assets/index-CS60sOpp.css">
9
+ <link rel="modulepreload" crossorigin href="/assets/src-B22P60S6.js">
10
+ <link rel="modulepreload" crossorigin href="/assets/protocol-CDkth-6D.js">
11
+ <link rel="stylesheet" crossorigin href="/assets/index-cL-Dm_aw.css">
12
12
  </head>
13
13
  <body>
14
14
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beff/aula-cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "The aula command: runs chapter modules on the @beff/aula engine, checks and lints them, writes PNG pictures for review, makes project zips, and serves the web player with narration.",
6
6
  "license": "MIT AND GPL-3.0-or-later",
@@ -24,6 +24,6 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "esbuild-wasm": "^0.28.2",
27
- "@beff/aula": "0.1.0"
27
+ "@beff/aula": "0.2.0"
28
28
  }
29
29
  }
@@ -1,57 +0,0 @@
1
- import {
2
- ObjectRuntype,
3
- OptionalFieldRuntype,
4
- RefRuntype,
5
- TypeofRuntype,
6
- buildParsers
7
- } from "./chunk-SDFXIMLW.js";
8
-
9
- // generated/parser.js
10
- var RequiredStringFormats = [];
11
- var RequiredNumberFormats = [];
12
- var namedRuntypes = {};
13
- var stringFormatters = {};
14
- var numberFormatters = {};
15
- var direct_hoist_0 = new RefRuntype(void 0, "SpeakRequest", namedRuntypes);
16
- var direct_hoist_1 = new RefRuntype(void 0, "TokensLine", namedRuntypes);
17
- var direct_hoist_2 = new TypeofRuntype(void 0, "number");
18
- var direct_hoist_3 = new TypeofRuntype(void 0, "string");
19
- var direct_hoist_4 = new ObjectRuntype({
20
- "description": "`POST /speak` and `POST /time`: the text, and its speed (1 is normal; headings use 0.9)."
21
- }, {
22
- "speed": direct_hoist_2,
23
- "text": direct_hoist_3
24
- }, []);
25
- var direct_hoist_5 = new ObjectRuntype({
26
- "description": "One input line of `aula tokens`: a text, and an optional id that the output line repeats."
27
- }, {
28
- "id": new OptionalFieldRuntype(direct_hoist_3),
29
- "text": direct_hoist_3
30
- }, []);
31
- Object.assign(namedRuntypes, {
32
- "SpeakRequest": direct_hoist_4,
33
- "TokensLine": direct_hoist_5
34
- });
35
- var buildParsersInput = {
36
- "SpeakRequest": direct_hoist_0,
37
- "TokensLine": direct_hoist_1
38
- };
39
- var parser_default = {
40
- buildParsers: (args) => buildParsers(
41
- {
42
- parsers: buildParsersInput,
43
- stringFormatters,
44
- numberFormatters,
45
- requiredStringFormats: RequiredStringFormats,
46
- requiredNumberFormats: RequiredNumberFormats
47
- },
48
- args
49
- )
50
- };
51
-
52
- // src/parsers.ts
53
- var Parsers = parser_default.buildParsers();
54
-
55
- export {
56
- Parsers
57
- };
@@ -1,88 +0,0 @@
1
- // ../aula-project/src/diagnostics.ts
2
- import { diagnosticOf } from "@beff/aula/run";
3
- function error(message, more = {}) {
4
- return { severity: "error", message, ...more, stack: [], related: [] };
5
- }
6
- var isError = (d) => d.severity === "error";
7
- var Problems = class extends Error {
8
- diagnostics;
9
- constructor(diagnostics) {
10
- super(diagnostics.map((d) => d.message).join("\n"));
11
- this.diagnostics = diagnostics;
12
- }
13
- };
14
- function wrongArgument(message, hint) {
15
- return new Problems([error(message, hint === void 0 ? {} : { hint })]);
16
- }
17
- function diagnosticsOf(e, host2) {
18
- return e instanceof Problems ? e.diagnostics : [diagnosticOf(e, "", host2)];
19
- }
20
-
21
- // ../aula-project/src/node.ts
22
- import path from "node:path";
23
- import { pathToFileURL } from "node:url";
24
- import { isProjectDefinition } from "@beff/aula";
25
- import { definedAt, loadEngine, v8Frames } from "@beff/aula/run";
26
- var PROJECT_MODULE = "index.ts";
27
- var GLUE = [
28
- `${path.dirname(new URL(import.meta.resolve("@beff/aula")).pathname)}/`,
29
- new URL(import.meta.url).pathname
30
- ];
31
- function host(capabilities, root, glue = []) {
32
- const all = [...GLUE, ...glue];
33
- return {
34
- frames: v8Frames,
35
- name: (file) => file.startsWith("/") && !file.includes("/node_modules/") && !all.some((g) => file.startsWith(g)) ? path.relative(root, file) : void 0,
36
- exists: (file) => capabilities.fs.existsSync(path.resolve(root, file))
37
- };
38
- }
39
- function propertyOf(e, key) {
40
- return typeof e === "object" && e !== null ? Reflect.get(e, key) : void 0;
41
- }
42
- async function loadProject(capabilities, load, root, folder) {
43
- const file = path.join(folder, PROJECT_MODULE);
44
- if (!capabilities.fs.existsSync(file)) {
45
- throw wrongArgument(
46
- `${path.relative(root, folder) || "."} has no ${PROJECT_MODULE}`,
47
- `give the project folder: the folder with ${PROJECT_MODULE}`
48
- );
49
- }
50
- await loadEngine();
51
- const module = await load(pathToFileURL(file).href);
52
- const exported = propertyOf(module, "default");
53
- if (!isProjectDefinition(exported)) {
54
- const rel = path.relative(root, file);
55
- throw new Problems([
56
- error(`the default export of ${rel} is not made by defineProject`, {
57
- location: { file: rel, line: 1, col: 0 },
58
- hint: "write `export default defineProject({ title, theme, chapters: [ \u2026 ] })`"
59
- })
60
- ]);
61
- }
62
- return exported;
63
- }
64
- var folderOf = (project) => path.dirname(definedAt(project).file);
65
- var nameOf = (project) => path.basename(folderOf(project));
66
- async function withSource(capabilities, root, d) {
67
- if (d.source !== void 0 || d.location === void 0) return d;
68
- const file = path.resolve(root, d.location.file);
69
- if (!capabilities.fs.existsSync(file)) return d;
70
- const text = await capabilities.fs.readFile(file, "utf8");
71
- const lines = text.split("\n");
72
- if (lines.at(-1) === "") lines.pop();
73
- const line = lines[d.location.line - 1];
74
- return line === void 0 || d.location.line < 1 ? d : { ...d, source: line.replace(/\r$/, "") };
75
- }
76
-
77
- export {
78
- error,
79
- isError,
80
- Problems,
81
- wrongArgument,
82
- diagnosticsOf,
83
- host,
84
- loadProject,
85
- folderOf,
86
- nameOf,
87
- withSource
88
- };
@@ -1,81 +0,0 @@
1
- import {
2
- AULA_VOICE_FILES,
3
- AULA_VOICE_RELEASE,
4
- AULA_VOICE_WEIGHTS,
5
- KOKORO_VOCAB,
6
- aulaVoiceNarrator,
7
- aulaVoiceUrl,
8
- britishPhonemizer,
9
- studentWeightFile,
10
- tokenBatches
11
- } from "./chunk-EYXQ2I7K.js";
12
-
13
- // ../aula-narration/src/node.ts
14
- import { Buffer } from "node:buffer";
15
- import { createHash } from "node:crypto";
16
- import path from "node:path";
17
- import { fault } from "@beff/aula/errors";
18
- var sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
19
- async function download(capabilities, fetch, downloading, destination, url, hash) {
20
- if (capabilities.fs.existsSync(destination)) {
21
- const kept = new Uint8Array(await capabilities.fs.readFile(destination));
22
- if (sha256(kept) === hash) return kept;
23
- }
24
- downloading(path.basename(destination));
25
- const response = await fetch(url, { headers: { "User-Agent": "aula" } });
26
- if (!response.ok) throw new Error(`Cannot download ${url}: HTTP ${String(response.status)}`);
27
- const bytes = new Uint8Array(await response.arrayBuffer());
28
- const expected = Number(response.headers.get("Content-Length") ?? 0);
29
- if (expected && bytes.byteLength !== expected) throw new Error(`Incomplete download of ${url}; run again to retry`);
30
- if (sha256(bytes) !== hash) {
31
- fault(`the download of ${url} has the wrong SHA-256`, "run the command again; if it fails again, report it");
32
- }
33
- await capabilities.fs.mkdir(path.dirname(destination), { recursive: true });
34
- await capabilities.fs.writeFile(`${destination}.part`, bytes);
35
- await capabilities.fs.rename(`${destination}.part`, destination);
36
- return bytes;
37
- }
38
- var phonemize = britishPhonemizer(new Set(KOKORO_VOCAB.keys()));
39
- function textTokens() {
40
- return (text) => tokenBatches(KOKORO_VOCAB, phonemize, text);
41
- }
42
- var aulaVoiceFolder = (models) => path.join(models, "aula-voice", AULA_VOICE_RELEASE);
43
- async function aulaVoiceWeightFile(capabilities, options) {
44
- const { fetch, models, downloading } = options;
45
- const folder = aulaVoiceFolder(models);
46
- const destination = path.join(folder, AULA_VOICE_WEIGHTS.path);
47
- if (capabilities.fs.existsSync(destination)) {
48
- const kept = new Uint8Array(await capabilities.fs.readFile(destination));
49
- if (sha256(kept) === AULA_VOICE_WEIGHTS.sha256) return kept;
50
- }
51
- const { model, config } = AULA_VOICE_FILES;
52
- const raw = (file) => download(capabilities, fetch, downloading, path.join(folder, file.path), aulaVoiceUrl(file), file.sha256);
53
- const avw = studentWeightFile(await raw(model), await raw(config));
54
- if (sha256(avw) !== AULA_VOICE_WEIGHTS.sha256) {
55
- fault("the weight file made from aula-voice's release has the wrong SHA-256", "report it");
56
- }
57
- await capabilities.fs.writeFile(`${destination}.part`, avw);
58
- await capabilities.fs.rename(`${destination}.part`, destination);
59
- return avw;
60
- }
61
- function createAulaVoice(capabilities, options) {
62
- return aulaVoiceNarrator("wasm", async () => {
63
- const { aulaVoiceModel } = await import("./aula-voice-tts-ZXQ7XXHJ.js");
64
- return { model: await aulaVoiceModel(await aulaVoiceWeightFile(capabilities, options)), phonemize };
65
- });
66
- }
67
- function speakAnswer(speech) {
68
- const bytes = new Uint8Array(speech.samples.buffer, speech.samples.byteOffset, speech.samples.byteLength);
69
- return { sample_rate: speech.sampleRate, samples: Buffer.from(bytes).toString("base64"), words: speech.words };
70
- }
71
- function timeAnswer(timing) {
72
- return { sample_rate: timing.sampleRate, samples: timing.samples, words: timing.words };
73
- }
74
-
75
- export {
76
- textTokens,
77
- aulaVoiceWeightFile,
78
- createAulaVoice,
79
- speakAnswer,
80
- timeAnswer
81
- };
@@ -1,12 +0,0 @@
1
- import {
2
- printDiagnostics
3
- } from "./chunk-UREQAEFC.js";
4
- import "./chunk-SDFXIMLW.js";
5
- import "./chunk-EYXQ2I7K.js";
6
- import {
7
- diagnosticsOf
8
- } from "./chunk-PYRORQA5.js";
9
- export {
10
- diagnosticsOf,
11
- printDiagnostics
12
- };
@@ -1 +0,0 @@
1
- import{t as e}from"./aula-voice-worker-BL6WcrSe.js";var t=/* @__PURE__ */ e(((e,t)=>{t.exports={}}));export default t();