@beff/aula-cli 0.12.0 → 0.13.1
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.
- package/README.md +6 -1
- package/dist/src/aula-render.core.wasm +0 -0
- package/dist/src/{aula-voice-tts-YOS4IQXV.js → aula-voice-tts-FEFKNA2I.js} +1 -1
- package/dist/src/aula.js +2 -2
- package/dist/src/{chunk-DC7A435Z.js → chunk-2BEUK7M7.js} +1 -1
- package/dist/src/{chunk-2PAZTBSE.js → chunk-2VD3JPLV.js} +3 -5
- package/dist/src/chunk-4N5SDSCV.js +63 -0
- package/dist/src/{chunk-AXQBWV7J.js → chunk-F37DXY3P.js} +219 -115
- package/dist/src/{chunk-PZXFW6ZD.js → chunk-FGTN34N7.js} +3 -3
- package/dist/src/{chunk-RAGZAJKD.js → chunk-GQSFMINU.js} +3 -33
- package/dist/src/chunk-N3YZ7K5L.js +111 -0
- package/dist/src/{chunk-DN2LVJO3.js → chunk-T7S65ZHW.js} +4307 -1645
- package/dist/src/{chunk-TDAWUJ2L.js → chunk-V3GJ4XSW.js} +118 -66
- package/dist/src/{chunk-T6CAPT32.js → chunk-VJAXVLXZ.js} +3 -2
- package/dist/src/{chunk-HD6FTA3H.js → chunk-Z7VLJSDG.js} +211 -92
- package/dist/src/cli.js +44 -155
- package/dist/src/{commands-BSDNHYB3.js → commands-ZTGXXVOO.js} +12 -10
- package/dist/src/generated/aula.core5.wasm +0 -0
- package/dist/src/generated/aula.js +4076 -1341
- package/dist/src/generated/interfaces/aula-engine-engine.d.ts +39 -0
- package/dist/src/problems-BDPV4IRL.js +17 -0
- package/dist/src/project-XHL7FN7B.js +16 -0
- package/dist/src/run-LZVKYMKT.js +238 -0
- package/dist/src/{server-TJTMSDO2.js → server-H7XOUJNL.js} +24 -21
- package/dist/src/{site-RGPJOWSU.js → site-7MLO35NA.js} +16 -89
- package/dist/src/workspace-load-OQXB2ZOC.js +16 -0
- package/dist/web/app/assets/{bf5dd884 → 15e78332}/aula-method.js +1 -1
- package/dist/web/app/assets/{bf5dd884 → 15e78332}/aula.js +1 -1
- package/dist/web/app/assets/15e78332/build-worker.js +2 -0
- package/dist/web/app/assets/15e78332/index.js +51 -0
- package/dist/web/app/assets/__vite-browser-external-CCI-9X_7.js +1 -0
- package/dist/web/app/assets/aula-voice-worker-bYZ7BKji.js +1 -0
- package/dist/web/app/assets/{aula.core5-CQ2oHbtB.wasm → aula.core5-CtBp7wFf.wasm} +0 -0
- package/dist/web/app/assets/protocol-j759xoXL.js +15 -0
- package/dist/web/app/assets/src-BjcN7H3T.js +6 -0
- package/dist/web/{site/assets/tex-mathjax-DrZV_cwB.js → app/assets/tex-mathjax-Bbh2jsAv.js} +1 -1
- package/dist/web/app/index.html +4 -4
- package/dist/web/site/assets/{07fb5cf0 → 671a8ee2}/aula-method.js +1 -1
- package/dist/web/site/assets/{07fb5cf0 → 671a8ee2}/aula.js +1 -1
- package/dist/web/site/assets/671a8ee2/build-worker.js +2 -0
- package/dist/web/site/assets/671a8ee2/index.js +51 -0
- package/dist/web/site/assets/__vite-browser-external-CrZYh5ba.js +1 -0
- package/dist/web/site/assets/aula-voice-worker-Doyh20uI.js +1 -0
- package/dist/web/site/assets/{aula.core5-CQ2oHbtB.wasm → aula.core5-CtBp7wFf.wasm} +0 -0
- package/dist/web/site/assets/protocol-ByKVs3Yn.js +15 -0
- package/dist/web/site/assets/src-BwnY0kQu.js +6 -0
- package/dist/web/{app/assets/tex-mathjax-eWNptbJg.js → site/assets/tex-mathjax-DKtiwFu-.js} +1 -1
- package/dist/web/site/index.html +4 -4
- package/package.json +1 -1
- package/dist/src/chunk-4QGX7XXO.js +0 -104
- package/dist/src/problems-CGKCPETU.js +0 -18
- package/dist/src/project-EUFMRQXR.js +0 -16
- package/dist/src/run-ER27SVTA.js +0 -183
- package/dist/web/app/assets/__vite-browser-external-BHESVS8k.js +0 -1
- package/dist/web/app/assets/aula-voice-worker-CJpoa9h-.js +0 -1
- package/dist/web/app/assets/bf5dd884/build-worker.js +0 -2
- package/dist/web/app/assets/bf5dd884/index.js +0 -51
- package/dist/web/app/assets/protocol-Dc79M9p3.js +0 -15
- package/dist/web/app/assets/src-DWqZcp-P.js +0 -6
- package/dist/web/site/assets/07fb5cf0/build-worker.js +0 -2
- package/dist/web/site/assets/07fb5cf0/index.js +0 -51
- package/dist/web/site/assets/__vite-browser-external-DQubyTsZ.js +0 -1
- package/dist/web/site/assets/aula-voice-worker-BRrzyFz3.js +0 -1
- package/dist/web/site/assets/protocol-F-4tHoAW.js +0 -15
- package/dist/web/site/assets/src-DfPcHwz-.js +0 -6
|
@@ -430,7 +430,7 @@ import {
|
|
|
430
430
|
wiggle,
|
|
431
431
|
wrap,
|
|
432
432
|
wrong
|
|
433
|
-
} from "./chunk-
|
|
433
|
+
} from "./chunk-T7S65ZHW.js";
|
|
434
434
|
import {
|
|
435
435
|
fault
|
|
436
436
|
} from "./chunk-VX7UVLQW.js";
|
|
@@ -2501,27 +2501,6 @@ function svgPathPoints(d) {
|
|
|
2501
2501
|
}
|
|
2502
2502
|
return out;
|
|
2503
2503
|
}
|
|
2504
|
-
function lerp2(a, b, t) {
|
|
2505
|
-
return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
|
|
2506
|
-
}
|
|
2507
|
-
function splitCubic(q, t) {
|
|
2508
|
-
const z = [0, 0];
|
|
2509
|
-
const [p0, p1, p2, p3] = [q[0] ?? z, q[1] ?? z, q[2] ?? z, q[3] ?? z];
|
|
2510
|
-
const a = lerp2(p0, p1, t);
|
|
2511
|
-
const b = lerp2(p1, p2, t);
|
|
2512
|
-
const d = lerp2(p2, p3, t);
|
|
2513
|
-
const e = lerp2(a, b, t);
|
|
2514
|
-
const f = lerp2(b, d, t);
|
|
2515
|
-
const g = lerp2(e, f, t);
|
|
2516
|
-
return [
|
|
2517
|
-
[p0, a, e, g],
|
|
2518
|
-
[g, f, d, p3]
|
|
2519
|
-
];
|
|
2520
|
-
}
|
|
2521
|
-
function cubicPart(c, t0, t1) {
|
|
2522
|
-
const right = splitCubic(c, t0)[1];
|
|
2523
|
-
return t0 >= 1 ? [...right] : splitCubic(right, (t1 - t0) / (1 - t0))[0];
|
|
2524
|
-
}
|
|
2525
2504
|
function partialPoints(points, a, b) {
|
|
2526
2505
|
const n = Math.floor(points.length / 4);
|
|
2527
2506
|
if (n === 0 || b <= a) return [];
|
|
@@ -2529,23 +2508,14 @@ function partialPoints(points, a, b) {
|
|
|
2529
2508
|
const out = [];
|
|
2530
2509
|
for (let i = 0; i < n; i++) {
|
|
2531
2510
|
if (i + 1 <= lo || i >= hi) continue;
|
|
2532
|
-
out.push(...
|
|
2511
|
+
out.push(...engine.cubicPartial(points.slice(4 * i, 4 * i + 4), Math.max(0, lo - i), Math.min(1, hi - i)));
|
|
2533
2512
|
}
|
|
2534
2513
|
return out;
|
|
2535
2514
|
}
|
|
2536
2515
|
function insertCurves(points, n) {
|
|
2537
2516
|
const count = Math.floor(points.length / 4);
|
|
2538
2517
|
if (count === 0 || n <= 0) return [...points];
|
|
2539
|
-
|
|
2540
|
-
const pieces = Array.from({ length: count }, () => 0);
|
|
2541
|
-
for (let k = 0; k < target; k++) {
|
|
2542
|
-
const i = Math.floor(k * count / target);
|
|
2543
|
-
pieces[i] = (pieces[i] ?? 0) + 1;
|
|
2544
|
-
}
|
|
2545
|
-
return pieces.flatMap((sf, i) => {
|
|
2546
|
-
const curve = points.slice(4 * i, 4 * i + 4);
|
|
2547
|
-
return Array.from({ length: sf }, (_, j) => cubicPart(curve, j / sf, (j + 1) / sf)).flat();
|
|
2548
|
-
});
|
|
2518
|
+
return engine.insertCurves([...points], n);
|
|
2549
2519
|
}
|
|
2550
2520
|
|
|
2551
2521
|
// ../aula-core/src/graphing.ts
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createNodeBundler,
|
|
3
|
+
nodeTree
|
|
4
|
+
} from "./chunk-THQ5Y74K.js";
|
|
5
|
+
import {
|
|
6
|
+
draftSkipMessage,
|
|
7
|
+
listedProjects,
|
|
8
|
+
loadBuiltProjects,
|
|
9
|
+
workspaceHost
|
|
10
|
+
} from "./chunk-F37DXY3P.js";
|
|
11
|
+
import {
|
|
12
|
+
NO_PROJECT_MESSAGE,
|
|
13
|
+
Problems,
|
|
14
|
+
bundleProjects,
|
|
15
|
+
bundleWorkspace,
|
|
16
|
+
wrongArgument
|
|
17
|
+
} from "./chunk-VJAXVLXZ.js";
|
|
18
|
+
import {
|
|
19
|
+
v8Frames
|
|
20
|
+
} from "./chunk-T7S65ZHW.js";
|
|
21
|
+
|
|
22
|
+
// src/workspace-load.ts
|
|
23
|
+
import { existsSync } from "node:fs";
|
|
24
|
+
import os from "node:os";
|
|
25
|
+
import path from "node:path";
|
|
26
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
27
|
+
var METHOD_STUB = "export const paragraph = () => () => ({});\n";
|
|
28
|
+
async function loadWorkspaceProjects(capabilities, workspaceBundle) {
|
|
29
|
+
const scratch = await capabilities.fs.mkdtemp(path.join(os.tmpdir(), "aula-workspace-"));
|
|
30
|
+
let count = 0;
|
|
31
|
+
try {
|
|
32
|
+
const method = path.join(scratch, "aula-method.mjs");
|
|
33
|
+
await capabilities.fs.writeFile(method, METHOD_STUB);
|
|
34
|
+
const bundledAula = path.join(path.dirname(fileURLToPath(import.meta.url)), "aula.js");
|
|
35
|
+
const player = {
|
|
36
|
+
"@beff/aula": existsSync(bundledAula) ? pathToFileURL(bundledAula).href : import.meta.resolve("@beff/aula"),
|
|
37
|
+
"@beff/aula-method": pathToFileURL(method).href
|
|
38
|
+
};
|
|
39
|
+
const modules = {
|
|
40
|
+
load: async ({ code }) => {
|
|
41
|
+
count += 1;
|
|
42
|
+
const file = path.join(scratch, `bundle-${String(count)}.mjs`);
|
|
43
|
+
await capabilities.fs.writeFile(file, code);
|
|
44
|
+
const url = pathToFileURL(file).href;
|
|
45
|
+
return { url, exports: await import(url) };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const loaded = await loadBuiltProjects(workspaceBundle, workspaceHost(v8Frames), modules, player);
|
|
49
|
+
if (loaded._tag === "Left") throw new Problems(loaded.left);
|
|
50
|
+
return loaded.right;
|
|
51
|
+
} finally {
|
|
52
|
+
await capabilities.fs.rm(scratch, { recursive: true, force: true });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function projectFolderLabel(root, project) {
|
|
56
|
+
return project.folder === "" ? path.basename(root) : project.folder;
|
|
57
|
+
}
|
|
58
|
+
async function resolveRootProjects(capabilities, root, includeDrafts) {
|
|
59
|
+
const tree = nodeTree(capabilities, root);
|
|
60
|
+
const name = path.basename(root);
|
|
61
|
+
const bundler = createNodeBundler();
|
|
62
|
+
try {
|
|
63
|
+
const bundled = await bundleWorkspace(bundler, tree, name);
|
|
64
|
+
if (bundled._tag === "Left") throw new Problems(bundled.left);
|
|
65
|
+
let bundle = bundled.right.bundle;
|
|
66
|
+
const inputs = bundled.right.inputs;
|
|
67
|
+
const loaded = await loadWorkspaceProjects(capabilities, bundle);
|
|
68
|
+
if (loaded.length === 0) throw new Error(NO_PROJECT_MESSAGE);
|
|
69
|
+
const projects = listedProjects(loaded, { includeDrafts });
|
|
70
|
+
for (const project of loaded) {
|
|
71
|
+
if (project.draft && !includeDrafts) {
|
|
72
|
+
capabilities.log.out(draftSkipMessage(projectFolderLabel(root, project)));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (projects.length !== loaded.length) {
|
|
76
|
+
const keep = new Set(projects.map((project) => project.name));
|
|
77
|
+
const filtered = bundle.projects.filter((project) => keep.has(project.name));
|
|
78
|
+
if (filtered.length > 0) {
|
|
79
|
+
const rebundled = await bundleProjects(bundler, tree, name, filtered);
|
|
80
|
+
if (rebundled._tag === "Left") throw new Problems(rebundled.left);
|
|
81
|
+
bundle = rebundled.right.bundle;
|
|
82
|
+
} else {
|
|
83
|
+
bundle = { ...bundle, projects: [], code: "export default [];\n", map: "{}" };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (includeDrafts) bundle = { ...bundle, includeDrafts: true };
|
|
87
|
+
return { loaded, projects, bundle, inputs };
|
|
88
|
+
} finally {
|
|
89
|
+
await bundler.stop();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function projectFolderOf(root, project) {
|
|
93
|
+
return project.folder === "" ? root : path.join(root, project.folder);
|
|
94
|
+
}
|
|
95
|
+
async function resolveOneProject(capabilities, root, includeDrafts, command) {
|
|
96
|
+
const { projects } = await resolveRootProjects(capabilities, root, includeDrafts);
|
|
97
|
+
if (projects.length === 1) {
|
|
98
|
+
const project = projects[0];
|
|
99
|
+
if (project === void 0) throw new Error("resolveOneProject: missing project");
|
|
100
|
+
return { folder: projectFolderOf(root, project), project };
|
|
101
|
+
}
|
|
102
|
+
throw wrongArgument(
|
|
103
|
+
`aula ${command} needs exactly one project after filtering`,
|
|
104
|
+
projects.length === 0 ? "pass a project folder, or pass --include-drafts when the project is a draft" : "pass a project folder, not a playlist folder with more than one project"
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
resolveRootProjects,
|
|
110
|
+
resolveOneProject
|
|
111
|
+
};
|