@beff/aula-cli 0.6.1 → 0.7.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.
- package/dist/src/{chunk-XYBGXFIM.js → chunk-HLRTXRAC.js} +63 -42
- package/dist/src/{chunk-6CZECZIX.js → chunk-JWAUET3S.js} +374 -15
- package/dist/src/{chunk-6LC3WXJ7.js → chunk-PLBRKNMD.js} +20 -5
- package/dist/src/{chunk-3MPFI4UE.js → chunk-RRS3SD7K.js} +41 -18
- package/dist/src/chunk-STW7EAFL.js +127 -0
- package/dist/src/chunk-THQ5Y74K.js +64 -0
- package/dist/src/{chunk-32AJJP3R.js → chunk-UKSA5OFC.js} +1 -1
- package/dist/src/{chunk-ZASMFCUL.js → chunk-WY3AMP6M.js} +5 -4
- package/dist/src/cli.js +23 -13
- package/dist/src/{commands-KNPNJHDC.js → commands-NDTPHXGF.js} +8 -8
- package/dist/src/problems-CQXPY4G5.js +14 -0
- package/dist/src/project-ICPIW4MO.js +12 -0
- package/dist/src/{run-V3U7HCKB.js → run-IBCNVZ4J.js} +8 -8
- package/dist/src/{server-KTS6ORJM.js → server-QQ2V343V.js} +84 -27
- package/dist/src/{site-VW2NSQV5.js → site-XYQKQZLZ.js} +33 -65
- package/dist/web/app/assets/{72474bf9 → 7ca1e7de}/aula-method.js +1 -1
- package/dist/web/app/assets/{72474bf9 → 7ca1e7de}/aula.js +1 -1
- package/dist/web/app/assets/7ca1e7de/build-worker.js +2 -0
- package/dist/web/app/assets/7ca1e7de/index.js +52 -0
- package/dist/web/app/assets/__vite-browser-external-CZjgZoe-.js +1 -0
- package/dist/web/app/assets/{aula-voice-worker-DxzRCbJL.js → aula-voice-worker-CjeRSu86.js} +10 -10
- package/dist/web/app/assets/{aula.core5-BdGr7QcG.wasm → aula.core5-DVDCNzCV.wasm} +0 -0
- package/dist/web/app/assets/{72474bf9/build-worker.js → browser-sNTR4ahh.js} +4 -5
- package/dist/web/app/assets/esbuild-D6hmBtXM.js +1 -0
- package/dist/web/{site/assets/index-Dcly6eU3.css → app/assets/index-CFRTa3wf.css} +1 -1
- package/dist/web/app/assets/protocol-CVAj9kTL.js +15 -0
- package/dist/web/app/assets/{src-Cz8PghaR.js → src-uzFdGdZX.js} +2 -3
- package/dist/web/app/index.html +28 -4
- package/dist/web/site/assets/{9db97082 → 8f69161f}/aula-method.js +1 -1
- package/dist/web/site/assets/{9db97082 → 8f69161f}/aula.js +1 -1
- package/dist/web/site/assets/8f69161f/build-worker.js +2 -0
- package/dist/web/site/assets/8f69161f/index.js +52 -0
- package/dist/web/site/assets/__vite-browser-external-lWmWnTMm.js +1 -0
- package/dist/web/site/assets/{aula-voice-worker-CzRFydP2.js → aula-voice-worker-Sm-si1oe.js} +10 -12
- package/dist/web/site/assets/{aula.core5-BdGr7QcG.wasm → aula.core5-DVDCNzCV.wasm} +0 -0
- package/dist/web/site/assets/{9db97082/build-worker.js → browser-sNTR4ahh.js} +4 -5
- package/dist/web/site/assets/esbuild-CW5RQptO.js +1 -0
- package/dist/web/{app/assets/index-DtOukfzG.css → site/assets/index-CFRTa3wf.css} +1 -1
- package/dist/web/site/assets/protocol-47nVPHKy.js +15 -0
- package/dist/web/site/assets/{src-71sAnADq.js → src-DWVrqSqZ.js} +2 -3
- package/dist/web/site/index.html +28 -4
- package/package.json +2 -2
- package/dist/src/chunk-KQJVAXSC.js +0 -369
- package/dist/src/chunk-NAMV5OAS.js +0 -77
- package/dist/src/problems-P6M3366O.js +0 -14
- package/dist/src/project-BZL5K5BR.js +0 -12
- package/dist/web/app/assets/72474bf9/index.js +0 -53
- package/dist/web/app/assets/__vite-browser-external-CS_r4ncq.js +0 -1
- package/dist/web/app/assets/protocol-DqAun5Af.js +0 -15
- package/dist/web/site/assets/9db97082/index.js +0 -53
- package/dist/web/site/assets/__vite-browser-external-CTYaiPUZ.js +0 -1
- package/dist/web/site/assets/protocol-DPaQDdsV.js +0 -15
|
@@ -1012,21 +1012,16 @@ var parser_default = {
|
|
|
1012
1012
|
var Parsers = parser_default.buildParsers();
|
|
1013
1013
|
|
|
1014
1014
|
// ../aula-bundle/src/index.ts
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
if (first !== void 0 && rest.length > 0) names.add(first);
|
|
1026
|
-
}
|
|
1027
|
-
return Promise.resolve([...names].toSorted());
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1015
|
+
var PROVIDED = ["@beff/aula", "@beff/aula-method"];
|
|
1016
|
+
var PROVIDED_IMPORTS = Object.fromEntries(PROVIDED.map((name) => [name, `aula-provide:${name}`]));
|
|
1017
|
+
var LIST_MODULE = "aula-projects.ts";
|
|
1018
|
+
function linkBundle(code, player) {
|
|
1019
|
+
let out = code;
|
|
1020
|
+
for (const [pkg, placeholder] of Object.entries(PROVIDED_IMPORTS)) {
|
|
1021
|
+
const target = player[pkg];
|
|
1022
|
+
if (target !== void 0) out = out.replaceAll(JSON.stringify(placeholder), JSON.stringify(target));
|
|
1023
|
+
}
|
|
1024
|
+
return out;
|
|
1030
1025
|
}
|
|
1031
1026
|
var SOURCE_PREFIX = "tree:";
|
|
1032
1027
|
function dirname(path) {
|
|
@@ -1092,10 +1087,10 @@ var diagnostic = ({ text, location: at }) => ({
|
|
|
1092
1087
|
stack: [],
|
|
1093
1088
|
related: []
|
|
1094
1089
|
});
|
|
1095
|
-
async function bundle(
|
|
1090
|
+
async function bundle(bundler, tree, entry, imports) {
|
|
1096
1091
|
let result;
|
|
1097
1092
|
try {
|
|
1098
|
-
result = await
|
|
1093
|
+
result = await bundler.build({
|
|
1099
1094
|
entryPoints: [entry],
|
|
1100
1095
|
bundle: true,
|
|
1101
1096
|
write: false,
|
|
@@ -1249,6 +1244,31 @@ async function projectModules(tree, root) {
|
|
|
1249
1244
|
});
|
|
1250
1245
|
return errors.length > 0 ? { _tag: "Left", left: errors } : { _tag: "Right", right: found };
|
|
1251
1246
|
}
|
|
1247
|
+
async function bundleWorkspace(bundler, tree, root) {
|
|
1248
|
+
const listed = await projectModules(tree, root);
|
|
1249
|
+
if (listed._tag === "Left") return listed;
|
|
1250
|
+
const projects = listed.right;
|
|
1251
|
+
if (projects.length === 0) {
|
|
1252
|
+
throw new Error("no project here: open a folder that has index.ts, or whose subfolders have index.ts");
|
|
1253
|
+
}
|
|
1254
|
+
const list = [
|
|
1255
|
+
...projects.map((project, i) => `import p${String(i)} from ${JSON.stringify(`./${project.module}`)};`),
|
|
1256
|
+
`export default [${projects.map((_, i) => `p${String(i)}`).join(", ")}];`
|
|
1257
|
+
].join("\n");
|
|
1258
|
+
const virtual = {
|
|
1259
|
+
read: (path) => path === LIST_MODULE ? Promise.resolve(list) : tree.read(path),
|
|
1260
|
+
list: (folder) => tree.list(folder)
|
|
1261
|
+
};
|
|
1262
|
+
const bundled = await bundle(bundler, virtual, LIST_MODULE, PROVIDED_IMPORTS);
|
|
1263
|
+
if (bundled._tag === "Left") return bundled;
|
|
1264
|
+
return {
|
|
1265
|
+
_tag: "Right",
|
|
1266
|
+
right: {
|
|
1267
|
+
bundle: { name: root, projects, code: bundled.right.code, map: bundled.right.map },
|
|
1268
|
+
inputs: bundled.right.inputs
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1252
1272
|
|
|
1253
1273
|
// ../aula-project/src/diagnostics.ts
|
|
1254
1274
|
import { diagnosticOf } from "@beff/aula/run";
|
|
@@ -1277,10 +1297,13 @@ export {
|
|
|
1277
1297
|
RefRuntype,
|
|
1278
1298
|
buildParsers,
|
|
1279
1299
|
Parsers,
|
|
1280
|
-
|
|
1300
|
+
PROVIDED,
|
|
1301
|
+
LIST_MODULE,
|
|
1302
|
+
linkBundle,
|
|
1281
1303
|
bundle,
|
|
1282
1304
|
projectName,
|
|
1283
1305
|
projectModules,
|
|
1306
|
+
bundleWorkspace,
|
|
1284
1307
|
error,
|
|
1285
1308
|
isError,
|
|
1286
1309
|
Problems,
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Problems,
|
|
3
|
+
diagnosticsOf,
|
|
4
|
+
error,
|
|
5
|
+
projectName,
|
|
6
|
+
wrongArgument
|
|
7
|
+
} from "./chunk-RRS3SD7K.js";
|
|
8
|
+
|
|
9
|
+
// ../aula-project/src/node.ts
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { pathToFileURL } from "node:url";
|
|
12
|
+
import { isProjectDefinition } from "@beff/aula";
|
|
13
|
+
import { definedAt, importUserModule, loadEngine, v8Frames } from "@beff/aula/run";
|
|
14
|
+
var PROJECT_MODULE = "index.ts";
|
|
15
|
+
var GLUE = [
|
|
16
|
+
`${path.dirname(new URL(import.meta.resolve("@beff/aula")).pathname)}/`,
|
|
17
|
+
new URL(import.meta.url).pathname
|
|
18
|
+
];
|
|
19
|
+
function host(capabilities, root, glue = []) {
|
|
20
|
+
const all = [...GLUE, ...glue];
|
|
21
|
+
return {
|
|
22
|
+
frames: v8Frames,
|
|
23
|
+
name: (file) => file.startsWith("/") && !file.includes("/node_modules/") && !all.some((g) => file.startsWith(g)) ? path.relative(root, file) : void 0,
|
|
24
|
+
exists: (file) => capabilities.fs.existsSync(path.resolve(root, file)),
|
|
25
|
+
media: (file) => {
|
|
26
|
+
const full = path.resolve(root, file);
|
|
27
|
+
const stat = capabilities.fs.statSync(full, { throwIfNoEntry: false });
|
|
28
|
+
if (stat === void 0 || !stat.isFile()) return void 0;
|
|
29
|
+
let bytes;
|
|
30
|
+
return { size: stat.size, read: () => bytes ??= capabilities.fs.readFileSync(full) };
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function propertyOf(e, key) {
|
|
35
|
+
return typeof e === "object" && e !== null ? Reflect.get(e, key) : void 0;
|
|
36
|
+
}
|
|
37
|
+
function slugOf(text) {
|
|
38
|
+
return text.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
39
|
+
}
|
|
40
|
+
function listedChapters(capabilities, folder, projectFile) {
|
|
41
|
+
const source = capabilities.fs.readFileSync(projectFile, "utf8");
|
|
42
|
+
const imports = /* @__PURE__ */ new Map();
|
|
43
|
+
for (const match of source.matchAll(/^\s*import\s+([A-Za-z_$][\w$]*)\s+from\s+["'](\.[^"']+)["']/gm)) {
|
|
44
|
+
if (match[1] !== void 0 && match[2] !== void 0) {
|
|
45
|
+
imports.set(match[1], path.resolve(folder, match[2]));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const list = /chapters\s*:\s*\[([^\]]*)\]/s.exec(source)?.[1];
|
|
49
|
+
if (list === void 0) return [];
|
|
50
|
+
const ids = list.replace(/\/\/.*$/gm, "").split(",").map((part) => part.trim()).filter((part) => /^[A-Za-z_$][\w$]*$/.test(part));
|
|
51
|
+
return ids.flatMap((id, index) => {
|
|
52
|
+
const chapterFile = imports.get(id);
|
|
53
|
+
if (chapterFile === void 0) return [];
|
|
54
|
+
const number = index + 1;
|
|
55
|
+
const body = capabilities.fs.existsSync(chapterFile) ? capabilities.fs.readFileSync(chapterFile, "utf8") : "";
|
|
56
|
+
const heading = /heading\s*:\s*(?:say\s*`([^`$]+)`|"([^"]+)"|'([^']+)')/.exec(body);
|
|
57
|
+
const raw = heading?.[1] ?? heading?.[2] ?? heading?.[3] ?? path.basename(chapterFile, path.extname(chapterFile));
|
|
58
|
+
const slug = slugOf(raw) || path.basename(chapterFile, path.extname(chapterFile));
|
|
59
|
+
return [{ number, file: chapterFile, name: `${String(number).padStart(2, "0")}-${slug}` }];
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function stoppedByOtherChapter(capabilities, root, folder, projectFile, only, glue, thrown) {
|
|
63
|
+
if (only.length === 0) return void 0;
|
|
64
|
+
const chapters = listedChapters(capabilities, folder, projectFile);
|
|
65
|
+
if (chapters.length === 0) return void 0;
|
|
66
|
+
const wanted = only.map((arg) => arg.split(":")[0] ?? arg);
|
|
67
|
+
const isWanted = (entry) => wanted.some((w) => w === entry.name || Number(/^(\d+)-/.exec(w)?.[1]) === entry.number);
|
|
68
|
+
const diagnostics = diagnosticsOf(thrown, host(capabilities, root, glue));
|
|
69
|
+
const [first] = diagnostics;
|
|
70
|
+
if (first === void 0) return void 0;
|
|
71
|
+
const files = [
|
|
72
|
+
...first.location === void 0 ? [] : [path.resolve(root, first.location.file)],
|
|
73
|
+
...thrown instanceof Error ? v8Frames(thrown).map((frame) => frame.file) : []
|
|
74
|
+
];
|
|
75
|
+
const byFile = new Map(chapters.map((entry) => [entry.file, entry]));
|
|
76
|
+
const hit = files.map((candidate) => byFile.get(candidate)).find((entry) => entry !== void 0);
|
|
77
|
+
if (hit === void 0 || isWanted(hit)) return void 0;
|
|
78
|
+
return new Problems(
|
|
79
|
+
diagnostics.map((d, i) => i === 0 ? { ...d, message: `stopped by an error in ${hit.name}: ${d.message}` } : d)
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
async function loadProject(capabilities, load, root, folder, only = [], glue = []) {
|
|
83
|
+
const file = path.join(folder, PROJECT_MODULE);
|
|
84
|
+
if (!capabilities.fs.existsSync(file)) {
|
|
85
|
+
throw wrongArgument(
|
|
86
|
+
`${path.relative(root, folder) || "."} has no ${PROJECT_MODULE}`,
|
|
87
|
+
`give the project folder: the folder with ${PROJECT_MODULE}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
await loadEngine();
|
|
91
|
+
const loaded = await importUserModule(() => load(pathToFileURL(file).href));
|
|
92
|
+
if (loaded._tag === "Left") {
|
|
93
|
+
throw stoppedByOtherChapter(capabilities, root, folder, file, only, glue, loaded.left) ?? loaded.left;
|
|
94
|
+
}
|
|
95
|
+
const module = loaded.right;
|
|
96
|
+
const exported = propertyOf(module, "default");
|
|
97
|
+
if (!isProjectDefinition(exported)) {
|
|
98
|
+
const rel = path.relative(root, file);
|
|
99
|
+
throw new Problems([
|
|
100
|
+
error(`the default export of ${rel} is not made by defineProject`, {
|
|
101
|
+
location: { file: rel, line: 1, col: 0 },
|
|
102
|
+
hint: "write `export default defineProject({ title, theme, chapters: [ \u2026 ] })`"
|
|
103
|
+
})
|
|
104
|
+
]);
|
|
105
|
+
}
|
|
106
|
+
return exported;
|
|
107
|
+
}
|
|
108
|
+
var folderOf = (project) => path.dirname(definedAt(project).file);
|
|
109
|
+
var nameOf = (project) => projectName(path.basename(folderOf(project)));
|
|
110
|
+
async function withSource(capabilities, root, d) {
|
|
111
|
+
if (d.source !== void 0 || d.location === void 0) return d;
|
|
112
|
+
const file = path.resolve(root, d.location.file);
|
|
113
|
+
if (!capabilities.fs.existsSync(file)) return d;
|
|
114
|
+
const text = await capabilities.fs.readFile(file, "utf8");
|
|
115
|
+
const lines = text.split("\n");
|
|
116
|
+
if (lines.at(-1) === "") lines.pop();
|
|
117
|
+
const line = lines[d.location.line - 1];
|
|
118
|
+
return line === void 0 || d.location.line < 1 ? d : { ...d, source: line.replace(/\r$/, "") };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export {
|
|
122
|
+
host,
|
|
123
|
+
loadProject,
|
|
124
|
+
folderOf,
|
|
125
|
+
nameOf,
|
|
126
|
+
withSource
|
|
127
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/bundler.ts
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
function createNodeBundler() {
|
|
4
|
+
let loaded = null;
|
|
5
|
+
return {
|
|
6
|
+
build: async (options) => {
|
|
7
|
+
loaded ??= import("esbuild-wasm");
|
|
8
|
+
const esbuild = await loaded;
|
|
9
|
+
return esbuild.build(options);
|
|
10
|
+
},
|
|
11
|
+
stop: async () => {
|
|
12
|
+
if (loaded === null) return;
|
|
13
|
+
const esbuild = await loaded;
|
|
14
|
+
loaded = null;
|
|
15
|
+
await esbuild.stop();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
var ROOT_NODE_MODULE = /^node_modules\/((?:@[^/]+\/)?[^/]+)(?:\/(.*))?$/;
|
|
20
|
+
function nodeTree(capabilities, folder) {
|
|
21
|
+
const root = path.resolve(folder);
|
|
22
|
+
const diskPath = (virtualPath) => {
|
|
23
|
+
const match = ROOT_NODE_MODULE.exec(virtualPath);
|
|
24
|
+
if (match !== null) {
|
|
25
|
+
const pkg = match[1];
|
|
26
|
+
if (pkg === void 0) return null;
|
|
27
|
+
for (let dir = root; ; ) {
|
|
28
|
+
if (capabilities.fs.existsSync(path.join(dir, "node_modules", pkg))) {
|
|
29
|
+
return path.join(dir, virtualPath);
|
|
30
|
+
}
|
|
31
|
+
const parent = path.dirname(dir);
|
|
32
|
+
if (parent === dir) return null;
|
|
33
|
+
dir = parent;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return path.join(root, virtualPath);
|
|
37
|
+
};
|
|
38
|
+
const kind = async (full) => {
|
|
39
|
+
if (full === null || !capabilities.fs.existsSync(full)) return null;
|
|
40
|
+
const stat = await capabilities.fs.stat(full);
|
|
41
|
+
return stat.isFile() ? "file" : stat.isDirectory() ? "folder" : null;
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
diskPath,
|
|
45
|
+
read: async (file) => {
|
|
46
|
+
const full = diskPath(file);
|
|
47
|
+
return await kind(full) === "file" && full !== null ? capabilities.fs.readFile(full, "utf8") : null;
|
|
48
|
+
},
|
|
49
|
+
list: async (sub) => {
|
|
50
|
+
const full = sub === "" ? root : diskPath(sub);
|
|
51
|
+
if (await kind(full) !== "folder" || full === null) return [];
|
|
52
|
+
const names = [];
|
|
53
|
+
for (const name of await capabilities.fs.readdir(full)) {
|
|
54
|
+
if (await kind(path.join(full, name)) === "folder") names.push(name);
|
|
55
|
+
}
|
|
56
|
+
return names.toSorted();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
createNodeBundler,
|
|
63
|
+
nodeTree
|
|
64
|
+
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
host,
|
|
3
3
|
loadProject
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-STW7EAFL.js";
|
|
5
5
|
|
|
6
6
|
// src/project.ts
|
|
7
7
|
function exists(capabilities, file) {
|
|
8
8
|
return capabilities.fs.existsSync(file);
|
|
9
9
|
}
|
|
10
|
+
var SELF = new URL(import.meta.url).pathname;
|
|
10
11
|
function host2(capabilities, root) {
|
|
11
|
-
return host(capabilities, root, [
|
|
12
|
+
return host(capabilities, root, [SELF]);
|
|
12
13
|
}
|
|
13
|
-
function loadProject2(capabilities, root, folder) {
|
|
14
|
-
return loadProject(capabilities, (url) => import(url), root, folder);
|
|
14
|
+
function loadProject2(capabilities, root, folder, only = []) {
|
|
15
|
+
return loadProject(capabilities, (url) => import(url), root, folder, only, [SELF]);
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export {
|
package/dist/src/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
studentWeightFile,
|
|
15
15
|
timeAulaVoice,
|
|
16
16
|
tokenBatches
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-PLBRKNMD.js";
|
|
18
18
|
|
|
19
19
|
// src/cli.ts
|
|
20
20
|
import { spawn } from "node:child_process";
|
|
@@ -178,6 +178,18 @@ import { createHash } from "node:crypto";
|
|
|
178
178
|
import path2 from "node:path";
|
|
179
179
|
import { fault } from "@beff/aula/errors";
|
|
180
180
|
var sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
181
|
+
async function writeAtomic(capabilities2, destination, bytes) {
|
|
182
|
+
const folder = path2.dirname(destination);
|
|
183
|
+
await capabilities2.fs.mkdir(folder, { recursive: true });
|
|
184
|
+
const work = await capabilities2.fs.mkdtemp(path2.join(folder, `.${path2.basename(destination)}.`));
|
|
185
|
+
try {
|
|
186
|
+
const staged = path2.join(work, path2.basename(destination));
|
|
187
|
+
await capabilities2.fs.writeFile(staged, bytes);
|
|
188
|
+
await capabilities2.fs.rename(staged, destination);
|
|
189
|
+
} finally {
|
|
190
|
+
await capabilities2.fs.rm(work, { recursive: true, force: true });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
181
193
|
async function download(capabilities2, fetch2, downloading, destination, url, hash) {
|
|
182
194
|
if (capabilities2.fs.existsSync(destination)) {
|
|
183
195
|
const kept = new Uint8Array(await capabilities2.fs.readFile(destination));
|
|
@@ -192,9 +204,7 @@ async function download(capabilities2, fetch2, downloading, destination, url, ha
|
|
|
192
204
|
if (sha256(bytes) !== hash) {
|
|
193
205
|
fault(`the download of ${url} has the wrong SHA-256`, "run the command again; if it fails again, report it");
|
|
194
206
|
}
|
|
195
|
-
await capabilities2
|
|
196
|
-
await capabilities2.fs.writeFile(`${destination}.part`, bytes);
|
|
197
|
-
await capabilities2.fs.rename(`${destination}.part`, destination);
|
|
207
|
+
await writeAtomic(capabilities2, destination, bytes);
|
|
198
208
|
return bytes;
|
|
199
209
|
}
|
|
200
210
|
var phonemize = britishPhonemizer(new Set(KOKORO_VOCAB.keys()));
|
|
@@ -216,8 +226,7 @@ async function aulaVoiceWeightFile(capabilities2, options2) {
|
|
|
216
226
|
if (sha256(avw) !== AULA_VOICE_WEIGHTS.sha256) {
|
|
217
227
|
fault("the weight file made from aula-voice's release has the wrong SHA-256", "report it");
|
|
218
228
|
}
|
|
219
|
-
await capabilities2
|
|
220
|
-
await capabilities2.fs.rename(`${destination}.part`, destination);
|
|
229
|
+
await writeAtomic(capabilities2, destination, avw);
|
|
221
230
|
return avw;
|
|
222
231
|
}
|
|
223
232
|
function aulaVoice(capabilities2, options2) {
|
|
@@ -271,9 +280,9 @@ var base = Capabilities.create({
|
|
|
271
280
|
},
|
|
272
281
|
spawn
|
|
273
282
|
});
|
|
274
|
-
var { diagnosticsOf, printDiagnostics } = await import("./problems-
|
|
275
|
-
var { host, loadProject } = await import("./project-
|
|
276
|
-
var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-
|
|
283
|
+
var { diagnosticsOf, printDiagnostics } = await import("./problems-CQXPY4G5.js");
|
|
284
|
+
var { host, loadProject } = await import("./project-ICPIW4MO.js");
|
|
285
|
+
var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-IBCNVZ4J.js");
|
|
277
286
|
var locks = createLocks(base, path3.join(os.homedir(), ".cache/aula/heavy.lock"));
|
|
278
287
|
var render = createRender(base, process.execPath);
|
|
279
288
|
var models = path3.join(os.homedir(), ".cache/aula/models");
|
|
@@ -296,7 +305,7 @@ async function main(argv) {
|
|
|
296
305
|
}
|
|
297
306
|
const args = parse(rest, optionsOf(command));
|
|
298
307
|
if (command === "web") {
|
|
299
|
-
const { serve } = await import("./server-
|
|
308
|
+
const { serve } = await import("./server-QQ2V343V.js");
|
|
300
309
|
const stop = new AbortController();
|
|
301
310
|
for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => stop.abort());
|
|
302
311
|
const web = Capabilities.create({
|
|
@@ -312,18 +321,19 @@ async function main(argv) {
|
|
|
312
321
|
return 0;
|
|
313
322
|
}
|
|
314
323
|
if (command === "site") {
|
|
315
|
-
const { site } = await import("./site-
|
|
324
|
+
const { site } = await import("./site-XYQKQZLZ.js");
|
|
316
325
|
const weights = Capabilities.create({ weights: aulaVoiceWeights(base, fetch, models) });
|
|
317
326
|
return await site(Capabilities.extend(capabilities, weights), siteOptions(cwd, args)) ? 0 : 1;
|
|
318
327
|
}
|
|
319
328
|
if (command === "tokens") {
|
|
320
|
-
const { tokens, tokensArgs } = await import("./commands-
|
|
329
|
+
const { tokens, tokensArgs } = await import("./commands-NDTPHXGF.js");
|
|
321
330
|
tokensArgs(args.positional);
|
|
322
331
|
const tokensOf = createTokens();
|
|
323
332
|
return await tokens(capabilities, tokensOf, createInterface({ input: process.stdin, crlfDelay: Infinity })) ? 0 : 1;
|
|
324
333
|
}
|
|
325
334
|
const { folder, rest: after } = folderArgs(cwd, command, args);
|
|
326
|
-
const
|
|
335
|
+
const only = command === "preview" ? after.slice(1) : command === "check" || command === "timeline" ? after : [];
|
|
336
|
+
const project = await loadProject(capabilities, cwd, folder, only);
|
|
327
337
|
return await run2(capabilities, cwd, command, project, after, args.flags) ? 0 : 1;
|
|
328
338
|
}
|
|
329
339
|
try {
|
|
@@ -7,17 +7,17 @@ import {
|
|
|
7
7
|
timeline,
|
|
8
8
|
tokens,
|
|
9
9
|
tokensArgs
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-6CZECZIX.js";
|
|
10
|
+
} from "./chunk-JWAUET3S.js";
|
|
12
11
|
import "./chunk-BLKXJGEO.js";
|
|
13
12
|
import "./chunk-2XGNOG2U.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-UKSA5OFC.js";
|
|
14
|
+
import "./chunk-HLRTXRAC.js";
|
|
15
|
+
import "./chunk-THQ5Y74K.js";
|
|
16
16
|
import "./chunk-S74JLCZK.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-PLBRKNMD.js";
|
|
18
|
+
import "./chunk-WY3AMP6M.js";
|
|
19
|
+
import "./chunk-STW7EAFL.js";
|
|
20
|
+
import "./chunk-RRS3SD7K.js";
|
|
21
21
|
export {
|
|
22
22
|
bundle,
|
|
23
23
|
check,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
printDiagnostics
|
|
3
|
+
} from "./chunk-UKSA5OFC.js";
|
|
4
|
+
import "./chunk-HLRTXRAC.js";
|
|
5
|
+
import "./chunk-S74JLCZK.js";
|
|
6
|
+
import "./chunk-PLBRKNMD.js";
|
|
7
|
+
import "./chunk-STW7EAFL.js";
|
|
8
|
+
import {
|
|
9
|
+
diagnosticsOf
|
|
10
|
+
} from "./chunk-RRS3SD7K.js";
|
|
11
|
+
export {
|
|
12
|
+
diagnosticsOf,
|
|
13
|
+
printDiagnostics
|
|
14
|
+
};
|
|
@@ -5,19 +5,19 @@ import {
|
|
|
5
5
|
preview,
|
|
6
6
|
script,
|
|
7
7
|
timeline
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-6CZECZIX.js";
|
|
8
|
+
} from "./chunk-JWAUET3S.js";
|
|
10
9
|
import "./chunk-BLKXJGEO.js";
|
|
11
10
|
import "./chunk-2XGNOG2U.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-UKSA5OFC.js";
|
|
12
|
+
import "./chunk-HLRTXRAC.js";
|
|
13
|
+
import "./chunk-THQ5Y74K.js";
|
|
14
14
|
import "./chunk-S74JLCZK.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-PLBRKNMD.js";
|
|
16
|
+
import "./chunk-WY3AMP6M.js";
|
|
17
|
+
import "./chunk-STW7EAFL.js";
|
|
18
18
|
import {
|
|
19
19
|
wrongArgument
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-RRS3SD7K.js";
|
|
21
21
|
|
|
22
22
|
// src/run.ts
|
|
23
23
|
import path from "node:path";
|