@beff/aula-cli 0.1.0 → 0.1.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 +2 -2
- package/dist/src/aula-render.core.wasm +0 -0
- package/dist/src/{chunk-3IBMAZRS.js → chunk-46KT47TH.js} +1 -1
- package/dist/src/{chunk-SDFXIMLW.js → chunk-7KT36JRP.js} +312 -113
- package/dist/src/{chunk-UREQAEFC.js → chunk-IAQZ6DTC.js} +2 -222
- package/dist/src/{chunk-OMBYV6CK.js → chunk-QWNBVWUQ.js} +54 -12
- package/dist/src/chunk-XUBCUJW5.js +104 -0
- package/dist/src/{chunk-EYXQ2I7K.js → chunk-YX73KJQ6.js} +4 -31
- package/dist/src/cli.js +81 -16
- package/dist/src/{commands-VDGWDVWT.js → commands-M246OWYJ.js} +6 -7
- package/dist/src/problems-Y67BY7WB.js +12 -0
- package/dist/src/{project-M63R4ENB.js → project-NWT5MDQI.js} +2 -2
- package/dist/src/{run-CY72QGZJ.js → run-CTVGU7EK.js} +10 -10
- package/dist/src/{server-ZG6K7Z7H.js → server-5OGXX6BF.js} +6 -66
- package/dist/web/app/assets/__vite-browser-external-BN30sEqc.js +1 -0
- package/dist/web/app/assets/aula-method.js +1 -1
- package/dist/web/app/assets/{aula-voice-worker-BL6WcrSe.js → aula-voice-worker-DymX5vwM.js} +10 -10
- package/dist/web/app/assets/{aula.core5-BdGB-M10.wasm → aula.core5-YhDIb7Me.wasm} +0 -0
- package/dist/web/app/assets/aula.js +1 -1
- package/dist/web/app/assets/build-worker.js +8 -9
- package/dist/web/app/assets/index-B8_aMtuI.js +53 -0
- package/dist/web/app/assets/index-cL-Dm_aw.css +2 -0
- package/dist/web/app/assets/protocol-CnlzsyRt.js +15 -0
- package/dist/web/app/assets/{src-BbJ5r410.js → src-CmWmmzpF.js} +6 -6
- package/dist/web/app/index.html +4 -4
- package/package.json +2 -2
- package/dist/src/chunk-KLE5UOUB.js +0 -57
- package/dist/src/chunk-PYRORQA5.js +0 -88
- package/dist/src/chunk-X3HJY34X.js +0 -81
- package/dist/src/problems-OGUR4BLZ.js +0 -12
- package/dist/web/app/assets/__vite-browser-external-Bbi05A7N.js +0 -1
- package/dist/web/app/assets/index-BVQqteYG.js +0 -53
- package/dist/web/app/assets/index-CS60sOpp.css +0 -2
- package/dist/web/app/assets/protocol-Ds4jI5bY.js +0 -15
|
@@ -5,17 +5,16 @@ import {
|
|
|
5
5
|
preview,
|
|
6
6
|
script,
|
|
7
7
|
timeline
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QWNBVWUQ.js";
|
|
9
9
|
import "./chunk-GFCJYE75.js";
|
|
10
10
|
import "./chunk-2XGNOG2U.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-3IBMAZRS.js";
|
|
11
|
+
import "./chunk-IAQZ6DTC.js";
|
|
12
|
+
import "./chunk-XUBCUJW5.js";
|
|
13
|
+
import "./chunk-YX73KJQ6.js";
|
|
14
|
+
import "./chunk-46KT47TH.js";
|
|
16
15
|
import {
|
|
17
16
|
wrongArgument
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-7KT36JRP.js";
|
|
19
18
|
|
|
20
19
|
// src/run.ts
|
|
21
20
|
import path from "node:path";
|
|
@@ -34,9 +33,10 @@ aula preview <folder> <out> [<chapter>[:<line>] ...]
|
|
|
34
33
|
motion stills, contact sheets and moves.md
|
|
35
34
|
aula export <folder> <file.mp4> the video to send: narrated in this run, H.264 and
|
|
36
35
|
AAC at 1280x720 and 30 fps; needs ffmpeg
|
|
37
|
-
aula web [<folder>] [--port N] the web app for
|
|
38
|
-
|
|
39
|
-
folder
|
|
36
|
+
aula web [<folder>] [--port N] the web app for the folder if it has index.ts, else
|
|
37
|
+
for each subfolder with index.ts, in the order of
|
|
38
|
+
the folder names (default: the current folder);
|
|
39
|
+
the page narrates in the browser
|
|
40
40
|
aula bundle <folder> <file.zip> the project zip: the project folder, and the
|
|
41
41
|
packages it imports, to share or host
|
|
42
42
|
aula script <folder> print the narration text with lines
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
speakAnswer,
|
|
3
|
-
timeAnswer
|
|
4
|
-
} from "./chunk-X3HJY34X.js";
|
|
5
|
-
import {
|
|
6
|
-
Parsers
|
|
7
|
-
} from "./chunk-KLE5UOUB.js";
|
|
8
|
-
import "./chunk-SDFXIMLW.js";
|
|
1
|
+
import "./chunk-XUBCUJW5.js";
|
|
9
2
|
import {
|
|
10
3
|
SERVER_WEIGHTS_PATH
|
|
11
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YX73KJQ6.js";
|
|
12
5
|
import {
|
|
13
6
|
exists
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-46KT47TH.js";
|
|
8
|
+
import "./chunk-7KT36JRP.js";
|
|
16
9
|
|
|
17
10
|
// src/web/server.ts
|
|
18
11
|
import { once } from "node:events";
|
|
@@ -125,13 +118,11 @@ function shared(load) {
|
|
|
125
118
|
return running;
|
|
126
119
|
};
|
|
127
120
|
}
|
|
128
|
-
var MAX_BODY = 1 << 20;
|
|
129
121
|
async function serve(capabilities, options) {
|
|
130
|
-
const narration = narrator(capabilities);
|
|
131
122
|
const watching = changes(capabilities);
|
|
132
123
|
const weights = shared(capabilities.weights);
|
|
133
124
|
const server = createServer((request, response) => {
|
|
134
|
-
answer(capabilities, options.root,
|
|
125
|
+
answer(capabilities, options.root, watching, weights, request, response).catch((error) => {
|
|
135
126
|
const fix = error instanceof AulaError && error.hint !== void 0 ? `: ${error.hint}` : "";
|
|
136
127
|
const message = `${error instanceof Error ? error.message : String(error)}${fix}`;
|
|
137
128
|
capabilities.log.err(`aula web: ${request.url ?? ""}: ${message}`);
|
|
@@ -152,31 +143,6 @@ async function serve(capabilities, options) {
|
|
|
152
143
|
});
|
|
153
144
|
await once(server, "close");
|
|
154
145
|
}
|
|
155
|
-
function narrator(capabilities) {
|
|
156
|
-
let turn = Promise.resolve();
|
|
157
|
-
const speak = async (text, speed) => {
|
|
158
|
-
const release = await capabilities.locks.heavy();
|
|
159
|
-
try {
|
|
160
|
-
return speakAnswer(await capabilities.narrator.speak(text, speed));
|
|
161
|
-
} finally {
|
|
162
|
-
await release();
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
return {
|
|
166
|
-
time: async (text, speed) => timeAnswer(await capabilities.narrator.time(text, speed)),
|
|
167
|
-
speak: async (text, speed) => {
|
|
168
|
-
const before = turn;
|
|
169
|
-
const { promise, resolve: done } = Promise.withResolvers();
|
|
170
|
-
turn = promise;
|
|
171
|
-
await before;
|
|
172
|
-
try {
|
|
173
|
-
return await speak(text, speed);
|
|
174
|
-
} finally {
|
|
175
|
-
done();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
146
|
function send(request, response, body, kind, status) {
|
|
181
147
|
const data = typeof body === "string" ? Buffer.from(body) : body;
|
|
182
148
|
response.writeHead(status, {
|
|
@@ -194,17 +160,6 @@ function pathParts(path) {
|
|
|
194
160
|
const parts = decodeURIComponent(path).split("/");
|
|
195
161
|
return parts.every((part) => part !== "" && !part.startsWith(".") && !part.includes("\\")) ? parts : null;
|
|
196
162
|
}
|
|
197
|
-
async function readBody(request) {
|
|
198
|
-
const chunks = [];
|
|
199
|
-
let size = 0;
|
|
200
|
-
for await (const chunk of request) {
|
|
201
|
-
const piece = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk));
|
|
202
|
-
size += piece.length;
|
|
203
|
-
if (size > MAX_BODY) throw new Error("the request is too large");
|
|
204
|
-
chunks.push(piece);
|
|
205
|
-
}
|
|
206
|
-
return Buffer.concat(chunks).toString("utf8");
|
|
207
|
-
}
|
|
208
163
|
async function folderFile(capabilities, root, path, request, response, served) {
|
|
209
164
|
const folder = path.startsWith("/folders/") || path === "/folders";
|
|
210
165
|
if (!folder && !path.startsWith("/files/")) return false;
|
|
@@ -230,23 +185,8 @@ async function folderFile(capabilities, root, path, request, response, served) {
|
|
|
230
185
|
send(request, response, data, "text/plain; charset=utf-8", 200);
|
|
231
186
|
return true;
|
|
232
187
|
}
|
|
233
|
-
async function answer(capabilities, root,
|
|
188
|
+
async function answer(capabilities, root, watching, weights, request, response) {
|
|
234
189
|
const path = new URL(request.url ?? "/", "http://localhost").pathname;
|
|
235
|
-
if (path === "/speak" || path === "/time") {
|
|
236
|
-
if (request.method !== "POST") {
|
|
237
|
-
send(request, response, "Use POST\n", "text/plain", 405);
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
const parsed = Parsers.SpeakRequest.safeParse(JSON.parse(await readBody(request)));
|
|
241
|
-
if (!parsed.success) {
|
|
242
|
-
send(request, response, 'The body must be {"text": <text>, "speed": <number>}\n', "text/plain", 400);
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
const { text, speed } = parsed.data;
|
|
246
|
-
const answered = path === "/speak" ? await narration.speak(text, speed) : await narration.time(text, speed);
|
|
247
|
-
send(request, response, JSON.stringify(answered), "application/json", 200);
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
190
|
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
251
191
|
notFound(request, response);
|
|
252
192
|
return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./aula-voice-worker-DymX5vwM.js";var t=/* @__PURE__ */ e(((e,t)=>{t.exports={}}));export default t();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e,p as t}from"./src-
|
|
1
|
+
import{l as e,p as t}from"./src-CmWmmzpF.js";var n=8,r=.5,i=3,a=3,o=[`view`,`claim`,`forecast`,`estimate`,`proposed`,`external`,`schematic`,`not measured`,`expected`,`alleged`],s=1,c=e=>JSON.stringify(e);function l(e){return e.toLowerCase().match(/[a-z0-9$%]+/g)??[]}function u(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function d(e,t){let n=l(e),r=` ${l(t).join(` `)} `;for(let e=0;e+a<=n.length;e++)if(r.includes(` ${n.slice(e,e+a).join(` `)} `))return!0;return!1}function f(e){let t=e.toLowerCase();return o.some(e=>t.includes(e))||/(^|[^\p{L}\p{N}_])\p{Lu}[\p{L}\p{N}_.&-]*['’]s(?![\p{L}\p{N}_])/u.test(e)}function p(e,t){let n=Math.max(e.low[0]-t.high[0],t.low[0]-e.high[0],0),r=Math.max(e.low[1]-t.high[1],t.low[1]-e.high[1],0);return Math.hypot(n,r)<=s}function m(e,t,a){let o=[],s=(t,n=e.place)=>{o.push({message:t,...n===void 0?{}:{at:n}})};a.mechanism.trim()===``&&s(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`),a.sources.length===0&&s(`the paragraph has no sources (give its sources, or ["recap"])`);for(let e of a.sources)u(e)&&!t.exists(e)&&s(`${c(e)}: this path is not a file: correct the path or add the file`);let l=t.paragraphs.flatMap(e=>e.says.map(e=>e.text)).join(` `),m=new Map;for(let t of e.screen.instants)for(let e of t.texts)m.set(JSON.stringify([e.place,e.text]),e);for(let e of m.values())e.text.split(/\s+/).filter(Boolean).length>i&&s(`text on screen over ${String(i)} words: ${c(e.text)}; make it shorter`,e.place),d(e.text,l)&&s(`text on screen repeats the narration: ${c(e.text)}; use other words`,e.place);let h=new Map;for(let t of e.screen.instants){let e=new Set(t.texts.filter(e=>e.opacity>r).map(e=>e.id)).size,i=JSON.stringify(t.place);e>(h.get(i)?.count??n)&&h.set(i,{count:e,at:t.place})}for(let{count:e,at:t}of h.values())s(`${String(e)} labels on screen (about ${String(n)} at most): show fewer labels at one time, or split the picture`,t);let g=new Map,_=new Set;for(let t of e.screen.instants)for(let e of t.dashed)t.texts.some(t=>f(t.text)&&p(t,e))?_.add(e.id):g.set(e.id,e);for(let[e,t]of g)_.has(e)||s(`dashed shape with no attribution text near it: put a text that says whose view it is, such as "Smith's view", next to it`,t.place);return t.number===t.count&&e.index===t.paragraphs.length-1&&(a.sources.length!==1||a.sources[0]!==`recap`)&&s(`the video must end with a recap paragraph (sources: ["recap"])`),o}function h(n){let r=t(`paragraph`,n);return({sources:t},n)=>e({mechanism:r,sources:t},n??((e,n)=>m(e,n,{mechanism:r,sources:t})))}export{m as findings,h as paragraph};
|