@beff/aula-cli 0.11.0 → 0.12.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/dist/src/{aula-voice-tts-HPJAJO2Q.js → aula-voice-tts-YOS4IQXV.js} +1 -1
  2. package/dist/src/aula.js +2 -2
  3. package/dist/src/{chunk-5ABPFV55.js → chunk-2PAZTBSE.js} +2 -2
  4. package/dist/src/{chunk-JWBPHDVP.js → chunk-4QGX7XXO.js} +1 -1
  5. package/dist/src/{chunk-5XVICDLW.js → chunk-AXQBWV7J.js} +12 -6
  6. package/dist/src/{chunk-4PZYWKO5.js → chunk-DC7A435Z.js} +1 -1
  7. package/dist/src/{chunk-Y56UHOZ2.js → chunk-DN2LVJO3.js} +1 -0
  8. package/dist/src/{chunk-3RB5T3CC.js → chunk-HD6FTA3H.js} +9 -9
  9. package/dist/src/{chunk-5TUGYMFH.js → chunk-PZXFW6ZD.js} +3 -3
  10. package/dist/src/{chunk-XCPBFMEA.js → chunk-RAGZAJKD.js} +1 -1
  11. package/dist/src/{chunk-DFXG2P7A.js → chunk-T6CAPT32.js} +11 -7
  12. package/dist/src/{chunk-KCGXC2RV.js → chunk-TDAWUJ2L.js} +1 -1
  13. package/dist/src/cli.js +9 -9
  14. package/dist/src/{commands-BUM4AG3N.js → commands-BSDNHYB3.js} +10 -10
  15. package/dist/src/problems-CGKCPETU.js +18 -0
  16. package/dist/src/project-EUFMRQXR.js +16 -0
  17. package/dist/src/{run-YLF62D3C.js → run-ER27SVTA.js} +33 -23
  18. package/dist/src/{server-ALRN2C2W.js → server-TJTMSDO2.js} +18 -9
  19. package/dist/src/{site-A2I4P4GX.js → site-RGPJOWSU.js} +32 -15
  20. package/dist/web/app/assets/{56cf58c4 → bf5dd884}/aula-method.js +1 -1
  21. package/dist/web/app/assets/{56cf58c4 → bf5dd884}/aula.js +1 -1
  22. package/dist/web/app/assets/{56cf58c4 → bf5dd884}/build-worker.js +2 -2
  23. package/dist/web/app/assets/{56cf58c4 → bf5dd884}/index.js +2 -2
  24. package/dist/web/app/assets/protocol-Dc79M9p3.js +15 -0
  25. package/dist/web/app/assets/{src-DTLT9Lbm.js → src-DWqZcp-P.js} +1 -1
  26. package/dist/web/app/assets/{tex-mathjax-8QilZX4j.js → tex-mathjax-eWNptbJg.js} +1 -1
  27. package/dist/web/app/index.html +3 -3
  28. package/dist/web/site/assets/{82624cbe → 07fb5cf0}/aula-method.js +1 -1
  29. package/dist/web/site/assets/{82624cbe → 07fb5cf0}/aula.js +1 -1
  30. package/dist/web/site/assets/{82624cbe → 07fb5cf0}/build-worker.js +2 -2
  31. package/dist/web/site/assets/{82624cbe → 07fb5cf0}/index.js +2 -2
  32. package/dist/web/site/assets/protocol-F-4tHoAW.js +15 -0
  33. package/dist/web/site/assets/{src-DpS3WA7l.js → src-DfPcHwz-.js} +1 -1
  34. package/dist/web/site/assets/{tex-mathjax-CVHS5J80.js → tex-mathjax-DrZV_cwB.js} +1 -1
  35. package/dist/web/site/index.html +3 -3
  36. package/package.json +1 -1
  37. package/dist/src/problems-2IXR6RUV.js +0 -18
  38. package/dist/src/project-36YBXKCD.js +0 -16
  39. package/dist/web/app/assets/protocol-C3Pseh4g.js +0 -15
  40. package/dist/web/site/assets/protocol-BOv1ch3F.js +0 -15
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadEngine,
3
3
  tts
4
- } from "./chunk-Y56UHOZ2.js";
4
+ } from "./chunk-DN2LVJO3.js";
5
5
  import "./chunk-VX7UVLQW.js";
6
6
  import "./chunk-CZ7CSFO4.js";
7
7
 
