@beff/aula-cli 0.5.1 → 0.6.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.
Files changed (47) hide show
  1. package/dist/src/aula-render.core.wasm +0 -0
  2. package/dist/src/{chunk-EQ3DVZV5.js → chunk-32AJJP3R.js} +1 -1
  3. package/dist/src/{chunk-2NMVSQG4.js → chunk-3MPFI4UE.js} +17 -0
  4. package/dist/src/{chunk-DQ2NGXNI.js → chunk-6CZECZIX.js} +1 -1
  5. package/dist/src/{chunk-IKKANHTF.js → chunk-BLKXJGEO.js} +1 -1
  6. package/dist/src/{chunk-JDXHKYLZ.js → chunk-KQJVAXSC.js} +7 -7
  7. package/dist/src/{chunk-JVCECTG2.js → chunk-NAMV5OAS.js} +1 -1
  8. package/dist/src/{chunk-YBHISJLN.js → chunk-XYBGXFIM.js} +89 -6
  9. package/dist/src/{chunk-5VYKT646.js → chunk-ZASMFCUL.js} +1 -1
  10. package/dist/src/cli.js +6 -6
  11. package/dist/src/{commands-34YCDSR5.js → commands-KNPNJHDC.js} +8 -8
  12. package/dist/src/{problems-U4QXN6RO.js → problems-P6M3366O.js} +4 -4
  13. package/dist/src/project-BZL5K5BR.js +12 -0
  14. package/dist/src/render-child.js +5 -5
  15. package/dist/src/{run-7PM6EPND.js → run-V3U7HCKB.js} +9 -9
  16. package/dist/src/{server-YQYW4FT4.js → server-KTS6ORJM.js} +3 -3
  17. package/dist/src/{site-SVNNSF72.js → site-VW2NSQV5.js} +73 -23
  18. package/dist/web/app/assets/{b274e91c → 72474bf9}/aula-method.js +1 -1
  19. package/dist/web/app/assets/{b274e91c → 72474bf9}/aula.js +1 -1
  20. package/dist/web/app/assets/{b274e91c → 72474bf9}/build-worker.js +2 -2
  21. package/dist/web/app/assets/{b274e91c → 72474bf9}/index.js +6 -5
  22. package/dist/web/app/assets/__vite-browser-external-CS_r4ncq.js +1 -0
  23. package/dist/web/app/assets/{aula-voice-worker-Ca14p_J5.js → aula-voice-worker-DxzRCbJL.js} +1 -1
  24. package/dist/web/app/assets/{aula.core5-BsYwXoy8.wasm → aula.core5-BdGr7QcG.wasm} +0 -0
  25. package/dist/web/app/assets/index-DtOukfzG.css +2 -0
  26. package/dist/web/app/assets/protocol-DqAun5Af.js +15 -0
  27. package/dist/web/app/assets/{src-BA-sYAmS.js → src-Cz8PghaR.js} +6 -6
  28. package/dist/web/app/index.html +4 -4
  29. package/dist/web/site/assets/{27f0d05e → 9db97082}/aula-method.js +1 -1
  30. package/dist/web/site/assets/{27f0d05e → 9db97082}/aula.js +1 -1
  31. package/dist/web/site/assets/{27f0d05e → 9db97082}/build-worker.js +2 -2
  32. package/dist/web/site/assets/{27f0d05e → 9db97082}/index.js +6 -5
  33. package/dist/web/site/assets/__vite-browser-external-CTYaiPUZ.js +1 -0
  34. package/dist/web/site/assets/{aula-voice-worker-CaLJBS98.js → aula-voice-worker-CzRFydP2.js} +1 -1
  35. package/dist/web/site/assets/{aula.core5-BsYwXoy8.wasm → aula.core5-BdGr7QcG.wasm} +0 -0
  36. package/dist/web/site/assets/index-Dcly6eU3.css +2 -0
  37. package/dist/web/site/assets/protocol-DPaQDdsV.js +15 -0
  38. package/dist/web/site/assets/{src-BXUc4CQF.js → src-71sAnADq.js} +6 -6
  39. package/dist/web/site/index.html +4 -4
  40. package/package.json +2 -2
  41. package/dist/src/project-WS7P5VIH.js +0 -12
  42. package/dist/web/app/assets/__vite-browser-external-CJXyzDbj.js +0 -1
  43. package/dist/web/app/assets/index-BXxc0ZmT.css +0 -2
  44. package/dist/web/app/assets/protocol-BejjzB3o.js +0 -15
  45. package/dist/web/site/assets/__vite-browser-external-CHF7v6EZ.js +0 -1
  46. package/dist/web/site/assets/index-Dn5gqwRn.css +0 -2
  47. package/dist/web/site/assets/protocol-fozbK8HD.js +0 -15
