@beff/aula-cli 0.6.2 → 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.
Files changed (45) hide show
  1. package/dist/src/{chunk-LSXILCMB.js → chunk-HLRTXRAC.js} +23 -35
  2. package/dist/src/{chunk-6CZECZIX.js → chunk-JWAUET3S.js} +374 -15
  3. package/dist/src/{chunk-3MPFI4UE.js → chunk-RRS3SD7K.js} +41 -18
  4. package/dist/src/{chunk-EZROW2IP.js → chunk-STW7EAFL.js} +1 -1
  5. package/dist/src/chunk-THQ5Y74K.js +64 -0
  6. package/dist/src/{chunk-7C6QW2TD.js → chunk-UKSA5OFC.js} +1 -1
  7. package/dist/src/{chunk-J7LNPVU2.js → chunk-WY3AMP6M.js} +1 -1
  8. package/dist/src/cli.js +6 -6
  9. package/dist/src/{commands-7MTNNJKO.js → commands-NDTPHXGF.js} +7 -7
  10. package/dist/src/{problems-CCUJW4H4.js → problems-CQXPY4G5.js} +4 -4
  11. package/dist/src/project-ICPIW4MO.js +12 -0
  12. package/dist/src/{run-VCOTEL37.js → run-IBCNVZ4J.js} +7 -7
  13. package/dist/src/{server-5W36J7WM.js → server-QQ2V343V.js} +83 -26
  14. package/dist/src/{site-NA5QNSHF.js → site-XYQKQZLZ.js} +32 -64
  15. package/dist/web/app/assets/{3cdff963 → 7ca1e7de}/aula-method.js +1 -1
  16. package/dist/web/app/assets/{3cdff963 → 7ca1e7de}/aula.js +1 -1
  17. package/dist/web/app/assets/7ca1e7de/build-worker.js +2 -0
  18. package/dist/web/app/assets/{3cdff963 → 7ca1e7de}/index.js +3 -4
  19. package/dist/web/app/assets/__vite-browser-external-CZjgZoe-.js +1 -0
  20. package/dist/web/{site/assets/aula-voice-worker-DHEZKCCg.js → app/assets/aula-voice-worker-CjeRSu86.js} +10 -12
  21. package/dist/web/app/assets/{3cdff963/build-worker.js → browser-sNTR4ahh.js} +4 -5
  22. package/dist/web/app/assets/esbuild-D6hmBtXM.js +1 -0
  23. package/dist/web/{site/assets/index-BirjmJbl.css → app/assets/index-CFRTa3wf.css} +1 -1
  24. package/dist/web/app/assets/protocol-CVAj9kTL.js +15 -0
  25. package/dist/web/app/assets/{src-CTZjQYUv.js → src-uzFdGdZX.js} +2 -3
  26. package/dist/web/app/index.html +5 -4
  27. package/dist/web/site/assets/{fbc21d75 → 8f69161f}/aula-method.js +1 -1
  28. package/dist/web/site/assets/{fbc21d75 → 8f69161f}/aula.js +1 -1
  29. package/dist/web/site/assets/8f69161f/build-worker.js +2 -0
  30. package/dist/web/site/assets/{fbc21d75 → 8f69161f}/index.js +3 -4
  31. package/dist/web/site/assets/__vite-browser-external-lWmWnTMm.js +1 -0
  32. package/dist/web/{app/assets/aula-voice-worker-C7UeMloK.js → site/assets/aula-voice-worker-Sm-si1oe.js} +10 -10
  33. package/dist/web/site/assets/{fbc21d75/build-worker.js → browser-sNTR4ahh.js} +4 -5
  34. package/dist/web/site/assets/esbuild-CW5RQptO.js +1 -0
  35. package/dist/web/{app/assets/index-BirjmJbl.css → site/assets/index-CFRTa3wf.css} +1 -1
  36. package/dist/web/site/assets/protocol-47nVPHKy.js +15 -0
  37. package/dist/web/site/assets/{src-1_dQqt80.js → src-DWVrqSqZ.js} +2 -3
  38. package/dist/web/site/index.html +5 -4
  39. package/package.json +2 -2
  40. package/dist/src/chunk-EB67KE2S.js +0 -369
  41. package/dist/src/project-PF77AQKF.js +0 -12
  42. package/dist/web/app/assets/__vite-browser-external-CTDtqMqs.js +0 -1
  43. package/dist/web/app/assets/protocol-C3MGnf_t.js +0 -15
  44. package/dist/web/site/assets/__vite-browser-external-D1sFDdqr.js +0 -1
  45. package/dist/web/site/assets/protocol-CzWPeNPI.js +0 -15
@@ -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,6 +1,6 @@
1
1
  import {
2
2
  withSource
3
- } from "./chunk-EZROW2IP.js";
3
+ } from "./chunk-STW7EAFL.js";
4
4
 
5
5
  // src/problems.ts
6
6
  import { loadEngine } from "@beff/aula/run";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  host,
3
3
  loadProject
4
- } from "./chunk-EZROW2IP.js";
4
+ } from "./chunk-STW7EAFL.js";
5
5
 
6
6
  // src/project.ts
