@beff/aula-cli 0.0.1 → 0.1.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 (40) hide show
  1. package/README.md +11 -1
  2. package/dist/licenses/aula-g2p-NOTICE.txt +13 -0
  3. package/dist/licenses/espeak-ng-COPYING.txt +674 -0
  4. package/dist/licenses/fonts-OFL-JetBrainsMono.txt +93 -0
  5. package/dist/licenses/fonts-OFL-NunitoSans.txt +93 -0
  6. package/dist/src/aula-render.core.wasm +0 -0
  7. package/dist/src/aula-voice-tts-ZXQ7XXHJ.js +14 -0
  8. package/dist/src/chunk-2XGNOG2U.js +28 -0
  9. package/dist/src/chunk-3IBMAZRS.js +21 -0
  10. package/dist/src/chunk-EYXQ2I7K.js +604 -0
  11. package/dist/src/chunk-GFCJYE75.js +42 -0
  12. package/dist/src/chunk-KLE5UOUB.js +57 -0
  13. package/dist/src/chunk-OMBYV6CK.js +1063 -0
  14. package/dist/src/chunk-PYRORQA5.js +88 -0
  15. package/dist/src/chunk-SDFXIMLW.js +1083 -0
  16. package/dist/src/chunk-UREQAEFC.js +491 -0
  17. package/dist/src/chunk-X3HJY34X.js +81 -0
  18. package/dist/src/cli.js +269 -0
  19. package/dist/src/commands-VDGWDVWT.js +28 -0
  20. package/dist/src/problems-OGUR4BLZ.js +12 -0
  21. package/dist/src/project-M63R4ENB.js +11 -0
  22. package/dist/src/render-child.js +3771 -0
  23. package/dist/src/run-CY72QGZJ.js +127 -0
  24. package/dist/src/server-ZG6K7Z7H.js +280 -0
  25. package/dist/web/app/assets/__vite-browser-external-Bbi05A7N.js +1 -0
  26. package/dist/web/app/assets/__vite-browser-external-BtQTJ51O.js +1 -0
  27. package/dist/web/app/assets/aula-method.js +1 -0
  28. package/dist/web/app/assets/aula-voice-worker-BL6WcrSe.js +52 -0
  29. package/dist/web/app/assets/aula.core-BtiPQSZi.wasm +0 -0
  30. package/dist/web/app/assets/aula.core5-BdGB-M10.wasm +0 -0
  31. package/dist/web/app/assets/aula.js +1 -0
  32. package/dist/web/app/assets/build-worker.js +697 -0
  33. package/dist/web/app/assets/esbuild-BaXVPFT2.wasm +0 -0
  34. package/dist/web/app/assets/index-BVQqteYG.js +53 -0
  35. package/dist/web/app/assets/index-CS60sOpp.css +2 -0
  36. package/dist/web/app/assets/protocol-Ds4jI5bY.js +15 -0
  37. package/dist/web/app/assets/rolldown-runtime-BLXQ4ufn.js +1 -0
  38. package/dist/web/app/assets/src-BbJ5r410.js +25 -0
  39. package/dist/web/app/index.html +15 -0
  40. package/package.json +27 -5
@@ -0,0 +1,88 @@
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
+ };