package/dist/src/aula.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  manim_exports
3
- } from "./chunk-XCPBFMEA.js";
3
+ } from "./chunk-RAGZAJKD.js";
4
4
  import {
5
5
  defineChapter,
6
6
  defineProject,
@@ -10,7 +10,7 @@ import {
10
10
  pronounce,
11
11
  say,
12
12
  show
13
- } from "./chunk-Y56UHOZ2.js";
13
+ } from "./chunk-DN2LVJO3.js";
14
14
  import "./chunk-VX7UVLQW.js";
15
15
  import "./chunk-CZ7CSFO4.js";
16
16
  export {
@@ -4,7 +4,7 @@ import {
4
4
  error,
5
5
  projectName,
6
6
  wrongArgument
7
- } from "./chunk-DFXG2P7A.js";
7
+ } from "./chunk-T6CAPT32.js";
8
8
  import {
9
9
  definedAt,
10
10
  importUserModule,
@@ -13,7 +13,7 @@ import {
13
13
  loadEngine,
14
14
  loadTex,
15
15
  v8Frames
16
- } from "./chunk-Y56UHOZ2.js";
16
+ } from "./chunk-DN2LVJO3.js";
17
17
 
18
18
  // ../aula-project/src/node.ts
19
19
  import { existsSync } from "node:fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  chapterNarration
3
- } from "./chunk-KCGXC2RV.js";
3
+ } from "./chunk-TDAWUJ2L.js";
4
4
 
5
5
  // ../aula-narration/src/script.ts
6
6
  var starts = (words) => Float64Array.from(words, (w) => w.start);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  timeChapter
3
- } from "./chunk-JWBPHDVP.js";
3
+ } from "./chunk-4QGX7XXO.js";
4
4
  import {
5
5
  check,
6
6
  moveFrames,
@@ -10,7 +10,7 @@ import {
10
10
  timeline,
11
11
  unclearWords,
12
12
  words
13
- } from "./chunk-KCGXC2RV.js";
13
+ } from "./chunk-TDAWUJ2L.js";
14
14
  import {
15
15
  LIST_MODULE,
16
16
  Problems,
@@ -18,10 +18,10 @@ import {
18
18
  isError,
19
19
  linkBundle,
20
20
  wrongArgument
21
- } from "./chunk-DFXG2P7A.js";
21
+ } from "./chunk-T6CAPT32.js";
22
22
  import {
23
23
  manim_exports
24
- } from "./chunk-XCPBFMEA.js";
24
+ } from "./chunk-RAGZAJKD.js";
25
25
  import {
26
26
  FPS,
27
27
  chapterNames,
@@ -35,7 +35,7 @@ import {
35
35
  loadEngine,
36
36
  readChapter,
37
37
  renderChapter
38
- } from "./chunk-Y56UHOZ2.js";
38
+ } from "./chunk-DN2LVJO3.js";
39
39
 
40
40
  // ../aula-project/src/chapters.ts
