trace-avatar-render 0.2.2 → 0.2.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.3
4
+
5
+ - A director that fails leaves a screenshot of the page it was on: `failShot` in `direct()`; campaigns write `<out>/<render>.failed.png` (and remove a stale one when the render is made again).
6
+
3
7
  ## 0.2.2
4
8
 
5
9
  - A director card that shows the product's address (`card(title, { url: true })`) now records its caption with
@@ -2551,7 +2551,15 @@ async function direct(o) {
2551
2551
  playAt = Date.now();
2552
2552
  events.push({ t: playAt, type: "play", url: path() });
2553
2553
  log(`${id}: playing \u2026`);
2554
- await script(d);
2554
+ try {
2555
+ await script(d);
2556
+ } catch (e) {
2557
+ if (o.failShot) {
2558
+ await d.page.screenshot({ path: o.failShot }).then(() => log(`${id}: the page when it failed: ${o.failShot}`), () => {
2559
+ });
2560
+ }
2561
+ throw e;
2562
+ }
2555
2563
  await sleep3(o.tailMs ?? 800);
2556
2564
  moves.push({ t: Date.now(), ...at });
2557
2565
  await cdp.send("Page.stopScreencast").catch(() => {
@@ -2912,6 +2920,7 @@ async function makeCampaign(c, o = {}) {
2912
2920
  const outBase = join4(c.out, r.id);
2913
2921
  const firstBase = join4(c.out, outs[0].name.replace(/\.[^.]+$/, ""));
2914
2922
  for (const b of [outBase, firstBase]) for (const ext of ["vtt", "chapters.vtt", "png", "scenes.json"]) rmSync3(`${b}.${ext}`, { force: true });
2923
+ rmSync3(join4(c.out, `${r.id}.failed.png`), { force: true });
2915
2924
  const look = c.looks[r.look];
2916
2925
  const script = v.voice?.[r.look];
2917
2926
  const fill = (existsSync5(look.brand) ? brandFile(look.brand).fill : void 0) ?? [];
@@ -2932,6 +2941,7 @@ async function makeCampaign(c, o = {}) {
2932
2941
  url: c.app.url,
2933
2942
  page: v.page ?? "/",
2934
2943
  appName: c.app.name ?? "",
2944
+ failShot: join4(c.out, `${r.id}.failed.png`),
2935
2945
  out: outs.map((x) => ({ file: join4(c.out, x.name), format: x.format, ...x.canvas ? { canvas: x.canvas } : {}, ...x.format === "gif" ? { width: v.width ?? 800 } : {} })),
2936
2946
  look: lookOptions({ title: v.title, endTitle: v.endTitle, polish: r.polish }, look.brand, c.app.name ?? ""),
2937
2947
  ...r.phone ? { viewport: tall ? TALL : { width: 390, height: 844 } } : wide ? { viewport: WIDE } : {},
@@ -3602,4 +3612,4 @@ export {
3602
3612
  makeCampaign,
3603
3613
  saysOf
3604
3614
  };
3605
- //# sourceMappingURL=chunk-NFJMQBQ4.js.map
3615
+ //# sourceMappingURL=chunk-I4LM2D2B.js.map