7
7
  function exists(capabilities, file) {
package/dist/src/cli.js CHANGED
@@ -280,9 +280,9 @@ var base = Capabilities.create({
280
280
  },
281
281
  spawn
282
282
  });
283
- var { diagnosticsOf, printDiagnostics } = await import("./problems-CCUJW4H4.js");
284
- var { host, loadProject } = await import("./project-PF77AQKF.js");
285
- var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-VCOTEL37.js");
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");
286
286
  var locks = createLocks(base, path3.join(os.homedir(), ".cache/aula/heavy.lock"));
287
287
  var render = createRender(base, process.execPath);
288
288
  var models = path3.join(os.homedir(), ".cache/aula/models");
@@ -305,7 +305,7 @@ async function main(argv) {
305
305
  }
306
306
  const args = parse(rest, optionsOf(command));
307
307
  if (command === "web") {
308
- const { serve } = await import("./server-5W36J7WM.js");
308
+ const { serve } = await import("./server-QQ2V343V.js");
309
309
  const stop = new AbortController();
310
310
  for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => stop.abort());
311
311
  const web = Capabilities.create({
@@ -321,12 +321,12 @@ async function main(argv) {
321
321
  return 0;
322
322
  }
323
323
  if (command === "site") {
324
- const { site } = await import("./site-NA5QNSHF.js");
324
+ const { site } = await import("./site-XYQKQZLZ.js");
325
325
  const weights = Capabilities.create({ weights: aulaVoiceWeights(base, fetch, models) });
326
326
  return await site(Capabilities.extend(capabilities, weights), siteOptions(cwd, args)) ? 0 : 1;
327
327
  }
328
328
  if (command === "tokens") {
329
- const { tokens, tokensArgs } = await import("./commands-7MTNNJKO.js");
329
+ const { tokens, tokensArgs } = await import("./commands-NDTPHXGF.js");
330
330
  tokensArgs(args.positional);
331
331
  const tokensOf = createTokens();
332
332
  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-EB67KE2S.js";
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-7C6QW2TD.js";
15
- import "./chunk-LSXILCMB.js";
13
+ import "./chunk-UKSA5OFC.js";
14
+ import "./chunk-HLRTXRAC.js";
15
+ import "./chunk-THQ5Y74K.js";
16
16
  import "./chunk-S74JLCZK.js";
17
17
  import "./chunk-PLBRKNMD.js";
18
- import "./chunk-J7LNPVU2.js";
19
- import "./chunk-EZROW2IP.js";
20
- import "./chunk-3MPFI4UE.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,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  printDiagnostics
3
- } from "./chunk-7C6QW2TD.js";
4
- import "./chunk-LSXILCMB.js";
3
+ } from "./chunk-UKSA5OFC.js";
4
+ import "./chunk-HLRTXRAC.js";
5
5
  import "./chunk-S74JLCZK.js";
6
6
  import "./chunk-PLBRKNMD.js";
7
- import "./chunk-EZROW2IP.js";
7
+ import "./chunk-STW7EAFL.js";
8
8
  import {
9
9
  diagnosticsOf
10
- } from "./chunk-3MPFI4UE.js";
10
+ } from "./chunk-RRS3SD7K.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-WY3AMP6M.js";
6
+ import "./chunk-STW7EAFL.js";
7
+ import "./chunk-RRS3SD7K.js";
8
+ export {
9
+ exists,
10
+ host,
11
+ loadProject
12
+ };
@@ -5,19 +5,19 @@ import {
5
5
  preview,
6
6
  script,
7
7
  timeline
8
- } from "./chunk-EB67KE2S.js";
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-7C6QW2TD.js";
13
- import "./chunk-LSXILCMB.js";
11
+ import "./chunk-UKSA5OFC.js";
12
+ import "./chunk-HLRTXRAC.js";
13
+ import "./chunk-THQ5Y74K.js";
14
14
  import "./chunk-S74JLCZK.js";
15
15
  import "./chunk-PLBRKNMD.js";
16
- import "./chunk-J7LNPVU2.js";
17
- import "./chunk-EZROW2IP.js";
16
+ import "./chunk-WY3AMP6M.js";
17
+ import "./chunk-STW7EAFL.js";
18
18
  import {
19
19
  wrongArgument
20
- } from "./chunk-3MPFI4UE.js";
20
+ } from "./chunk-RRS3SD7K.js";
21
21
 
22
22
  // src/run.ts
23
23
  import path from "node:path";
@@ -1,15 +1,21 @@
1
1
  import {
2
2
  PACKAGE
3
3
  } from "./chunk-A5QHTZKT.js";
4
+ import {
5
+ createNodeBundler,
6
+ nodeTree
7
+ } from "./chunk-THQ5Y74K.js";
4
8
  import "./chunk-S74JLCZK.js";
5
9
  import {
6
10
  SERVER_WEIGHTS_PATH
7
11
  } from "./chunk-PLBRKNMD.js";
8
12
  import {
9
13
  exists
10
- } from "./chunk-J7LNPVU2.js";
11
- import "./chunk-EZROW2IP.js";
12
- import "./chunk-3MPFI4UE.js";
14
+ } from "./chunk-WY3AMP6M.js";
15
+ import "./chunk-STW7EAFL.js";
16
+ import {
17
+ bundleWorkspace
18
+ } from "./chunk-RRS3SD7K.js";
13
19
 