Binary file
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withSource
3
- } from "./chunk-JVCECTG2.js";
3
+ } from "./chunk-NAMV5OAS.js";
4
4
 
5
5
  // src/problems.ts
6
6
  import { loadEngine } from "@beff/aula/run";
@@ -1012,6 +1012,22 @@ var parser_default = {
1012
1012
  var Parsers = parser_default.buildParsers();
1013
1013
 
1014
1014
  // ../aula-bundle/src/index.ts
1015
+ function pathsTree(paths, read) {
1016
+ const all = [...paths];
1017
+ return {
1018
+ read,
1019
+ list: (folder) => {
1020
+ const prefix = folder === "" ? "" : `${folder}/`;
1021
+ const names = /* @__PURE__ */ new Set();
1022
+ for (const path of all) {
1023
+ if (!path.startsWith(prefix)) continue;
1024
+ const [first, ...rest] = path.slice(prefix.length).split("/");
1025
+ if (first !== void 0 && rest.length > 0) names.add(first);
1026
+ }
1027
+ return Promise.resolve([...names].toSorted());
1028
+ }
1029
+ };
1030
+ }
1015
1031
  var SOURCE_PREFIX = "tree:";
1016
1032
  function dirname(path) {
1017
1033
  const at = path.lastIndexOf("/");
@@ -1261,6 +1277,7 @@ export {
1261
1277
  RefRuntype,
1262
1278
  buildParsers,
1263
1279
  Parsers,
1280
+ pathsTree,
1264
1281
  bundle,
1265
1282
  projectName,
1266
1283
  projectModules,
@@ -2,7 +2,7 @@ import {
2
2
  Parsers,
3
3
  Problems,
4
4
  bundle
5
- } from "./chunk-2NMVSQG4.js";
5
+ } from "./chunk-3MPFI4UE.js";
6
6
 
7
7
  // ../../node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/index.mjs
8
8
  import { createRequire } from "module";
@@ -4,7 +4,7 @@ import {
4
4
 
5
5
  // src/media.ts
6
6
  import path from "node:path";
7
- var VIDEO = { width: 1280, height: 720, fps: 30 };
7
+ var VIDEO = { width: 1280, height: 720, fps: 60 };
8
8
  async function ffmpeg(capabilities, args) {
9
9
  const ran = await run(capabilities, "ffmpeg", ["-hide_banner", "-loglevel", "error", "-nostdin", "-y", ...args]);
10
10
  if (ran.code !== 0) throw new Error(`ffmpeg failed: ${ran.stderr.trim()}`);
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  projectFiles,
3
3
  zipBytes
4
- } from "./chunk-DQ2NGXNI.js";
4
+ } from "./chunk-6CZECZIX.js";
5
5
  import {
6
6
  VIDEO,
7
7
  assemble,
8
8
  ffmpeg,
9
9
  hasAudio
10
- } from "./chunk-IKKANHTF.js";
10
+ } from "./chunk-BLKXJGEO.js";
11
11
  import {
12
12
  printDiagnostics
13
- } from "./chunk-EQ3DVZV5.js";
13
+ } from "./chunk-32AJJP3R.js";
14
14
  import {
15
15
  chapterIndexes,
16
16
  checkProject,
@@ -30,7 +30,7 @@ import {
30
30
  targetChapters,
31
31
  timelineView,
32
32
  wordNotes
33
- } from "./chunk-YBHISJLN.js";
33
+ } from "./chunk-XYBGXFIM.js";
34
34
  import {
35
35
  narrateScript,
36
36
  scriptAudio,
@@ -38,11 +38,11 @@ import {
38
38
  } from "./chunk-S74JLCZK.js";
39
39
  import {
40
40
  host
41
- } from "./chunk-5VYKT646.js";
41
+ } from "./chunk-ZASMFCUL.js";
42
42
  import {
43
43
  folderOf,
44
44
  nameOf
45
- } from "./chunk-JVCECTG2.js";
45
+ } from "./chunk-NAMV5OAS.js";
46
46
  import {
47
47
  ObjectRuntype,
48
48
  OptionalFieldRuntype,
@@ -51,7 +51,7 @@ import {
51
51
  buildParsers,
52
52
  isError,
53
53
  wrongArgument
54
- } from "./chunk-2NMVSQG4.js";
54
+ } from "./chunk-3MPFI4UE.js";
55
55
 