41
41
  function chapterIndex(names, name) {
@@ -486,6 +486,10 @@ async function loadBuiltProjects(bundled, host, modules, player, engineLoaded) {
486
486
  return { _tag: "Right", right: out };
487
487
  }
488
488
  var folderOfModule = (module) => module.slice(0, Math.max(0, module.lastIndexOf("/")));
489
+ function listedProjects(projects) {
490
+ if (projects.length === 1 && projects[0]?.folder === "") return [...projects];
491
+ return projects.filter((project) => !project.draft);
492
+ }
489
493
  function localProject(name, folder, section, definition, host) {
490
494
  const count = definition.chapters.length + 1;
491
495
  return {
@@ -493,6 +497,7 @@ function localProject(name, folder, section, definition, host) {
493
497
  folder,
494
498
  ...section === void 0 ? {} : { section },
495
499
  title: definition.title,
500
+ draft: definition.draft,
496
501
  chapters: count,
497
502
  titles: [definition.title, ...definition.chapters.map((c) => c.heading)],
498
503
  script: () => {
@@ -547,5 +552,6 @@ export {
547
552
  timelineView,
548
553
  scriptView,
549
554
  workspaceHost,
550
- loadBuiltProjects
555
+ loadBuiltProjects,
556
+ listedProjects
551
557
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  host,
3
3
  loadProject
4
- } from "./chunk-5ABPFV55.js";
4
+ } from "./chunk-2PAZTBSE.js";
5
5
 
6
6
  // src/load-user.ts
7
7
  import { existsSync } from "node:fs";
@@ -66560,6 +66560,7 @@ function defineProject(fields) {
66560
66560
  [PROJECT]: true,
66561
66561
  storyboard: "",
66562
66562
  lexicon: {},
66563
+ draft: false,
66563
66564
  ...fields,
66564
66565
  title: title.text,
66565
66566
  titleParts: title.parts,
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-F4XRXW6M.js";
10
10
  import {
11
11
  printDiagnostics
12
- } from "./chunk-5TUGYMFH.js";
12
+ } from "./chunk-PZXFW6ZD.js";
13
13
  import {
14
14
  chapterIndexes,
15
15
  checkProject,
@@ -30,22 +30,22 @@ import {
30
30
  timedChapter,
31
31
  timelineView,
32
32
  wordNotes
33
- } from "./chunk-5XVICDLW.js";
33
+ } from "./chunk-AXQBWV7J.js";
34
34
  import {
35
35
  narrateScript,
36
36
  scriptAudio,
37
37
  wav
38
- } from "./chunk-JWBPHDVP.js";
38
+ } from "./chunk-4QGX7XXO.js";
39
39
  import {
40
40
  narrationScript
41
- } from "./chunk-KCGXC2RV.js";
41
+ } from "./chunk-TDAWUJ2L.js";
42
42
  import {
43
43
  host
44
- } from "./chunk-4PZYWKO5.js";
44
+ } from "./chunk-DC7A435Z.js";
45
45
  import {
46
46
  folderOf,
47
47
  nameOf
48
- } from "./chunk-5ABPFV55.js";
48
+ } from "./chunk-2PAZTBSE.js";
49
49
  import {
50
50
  ObjectRuntype,
51
51
  OptionalFieldRuntype,
@@ -58,14 +58,14 @@ import {
58
58
  bundle,
59
59
  isError,
60
60
  wrongArgument
61
- } from "./chunk-DFXG2P7A.js";
61
+ } from "./chunk-T6CAPT32.js";
62
62
  import {
63
63
  manim_exports
64
- } from "./chunk-XCPBFMEA.js";
64
+ } from "./chunk-RAGZAJKD.js";
65
65
  import {
66
66
  chapterNames,
67
67
  renderChapter
68
- } from "./chunk-Y56UHOZ2.js";
68
+ } from "./chunk-DN2LVJO3.js";
69
69
 
70
70
  // src/commands.ts
71
71
  import path2 from "node:path";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  renderDiagnostic
3
- } from "./chunk-KCGXC2RV.js";
3
+ } from "./chunk-TDAWUJ2L.js";
4
4
  import {
5
5
  withSource
6
- } from "./chunk-5ABPFV55.js";
6
+ } from "./chunk-2PAZTBSE.js";
7
7
  import {
8
8
  loadEngine
9
- } from "./chunk-Y56UHOZ2.js";
9
+ } from "./chunk-DN2LVJO3.js";
10
10
 
11
11
  // src/problems.ts
12
12
  async function printDiagnostics(capabilities, root, diagnostics, print = (text) => capabilities.log.out(text)) {
@@ -430,7 +430,7 @@ import {
430
430
  wiggle,
431
431
  wrap,
432
432
  wrong
433
- } from "./chunk-Y56UHOZ2.js";
433
+ } from "./chunk-DN2LVJO3.js";
434
434
  import {
435
435
  fault
436
436
  } from "./chunk-VX7UVLQW.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticOf
3
- } from "./chunk-Y56UHOZ2.js";
3
+ } from "./chunk-DN2LVJO3.js";
4
4
 
5
5
  // ../../node_modules/.pnpm/@beff+client@1.0.1/node_modules/@beff/client/dist/esm/openapi-pp.js
6
6
  var removeNullUnionBranch = (definition) => {
@@ -1251,12 +1251,10 @@ async function projectModules(tree, root) {
1251
1251
  });
1252
1252
  return errors.length > 0 ? { _tag: "Left", left: errors } : { _tag: "Right", right: found };
1253
1253
  }