14
20
  // src/web/server.ts
15
21
  import { once } from "node:events";
@@ -85,18 +91,22 @@ function watcher(capabilities, reload) {
85
91
  }
86
92
 
87
93
  // src/web/server.ts
88
- function changes(capabilities) {
94
+ function changes(capabilities, onChange) {
89
95
  const streams = /* @__PURE__ */ new Set();
90
96
  const folders = /* @__PURE__ */ new Set();
91
97
  const files = watcher(capabilities, () => {
98
+ onChange();
92
99
  for (const response of streams) response.write("data: changed\n\n");
93
100
  });
101
+ const follow = (folder) => {
102
+ if (folders.has(folder)) return;
103
+ folders.add(folder);
104
+ files.follow([...folders]);
105
+ };
94
106
  return {
107
+ folder: follow,
95
108
  served: (file) => {
96
- const folder = dirname(file);
97
- if (folders.has(folder)) return;
98
- folders.add(folder);
99
- files.follow([...folders]);
109
+ follow(dirname(file));
100
110
  },
101
111
  stream: (response) => {
102
112
  response.writeHead(200, { "Content-Type": "text/event-stream", "Cache-Control": "no-cache" });
@@ -120,11 +130,65 @@ function shared(load) {
120
130
  return running;
121
131
  };
122
132
  }
133
+ async function watchWorkspaceFolders(capabilities, root, watching) {
134
+ watching.folder(root);
135
+ const top = await capabilities.fs.readdir(root, { withFileTypes: true });
136
+ for (const entry of top) {
137
+ if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
138
+ const sub = join(root, entry.name);
139
+ const stat = await capabilities.fs.stat(sub);
140
+ if (!stat.isDirectory()) continue;
141
+ watching.folder(sub);
142
+ if (capabilities.fs.existsSync(join(sub, "index.ts"))) continue;
143
+ const inner = await capabilities.fs.readdir(sub, { withFileTypes: true });
144
+ for (const child of inner) {
145
+ if (child.name.startsWith(".") || child.name === "node_modules") continue;
146
+ const nested = join(sub, child.name);
147
+ const childStat = await capabilities.fs.stat(nested);
148
+ if (childStat.isDirectory()) watching.folder(nested);
149
+ }
150
+ }
151
+ }
123
152
  async function serve(capabilities, options) {
124
- const watching = changes(capabilities);
153
+ let generation = 0;
154
+ let cached = null;
155
+ const watching = changes(capabilities, () => {
156
+ generation += 1;
157
+ cached = null;
158
+ });
159
+ const bundler = createNodeBundler();
160
+ const tree = nodeTree(capabilities, options.root);
161
+ const buildBundle = () => {
162
+ if (cached !== null && cached.generation === generation) return cached.result;
163
+ const at = generation;
164
+ const result = (async () => {
165
+ await watchWorkspaceFolders(capabilities, options.root, watching);
166
+ const bundled = await bundleWorkspace(bundler, tree, basename(options.root));
167
+ if (bundled._tag === "Left") {
168
+ for (const diagnostic of bundled.left) {
169
+ const file = diagnostic.location?.file;
170
+ if (file === void 0) continue;
171
+ const disk = tree.diskPath(file);
172
+ if (disk !== null && exists(capabilities, disk)) watching.served(disk);
173
+ }
174
+ return bundled;
175
+ }
176
+ for (const input of bundled.right.inputs) {
177
+ const disk = tree.diskPath(input);
178
+ if (disk !== null) watching.served(disk);
179
+ }
180
+ return { _tag: "Right", right: bundled.right.bundle };
181
+ })();
182
+ const entry = { generation: at, result };
183
+ cached = entry;
184
+ void result.catch(() => {
185
+ if (cached === entry) cached = null;
186
+ });
187
+ return result;
188
+ };
125
189
  const weights = shared(capabilities.weights);
126
190
  const server = createServer((request, response) => {
127
- answer(capabilities, options.root, watching, weights, request, response).catch((error) => {
191
+ answer(capabilities, options.root, watching, weights, buildBundle, request, response).catch((error) => {
128
192
  const fix = error instanceof AulaError && error.hint !== void 0 ? `: ${error.hint}` : "";
129
193
  const message = `${error instanceof Error ? error.message : String(error)}${fix}`;
130
194
  capabilities.log.err(`aula web: ${request.url ?? ""}: ${message}`);
@@ -140,6 +204,7 @@ async function serve(capabilities, options) {
140
204
  capabilities.log.out(`aula web: open http://127.0.0.1:${String(port)}/ in a browser (Ctrl-C stops it)`);
141
205
  options.stop.addEventListener("abort", () => {
142
206
  watching.close();
207
+ void bundler.stop();
143
208
  server.close();
144
209
  server.closeAllConnections();
145
210
  });
@@ -162,11 +227,9 @@ function pathParts(path) {
162
227
  const parts = decodeURIComponent(path).split("/");
163
228
  return parts.every((part) => part !== "" && !part.startsWith(".") && !part.includes("\\")) ? parts : null;
164
229
  }
165
- async function folderFile(capabilities, root, path, request, response, served) {
166
- const folder = path.startsWith("/folders/") || path === "/folders";
167
- if (!folder && !path.startsWith("/files/")) return false;
168
- const rest = path.replace(/^\/(files|folders)\/?/, "");
169
- const parts = rest === "" && folder ? [] : pathParts(rest);
230
+ async function mediaFile(capabilities, root, path, request, response, served) {
231
+ if (!path.startsWith("/files/")) return false;
232
+ const parts = pathParts(path.slice("/files/".length));
170
233
  if (parts === null) {
171
234
  notFound(request, response);
172
235
  return true;
@@ -176,18 +239,12 @@ async function folderFile(capabilities, root, path, request, response, served) {
176
239
  notFound(request, response);
177
240
  return true;
178
241
  }
179
- if (folder) {
180
- const entries = await capabilities.fs.readdir(target, { withFileTypes: true });
181
- const names = entries.filter((e) => (e.isDirectory() || e.isSymbolicLink()) && !e.name.startsWith(".")).map((e) => e.name);
182
- send(request, response, JSON.stringify(names.toSorted()), "application/json", 200);
183
- return true;
184
- }
185
242
  const data = await capabilities.fs.readFile(target);
186
243
  served(target);
187
- send(request, response, data, "text/plain; charset=utf-8", 200);
244
+ send(request, response, data, "application/octet-stream", 200);
188
245
  return true;
189
246
  }
190
- async function answer(capabilities, root, watching, weights, request, response) {
247
+ async function answer(capabilities, root, watching, weights, buildBundle, request, response) {
191
248
  const path = new URL(request.url ?? "/", "http://localhost").pathname;
192
249
  if (request.method !== "GET" && request.method !== "HEAD") {
193
250
  notFound(request, response);
@@ -201,8 +258,8 @@ async function answer(capabilities, root, watching, weights, request, response)
201
258
  send(request, response, await weights(), "application/octet-stream", 200);
202
259
  return;
203
260
  }
204
- if (path === "/name") {
205
- send(request, response, basename(root), "text/plain; charset=utf-8", 200);
261
+ if (path === "/bundle.json") {
262
+ send(request, response, JSON.stringify(await buildBundle()), "application/json", 200);
206
263
  return;
207
264
  }
208
265
  const file = await asset(capabilities, path);
@@ -213,7 +270,7 @@ async function answer(capabilities, root, watching, weights, request, response)
213
270
  const served = (target) => {
214
271
  watching.served(target);
215
272
  };
216
- if (await folderFile(capabilities, root, path, request, response, served)) return;
273
+ if (await mediaFile(capabilities, root, path, request, response, served)) return;
217
274
  notFound(request, response);
218
275
  }
219
276
  export {
@@ -1,24 +1,24 @@
1
1
  import {
2
- diskTree,
3
- packageFiles
4
- } from "./chunk-6CZECZIX.js";
5
- import {
6
- loadProjects,
2
+ loadBuiltProjects,
7
3
  workspaceHost
8
- } from "./chunk-LSXILCMB.js";
4
+ } from "./chunk-HLRTXRAC.js";
9
5
  import {
10
6
  PACKAGE
11
7
  } from "./chunk-A5QHTZKT.js";
8
+ import {
9
+ createNodeBundler,
10
+ nodeTree
11
+ } from "./chunk-THQ5Y74K.js";
12
12
  import "./chunk-S74JLCZK.js";
13
13
  import {
14
14
  AULA_VOICE_WEIGHTS
15
15
  } from "./chunk-PLBRKNMD.js";
16
16
  import {
17
17
  Problems,
18
- pathsTree,
18
+ bundleWorkspace,
19
19
  projectModules,
20
20
  wrongArgument
21
- } from "./chunk-3MPFI4UE.js";
21
+ } from "./chunk-RRS3SD7K.js";
22
22
 
23
23
  // src/site.ts
24
24
  import os from "node:os";
@@ -28,7 +28,8 @@ import { fault } from "@beff/aula/errors";
28
28
  import { v8Frames } from "@beff/aula/run";
29
29
  var PAGE = new URL("web/site/", PACKAGE);
30
30
  var PAGE_FOLDER = fileURLToPath(PAGE);
31
- var WRITTEN = ["index.html", "assets", "tree", "tree.json", AULA_VOICE_WEIGHTS.path];
31
+ var WRITTEN = ["index.html", "assets", "bundle.json", "media", "tree", "tree.json", AULA_VOICE_WEIGHTS.path];
32
+ var MEDIA_FILE = /\.(mp4|webm|wav|mp3|png|jpe?g|webp|gif|svg)$/i;
32
33
  var escapeHtml = (text) => text.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
33
34
  function pageHtml(html, title, base) {
34
35
  const titled = html.replace(/<title>[^<]*<\/title>/, () => `<title>${escapeHtml(title)}</title>`);
@@ -48,45 +49,13 @@ async function walk(capabilities, folder, from = "") {
48
49
  }
49
50
  return found;
50
51
  }
51
- var sameBytes = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);
52
- var packageOf = (at) => /^node_modules\/(?:@[^/]+\/)?[^/]+/.exec(at)?.[0] ?? at;
53
- async function differs(capabilities, files, at, source) {
54
- const kept = files.get(at);
55
- if (kept === void 0 || kept === source) return false;
56
- const [a, b] = await Promise.all([capabilities.fs.readFile(kept), capabilities.fs.readFile(source)]);
57
- return !sameBytes(new Uint8Array(a), new Uint8Array(b));
52
+ async function mediaFiles(capabilities, folder, projects) {
53
+ const folders = projects.map(({ module }) => path.posix.dirname(module));
54
+ const inProject = (file) => folders.some((own) => own === "." || file.startsWith(`${own}/`));
55
+ return (await walk(capabilities, folder)).filter((file) => MEDIA_FILE.test(file) && inProject(file)).toSorted();
58
56
  }
59
57
  var METHOD_STUB = "export const findings = () => [];\nexport const paragraph = () => () => ({});\n";
60
- async function packages(capabilities, esbuild, folder, modules) {
61
- const root = path.parse(folder).root;
62
- const home = path.relative(root, folder).split(path.sep).join("/");
63
- const tree = diskTree(capabilities, root);
64
- const files = /* @__PURE__ */ new Map();
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
- };
58
+ async function listVideos(capabilities, workspaceBundle) {
90
59
  const scratch = await capabilities.fs.mkdtemp(path.join(os.tmpdir(), "aula-site-videos-"));
91
60
  let count = 0;
92
61
  try {
@@ -105,7 +74,7 @@ async function listVideos(capabilities, esbuild, name, paths, files) {
105
74
  return { url, exports: await import(url) };
106
75
  }
107
76
  };
108
- const loaded = await loadProjects(workspace, workspaceHost(v8Frames), modules, esbuild, player);
77
+ const loaded = await loadBuiltProjects(workspaceBundle, workspaceHost(v8Frames), modules, player);
109
78
  if (loaded._tag === "Left") throw new Problems(loaded.left);
110
79
  return loaded.right.map(({ name: projectName, title, section }) => ({
111
80
  name: projectName,
@@ -137,7 +106,9 @@ async function site(capabilities, options) {
137
106
  "give an output folder that is outside the playlist folder"
138
107
  );
139
108
  }
140
- const listed = await projectModules(diskTree(capabilities, folder), path.basename(folder));
109
+ const tree = nodeTree(capabilities, folder);
110
+ const folderName = path.basename(folder);
111
+ const listed = await projectModules(tree, folderName);
141
112
  if (listed._tag === "Left") throw new Problems(listed.left);
142
113
  if (listed.right.length === 0) {
143
114
  throw wrongArgument(
@@ -145,25 +116,25 @@ async function site(capabilities, options) {
145
116
  "give a folder that has index.ts, or whose subfolders have index.ts"
146
117
  );
147
118
  }
148
- const own = await walk(capabilities, folder);
149
- const files = new Map(own.map((file) => [file, path.join(folder, file)]));
150
- const folderName = path.basename(folder);
151
- const esbuild = await import("esbuild-wasm");
152
- let paths;
119
+ const bundler = createNodeBundler();
120
+ let workspaceBundle;
153
121
  let videos;
154
122
  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);
123
+ const bundled = await bundleWorkspace(bundler, tree, folderName);
124
+ if (bundled._tag === "Left") throw new Problems(bundled.left);
125
+ workspaceBundle = bundled.right.bundle;
126
+ videos = await listVideos(capabilities, workspaceBundle);
158
127
  } finally {
159
- await esbuild.stop();
128
+ await bundler.stop();
160
129
  }
130
+ const media = await mediaFiles(capabilities, folder, workspaceBundle.projects);
131
+ const bundleJson = JSON.stringify({ ...workspaceBundle, videos, media });
161
132
  const weights = await capabilities.weights();
162
133
  const page = await pageFiles(capabilities);
163
134
  const html = pageHtml(await capabilities.fs.readFile(path.join(PAGE_FOLDER, "index.html"), "utf8"), title, base);
164
135
  await capabilities.fs.mkdir(out, { recursive: true });
165
136
  for (const name of WRITTEN) await capabilities.fs.rm(path.join(out, name), { recursive: true, force: true });
166
- let bytes = weights.length + html.length;
137
+ let bytes = weights.length + Buffer.byteLength(html) + Buffer.byteLength(bundleJson);
167
138
  const copy = async (from, to) => {
168
139
  const data = await capabilities.fs.readFile(from);
169
140
  bytes += data.length;
@@ -171,15 +142,12 @@ async function site(capabilities, options) {
171
142
  await capabilities.fs.writeFile(to, data);
172
143
  };
173
144
  for (const file of page) if (file !== "index.html") await copy(path.join(PAGE_FOLDER, file), path.join(out, file));
174
- for (const [at, from] of files) await copy(from, path.join(out, "tree", at));
145
+ for (const file of media) await copy(path.join(folder, file), path.join(out, "media", file));
175
146
  await capabilities.fs.writeFile(path.join(out, "index.html"), html);
176
- await capabilities.fs.writeFile(
177
- path.join(out, "tree.json"),
178
- JSON.stringify({ name: folderName, files: paths, videos })
179
- );
147
+ await capabilities.fs.writeFile(path.join(out, "bundle.json"), bundleJson);
180
148
  await capabilities.fs.writeFile(path.join(out, AULA_VOICE_WEIGHTS.path), weights);
181
149
  capabilities.log.out(
182
- `${out}: ${String(listed.right.length)} projects, ${String(files.size)} files, ${String(Math.ceil(bytes / 1024))} kB`
150
+ `${out}: ${String(workspaceBundle.projects.length)} projects, ${String(1 + media.length)} files, ${String(Math.ceil(bytes / 1024))} kB`
183
151
  );
184
152
  return true;
185
153
  }
@@ -1 +1 @@
1
- import{m as e,y as t}from"../src-CTZjQYUv.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-uzFdGdZX.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-CTZjQYUv.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-uzFdGdZX.js";
@@ -0,0 +1,2 @@
1
+ import{r as e,t}from"../rolldown-runtime-BLXQ4ufn.js";import{a as n,d as r,f as i,g as a,h as o,i as s,l as c,n as l,o as u,p as d,u as f}from"../protocol-CVAj9kTL.js";import{C as p,x as m}from"../src-uzFdGdZX.js";var h=44,g=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,_=new Uint8Array(64),v=new Uint8Array(128);for(let e=0;e<g.length;e++){let t=g.charCodeAt(e);_[e]=t,v[t]=e}function y(e){let t=0,n=0,r=0;do r=v[e.next()],t|=(r&31)<<n,n+=5;while(r&32);return t}function b(e){return e&1?-0x80000000|-(e>>>1):e>>>1}function x(e,t){return e.pos>=t?!1:e.peek()!==h}var ee=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function S(e){let{length:t}=e,n=new ee(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i+=b(y(n)),i<u&&(l=!1),u=i,x(n,e)?(a+=b(y(n)),o+=b(y(n)),s+=b(y(n)),x(n,e)?(c+=b(y(n)),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||C(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function C(e){e.sort(te)}function te(e,t){return e[0]-t[0]}var w=e(t(((e,t,n)=>{var r;(function(n,i){typeof e==`object`&&t!==void 0?t.exports=i():typeof r==`function`&&r.amd?r(i):(n=typeof globalThis<`u`?globalThis:n||self,n.resolveURI=i())})(n,(function(){let e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?(\[[^\]]+\]|[^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function r(t){return e.test(t)}function i(e){return e.startsWith(`//`)}function a(e){return e.startsWith(`/`)}function o(e){return e.startsWith(`file:`)}function s(e){return/^[.?#]/.test(e)}function c(e){let n=t.exec(e);return u(n[1],n[2]||``,n[3],n[4]||``,n[5]||`/`,n[6]||``,n[7]||``)}function l(e){let t=n.exec(e),r=t[2];return u(`file:`,``,t[1]||``,``,a(r)?r:`/`+r,t[3]||``,t[4]||``)}function u(e,t,n,r,i,a,o){return{scheme:e,user:t,host:n,port:r,path:i,query:a,hash:o,type:7}}function d(e){if(i(e)){let t=c(`http:`+e);return t.scheme=``,t.type=6,t}if(a(e)){let t=c(`http://foo.com`+e);return t.scheme=``,t.host=``,t.type=5,t}if(o(e))return l(e);if(r(e))return c(e);let t=c(`http://foo.com/`+e);return t.scheme=``,t.host=``,t.type=e?e.startsWith(`?`)?3:e.startsWith(`#`)?2:4:1,t}function f(e){if(e.endsWith(`/..`))return e;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function p(e,t){m(t,t.type),e.path=e.path===`/`?t.path:f(t.path)+e.path}function m(e,t){let n=t<=4,r=e.path.split(`/`),i=1,a=0,o=!1;for(let e=1;e<r.length;e++){let t=r[e];t?(o=!1,t!==`.`&&(t===`..`?a?(o=!0,a--,i--):n&&(r[i++]=t):(r[i++]=t,a++))):o=!0}let s=``;for(let e=1;e<i;e++)s+=`/`+r[e];(!s||o&&!s.endsWith(`/..`))&&(s+=`/`),e.path=s}function h(e,t){if(!e&&!t)return``;let n=d(e),r=n.type;if(t&&r!==7){let e=d(t),i=e.type;switch(r){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:p(n,e);case 5:n.user=e.user,n.host=e.host,n.port=e.port;case 6:n.scheme=e.scheme}i>r&&(r=i)}m(n,r);let i=n.query+n.hash;switch(r){case 2:case 3:return i;case 4:{let r=n.path.slice(1);return r?s(t||e)&&!s(r)?`./`+r+i:r+i:i||`.`}case 5:return n.path+i;default:return n.scheme+`//`+n.user+n.host+n.port+n.path+i}}return h}))}))(),1);function T(e){if(!e)return``;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function ne(e,t){let n=T(e),r=t?t+`/`:``;return e=>(0,w.default)(r+(e||``),n)}var E=0,re=1,ie=2,ae=3,D=4;function O(e,t){let n=k(e,0);if(n===e.length)return e;t||(e=e.slice());for(let r=n;r<e.length;r=k(e,r+1))e[r]=j(e[r],t);return e}function k(e,t){for(let n=t;n<e.length;n++)if(!A(e[n]))return n;return e.length}function A(e){for(let t=1;t<e.length;t++)if(e[t][E]<e[t-1][E])return!1;return!0}function j(e,t){return t||(e=e.slice()),e.sort(M)}function M(e,t){return e[E]-t[E]}var N=!1;function P(e,t,n,r){for(;n<=r;){let i=n+(r-n>>1),a=e[i][E]-t;if(a===0)return N=!0,i;a<0?n=i+1:r=i-1}return N=!1,n-1}function F(e,t,n){for(let r=n+1;r<e.length&&e[r][E]===t;n=r++);return n}function I(e,t,n){for(let r=n-1;r>=0&&e[r][E]===t;n=r--);return n}function L(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function R(e,t,n,r){let{lastKey:i,lastNeedle:a,lastIndex:o}=n,s=0,c=e.length-1;if(r===i){if(t===a)return N=o!==-1&&e[o][E]===t,o;t>=a?s=o===-1?0:o:c=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=P(e,t,s,c)}function z(e){return typeof e==`string`?JSON.parse(e):e}var B="`line` must be greater than 0 (lines start at line 1)",V="`column` must be greater than or equal to 0 (columns start at column 0)",H=class{constructor(e,t){let n=typeof e==`string`;if(!n&&e._decodedMemo)return e;let r=z(e),{version:i,file:a,names:o,sourceRoot:s,sources:c,sourcesContent:l}=r;this.version=i,this.file=a,this.names=o||[],this.sourceRoot=s,this.sources=c,this.sourcesContent=l,this.ignoreList=r.ignoreList||r.x_google_ignoreList||void 0;let u=ne(t,s);this.resolvedSources=c.map(u);let{mappings:d}=r;if(typeof d==`string`)this._encoded=d,this._decoded=void 0;else if(Array.isArray(d))this._encoded=void 0,this._decoded=O(d,n);else if(r.sections)throw Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);else throw Error(`invalid source map: ${JSON.stringify(r)}`);this._decodedMemo=L(),this._bySources=void 0,this._bySourceMemos=void 0}};function U(e){return e}function W(e){var t;return(t=U(e))._decoded||(t._decoded=S(U(e)._encoded))}function G(e,t){let{line:n,column:r,bias:i}=t;if(n--,n<0)throw Error(B);if(r<0)throw Error(V);let a=W(e);if(n>=a.length)return K(null,null,null,null);let o=a[n],s=q(o,U(e)._decodedMemo,n,r,i||1);if(s===-1)return K(null,null,null,null);let c=o[s];if(c.length===1)return K(null,null,null,null);let{names:l,resolvedSources:u}=e;return K(u[c[re]],c[ie]+1,c[ae],c.length===5?l[c[D]]:null)}function K(e,t,n,r){return{source:e,line:t,column:n,name:r}}function q(e,t,n,r,i){let a=R(e,r,t,n);return N?a=(i===-1?F:I)(e,r,a):i===-1&&a++,a===-1||a===e.length?-1:a}var J=new Map;function oe(e,t,n){J.set(e,{map:new H(t),prefix:n})}function se(e,t,n){let r=J.get(e);if(!r)return{file:e,line:t,column:n};let i=G(r.map,{line:t,column:n-1});return i.source===null||i.line===null||i.column===null?{file:e,line:t,column:n}:{file:i.source.startsWith(r.prefix)?i.source.slice(r.prefix.length):i.source,line:i.line,column:i.column+1}}var Y=a(se);function ce(e){let t=0,r=new Map;e.then(e=>{e.addEventListener(`message`,t=>{let i=t.data;if(i.kind===`error`)throw e.close(),new n(`the narrator stopped: ${i.message}`,i.stack);let a=r.get(i.id);r.delete(i.id),a?.(i)}),e.start()});let i=async(n,i)=>{let a=await e;return new Promise(e=>{let o=t++;r.set(o,e),a.postMessage({id:o,kind:n,words:i})})};return{speak:async e=>{let t=await i(`speak`,e);if(t.kind!==`speech`)throw Error(`the narrator answered ${t.kind} to a speech`);return{samples:t.samples,sampleRate:t.sampleRate,words:t.words}},time:async e=>{let t=await i(`time`,e);if(t.kind!==`timing`)throw Error(`the narrator answered ${t.kind} to a clock`);return{samples:t.samples,sampleRate:t.sampleRate,words:t.words}}}}function le(e){let t=0,n=0,a=!1,u=new Map,d=n=>{let r=r=>{let i=t++,{promise:a,resolve:o}=Promise.withResolvers();return u.set(i,o),e.post({kind:`files`,id:i,tree:n,question:r},[]),a};return{bundle:async()=>{let e=await r({kind:`bundle`});if(e.kind!==`bundle`)throw Error(`the page answered ${e.kind} to a question of the bundle`);return e.result},name:async()=>{let e=await r({kind:`name`});if(e.kind!==`name`)throw Error(`the page answered ${e.kind} to a question of the name`);return e.name},read:async e=>{let t=await r({kind:`read`,path:e});if(t.kind!==`read`)throw Error(`the page answered ${t.kind} to a read of ${e}`);return t.text},bytes:async e=>{let t=await r({kind:`bytes`,path:e});if(t.kind!==`bytes`)throw Error(`the page answered ${t.kind} to a read of the bytes of ${e}`);return t.bytes},list:async e=>{let t=await r({kind:`list`,folder:e});if(t.kind!==`list`)throw Error(`the page answered ${t.kind} to a list of ${e}`);return t.names}}},p=async()=>{let t=d(n++),o=new Map,s=new Set,c=e=>{let t=o.get(e);return t===void 0&&s.add(e),t?{size:t.length,read:()=>t}:void 0},[l]=await Promise.all([t.bundle(),m().then(()=>{e.post({kind:`stage`,stage:`engine`},[])})]),u;if(l!==null){if(l._tag===`Left`)return e.post({kind:`stage`,stage:`project`},[]),l;u=await f(l.right,i(Y,c),e.modules,e.player)}else{let n=await t.name();if(n===null)return e.post({kind:`stage`,stage:`project`},[]),{_tag:`Right`,right:[]};let a={name:()=>Promise.resolve(n),read:t.read,list:t.list},o=await e.bundler();u=await r(a,i(Y,c),e.modules,o,e.player)}if(e.post({kind:`stage`,stage:`project`},[]),u._tag===`Left`)return u;a||(a=!0,e.post({kind:`narrator`},[]));let p=async e=>{for(;;){s.clear();let n=e(),r=[...s].filter(e=>!o.has(e));if(r.length===0)return n;await Promise.all(r.map(async e=>o.set(e,await t.bytes(e))))}};return{_tag:`Right`,right:u.right.map(e=>{let t=new Set;return{...e,readScript:()=>p(()=>e.script()),readChapter:async n=>{t.has(n)||(await p(()=>e.walk?.(n)),t.add(n))}}})}},h=Promise.withResolvers(),g=o(c.create({voice:ce(h.promise),workspace:{projects:p}})),_=[],v=(t,{chapters:n,...r})=>{let i=[],a=[],o=[];n.forEach((e,t)=>{let n=_[t];if(e===n)return;if(!e){i.push([t,void 0]);return}let r=n?.cues.map(e=>e.samples)??[];if(e.animation!==n?.animation){let{animation:n,cues:a,...o}=e,c=a.map(e=>{let t=e.samples?r.indexOf(e.samples):-1;return t===-1?null:t}),l=a.map(({at:e,length:t},n)=>({at:e,length:t,keep:c[n]??null}));i.push([t,{...o,lottie:s(n),cues:l}]),r=c.map(e=>e===null?void 0:r[e])}e.cues.forEach((e,n)=>{if(!e.samples||e.samples===r[n])return;let i=e.samples.slice();o.push(i.buffer),a.push({chapter:t,cue:n,samples:i})})}),_=n;let c={...r,errors:l(r.errors),warnings:l(r.warnings)};e.post({kind:`state`,watch:t,state:c,count:n.length,drawings:i,sounds:a},o)};return t=>{switch(t.kind){case`list`:g.build.list().then(n=>{let r=n._tag===`Left`?{_tag:`Left`,left:l(n.left)}:n;e.post({kind:`listed`,id:t.id,videos:r},[])});return;case`watch`:_=[],g.build.watch(t.name,{changed:e=>{v(t.watch,e)}});return;case`seek`:g.build.seek(t.name,t.place);return;case`halt`:g.halt();return;case`refresh`:g.refresh(t.place);return;case`files`:{let e=u.get(t.id);u.delete(t.id),e?.(t.answer);return}case`narrator`:h.resolve(t.port);return}}}var X=(e,t=[])=>{self.postMessage(e,{transfer:t})},Z=e=>{let t=u(e,Y);X({kind:`error`,message:t.message,stack:t.stack.map(e=>` ${e}`).join(`
2
+ `)})};self.addEventListener(`error`,e=>{e.preventDefault(),Z(e.error??Error(e.message))}),self.addEventListener(`unhandledrejection`,e=>{e.preventDefault(),Z(e.reason)});var ue={"@beff/aula":new URL(`./aula.js`,import.meta.url).href,"@beff/aula-method":new URL(`./aula-method.js`,import.meta.url).href},Q={load:async({code:e,map:t})=>{let n=URL.createObjectURL(new Blob([e],{type:`text/javascript`}));return oe(n,t,d),{url:n,exports:await import(n)}}},$=null;function de(){return $??=(async()=>{let t=performance.now(),[n,r]=await Promise.all([p(()=>import(`../browser-sNTR4ahh.js`).then(t=>e(t.default,1)),[]),p(()=>import(`../esbuild-D6hmBtXM.js`),[])]);return await n.initialize({wasmURL:r.default,worker:!1}),console.log(`aula: esbuild loaded in ${((performance.now()-t)/1e3).toFixed(1)} s`),n})(),$}var fe=le({post:X,bundler:de,modules:Q,player:ue});self.addEventListener(`message`,e=>{fe(e.data)});