56
56
  // src/commands.ts
57
57
  import path from "node:path";
@@ -3,7 +3,7 @@ import {
3
3
  error,
4
4
  projectName,
5
5
  wrongArgument
6
- } from "./chunk-2NMVSQG4.js";
6
+ } from "./chunk-3MPFI4UE.js";
7
7
 
8
8
  // ../aula-project/src/node.ts
9
9
  import path from "node:path";
@@ -3,10 +3,12 @@ import {
3
3
  } from "./chunk-S74JLCZK.js";
4
4
  import {
5
5
  Problems,
6
+ bundle,
6
7
  error,
7
8
  isError,
9
+ projectModules,
8
10
  wrongArgument
9
- } from "./chunk-2NMVSQG4.js";
11
+ } from "./chunk-3MPFI4UE.js";
10
12
 
11
13
  // ../aula-project/src/chapters.ts
12
14
  import { readChapter } from "@beff/aula";
@@ -319,16 +321,95 @@ Metaphor: ${text.metaphor}
319
321
  return out;
320
322
  }
321
323
 
322
- // ../aula-project/src/videos.ts
323
- import { FPS as FPS4 } from "@beff/aula/run";
324
- import { estimateNarration } from "@beff/aula/text";
325
-
326
324
  // ../aula-project/src/workspace.ts
327
325
  import * as Engine from "@beff/aula";
328
326
  import { diagnosticOf, importUserModule, loadEngine } from "@beff/aula/run";
329
327
  import {
330
328
  narrationScript as narrationScript2
331
329
  } from "@beff/aula/text";
330
+ var workspaceHost = (frames, media) => ({
331
+ frames,
332
+ name: (file) => /^[a-z][a-z0-9+.-]*:/.test(file) ? void 0 : file,
333
+ exists: () => true,
334
+ ...media ? { media } : {}
335
+ });
336
+ var propertyOf = (value, key) => typeof value === "object" && value !== null ? Reflect.get(value, key) : void 0;
337
+ var LIST = "aula-projects.ts";
338
+ async function loadProjects(files, host, modules, esbuild, player) {
339
+ const root = await files.name();
340
+ const listed = await projectModules(files, root);
341
+ if (listed._tag === "Left") return listed;
342
+ const found = listed.right.map((project) => project.module);
343
+ if (found.length === 0) {
344
+ throw new Error("no project here: open a folder that has index.ts, or whose subfolders have index.ts");
345
+ }
346
+ const list = [
347
+ ...found.map((module, i) => `import p${String(i)} from ${JSON.stringify(`./${module}`)};`),
348
+ `export default [${found.map((_, i) => `p${String(i)}`).join(", ")}];`
349
+ ].join("\n");
350
+ const tree = {
351
+ read: (path) => path === LIST ? Promise.resolve(list) : files.read(path),
352
+ list: (folder) => files.list(folder)
353
+ };
354
+ const [bundled] = await Promise.all([bundle(esbuild, tree, LIST, player), loadEngine()]);
355
+ if (bundled._tag === "Left") return bundled;
356
+ const loaded = await importUserModule(() => modules.load(bundled.right));
357
+ if (loaded._tag === "Left") return { _tag: "Left", left: [diagnosticOf(loaded.left, LIST, host)] };
358
+ const exported = propertyOf(loaded.right.exports, "default");
359
+ if (!Array.isArray(exported)) throw new Error(`${LIST} has no list of projects`);
360
+ const out = exported.map((definition, i) => {
361
+ if (!Engine.isProjectDefinition(definition)) {
362
+ throw new Error(
363
+ `the default export of ${found[i] ?? ""} is not made by defineProject: write \`export default defineProject({ title, theme, chapters: [ \u2026 ] })\``
364
+ );
365
+ }
366
+ const { name, section } = listed.right[i] ?? { name: "" };
367
+ return localProject(name, section, definition, host);
368
+ });
369
+ return { _tag: "Right", right: out };
370
+ }
371
+ function localProject(name, section, definition, host) {
372
+ const count = definition.chapters.length + 1;
373
+ return {
374
+ name,
375
+ ...section === void 0 ? {} : { section },
376
+ title: definition.title,
377
+ chapters: count,
378
+ titles: [definition.title, ...definition.chapters.map((c) => c.heading)],
379
+ script: () => {
380
+ const chapters = [];
381
+ for (const i of definition.chapters.keys()) {
382
+ const run = Engine.readChapter(definition, i + 1, { host });
383
+ if (run.value === void 0) return { _tag: "Left", left: run.diagnostics };
384
+ chapters.push(run.value);
385
+ }
386
+ const script = narrationScript2(definition, chapters);
387
+ return { _tag: "Right", right: { script } };
388
+ },
389
+ walk: () => {
390
+ for (const i of definition.chapters.keys()) Engine.checkChapter(definition, i + 1, { host });
391
+ },
392
+ render: (index, narration) => {
393
+ const run = Engine.renderChapter(definition, index, { host, narration });
394
+ if (!run.ok || run.value === void 0) return { _tag: "Left", left: run.diagnostics };
395
+ const { lottie, waits, embeds, diagnostics } = run.value;
396
+ return {
397
+ _tag: "Right",
398
+ right: {
399
+ lottie,
400
+ waits,
401
+ embeds,
402
+ background: (definition.theme ?? Engine.m.theme).background,
403
+ warnings: diagnostics
404
+ }
405
+ };
406
+ }
407
+ };
408
+ }
409
+
410
+ // ../aula-project/src/videos.ts
411
+ import { FPS as FPS4 } from "@beff/aula/run";
412
+ import { estimateNarration } from "@beff/aula/text";
332
413
 