1254
- async function bundleWorkspace(bundler, tree, root) {
1255
- const listed = await projectModules(tree, root);
1256
- if (listed._tag === "Left") return listed;
1257
- const projects = listed.right;
1254
+ var NO_PROJECT_MESSAGE = "no project here: run from a project or playlist folder, or pass it (for example: aula web examples)";
1255
+ async function bundleProjects(bundler, tree, root, projects) {
1258
1256
  if (projects.length === 0) {
1259
- throw new Error("no project here: open a folder that has index.ts, or whose subfolders have index.ts");
1257
+ throw new Error(NO_PROJECT_MESSAGE);
1260
1258
  }
1261
1259
  const list = [
1262
1260
  ...projects.map((project, i) => `import p${String(i)} from ${JSON.stringify(`./${project.module}`)};`),
@@ -1271,11 +1269,16 @@ async function bundleWorkspace(bundler, tree, root) {
1271
1269
  return {
1272
1270
  _tag: "Right",
1273
1271
  right: {
1274
- bundle: { name: root, projects, code: bundled.right.code, map: bundled.right.map },
1272
+ bundle: { name: root, projects: [...projects], code: bundled.right.code, map: bundled.right.map },
1275
1273
  inputs: bundled.right.inputs
1276
1274
  }
1277
1275
  };
1278
1276
  }
1277
+ async function bundleWorkspace(bundler, tree, root) {
1278
+ const listed = await projectModules(tree, root);
1279
+ if (listed._tag === "Left") return listed;
1280
+ return bundleProjects(bundler, tree, root, listed.right);
1281
+ }
1279
1282
 
1280
1283
  // ../aula-project/src/diagnostics.ts
1281
1284
  function error(message, more = {}) {
@@ -1310,6 +1313,7 @@ export {
1310
1313
  bundle,
1311
1314
  projectName,
1312
1315
  projectModules,
1316
+ bundleProjects,
1313
1317
  bundleWorkspace,
1314
1318
  error,
1315
1319
  isError,
@@ -3,7 +3,7 @@ import {
3
3
  initG2p,
4
4
  lexiconEntries,
5
5
  loadEngine
6
- } from "./chunk-Y56UHOZ2.js";
6
+ } from "./chunk-DN2LVJO3.js";
7
7
 
8
8
  // ../aula-narration/src/align.ts
9
9
  function roundHalfEven(value) {
package/dist/src/cli.js CHANGED
@@ -14,8 +14,8 @@ import {
14
14
  studentWeightFile,
15
15
  timeAulaVoice,
16
16
  tokenBatches
17
- } from "./chunk-KCGXC2RV.js";
18
- import "./chunk-Y56UHOZ2.js";
17
+ } from "./chunk-TDAWUJ2L.js";
18
+ import "./chunk-DN2LVJO3.js";
19
19
  import {
20
20
  fault
21
21
  } from "./chunk-VX7UVLQW.js";
@@ -236,7 +236,7 @@ async function aulaVoiceWeightFile(capabilities2, options2) {
236
236
  function aulaVoice(capabilities2, options2) {
237
237
  let loading = null;
238
238
  const parts = () => loading ??= (async () => {
239
- const { aulaVoiceModel } = await import("./aula-voice-tts-HPJAJO2Q.js");
239
+ const { aulaVoiceModel } = await import("./aula-voice-tts-YOS4IQXV.js");
240
240
  return { model: await aulaVoiceModel(await aulaVoiceWeightFile(capabilities2, options2)), phonemize };
241
241
  })();
242
242
  return {
@@ -284,9 +284,9 @@ var base = Capabilities.create({
284
284
  },
285
285
  spawn
286
286
  });
287
- var { diagnosticsOf, printDiagnostics } = await import("./problems-2IXR6RUV.js");
288
- var { host, loadProject } = await import("./project-36YBXKCD.js");
289
- var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-YLF62D3C.js");
287
+ var { diagnosticsOf, printDiagnostics } = await import("./problems-CGKCPETU.js");
288
+ var { host, loadProject } = await import("./project-EUFMRQXR.js");
289
+ var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-ER27SVTA.js");
290
290
  var locks = createLocks(base, path3.join(os.homedir(), ".cache/aula/heavy.lock"));
291
291
  var render = createRender(base, process.execPath);
292
292
  var models = path3.join(os.homedir(), ".cache/aula/models");
@@ -310,7 +310,7 @@ async function main(argv) {
310
310
  const args = parse(rest, optionsOf(command));
311
311
  if (command === "web") {
312
312
  const options2 = webOptions(cwd, args);
313
- const { serve } = await import("./server-ALRN2C2W.js");
313
+ const { serve } = await import("./server-TJTMSDO2.js");
314
314
  const stop = new AbortController();
315
315
  for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => stop.abort());
316
316
  const web = Capabilities.create({
@@ -326,12 +326,12 @@ async function main(argv) {
326
326
  return 0;
327
327
  }
328
328
  if (command === "site") {
329
- const { site } = await import("./site-A2I4P4GX.js");
329
+ const { site } = await import("./site-RGPJOWSU.js");
330
330
  const weights = Capabilities.create({ weights: aulaVoiceWeights(base, fetch, models) });
331
331
  return await site(Capabilities.extend(capabilities, weights), siteOptions(cwd, args)) ? 0 : 1;
332
332
  }
333
333
  if (command === "tokens") {
334
- const { tokens, tokensArgs } = await import("./commands-BUM4AG3N.js");
334
+ const { tokens, tokensArgs } = await import("./commands-BSDNHYB3.js");
335
335
  tokensArgs(args.positional);
336
336
  const tokensOf = createTokens();
337
337
  return await tokens(capabilities, tokensOf, createInterface({ input: process.stdin, crlfDelay: Infinity })) ? 0 : 1;
@@ -7,19 +7,19 @@ import {
7
7
  timeline,
8
8
  tokens,
9
9
  tokensArgs
10
- } from "./chunk-3RB5T3CC.js";
10
+ } from "./chunk-HD6FTA3H.js";
11
11
  import "./chunk-THQ5Y74K.js";
12
12
  import "./chunk-F4XRXW6M.js";
13
13
  import "./chunk-4N4NUMKP.js";
14
- import "./chunk-5TUGYMFH.js";
15
- import "./chunk-5XVICDLW.js";
16
- import "./chunk-JWBPHDVP.js";
17
- import "./chunk-KCGXC2RV.js";
18
- import "./chunk-4PZYWKO5.js";
19
- import "./chunk-5ABPFV55.js";
20
- import "./chunk-DFXG2P7A.js";
21
- import "./chunk-XCPBFMEA.js";
22
- import "./chunk-Y56UHOZ2.js";
14
+ import "./chunk-PZXFW6ZD.js";
15
+ import "./chunk-AXQBWV7J.js";
16
+ import "./chunk-4QGX7XXO.js";
17
+ import "./chunk-TDAWUJ2L.js";
18
+ import "./chunk-DC7A435Z.js";
19
+ import "./chunk-2PAZTBSE.js";
20
+ import "./chunk-T6CAPT32.js";
21
+ import "./chunk-RAGZAJKD.js";
22
+ import "./chunk-DN2LVJO3.js";
23
23
  import "./chunk-VX7UVLQW.js";
24
24
  import "./chunk-CZ7CSFO4.js";
25
25
  export {
@@ -0,0 +1,18 @@
1
+ import {
2
+ printDiagnostics
3
+ } from "./chunk-PZXFW6ZD.js";
4
+ import "./chunk-AXQBWV7J.js";
5
+ import "./chunk-4QGX7XXO.js";
6
+ import "./chunk-TDAWUJ2L.js";
7
+ import "./chunk-2PAZTBSE.js";
8
+ import {
9
+ diagnosticsOf
10
+ } from "./chunk-T6CAPT32.js";
11
+ import "./chunk-RAGZAJKD.js";
12
+ import "./chunk-DN2LVJO3.js";
13
+ import "./chunk-VX7UVLQW.js";
14
+ import "./chunk-CZ7CSFO4.js";
15
+ export {
16
+ diagnosticsOf,
17
+ printDiagnostics
18
+ };
@@ -0,0 +1,16 @@
1
+ import {
2
+ exists,
3
+ host,
4
+ loadProject
5
+ } from "./chunk-DC7A435Z.js";
6
+ import "./chunk-2PAZTBSE.js";
7
+ import "./chunk-T6CAPT32.js";
8
+ import "./chunk-RAGZAJKD.js";
9
+ import "./chunk-DN2LVJO3.js";
10
+ import "./chunk-VX7UVLQW.js";
11
+ import "./chunk-CZ7CSFO4.js";
12
+ export {
13
+ exists,
14
+ host,
15
+ loadProject
16
+ };
@@ -5,21 +5,21 @@ import {
5
5
  preview,
6
6
  script,
7
7
  timeline
8
- } from "./chunk-3RB5T3CC.js";
8
+ } from "./chunk-HD6FTA3H.js";
9
9
  import "./chunk-THQ5Y74K.js";
10
10
  import "./chunk-F4XRXW6M.js";
11
11
  import "./chunk-4N4NUMKP.js";
12
- import "./chunk-5TUGYMFH.js";
13
- import "./chunk-5XVICDLW.js";
14
- import "./chunk-JWBPHDVP.js";
15
- import "./chunk-KCGXC2RV.js";
16
- import "./chunk-4PZYWKO5.js";
17
- import "./chunk-5ABPFV55.js";
12
+ import "./chunk-PZXFW6ZD.js";
13
+ import "./chunk-AXQBWV7J.js";
14
+ import "./chunk-4QGX7XXO.js";
15
+ import "./chunk-TDAWUJ2L.js";
16
+ import "./chunk-DC7A435Z.js";
17
+ import "./chunk-2PAZTBSE.js";
18
18
  import {
19
19
  wrongArgument
20
- } from "./chunk-DFXG2P7A.js";
21
- import "./chunk-XCPBFMEA.js";
22
- import "./chunk-Y56UHOZ2.js";
20
+ } from "./chunk-T6CAPT32.js";
21
+ import "./chunk-RAGZAJKD.js";
22
+ import "./chunk-DN2LVJO3.js";
23
23
  import "./chunk-VX7UVLQW.js";
24
24
  import "./chunk-CZ7CSFO4.js";
25
25
 
@@ -42,20 +42,24 @@ aula preview <folder> <out> [<chapter>[:<line>] ...]
42
42
  motion stills, contact sheets and moves.md
43
43
  aula export <folder> <file.mp4> the video to send: narrated in this run, H.264 and
44
44
  AAC at 1280x720 and 60 fps; needs ffmpeg
45
- aula web [<folder>] [--port N] the web app for the folder if it has index.ts, else
46
- for each subfolder with index.ts, in the order of
47
- the folder names (default: the current folder);
48
- the page narrates in the browser
45
+ aula web [<folder>] [--port N] [--host H]
46
+ the web app for a project folder (index.ts) or a
47
+ playlist folder of such projects (default: cwd);
48
+ not a monorepo root that also holds kits; draft:
49
+ true projects stay out of a playlist list; the page
50
+ narrates in the browser; --host defaults to 127.0.0.1
51
+ (use 0.0.0.0 to listen on all interfaces)
49
52
  aula bundle <folder> <file.zip> the project zip: the project folder, and the
50
53
  packages it imports, to share or host
51
54
  aula site <folder> <out> [--title <text>] [--base <path>]
52
- a website of the projects of a playlist folder (the
53
- same projects, order and sections as aula web):
54
- the folder's files with the packages they import,
55
- and the web app, as plain files in <out> for any
56
- static host; --title is the site's title (default:
57
- the folder's name); --base pins the site to a base
58
- path such as /aula/ (default: it works at any path)
55
+ a website of a project or playlist folder (same as
56
+ aula web; not a monorepo root that also holds kits;
57
+ draft: true projects stay out): the folder's files
58
+ with the packages they import, and the web app, as
59
+ plain files in <out> for any static host; --title
60
+ is the site's title (default: the folder's name);
61
+ --base pins the site to a base path such as /aula/
62
+ (default: it works at any path)
59
63
  aula script <folder> [<chapter> ...] the review script: each chapter with its length,
60
64
  each spoken beat and what is on screen
61
65
  aula timeline <folder> [<chapter> ...]
@@ -69,6 +73,7 @@ aula tokens Kokoro v1.0's token ids of texts, for trai
69
73
  Errors make the exit code 1. Warnings do not change it.`;
70
74
  var VALUED = {
71
75
  "--port": { what: "a port number", number: true },
76
+ "--host": { what: "a host", number: false },
72
77
  "--title": { what: "a title", number: false },
73
78
  "--base": { what: "a base path", number: false }
74
79
  };
@@ -99,7 +104,7 @@ function parse(argv, allowed) {
99
104
  }
100
105
  var OPTIONS = {
101
106
  check: ["--json"],
102
- web: ["--port"],
107
+ web: ["--port", "--host"],
103
108
  site: ["--title", "--base"]
104
109
  };
105
110
  var isHelp = (command) => command === void 0 || command === "help" || command === "-h" || command === "--help";
@@ -142,7 +147,12 @@ async function run(capabilities, cwd, command, project, rest, flags = /* @__PURE
142
147
  function webOptions(cwd, args) {
143
148
  if (args.positional.length > 1) throw wrongArgument("aula web takes one folder", "run `aula help` for the usage");
144
149
  const port = args.values.get("--port");
145
- return { root: path.resolve(cwd, args.positional[0] ?? "."), port: typeof port === "number" ? port : 0 };
150
+ const host = args.values.get("--host");
151
+ return {
152
+ root: path.resolve(cwd, args.positional[0] ?? "."),
153
+ port: typeof port === "number" ? port : 0,
154
+ host: typeof host === "string" ? host : "127.0.0.1"
155
+ };
146
156
  }
147
157
  function siteOptions(cwd, args) {
148
158
  const [folder, out, ...more] = args.positional;
@@ -5,19 +5,19 @@ import {
5
5
  createNodeBundler,
6
6
  nodeTree
7
7
  } from "./chunk-THQ5Y74K.js";
8
- import "./chunk-JWBPHDVP.js";
8
+ import "./chunk-4QGX7XXO.js";
9
9
  import {
10
10
  SERVER_WEIGHTS_PATH
11
- } from "./chunk-KCGXC2RV.js";
11
+ } from "./chunk-TDAWUJ2L.js";
12
12
  import {
13
13
  exists
14
- } from "./chunk-4PZYWKO5.js";
15
- import "./chunk-5ABPFV55.js";
14
+ } from "./chunk-DC7A435Z.js";
15
+ import "./chunk-2PAZTBSE.js";
16
16
  import {
17
17
  bundleWorkspace
18
- } from "./chunk-DFXG2P7A.js";
19
- import "./chunk-XCPBFMEA.js";
20
- import "./chunk-Y56UHOZ2.js";
18
+ } from "./chunk-T6CAPT32.js";
19
+ import "./chunk-RAGZAJKD.js";
20
+ import "./chunk-DN2LVJO3.js";
21
21
  import {
22
22
  AulaError,
23
23
  fault
@@ -155,7 +155,13 @@ async function watchWorkspaceFolders(capabilities, root, watching) {
155
155
  }
156
156
  }
157
157
  }
158
+ function openHost(host) {
159
+ if (host === "0.0.0.0") return "127.0.0.1";
160
+ if (host === "::" || host === "[::]") return "[::1]";
161
+ return host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
162
+ }
158
163
  async function serve(capabilities, options) {
164
+ const host = options.host ?? "127.0.0.1";
159
165
  let generation = 0;
160
166
  let cached = null;
161
167
  const watching = changes(capabilities, () => {
@@ -203,11 +209,13 @@ async function serve(capabilities, options) {
203
209
  else response.destroy();
204
210
  });
205
211
  });
206
- server.listen(options.port, "127.0.0.1");
212
+ server.listen(options.port, host);
207
213
  await once(server, "listening");
208
214
  const address = server.address();
209
215
  const port = typeof address === "object" && address !== null ? address.port : options.port;
210
- capabilities.log.out(`aula web: open http://127.0.0.1:${String(port)}/ in a browser (Ctrl-C stops it)`);
216
+ const open = `http://${openHost(host)}:${String(port)}/`;
217
+ const bindNote = host === "0.0.0.0" || host === "::" || host === "[::]" ? ` (listening on ${host})` : "";
218
+ capabilities.log.out(`aula web: open ${open} in a browser${bindNote} (Ctrl-C stops it)`);
211
219
  options.stop.addEventListener("abort", () => {
212
220
  watching.close();
213
221
  void bundler.stop();
@@ -280,6 +288,7 @@ async function answer(capabilities, root, watching, weights, buildBundle, reques
280
288
  notFound(request, response);
281
289
  }
282
290
  export {
291
+ openHost,
283
292
  pathParts,
284
293
  serve
285
294
  };
@@ -6,23 +6,25 @@ import {
6
6
  nodeTree
7
7
  } from "./chunk-THQ5Y74K.js";
8
8
  import {
9
+ listedProjects,
9
10
  loadBuiltProjects,
10
11
  workspaceHost
11
- } from "./chunk-5XVICDLW.js";
12
- import "./chunk-JWBPHDVP.js";
12
+ } from "./chunk-AXQBWV7J.js";
13
+ import "./chunk-4QGX7XXO.js";
13
14
  import {
14
15
  AULA_VOICE_WEIGHTS
15
- } from "./chunk-KCGXC2RV.js";
16
+ } from "./chunk-TDAWUJ2L.js";
16
17
  import {
17
18
  Problems,
19
+ bundleProjects,
18
20
  bundleWorkspace,
19
21
  projectModules,
20
22
  wrongArgument
21
- } from "./chunk-DFXG2P7A.js";
22
- import "./chunk-XCPBFMEA.js";
23
+ } from "./chunk-T6CAPT32.js";
24
+ import "./chunk-RAGZAJKD.js";
23
25
  import {
24
26
  v8Frames
25
- } from "./chunk-Y56UHOZ2.js";
27
+ } from "./chunk-DN2LVJO3.js";
26
28
  import {
27
29
  fault
28
30
  } from "./chunk-VX7UVLQW.js";
@@ -63,7 +65,7 @@ async function mediaFiles(capabilities, folder, projects) {
63
65
  return (await walk(capabilities, folder)).filter((file) => MEDIA_FILE.test(file) && inProject(file)).toSorted();
64
66
  }
65
67
  var METHOD_STUB = "export const paragraph = () => () => ({});\n";
66
- async function listVideos(capabilities, workspaceBundle) {
68
+ async function loadSiteProjects(capabilities, workspaceBundle) {
67
69
  const scratch = await capabilities.fs.mkdtemp(path.join(os.tmpdir(), "aula-site-videos-"));
68
70
  let count = 0;
69
71
  try {
@@ -85,15 +87,16 @@ async function listVideos(capabilities, workspaceBundle) {
85
87
  };
86
88
  const loaded = await loadBuiltProjects(workspaceBundle, workspaceHost(v8Frames), modules, player);
87
89
  if (loaded._tag === "Left") throw new Problems(loaded.left);
88
- return loaded.right.map(({ name: projectName, title, section }) => ({
89
- name: projectName,
90
- title,
91
- ...section === void 0 ? {} : { section }
92
- }));
90
+ return loaded.right;
93
91
  } finally {
94
92
  await capabilities.fs.rm(scratch, { recursive: true, force: true });
95
93
  }
96
94
  }
95
+ var videosOf = (projects) => projects.map(({ name: projectName, title, section }) => ({
96
+ name: projectName,
97
+ title,
98
+ ...section === void 0 ? {} : { section }
99
+ }));
97
100
  async function pageFiles(capabilities) {
98
101
  if (!capabilities.fs.existsSync(new URL("index.html", PAGE))) {
99
102
  fault("the site page is not built", "run `pnpm --filter aula-web-pages build`");
@@ -121,8 +124,7 @@ async function site(capabilities, options) {
121
124
  if (listed._tag === "Left") throw new Problems(listed.left);
122
125
  if (listed.right.length === 0) {
123
126
  throw wrongArgument(
124
- `no project in ${folder}`,
125
- "give a folder that has index.ts, or whose subfolders have index.ts"
127
+ `no project in ${folder}: run from a project or playlist folder, or pass it (for example: aula site examples site-out)`
126
128
  );
127
129
  }
128
130
  const bundler = createNodeBundler();
@@ -132,7 +134,22 @@ async function site(capabilities, options) {
132
134
  const bundled = await bundleWorkspace(bundler, tree, folderName);
133
135
  if (bundled._tag === "Left") throw new Problems(bundled.left);
134
136
  workspaceBundle = bundled.right.bundle;
135
- videos = await listVideos(capabilities, workspaceBundle);
137
+ const loaded = await loadSiteProjects(capabilities, workspaceBundle);
138
+ const published = listedProjects(loaded);
139
+ if (published.length === 0) {
140
+ throw wrongArgument(
141
+ `no published project in ${folder}`,
142
+ "give a folder with at least one project that is not draft: true, or open a draft by its folder path"
143
+ );
144
+ }
145
+ if (published.length !== loaded.length) {
146
+ const keep = new Set(published.map((project) => project.name));
147
+ const filtered = workspaceBundle.projects.filter((project) => keep.has(project.name));
148
+ const rebundled = await bundleProjects(bundler, tree, folderName, filtered);
149
+ if (rebundled._tag === "Left") throw new Problems(rebundled.left);
150
+ workspaceBundle = rebundled.right.bundle;
151
+ }
152
+ videos = videosOf(published);
136
153
  } finally {
137
154
  await bundler.stop();
138
155
  }