@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
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createNodeBundler
|
|
2
|
+
createNodeBundler,
|
|
3
|
+
nodeTree
|
|
3
4
|
} from "./chunk-THQ5Y74K.js";
|
|
5
|
+
import {
|
|
6
|
+
Capabilities
|
|
7
|
+
} from "./chunk-4N5SDSCV.js";
|
|
4
8
|
import {
|
|
5
9
|
VIDEO,
|
|
6
10
|
assemble,
|
|
7
11
|
ffmpeg,
|
|
8
12
|
hasAudio
|
|
9
13
|
} from "./chunk-F4XRXW6M.js";
|
|
14
|
+
import {
|
|
15
|
+
run,
|
|
16
|
+
status
|
|
17
|
+
} from "./chunk-4N4NUMKP.js";
|
|
10
18
|
import {
|
|
11
19
|
printDiagnostics
|
|
12
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-FGTN34N7.js";
|
|
13
21
|
import {
|
|
14
22
|
chapterIndexes,
|
|
15
23
|
checkProject,
|
|
16
24
|
clipPlan,
|
|
17
25
|
clock,
|
|
26
|
+
clockWithUnclear,
|
|
27
|
+
draftSkipMessage,
|
|
18
28
|
exportCheck,
|
|
19
29
|
movesMarkdown,
|
|
30
|
+
narrateScript,
|
|
20
31
|
narrationAt,
|
|
21
32
|
noteLine,
|
|
22
33
|
notesLine,
|
|
@@ -25,28 +36,27 @@ import {
|
|
|
25
36
|
pictureStills,
|
|
26
37
|
previewJobs,
|
|
27
38
|
previewTargets,
|
|
39
|
+
scriptAudio,
|
|
28
40
|
scriptView,
|
|
29
41
|
targetChapters,
|
|
30
42
|
timedChapter,
|
|
31
43
|
timelineView,
|
|
44
|
+
wav,
|
|
32
45
|
wordNotes
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import {
|
|
35
|
-
narrateScript,
|
|
36
|
-
scriptAudio,
|
|
37
|
-
wav
|
|
38
|
-
} from "./chunk-4QGX7XXO.js";
|
|
46
|
+
} from "./chunk-F37DXY3P.js";
|
|
39
47
|
import {
|
|
40
48
|
narrationScript
|
|
41
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-V3GJ4XSW.js";
|
|
42
50
|
import {
|
|
43
|
-
host
|
|
44
|
-
|
|
51
|
+
host,
|
|
52
|
+
loadProject
|
|
53
|
+
} from "./chunk-2BEUK7M7.js";
|
|
45
54
|
import {
|
|
46
55
|
folderOf,
|
|
47
56
|
nameOf
|
|
48
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-2VD3JPLV.js";
|
|
49
58
|
import {
|
|
59
|
+
NO_PROJECT_MESSAGE,
|
|
50
60
|
ObjectRuntype,
|
|
51
61
|
OptionalFieldRuntype,
|
|
52
62
|
PROVIDED,
|
|
@@ -57,18 +67,20 @@ import {
|
|
|
57
67
|
buildParsers,
|
|
58
68
|
bundle,
|
|
59
69
|
isError,
|
|
70
|
+
projectModules,
|
|
60
71
|
wrongArgument
|
|
61
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-VJAXVLXZ.js";
|
|
62
73
|
import {
|
|
63
74
|
manim_exports
|
|
64
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-GQSFMINU.js";
|
|
65
76
|
import {
|
|
66
77
|
chapterNames,
|
|
67
78
|
renderChapter
|
|
68
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-T7S65ZHW.js";
|
|
69
80
|
|
|
70
81
|
// src/commands.ts
|
|
71
82
|
import path2 from "node:path";
|
|
83
|
+
import { fileURLToPath } from "node:url";
|
|
72
84
|
|
|
73
85
|
// ../../node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/index.mjs
|
|
74
86
|
import { createRequire } from "module";
|
|
@@ -912,13 +924,10 @@ async function projectFiles(capabilities, bundler, root, folder) {
|
|
|
912
924
|
}
|
|
913
925
|
|
|
914
926
|
// src/commands.ts
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
} finally {
|
|
920
|
-
await release();
|
|
921
|
-
}
|
|
927
|
+
var CHECK_CLI = fileURLToPath(new URL(import.meta.url.endsWith(".ts") ? "cli.ts" : "cli.js", import.meta.url));
|
|
928
|
+
function outputLines(text) {
|
|
929
|
+
if (text === "") return [];
|
|
930
|
+
return text.replace(/\n$/, "").split("\n");
|
|
922
931
|
}
|
|
923
932
|
async function withWork(capabilities, f) {
|
|
924
933
|
const work = await capabilities.fs.mkdtemp(path2.join(capabilities.env.temp, "aula-"));
|
|
@@ -980,32 +989,31 @@ function printCounts(capabilities, project, checked) {
|
|
|
980
989
|
capabilities.log.out(`other chapters: ${String(errors)} errors, ${String(warnings)} warnings`);
|
|
981
990
|
capabilities.log.out(rowLine(project, checked));
|
|
982
991
|
}
|
|
983
|
-
async function timeChapters(capabilities, root, project,
|
|
992
|
+
async function timeChapters(capabilities, root, project, cues, only) {
|
|
984
993
|
const names = chapterNames(project);
|
|
985
994
|
const indexes = (only ?? names.map((_, i2) => i2)).filter((i2) => i2 > 0);
|
|
986
|
-
if (indexes.length === 0) return [];
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
return warnings;
|
|
1000
|
-
});
|
|
995
|
+
if (indexes.length === 0) return { warnings: [], unclear: cues.map((chapter) => chapter.map(() => [])) };
|
|
996
|
+
const { narrations: n, unclear } = await clockWithUnclear(capabilities.narrator, cues, only, names);
|
|
997
|
+
const h = host(capabilities, root);
|
|
998
|
+
const warnings = [];
|
|
999
|
+
for (const index of indexes) {
|
|
1000
|
+
const drawn = renderChapter(project, index, {
|
|
1001
|
+
host: h,
|
|
1002
|
+
narration: narrationAt(n, index),
|
|
1003
|
+
lint: true
|
|
1004
|
+
});
|
|
1005
|
+
warnings.push(...drawn.diagnostics.filter((d) => !isError(d)));
|
|
1006
|
+
}
|
|
1007
|
+
return { warnings, unclear };
|
|
1001
1008
|
}
|
|
1002
1009
|
async function check(capabilities, root, project, only, json = false) {
|
|
1003
1010
|
const chapters = chapterIndexes(project, only);
|
|
1004
1011
|
const checked = checkProject(project, host(capabilities, root), chapters);
|
|
1005
|
-
const
|
|
1006
|
-
const
|
|
1007
|
-
const
|
|
1008
|
-
const
|
|
1012
|
+
const cues = narrationScript(project, checked.texts);
|
|
1013
|
+
const timed = checked.errors === 0 ? await timeChapters(capabilities, root, project, cues, chapters) : { warnings: [], unclear: null };
|
|
1014
|
+
const findings = [...checked.findings, ...timed.warnings];
|
|
1015
|
+
const warnings = checked.warnings + timed.warnings.length;
|
|
1016
|
+
const notes = wordNotes(cues, chapters, timed.unclear);
|
|
1009
1017
|
if (json) {
|
|
1010
1018
|
const { others, errors, open } = checked;
|
|
1011
1019
|
const result = { name: nameOf(project), errors, warnings, openMoves: open, others, findings, notes };
|
|
@@ -1018,6 +1026,126 @@ async function check(capabilities, root, project, only, json = false) {
|
|
|
1018
1026
|
printCounts(capabilities, project, { ...checked, findings, warnings });
|
|
1019
1027
|
return checked.errors === 0;
|
|
1020
1028
|
}
|
|
1029
|
+
function checkElapsed(ms) {
|
|
1030
|
+
const seconds = Math.max(0, ms) / 1e3;
|
|
1031
|
+
if (seconds < 60) return `${seconds.toFixed(1)}s`;
|
|
1032
|
+
const minutes = Math.floor(seconds / 60);
|
|
1033
|
+
const rest = Math.round(seconds - minutes * 60);
|
|
1034
|
+
return `${minutes}m ${rest}s`;
|
|
1035
|
+
}
|
|
1036
|
+
function checkProgressLine(index, total, label) {
|
|
1037
|
+
return `checking ${String(index)}/${String(total)} ${label}`;
|
|
1038
|
+
}
|
|
1039
|
+
function checkSummaryLine(passed, failed, skipped, ms) {
|
|
1040
|
+
return `${String(passed)} passed, ${String(failed)} failed, ${String(skipped)} skipped, ${checkElapsed(ms)}`;
|
|
1041
|
+
}
|
|
1042
|
+
async function checkCaptured(capabilities, cwd, project, only, json) {
|
|
1043
|
+
const lines = [];
|
|
1044
|
+
const nested = Capabilities.extend(
|
|
1045
|
+
capabilities,
|
|
1046
|
+
Capabilities.create({
|
|
1047
|
+
log: {
|
|
1048
|
+
out: (line) => void lines.push(line),
|
|
1049
|
+
write: (text) => void lines.push(text),
|
|
1050
|
+
err: () => void 0
|
|
1051
|
+
}
|
|
1052
|
+
})
|
|
1053
|
+
);
|
|
1054
|
+
return { ok: await check(nested, cwd, project, only, json), lines, skipped: false };
|
|
1055
|
+
}
|
|
1056
|
+
async function checkInChild(capabilities, node, cwd, entry, json) {
|
|
1057
|
+
const args = [CHECK_CLI, "check", entry.projectFolder];
|
|
1058
|
+
if (json) args.push("--json");
|
|
1059
|
+
if (entry.project.draft) args.push("--include-drafts");
|
|
1060
|
+
const ran = await run(capabilities, node, args, { cwd });
|
|
1061
|
+
for (const line of outputLines(ran.stderr)) capabilities.log.err(line);
|
|
1062
|
+
const lines = outputLines(ran.stdout);
|
|
1063
|
+
if (ran.code !== 0 && lines.length === 0) {
|
|
1064
|
+
const detail = outputLines(ran.stderr);
|
|
1065
|
+
return {
|
|
1066
|
+
ok: false,
|
|
1067
|
+
lines: detail.length > 0 ? detail : [`error: check of ${entry.label} failed (${status(ran)})`],
|
|
1068
|
+
skipped: false
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
return { ok: ran.code === 0, lines, skipped: false };
|
|
1072
|
+
}
|
|
1073
|
+
async function checkRoot(capabilities, cwd, folder, only, json = false, includeDrafts = false, node) {
|
|
1074
|
+
const tree = nodeTree(capabilities, folder);
|
|
1075
|
+
const listed = await projectModules(tree, path2.basename(folder));
|
|
1076
|
+
if (listed._tag === "Left") throw new Problems(listed.left);
|
|
1077
|
+
if (listed.right.length === 0) throw new Error(NO_PROJECT_MESSAGE);
|
|
1078
|
+
const loaded = [];
|
|
1079
|
+
for (const mod of listed.right) {
|
|
1080
|
+
const projectFolder = mod.module === "index.ts" ? folder : path2.join(folder, path2.dirname(mod.module));
|
|
1081
|
+
const label = mod.module === "index.ts" ? path2.basename(folder) : path2.dirname(mod.module);
|
|
1082
|
+
const project = await loadProject(capabilities, cwd, projectFolder, listed.right.length === 1 ? only : []);
|
|
1083
|
+
loaded.push({ label, projectFolder, project });
|
|
1084
|
+
}
|
|
1085
|
+
const projects = [];
|
|
1086
|
+
for (const entry of loaded) {
|
|
1087
|
+
if (!(entry.project.draft && !includeDrafts)) projects.push(entry);
|
|
1088
|
+
}
|
|
1089
|
+
if (projects.length > 0) {
|
|
1090
|
+
if (projects.length !== 1 && only.length > 0) {
|
|
1091
|
+
throw wrongArgument(
|
|
1092
|
+
"aula check takes chapters only when the folder gives one project",
|
|
1093
|
+
"pass a project folder, or omit the chapters to check every listed project"
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
if (listed.right.length !== 1 && projects.length === 1 && only.length > 0) {
|
|
1097
|
+
const entry = projects[0];
|
|
1098
|
+
if (entry === void 0) throw new Error("checkRoot: missing project after draft filter");
|
|
1099
|
+
entry.project = await loadProject(capabilities, cwd, entry.projectFolder, only);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
const progress = loaded.length > 1;
|
|
1103
|
+
const started = capabilities.clock.now();
|
|
1104
|
+
const slots = Array.from({ length: loaded.length });
|
|
1105
|
+
let nextPrint = 0;
|
|
1106
|
+
let passed = 0;
|
|
1107
|
+
let failed = 0;
|
|
1108
|
+
let skipped = 0;
|
|
1109
|
+
let ok = true;
|
|
1110
|
+
const flush = () => {
|
|
1111
|
+
while (nextPrint < loaded.length) {
|
|
1112
|
+
const slot = slots[nextPrint];
|
|
1113
|
+
if (slot === void 0) break;
|
|
1114
|
+
for (const line of slot.lines) capabilities.log.out(line);
|
|
1115
|
+
if (slot.skipped) skipped += 1;
|
|
1116
|
+
else if (slot.ok) passed += 1;
|
|
1117
|
+
else {
|
|
1118
|
+
failed += 1;
|
|
1119
|
+
ok = false;
|
|
1120
|
+
}
|
|
1121
|
+
nextPrint += 1;
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
const jobs = loaded.map((entry, index) => ({ entry, index }));
|
|
1125
|
+
const limit = progress ? Math.max(1, capabilities.env.parallelism) : 1;
|
|
1126
|
+
const useChildren = progress && node !== void 0 && limit > 1;
|
|
1127
|
+
await parallel(jobs, limit, async ({ entry, index }) => {
|
|
1128
|
+
if (progress) capabilities.log.err(checkProgressLine(index + 1, loaded.length, entry.label));
|
|
1129
|
+
if (entry.project.draft && !includeDrafts) {
|
|
1130
|
+
slots[index] = { ok: true, lines: [draftSkipMessage(entry.label)], skipped: true };
|
|
1131
|
+
flush();
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
let slot;
|
|
1135
|
+
if (useChildren) {
|
|
1136
|
+
if (node === void 0) throw new Error("checkRoot: child checks need the node path");
|
|
1137
|
+
slot = await checkInChild(capabilities, node, cwd, entry, json);
|
|
1138
|
+
} else {
|
|
1139
|
+
slot = await checkCaptured(capabilities, cwd, entry.project, only, json);
|
|
1140
|
+
}
|
|
1141
|
+
slots[index] = slot;
|
|
1142
|
+
flush();
|
|
1143
|
+
});
|
|
1144
|
+
if (progress) {
|
|
1145
|
+
capabilities.log.err(checkSummaryLine(passed, failed, skipped, capabilities.clock.now() - started));
|
|
1146
|
+
}
|
|
1147
|
+
return ok;
|
|
1148
|
+
}
|
|
1021
1149
|
async function script(capabilities, root, project, only) {
|
|
1022
1150
|
capabilities.log.write(await scriptView(project, host(capabilities, root), capabilities.narrator, only));
|
|
1023
1151
|
return true;
|
|
@@ -1041,26 +1169,24 @@ async function preview(capabilities, root, project, folder, given) {
|
|
|
1041
1169
|
return withWork(capabilities, async (work) => {
|
|
1042
1170
|
const stopped = [];
|
|
1043
1171
|
const waits = [];
|
|
1044
|
-
await
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
job.written.push(path2.join(out, "moves.md"), ...sheets);
|
|
1063
|
-
});
|
|
1172
|
+
const n = await clock(capabilities.narrator, narrationScript(project, all), only, chapterNames(project));
|
|
1173
|
+
for (const job of jobs) await capabilities.fs.rm(job.out, { recursive: true, force: true });
|
|
1174
|
+
await parallel(jobs, capabilities.env.parallelism, async (job) => {
|
|
1175
|
+
const lottie = path2.join(work, `${job.base}.json`);
|
|
1176
|
+
const drawn = await drawChapter(capabilities, root, project, job.index, narrationAt(n, job.index), lottie);
|
|
1177
|
+
if (!drawn.ok) {
|
|
1178
|
+
stopped.push(...drawn.findings);
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1181
|
+
waits.push(...drawn.findings.filter((d) => !isError(d)));
|
|
1182
|
+
const { out } = job;
|
|
1183
|
+
const { window, stills } = pictureStills(drawn.narration, job, drawn.frames, drawn.embeds);
|
|
1184
|
+
const groups = inFolder(folderOf(project), pictureGroups(window, stills));
|
|
1185
|
+
const sheets = await capabilities.render.pictures({ lottie, out, groups });
|
|
1186
|
+
await capabilities.fs.mkdir(out, { recursive: true });
|
|
1187
|
+
const moves = job.text === null ? "title card\n" : movesMarkdown(timedChapter(job.index, job.name, job.text, drawn.narration));
|
|
1188
|
+
await capabilities.fs.writeFile(path2.join(out, "moves.md"), moves);
|
|
1189
|
+
job.written.push(path2.join(out, "moves.md"), ...sheets);
|
|
1064
1190
|
});
|
|
1065
1191
|
if (stopped.length) {
|
|
1066
1192
|
await printDiagnostics(capabilities, root, stopped);
|
|
@@ -1072,7 +1198,6 @@ async function preview(capabilities, root, project, folder, given) {
|
|
|
1072
1198
|
});
|
|
1073
1199
|
}
|
|
1074
1200
|
async function exportVideo(capabilities, root, project, file) {
|
|
1075
|
-
if (!file.endsWith(".mp4")) throw wrongArgument(`the video path must end in .mp4: ${file}`);
|
|
1076
1201
|
const names = chapterNames(project);
|
|
1077
1202
|
const checked = exportCheck(project, host(capabilities, root));
|
|
1078
1203
|
await printChecked(capabilities, root, project, checked);
|
|
@@ -1084,28 +1209,25 @@ async function exportVideo(capabilities, root, project, file) {
|
|
|
1084
1209
|
return withWork(capabilities, async (work) => {
|
|
1085
1210
|
const audio = path2.join(work, "narration.wav");
|
|
1086
1211
|
const cues = narrationScript(project, checked.texts);
|
|
1087
|
-
const narrated = await
|
|
1212
|
+
const narrated = await narrate(capabilities, cues);
|
|
1088
1213
|
const lotties = names.map((name) => path2.join(work, `${name}.json`));
|
|
1089
1214
|
const drawn = [];
|
|
1090
1215
|
const problems = [];
|
|
1091
1216
|
let done = 0;
|
|
1092
|
-
await
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
done
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
);
|
|
1107
|
-
}
|
|
1108
|
-
)
|
|
1217
|
+
await parallel(
|
|
1218
|
+
names.map((_, index) => index),
|
|
1219
|
+
capabilities.env.parallelism,
|
|
1220
|
+
async (index) => {
|
|
1221
|
+
const narration = narrated[index]?.narration;
|
|
1222
|
+
if (narration === void 0) throw new Error(`no narration of chapter ${String(index)}`);
|
|
1223
|
+
const chapter = await drawChapter(capabilities, root, project, index, narration, lotties[index] ?? "");
|
|
1224
|
+
drawn[index] = chapter;
|
|
1225
|
+
if (!chapter.ok) problems.push(...chapter.findings);
|
|
1226
|
+
done += 1;
|
|
1227
|
+
capabilities.log.out(
|
|
1228
|
+
`[${String(done)}/${String(names.length)}] ${names[index] ?? ""}: ${chapter.ok ? "drawn" : "FAILED"}`
|
|
1229
|
+
);
|
|
1230
|
+
}
|
|
1109
1231
|
);
|
|
1110
1232
|
if (problems.length) {
|
|
1111
1233
|
await printDiagnostics(capabilities, root, problems);
|
|
@@ -1122,16 +1244,13 @@ async function exportVideo(capabilities, root, project, file) {
|
|
|
1122
1244
|
VIDEO.fps
|
|
1123
1245
|
);
|
|
1124
1246
|
const clips = names.map((name) => path2.join(work, `${name}.mp4`));
|
|
1125
|
-
await
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
await capabilities.render.clip({ lottie: lotties[index] ?? "", out: clips[index] ?? "", ...clip });
|
|
1133
|
-
}
|
|
1134
|
-
)
|
|
1247
|
+
await parallel(
|
|
1248
|
+
names.map((_, index) => index),
|
|
1249
|
+
capabilities.env.parallelism,
|
|
1250
|
+
async (index) => {
|
|
1251
|
+
const clip = plan.clips[index] ?? { from: 0, frames: 0 };
|
|
1252
|
+
await capabilities.render.clip({ lottie: lotties[index] ?? "", out: clips[index] ?? "", ...clip });
|
|
1253
|
+
}
|
|
1135
1254
|
);
|
|
1136
1255
|
await capabilities.fs.mkdir(path2.dirname(file), { recursive: true });
|
|
1137
1256
|
const placed = await placedClips(
|
|
@@ -1149,7 +1268,6 @@ async function exportVideo(capabilities, root, project, file) {
|
|
|
1149
1268
|
});
|
|
1150
1269
|
}
|
|
1151
1270
|
async function bundle2(capabilities, project, file) {
|
|
1152
|
-
if (!file.endsWith(".zip")) throw new Error(`the zip path must end in .zip: ${file}`);
|
|
1153
1271
|
const home = folderOf(project);
|
|
1154
1272
|
const root = path2.parse(home).root;
|
|
1155
1273
|
const folder = path2.relative(root, home).split(path2.sep).join("/");
|
|
@@ -1187,6 +1305,7 @@ function tokensArgs(positional) {
|
|
|
1187
1305
|
|
|
1188
1306
|
export {
|
|
1189
1307
|
check,
|
|
1308
|
+
checkRoot,
|
|
1190
1309
|
script,
|
|
1191
1310
|
timeline,
|
|
1192
1311
|
preview,
|