333
414
  export {
334
415
  scriptView,
@@ -348,5 +429,7 @@ export {
348
429
  pictureStills,
349
430
  pictureGroups,
350
431
  movesMarkdown,
351
- timelineView
432
+ timelineView,
433
+ workspaceHost,
434
+ loadProjects
352
435
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  host,
3
3
  loadProject
4
- } from "./chunk-JVCECTG2.js";
4
+ } from "./chunk-NAMV5OAS.js";
5
5
 
6
6
  // src/project.ts
7
7
  function exists(capabilities, file) {
package/dist/src/cli.js CHANGED
@@ -271,9 +271,9 @@ var base = Capabilities.create({
271
271
  },
272
272
  spawn
273
273
  });
274
- var { diagnosticsOf, printDiagnostics } = await import("./problems-U4QXN6RO.js");
275
- var { host, loadProject } = await import("./project-WS7P5VIH.js");
276
- var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-7PM6EPND.js");
274
+ var { diagnosticsOf, printDiagnostics } = await import("./problems-P6M3366O.js");
275
+ var { host, loadProject } = await import("./project-BZL5K5BR.js");
276
+ var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-V3U7HCKB.js");
277
277
  var locks = createLocks(base, path3.join(os.homedir(), ".cache/aula/heavy.lock"));
278
278
  var render = createRender(base, process.execPath);
279
279
  var models = path3.join(os.homedir(), ".cache/aula/models");
@@ -296,7 +296,7 @@ async function main(argv) {
296
296
  }
297
297
  const args = parse(rest, optionsOf(command));
298
298
  if (command === "web") {
299
- const { serve } = await import("./server-YQYW4FT4.js");
299
+ const { serve } = await import("./server-KTS6ORJM.js");
300
300
  const stop = new AbortController();
301
301
  for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => stop.abort());
302
302
  const web = Capabilities.create({
@@ -312,12 +312,12 @@ async function main(argv) {
312
312
  return 0;
313
313
  }
314
314
  if (command === "site") {
315
- const { site } = await import("./site-SVNNSF72.js");
315
+ const { site } = await import("./site-VW2NSQV5.js");
316
316
  const weights = Capabilities.create({ weights: aulaVoiceWeights(base, fetch, models) });
317
317
  return await site(Capabilities.extend(capabilities, weights), siteOptions(cwd, args)) ? 0 : 1;
318
318
  }
319
319
  if (command === "tokens") {
320
- const { tokens, tokensArgs } = await import("./commands-34YCDSR5.js");
320
+ const { tokens, tokensArgs } = await import("./commands-KNPNJHDC.js");
321
321
  tokensArgs(args.positional);
322
322
  const tokensOf = createTokens();
323
323
  return await tokens(capabilities, tokensOf, createInterface({ input: process.stdin, crlfDelay: Infinity })) ? 0 : 1;
@@ -7,17 +7,17 @@ import {
7
7
  timeline,
8
8
  tokens,
9
9
  tokensArgs
10
- } from "./chunk-JDXHKYLZ.js";
11
- import "./chunk-DQ2NGXNI.js";
12
- import "./chunk-IKKANHTF.js";
10
+ } from "./chunk-KQJVAXSC.js";
11
+ import "./chunk-6CZECZIX.js";
12
+ import "./chunk-BLKXJGEO.js";
13
13
  import "./chunk-2XGNOG2U.js";
14
- import "./chunk-EQ3DVZV5.js";
15
- import "./chunk-YBHISJLN.js";
14
+ import "./chunk-32AJJP3R.js";
15
+ import "./chunk-XYBGXFIM.js";
16
16
  import "./chunk-S74JLCZK.js";
17
17
  import "./chunk-6LC3WXJ7.js";
18
- import "./chunk-5VYKT646.js";
19
- import "./chunk-JVCECTG2.js";
20
- import "./chunk-2NMVSQG4.js";
18
+ import "./chunk-ZASMFCUL.js";
19
+ import "./chunk-NAMV5OAS.js";
20
+ import "./chunk-3MPFI4UE.js";
21
21
  export {
22
22
  bundle,
23
23
  check,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  printDiagnostics
3
- } from "./chunk-EQ3DVZV5.js";
4
- import "./chunk-YBHISJLN.js";
3
+ } from "./chunk-32AJJP3R.js";
4
+ import "./chunk-XYBGXFIM.js";
5
5
  import "./chunk-S74JLCZK.js";
6
6
  import "./chunk-6LC3WXJ7.js";
7
- import "./chunk-JVCECTG2.js";
7
+ import "./chunk-NAMV5OAS.js";
8
8
  import {
9
9
  diagnosticsOf
10
- } from "./chunk-2NMVSQG4.js";
10
+ } from "./chunk-3MPFI4UE.js";
11
11
  export {
12
12
  diagnosticsOf,
13
13
  printDiagnostics
@@ -0,0 +1,12 @@
1
+ import {
2
+ exists,
3
+ host,
4
+ loadProject
5
+ } from "./chunk-ZASMFCUL.js";
6
+ import "./chunk-NAMV5OAS.js";
7
+ import "./chunk-3MPFI4UE.js";
8
+ export {
9
+ exists,
10
+ host,
11
+ loadProject
12
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VIDEO
3
- } from "./chunk-IKKANHTF.js";
3
+ } from "./chunk-BLKXJGEO.js";
4
4
  import "./chunk-2XGNOG2U.js";
5
5
 
6
6
  // src/render-child.ts
@@ -3847,11 +3847,11 @@ function embedStill(arg0, arg1, arg2) {
3847
3847
  }
3848
3848
  });
3849
3849
  }
3850
- function trampoline0(handle) {
3850
+ var trampoline0 = (rep) => rscTableCreateOwn(HANDLE_INDEX_SPACES, handleTable0, rep);
3851
+ function trampoline1(handle) {
3851
3852
  let handleEntry = rscTableRemove(_jcoResourceRemoveContext, handleTable0, handle);
3852
3853
  handleEntry.own && exports0[0](handleEntry.rep);
3853
3854
  }
3854
- var trampoline1 = (rep) => rscTableCreateOwn(HANDLE_INDEX_SPACES, handleTable0, rep);
3855
3855
  await (() => {
3856
3856
  let gen = (function* _initGenerator() {
3857
3857
  let module0 = fetchCompile(_jcoFetchCompileContext, new URL("./aula-render.core.wasm", import.meta.url));
@@ -3870,8 +3870,8 @@ await (() => {
3870
3870
  INSTANCE_FLAGS.set(0, instanceFlags0);
3871
3871
  ({ exports: exports0 } = yield instantiateCore(WebAssembly, yield module1));
3872
3872
  ({ exports: exports1 } = yield instantiateCore(WebAssembly, yield module0, { "[export]aula:render/render": {
3873
- "[resource-drop]player": Object.assign(_guardTrap(_jcoComponentRecordTrapContext, 0, _guardMayLeave(_jcoComponentMayLeaveContext, 0, trampoline0), true), { _jcoMaySuspend: false }),
3874
- "[resource-new]player": Object.assign(_guardTrap(_jcoComponentRecordTrapContext, 0, _guardMayLeave(_jcoComponentMayLeaveContext, 0, trampoline1), true), { _jcoMaySuspend: false })
3873
+ "[resource-drop]player": Object.assign(_guardTrap(_jcoComponentRecordTrapContext, 0, _guardMayLeave(_jcoComponentMayLeaveContext, 0, trampoline1), true), { _jcoMaySuspend: false }),
3874
+ "[resource-new]player": Object.assign(_guardTrap(_jcoComponentRecordTrapContext, 0, _guardMayLeave(_jcoComponentMayLeaveContext, 0, trampoline0), true), { _jcoMaySuspend: false })
3875
3875
  } }));
3876
3876
  ({ exports: exports2 } = yield instantiateCore(WebAssembly, yield module2, {
3877
3877
  actual: { 0: Object.assign(exports1["aula:render/render#[dtor]player"], { _jcoMaySuspend: false }) },
@@ -5,19 +5,19 @@ import {
5
5
  preview,
6
6
  script,
7
7
  timeline
8
- } from "./chunk-JDXHKYLZ.js";
9
- import "./chunk-DQ2NGXNI.js";
10
- import "./chunk-IKKANHTF.js";
8
+ } from "./chunk-KQJVAXSC.js";
9
+ import "./chunk-6CZECZIX.js";
10
+ import "./chunk-BLKXJGEO.js";
11
11
  import "./chunk-2XGNOG2U.js";
12
- import "./chunk-EQ3DVZV5.js";
13
- import "./chunk-YBHISJLN.js";
12
+ import "./chunk-32AJJP3R.js";
13
+ import "./chunk-XYBGXFIM.js";
14
14
  import "./chunk-S74JLCZK.js";
15
15
  import "./chunk-6LC3WXJ7.js";
16
- import "./chunk-5VYKT646.js";
17
- import "./chunk-JVCECTG2.js";
16
+ import "./chunk-ZASMFCUL.js";
17
+ import "./chunk-NAMV5OAS.js";
18
18
  import {
19
19
  wrongArgument
20
- } from "./chunk-2NMVSQG4.js";
20
+ } from "./chunk-3MPFI4UE.js";
21
21
 
22
22
  // src/run.ts
23
23
  import path from "node:path";
@@ -37,7 +37,7 @@ aula preview <folder> <out> [<chapter>[:<line>] ...]
37
37
  PNG pictures for review: per chapter, stills,
38
38
  motion stills, contact sheets and moves.md
39
39
  aula export <folder> <file.mp4> the video to send: narrated in this run, H.264 and
40
- AAC at 1280x720 and 30 fps; needs ffmpeg
40
+ AAC at 1280x720 and 60 fps; needs ffmpeg
41
41
  aula web [<folder>] [--port N] the web app for the folder if it has index.ts, else
42
42
  for each subfolder with index.ts, in the order of
43
43
  the folder names (default: the current folder);
@@ -7,9 +7,9 @@ import {
7
7
  } from "./chunk-6LC3WXJ7.js";
8
8
  import {
9
9
  exists
10
- } from "./chunk-5VYKT646.js";
11
- import "./chunk-JVCECTG2.js";
12
- import "./chunk-2NMVSQG4.js";
10
+ } from "./chunk-ZASMFCUL.js";
11
+ import "./chunk-NAMV5OAS.js";
12
+ import "./chunk-3MPFI4UE.js";
13
13
 
14
14
  // src/web/server.ts
15
15
  import { once } from "node:events";
@@ -1,8 +1,11 @@
1
1
  import {
2
2
  diskTree,
3
3
  packageFiles
4
- } from "./chunk-DQ2NGXNI.js";
5
- import "./chunk-YBHISJLN.js";
4
+ } from "./chunk-6CZECZIX.js";
5
+ import {
6
+ loadProjects,
7
+ workspaceHost
8
+ } from "./chunk-XYBGXFIM.js";
6
9
  import {
7
10
  PACKAGE
8
11
  } from "./chunk-A5QHTZKT.js";
@@ -12,14 +15,17 @@ import {
12
15
  } from "./chunk-6LC3WXJ7.js";
13
16
  import {
14
17
  Problems,
18
+ pathsTree,
15
19
  projectModules,
16
20
  wrongArgument
17
- } from "./chunk-2NMVSQG4.js";
21
+ } from "./chunk-3MPFI4UE.js";
18
22
 
19
23
  // src/site.ts
24
+ import os from "node:os";
20
25
  import path from "node:path";
21
- import { fileURLToPath } from "node:url";
26
+ import { fileURLToPath, pathToFileURL } from "node:url";
22
27
  import { fault } from "@beff/aula/errors";
28
+ import { v8Frames } from "@beff/aula/run";
23
29
  var PAGE = new URL("web/site/", PACKAGE);
24
30
  var PAGE_FOLDER = fileURLToPath(PAGE);
25
31
  var WRITTEN = ["index.html", "assets", "tree", "tree.json", AULA_VOICE_WEIGHTS.path];
@@ -50,30 +56,65 @@ async function differs(capabilities, files, at, source) {
50
56
  const [a, b] = await Promise.all([capabilities.fs.readFile(kept), capabilities.fs.readFile(source)]);
51
57
  return !sameBytes(new Uint8Array(a), new Uint8Array(b));
52
58
  }
53
- async function packages(capabilities, folder, modules) {
59
+ var METHOD_STUB = "export const findings = () => [];\nexport const paragraph = () => () => ({});\n";
60
+ async function packages(capabilities, esbuild, folder, modules) {
54
61
  const root = path.parse(folder).root;
55
62
  const home = path.relative(root, folder).split(path.sep).join("/");
56
63
  const tree = diskTree(capabilities, root);
57
64
  const files = /* @__PURE__ */ new Map();
58
- const esbuild = await import("esbuild-wasm");
65
+ for (const { module } of modules) {
66
+ const own = path.posix.dirname(module);
67
+ const project = own === "." ? home : `${home}/${own}`;
68
+ const found = await packageFiles(esbuild, tree, project);
69
+ if (found._tag === "Left") throw new Problems(found.left);
70
+ const apart = /* @__PURE__ */ new Set();
71
+ for (const [at, from] of found.right) {
72
+ if (await differs(capabilities, files, at, path.join(root, from))) apart.add(packageOf(at));
73
+ }
74
+ for (const [at, from] of found.right) {
75
+ files.set(apart.has(packageOf(at)) ? `${own}/${at}` : at, path.join(root, from));
76
+ }
77
+ }
78
+ return files;
79
+ }
80
+ async function listVideos(capabilities, esbuild, name, paths, files) {
81
+ const tree = pathsTree(paths, async (at) => {
82
+ const from = files.get(at);
83
+ return from === void 0 ? null : capabilities.fs.readFile(from, "utf8");
84
+ });
85
+ const workspace = {
86
+ name: () => Promise.resolve(name),
87
+ read: (at) => tree.read(at),
88
+ list: (folder) => tree.list(folder)
89
+ };
90
+ const scratch = await capabilities.fs.mkdtemp(path.join(os.tmpdir(), "aula-site-videos-"));
91
+ let count = 0;
59
92
  try {
60
- for (const { module } of modules) {
61
- const own = path.posix.dirname(module);
62
- const project = own === "." ? home : `${home}/${own}`;
63
- const found = await packageFiles(esbuild, tree, project);
64
- if (found._tag === "Left") throw new Problems(found.left);
65
- const apart = /* @__PURE__ */ new Set();
66
- for (const [at, from] of found.right) {
67
- if (await differs(capabilities, files, at, path.join(root, from))) apart.add(packageOf(at));
68
- }
69
- for (const [at, from] of found.right) {
70
- files.set(apart.has(packageOf(at)) ? `${own}/${at}` : at, path.join(root, from));
93
+ const method = path.join(scratch, "aula-method.mjs");
94
+ await capabilities.fs.writeFile(method, METHOD_STUB);
95
+ const player = {
96
+ "@beff/aula": import.meta.resolve("@beff/aula"),
97
+ "@beff/aula-method": pathToFileURL(method).href
98
+ };
99
+ const modules = {
100
+ load: async ({ code }) => {
101
+ count += 1;
102
+ const file = path.join(scratch, `bundle-${String(count)}.mjs`);
103
+ await capabilities.fs.writeFile(file, code);
104
+ const url = pathToFileURL(file).href;
105
+ return { url, exports: await import(url) };
71
106
  }
72
- }
107
+ };
108
+ const loaded = await loadProjects(workspace, workspaceHost(v8Frames), modules, esbuild, player);
109
+ if (loaded._tag === "Left") throw new Problems(loaded.left);
110
+ return loaded.right.map(({ name: projectName, title, section }) => ({
111
+ name: projectName,
112
+ title,
113
+ ...section === void 0 ? {} : { section }
114
+ }));
73
115
  } finally {
74
- await esbuild.stop();
116
+ await capabilities.fs.rm(scratch, { recursive: true, force: true });
75
117
  }
76
- return files;
77
118
  }
78
119
  async function pageFiles(capabilities) {
79
120
  if (!capabilities.fs.existsSync(new URL("index.html", PAGE))) {
@@ -106,7 +147,17 @@ async function site(capabilities, options) {
106
147
  }
107
148
  const own = await walk(capabilities, folder);
108
149
  const files = new Map(own.map((file) => [file, path.join(folder, file)]));
109
- for (const [at, from] of await packages(capabilities, folder, listed.right)) files.set(at, from);
150
+ const folderName = path.basename(folder);
151
+ const esbuild = await import("esbuild-wasm");
152
+ let paths;
153
+ let videos;
154
+ try {
155
+ for (const [at, from] of await packages(capabilities, esbuild, folder, listed.right)) files.set(at, from);
156
+ paths = [...files.keys()].toSorted();
157
+ videos = await listVideos(capabilities, esbuild, folderName, paths, files);
158
+ } finally {
159
+ await esbuild.stop();
160
+ }
110
161
  const weights = await capabilities.weights();
111
162
  const page = await pageFiles(capabilities);
112
163
  const html = pageHtml(await capabilities.fs.readFile(path.join(PAGE_FOLDER, "index.html"), "utf8"), title, base);
@@ -121,11 +172,10 @@ async function site(capabilities, options) {
121
172
  };
122
173
  for (const file of page) if (file !== "index.html") await copy(path.join(PAGE_FOLDER, file), path.join(out, file));
123
174
  for (const [at, from] of files) await copy(from, path.join(out, "tree", at));
124
- const paths = [...files.keys()].toSorted();
125
175
  await capabilities.fs.writeFile(path.join(out, "index.html"), html);
126
176
  await capabilities.fs.writeFile(
127
177
  path.join(out, "tree.json"),
128
- JSON.stringify({ name: path.basename(folder), files: paths })
178
+ JSON.stringify({ name: folderName, files: paths, videos })
129
179
  );
130
180
  await capabilities.fs.writeFile(path.join(out, AULA_VOICE_WEIGHTS.path), weights);
131
181
  capabilities.log.out(
@@ -1 +1 @@
1
- import{m as e,y as t}from"../src-BA-sYAmS.js";var n=e=>JSON.stringify(e);function r(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function i(e,t,i){let a=[],o=(t,n=e.place)=>{a.push({message:t,...n===void 0?{}:{at:n}})};i.mechanism.trim()===``&&o(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`);for(let e of i.sources)r(e)&&!t.exists(e)&&o(`${n(e)}: this path is not a file: correct the path or add the file`);return a}function a(n){let r=t(`paragraph`,n);return({sources:t},n)=>e({mechanism:r,sources:t},n??((e,n)=>i(e,n,{mechanism:r,sources:t})))}export{i as findings,a as paragraph};
1
+ import{m as e,y as t}from"../src-Cz8PghaR.js";var n=e=>JSON.stringify(e);function r(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function i(e,t,i){let a=[],o=(t,n=e.place)=>{a.push({message:t,...n===void 0?{}:{at:n}})};i.mechanism.trim()===``&&o(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`);for(let e of i.sources)r(e)&&!t.exists(e)&&o(`${n(e)}: this path is not a file: correct the path or add the file`);return a}function a(n){let r=t(`paragraph`,n);return({sources:t},n)=>e({mechanism:r,sources:t},n??((e,n)=>i(e,n,{mechanism:r,sources:t})))}export{i as findings,a as paragraph};
@@ -1 +1 @@
1
- export{t as checkChapter,n as checkLexicon,r as checkTitle,u as defineChapter,d as defineProject,f as embed,p as isProjectDefinition,c as m,m as paragraph,h as pronounce,a as readChapter,o as renderChapter,g as renderScene,_ as say,v as show,y as tagText}from"../src-BA-sYAmS.js";
1
+ export{t as checkChapter,n as checkLexicon,r as checkTitle,u as defineChapter,d as defineProject,f as embed,p as isProjectDefinition,c as m,m as paragraph,h as pronounce,a as readChapter,o as renderChapter,g as renderScene,_ as say,v as show,y as tagText}from"../src-Cz8PghaR.js";