@joplo-app/server 0.6.2 → 0.7.2

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 (48) hide show
  1. package/dist/asset-usage.d.ts +48 -0
  2. package/dist/asset-usage.js +174 -0
  3. package/dist/audio-timing.d.ts +14 -0
  4. package/dist/audio-timing.js +66 -0
  5. package/dist/build.js +15 -2
  6. package/dist/capture.d.ts +15 -0
  7. package/dist/capture.js +49 -0
  8. package/dist/checkpoint.d.ts +10 -0
  9. package/dist/checkpoint.js +75 -0
  10. package/dist/contract.d.ts +63 -1
  11. package/dist/dev.d.ts +1 -0
  12. package/dist/dev.js +15 -7
  13. package/dist/export.d.ts +6 -0
  14. package/dist/export.js +5 -2
  15. package/dist/film.d.ts +12 -1
  16. package/dist/film.js +231 -25
  17. package/dist/index.d.ts +7 -1
  18. package/dist/index.js +5 -1
  19. package/dist/layout-audit-browser.js +114 -0
  20. package/dist/layout-audit.d.ts +94 -0
  21. package/dist/layout-audit.js +86 -0
  22. package/dist/local-resources.d.ts +5 -0
  23. package/dist/local-resources.js +32 -6
  24. package/dist/media-check.d.ts +7 -1
  25. package/dist/media-check.js +44 -3
  26. package/dist/output-file.d.ts +3 -0
  27. package/dist/output-file.js +23 -0
  28. package/dist/project.d.ts +5 -1
  29. package/dist/project.js +20 -4
  30. package/dist/render.d.ts +2 -0
  31. package/dist/render.js +24 -10
  32. package/dist/resources-run.d.ts +1 -0
  33. package/dist/resources-run.js +23 -2
  34. package/dist/timeline.d.ts +76 -0
  35. package/dist/timeline.js +143 -0
  36. package/dist/video-format.d.ts +2 -0
  37. package/dist/video-format.js +12 -0
  38. package/dist/vite-shared.d.ts +1 -1
  39. package/dist/vite-shared.js +2 -2
  40. package/dist/voice-http.d.ts +1 -0
  41. package/dist/voice-http.js +8 -2
  42. package/dist/voice-run.d.ts +17 -1
  43. package/dist/voice-run.js +71 -9
  44. package/dist/voice.d.ts +1 -0
  45. package/dist/voice.js +10 -2
  46. package/dist/watch-config.d.ts +3 -0
  47. package/dist/watch-config.js +10 -0
  48. package/package.json +4 -4
package/dist/dev.js CHANGED
@@ -30,7 +30,7 @@ import { CLOUD_EVENT, CloudHub } from "./cloud.js";
30
30
  import { Registry, clearServerInfo, joploHome, normalizeSettings, pidAlive, projectIdOf, readServerInfo, readSettings, writeServerInfo, writeSettings } from "./home.js";
31
31
  import { compileProject, invalidateProjectModules } from "./project.js";
32
32
  import { SelectionBody, readSelection, resolveSelection, writeSelection } from "./selection.js";
33
- import { IGNORED_DIRS, cssSourcePlugin, isProjectSource, joploProjectPlugin, kitAliases, locateWebAssets, realProjectDir } from "./vite-shared.js";
33
+ import { cssSourcePlugin, isProjectSource, joploProjectPlugin, kitAliases, locateWebAssets, realProjectDir } from "./vite-shared.js";
34
34
  /** 文件绝对路径 → Vite 的 /@fs/ 地址。 */
35
35
  const fsUrl = (abs) => `/@fs${abs.split(path.sep).join('/').replace(/^(?!\/)/, '/')}`;
36
36
  /** 离文件最近的 package.json 所在目录(插件包根目录);没有时用文件所在目录。 */
@@ -194,7 +194,7 @@ export async function createHub(opts = {}) {
194
194
  const baseUrl = () => `http://127.0.0.1:${actualPort}/`;
195
195
  const reviewHub = new LocalReviewHub(baseUrl);
196
196
  const activeDirs = () => [...slots.values()].filter((s) => !s.closed).map((s) => s.dir);
197
- const slotOfFile = (file) => [...slots.values()].find((s) => !s.closed && isProjectSource(s.dir, file)) ?? null;
197
+ const slotOfFile = (file) => [...slots.values()].find((s) => !s.closed && isProjectSource(s.dir, file, s.watchIgnore ?? [])) ?? null;
198
198
  const recordOf = (id) => registry.list().find((r) => projectIdOf(r.dir) === id) ?? null;
199
199
  const summaries = () => registry.list().map((r) => {
200
200
  const id = projectIdOf(r.dir);
@@ -242,17 +242,21 @@ export async function createHub(opts = {}) {
242
242
  const loader = slot.loader;
243
243
  invalidateProjectModules(loader, slot.dir);
244
244
  const out = await compileProject(loader, slot.dir, 'dev');
245
+ if (out.project && slot.watchIgnore === null)
246
+ slot.watchIgnore = out.watchIgnore ?? [];
245
247
  if (out.resources)
246
248
  localResources.set(slot.id, out.resources);
247
249
  else
248
250
  localResources.delete(slot.id);
249
251
  resourceWarnings.set(slot.id, new Map());
250
252
  if (out.project && out.resources?.requests.length)
251
- out.project.mediaAssets = Object.fromEntries(out.resources.requests.map(r => [r.id, `/__joplo/p/${encodeURIComponent(slot.id)}/resources/${encodeURIComponent(r.id)}`]));
253
+ out.project.mediaAssets = { ...out.project.mediaAssets, ...Object.fromEntries(out.resources.requests.map(r => [r.id, `/__joplo/p/${encodeURIComponent(slot.id)}/resources/${encodeURIComponent(r.id)}`])) };
252
254
  if (out.project) {
253
255
  if (out.resources) {
254
256
  const resources = await inlineResources(out.project, out.resources.requests.filter(r => referencedResources(out.project).has(r.id)), out.resources.host);
255
257
  out.project.mediaAssets = { ...out.project.mediaAssets, ...resources.assets };
258
+ out.project.mediaInfo = resources.audioInfo;
259
+ out.diagnostics.push(...resources.diagnostics);
256
260
  }
257
261
  out.project = binaryAssets(out.project, { directory: path.join(slot.dir, '.joplo', 'binary'), prefix: `/__joplo/p/${encodeURIComponent(slot.id)}/binary/`, diagnostics: out.diagnostics });
258
262
  }
@@ -329,6 +333,7 @@ export async function createHub(opts = {}) {
329
333
  ready: Promise.resolve(),
330
334
  payload: { version: 0, ok: false, project: null, diagnostics: [], home: null },
331
335
  runtimeModules: new Map(),
336
+ watchIgnore: null,
332
337
  compiling: true,
333
338
  closed: false,
334
339
  running: null,
@@ -338,9 +343,9 @@ export async function createHub(opts = {}) {
338
343
  slots.set(id, slot);
339
344
  slot.ready = (async () => {
340
345
  await startLoader(slot);
346
+ await run(slot);
341
347
  if (watch && server)
342
348
  server.watcher.add(dir);
343
- await run(slot);
344
349
  })().catch((e) => log(`[joplo] Project startup failed: ${e instanceof Error ? e.message : String(e)}`));
345
350
  invalidateCss();
346
351
  return slot;
@@ -672,6 +677,7 @@ export async function createHub(opts = {}) {
672
677
  if (typeof dir !== 'string' || !path.isAbsolute(dir))
673
678
  return sendJson(res, 400, { error: { code: 'USAGE', message: 'dir must be an absolute path to the project directory' } });
674
679
  const r = addProject(dir);
680
+ await r.slot?.ready;
675
681
  return sendJson(res, 200, { id: r.id, url: r.url });
676
682
  }
677
683
  const del = /^\/__joplo\/projects\/([^/]+)$/.exec(url.pathname);
@@ -756,7 +762,7 @@ export async function createHub(opts = {}) {
756
762
  strictPort: true,
757
763
  open: false,
758
764
  ...(web.mode === 'dist' ? { fs: { allow: [web.webDir] } } : {}),
759
- ...(watch ? { watch: { ignored: (p) => { const s = slotOfFile(p) ?? [...slots.values()].find((x) => p.startsWith(x.dir + path.sep)); return !!s && IGNORED_DIRS.includes(p.slice(s.dir.length + 1).split(path.sep)[0] ?? ''); } } } : { watch: null }),
765
+ ...(watch ? { watch: { ignored: (p) => { const s = slotOfFile(p) ?? [...slots.values()].find((x) => p.startsWith(x.dir + path.sep)); return !!s && p !== s.dir && !isProjectSource(s.dir, p, s.watchIgnore ?? []); } } } : { watch: null }),
760
766
  },
761
767
  });
762
768
  try {
@@ -849,7 +855,8 @@ export async function attachToRunning(home, projectDir, log, ownVersion = server
849
855
  method: 'POST',
850
856
  headers: { 'content-type': 'application/json', 'x-joplo-token': info.token },
851
857
  body: JSON.stringify({ dir: realProjectDir(projectDir) }),
852
- signal: AbortSignal.timeout(10000),
858
+ // Registration acknowledges the initial compilation, which can take longer than a ping.
859
+ signal: AbortSignal.timeout(120000),
853
860
  });
854
861
  const body = (await res.json().catch(() => null));
855
862
  if (!res.ok || !body?.url)
@@ -905,7 +912,8 @@ export async function startDev(opts) {
905
912
  }
906
913
  throw e;
907
914
  }
908
- const { url } = hub.addProject(projectDir);
915
+ const { url, slot } = hub.addProject(projectDir);
916
+ await slot?.ready;
909
917
  const cleanup = () => clearServerInfo(home, process.pid);
910
918
  process.once('exit', cleanup);
911
919
  if (opts.open)
package/dist/export.d.ts CHANGED
@@ -33,6 +33,12 @@ export type VideoCue = {
33
33
  };
34
34
  /** 录制结果(#56 #59):字幕时间轴(对到视频时间)与没有音频、按估算时长停留的旁白。 */
35
35
  export type RecordOutcome = {
36
+ timeline?: import('./timeline.js').PlaybackTimeline;
37
+ sync?: {
38
+ offsetMs: number;
39
+ videoEndMs: number;
40
+ audioEndMs: number;
41
+ };
36
42
  cues: VideoCue[];
37
43
  voice: {
38
44
  mode: 'estimate' | 'real' | 'off';
package/dist/export.js CHANGED
@@ -18,6 +18,7 @@
18
18
  *
19
19
  * 字段流向:job(写入点:这里的 runJob)→ jobs Map(存储)→ SSE / GET(读取点)→ 看板的导出视频弹窗(消费者)。
20
20
  */
21
+ import { playbackTimeline } from "./timeline.js";
21
22
  import { recordedCalibration } from "./media-calibration.js";
22
23
  import { muxRecordedAudio } from "./media-mux.js";
23
24
  import crypto from 'node:crypto';
@@ -141,7 +142,7 @@ export function defaultRecorder(load) {
141
142
  await page.waitForTimeout(900); // 停留在结果画面
142
143
  const endAt = await page.evaluate(() => performance.now());
143
144
  const calibrated = await page.evaluate(() => window.__JOPLO_RECORD__.calibrate?.() ?? false);
144
- const page_ = await page.evaluate(() => { const r = window.__JOPLO_RECORD__; return { cues: r.cues?.() ?? [], voice: r.voice?.() ?? { mode: 'off', missing: [] }, flash: r.calibratedAt?.() ?? null }; });
145
+ const page_ = await page.evaluate(() => { const r = window.__JOPLO_RECORD__; return { cues: r.cues?.() ?? [], voice: r.voice?.() ?? { mode: 'off', missing: [] }, timeline: r.timeline?.(), flash: r.calibratedAt?.() ?? null }; });
145
146
  const audio = await page.evaluate(() => window.__JOPLO_RECORD__.stopAudio?.() ?? null);
146
147
  if (screencast)
147
148
  await page.screencast.stop();
@@ -158,6 +159,7 @@ export function defaultRecorder(load) {
158
159
  await video.saveAs(out);
159
160
  }
160
161
  let endSeconds = (endAt - origin) / 1000;
162
+ let sync;
161
163
  if (audio) {
162
164
  if (!calibrated)
163
165
  throw new Error('Audio/video calibration unavailable');
@@ -172,12 +174,13 @@ export function defaultRecorder(load) {
172
174
  if (page_.flash !== null)
173
175
  origin = page_.flash - timing.videoPTS * 1000;
174
176
  endSeconds = timing.videoPTS;
177
+ sync = { offsetMs: timing.offsetSeconds * 1000, videoEndMs: timing.videoPTS * 1000, audioEndMs: timing.audioPTS * 1000 };
175
178
  }
176
179
  finally {
177
180
  await analysis.close();
178
181
  }
179
182
  }
180
- return { cues: videoCues(page_.cues, origin, endSeconds), voice: page_.voice };
183
+ return { cues: videoCues(page_.cues, origin, endSeconds), voice: page_.voice, ...(page_.timeline ? { timeline: playbackTimeline(page_.timeline, origin) } : {}), ...(sync ? { sync } : {}) };
181
184
  }
182
185
  finally {
183
186
  await browser.close().catch(() => undefined);
package/dist/film.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Page } from 'playwright-core';
1
2
  import type { FilmOptions, FilmResult, FilmCut, FilmStill, FilmBoundary, VideoOptions, VideoResult } from './contract.js';
2
3
  /** 单帧整屏突变:变化像素占比至少这么多,且是前后帧的 CUT_RATIO 倍以上(排除持续的快速运镜)。 */
3
4
  export declare const CUT_CHANGED = 0.3;
@@ -12,6 +13,7 @@ type Sample = {
12
13
  scenarioId: string | null;
13
14
  position: number;
14
15
  activeStep: number | null;
16
+ stepId?: string | null;
15
17
  jpg?: string;
16
18
  };
17
19
  /** 纯函数:从逐帧的相邻差找出硬切。changed[i] 是第 i 帧与第 i-1 帧之间变化像素的占比。 */
@@ -20,8 +22,17 @@ export declare function findCuts(samples: readonly Pick<Sample, 't' | 'changed'
20
22
  export declare function findStills(samples: readonly Pick<Sample, 't' | 'still' | 'scenarioId' | 'position'>[], minMs: number): FilmStill[];
21
23
  /** 纯函数:每次提交一步(或换场景)前后窗口里的最大相邻帧差,章节衔接是否硬切一眼可见。 */
22
24
  export declare function stepBoundaries(samples: readonly Pick<Sample, 't' | 'diff' | 'changed' | 'scenarioId' | 'position'>[], before?: number, after?: number): FilmBoundary[];
23
- /** 胶片条:按引擎时间逐帧定格取样。 */
25
+ export declare function waitForSample(page: Page, atMs: number, timeoutMs?: number, signal?: AbortSignal): Promise<void>;
24
26
  export declare function renderFilm(opts: FilmOptions): Promise<FilmResult>;
25
27
  /** 视频:与看板导出相同的录制器(真实时间)。 */
26
28
  export declare function renderVideo(opts: VideoOptions): Promise<VideoResult>;
29
+ /** Public offline frame export. No audio synthesis or private browser bridge is needed by callers. */
30
+ export declare function renderFrames(opts: import('./contract.js').FramesOptions): Promise<{
31
+ directory: string;
32
+ timeline: string;
33
+ fps: number;
34
+ frames: number;
35
+ durationMs: number;
36
+ toleranceMs: number;
37
+ }>;
27
38
  export {};
package/dist/film.js CHANGED
@@ -14,13 +14,20 @@
14
14
  * 停留时间与开着朗读的发布站一致。
15
15
  */
16
16
  import fs from 'node:fs';
17
+ import { createHash } from 'node:crypto';
17
18
  import path from 'node:path';
18
- import { JoploError, displaySceneId } from '@joplo-app/core';
19
+ import { JoploError, VIEWPORT_SIZE, displaySceneId } from '@joplo-app/core';
19
20
  import { createDev } from "./dev.js";
20
21
  import { realProjectDir } from "./vite-shared.js";
21
22
  import { joploHome } from "./home.js";
22
23
  import { loadPlaywright } from "./export-runtime.js";
23
- import { launch } from "./render.js";
24
+ import { assertNotProjectData, launch } from "./render.js";
25
+ import { encodeMp4 } from "./video-format.js";
26
+ import { commitOutput, writeOutput } from "./output-file.js";
27
+ import { createLayoutAuditSession } from "./layout-audit.js";
28
+ import { checkpointCommitsMatch, contentIdentity, exportRuntimeRoots } from "./checkpoint.js";
29
+ import { capture, geometryQuery } from "./capture.js";
30
+ import { frameTime, persistTimeline, playbackTimeline } from "./timeline.js";
24
31
  import { EXPORT_SIZE, defaultRecorder, srt } from "./export.js";
25
32
  /** 单帧整屏突变:变化像素占比至少这么多,且是前后帧的 CUT_RATIO 倍以上(排除持续的快速运镜)。 */
26
33
  export const CUT_CHANGED = 0.3;
@@ -29,6 +36,11 @@ export const CUT_RATIO = 2.5;
29
36
  export const STILL_CHANGED = 0.004;
30
37
  /** 一个像素的 RGB 平均差超过这个值才算“变了”(0–1)。 */
31
38
  const PIXEL_THRESHOLD = 0.08;
39
+ function distinctOutputs(paths) {
40
+ const values = paths.filter((p) => !!p).map(p => path.resolve(p));
41
+ if (new Set(values).size !== values.length)
42
+ throw new JoploError('USAGE', 'Export output, timeline, subtitles and checkpoint paths must differ');
43
+ }
32
44
  const MAX_MS = 10 * 60_000;
33
45
  /** 纯函数:从逐帧的相邻差找出硬切。changed[i] 是第 i 帧与第 i-1 帧之间变化像素的占比。 */
34
46
  export function findCuts(samples) {
@@ -78,15 +90,18 @@ const round = (n) => Math.round(n * 10000) / 10000;
78
90
  const esc = (t) => t.replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' })[c]);
79
91
  /** 辅助页:解码 JPEG、裁掉字幕区,与上一帧、静止起点比较。状态留在页面里,每帧只传一次图片。 */
80
92
  const DIFF_PAGE = `<!doctype html><canvas id=c></canvas><script>
81
- let prev=null, anchor=null, anchorT=0;
93
+ let prev=null, anchor=null, anchorT=0, history=[];
82
94
  async function load(b64){ const img=new Image(); img.src='data:image/jpeg;base64,'+b64; await img.decode(); return img; }
83
95
  function pixels(img, h){ const c=document.getElementById('c'); c.width=img.width; c.height=h; const g=c.getContext('2d',{willReadFrequently:true}); g.drawImage(img,0,0); return g.getImageData(0,0,img.width,h).data; }
84
96
  function compare(a,b,th){ let sum=0, changed=0; const n=a.length/4; for(let i=0;i<a.length;i+=4){ const d=(Math.abs(a[i]-b[i])+Math.abs(a[i+1]-b[i+1])+Math.abs(a[i+2]-b[i+2]))/765; sum+=d; if(d>th) changed++; } return { diff: sum/n, changed: changed/n }; }
97
+ window.dump = (back=0) => {const state=history[Math.max(0,history.length-1-back)]||{prev,anchor,anchorT};return {prev:Array.from(state.prev||[]),anchor:Array.from(state.anchor||[]),anchorT:state.anchorT};};
98
+ window.restore = (s) => {prev=new Uint8ClampedArray(s.prev);anchor=new Uint8ClampedArray(s.anchor);anchorT=s.anchorT;history=[{prev,anchor,anchorT}];};
85
99
  window.step = async (b64, cropRatio, t, th, stillTh) => {
86
100
  const img = await load(b64); const d = pixels(img, Math.max(1, Math.round(img.height*cropRatio)));
87
101
  const adj = prev ? compare(prev, d, th) : { diff: 0, changed: 0 };
88
102
  prev = d;
89
103
  if (!anchor || compare(anchor, d, th).changed > stillTh) { anchor = d; anchorT = t; }
104
+ history.push({prev,anchor,anchorT}); if(history.length>12)history.shift();
90
105
  return { ...adj, still: t - anchorT };
91
106
  };
92
107
  </script>`;
@@ -108,8 +123,38 @@ async function flush(page) {
108
123
  channel.port2.postMessage(0);
109
124
  })`);
110
125
  }
126
+ export async function waitForSample(page, atMs, timeoutMs = 10000, signal) {
127
+ const started = Date.now();
128
+ let stable;
129
+ try {
130
+ for (;;) {
131
+ if (signal?.aborted)
132
+ throw new JoploError('RENDER_FAILED', `Sample cancelled at ${atMs} ms`);
133
+ await flush(page);
134
+ const status = await page.evaluate(() => window.__JOPLO_RECORD__?.frameStatus?.() ?? { pending: 0, error: null });
135
+ if (status.error)
136
+ throw new JoploError('RENDER_FAILED', `Presentation failed at ${atMs} ms: ${status.error}`);
137
+ if (!status.pending) {
138
+ const revision = status.revision ?? 0;
139
+ if (stable === revision)
140
+ return;
141
+ stable = revision;
142
+ }
143
+ else
144
+ stable = undefined;
145
+ if (Date.now() - started >= timeoutMs)
146
+ throw new JoploError('RENDER_FAILED', `Presentation timed out at ${atMs} ms after ${timeoutMs} wall-clock ms (${status.pending} pending); complete or cancel frameReady tasks before capture`);
147
+ await page.waitForTimeout(5);
148
+ }
149
+ }
150
+ catch (error) {
151
+ await page.evaluate(() => window.__JOPLO_RECORD__?.cancelFrame?.()).catch(() => { });
152
+ throw error;
153
+ }
154
+ }
111
155
  function check(opts) {
112
156
  const out = path.resolve(opts.out);
157
+ assertNotProjectData(opts.projectDir, out);
113
158
  if (fs.existsSync(out) && !opts.overwrite)
114
159
  throw new JoploError('USAGE', `Output file already exists: ${out}. To overwrite, pass overwrite: true (CLI: --overwrite)`);
115
160
  const dataDir = path.join(realProjectDir(opts.projectDir), '.joplo');
@@ -121,7 +166,7 @@ async function compiled(projectDir) {
121
166
  const server = await createDev({ projectDir, port: 0, watch: false, log: () => undefined });
122
167
  const payload = server.payload();
123
168
  if (!payload.project) {
124
- await server.close();
169
+ await server.close().catch(() => undefined);
125
170
  const errs = payload.diagnostics.filter((d) => d.severity === 'error');
126
171
  throw new JoploError('INVALID_SCHEMA', `Project compilation failed: ${errs.map((d) => `${d.at ?? ''} ${d.message}`).join('; ')}`, { diagnostics: payload.diagnostics });
127
172
  }
@@ -139,14 +184,38 @@ function recordUrl(base, projectId, project, o) {
139
184
  if (o.content !== undefined && !project.i18n?.locales.includes(o.content))
140
185
  throw new JoploError('USAGE', project.i18n ? `--content ${o.content} is not in config locales (${project.i18n.locales.join(', ')})` : `--content needs config({ locales }); this project has a single language`);
141
186
  const voice = o.voice ?? 'estimate';
142
- const q = new URLSearchParams({ render: '1', project: projectId, scenario: o.scenarioId, position: '0', theme: o.theme ?? project.theme ?? 'sketch', frame: '1', record: '1', ...(voice !== 'off' ? { voice } : {}), ...(o.chain ? { chain: '1' } : {}), ...(o.audio === false ? { audio: '0' } : {}), ...(o.locale ? { locale: o.locale } : {}), ...(o.content ? { content: o.content } : {}), ...(o.hide?.length ? { hide: o.hide.join(',') } : {}), ...(o.canvas ? { w: String(o.canvas.width), h: String(o.canvas.height) } : {}) });
187
+ const q = new URLSearchParams({ render: '1', project: projectId, scenario: o.scenarioId, position: '0', theme: o.theme ?? project.theme ?? 'sketch', frame: '1', record: '1', ...(voice !== 'off' ? { voice } : {}), ...(o.chain ? { chain: '1' } : {}), ...(o.sampling ? { sampling: '1' } : {}), ...(o.audio === false ? { audio: '0' } : {}), ...(o.locale ? { locale: o.locale } : {}), ...(o.content ? { content: o.content } : {}), ...(o.hide?.length ? { hide: o.hide.join(',') } : {}), ...geometryQuery(o), ...(o.canvas ? { w: String(o.canvas.width), h: String(o.canvas.height) } : {}) });
143
188
  const device = project.scenes[displaySceneId(project, o.scenarioId, 0)]?.viewport === 'mobile' ? 'mobile' : 'desktop';
144
- return { url: `${base}?${q}`, size: EXPORT_SIZE[device], device };
189
+ return { url: `${base}?${q}`, size: o.logicalViewport ?? (o.noFrame ? VIEWPORT_SIZE[device] : EXPORT_SIZE[device]), device };
145
190
  }
146
191
  /** 胶片条:按引擎时间逐帧定格取样。 */
147
- export async function renderFilm(opts) {
192
+ async function samplePlayback(opts) {
193
+ if (opts.auditLayout && opts.resume)
194
+ throw new JoploError('USAGE', 'Layout audit requires a fresh render; do not combine it with --resume');
195
+ if (opts.auditLayout && opts.framesOnly)
196
+ throw new JoploError('USAGE', 'Layout audit supports static screenshots and --film, not --frames-out');
197
+ const baselineRssBytes = process.memoryUsage().rss;
148
198
  const projectDir = realProjectDir(opts.projectDir);
149
199
  const out = check({ ...opts, projectDir });
200
+ const metadataOut = check({ projectDir, out: out.replace(/(\.png)?$/i, '.json'), overwrite: opts.overwrite });
201
+ if (opts.timeline) {
202
+ check({ projectDir, out: opts.timeline, overwrite: opts.overwrite });
203
+ assertNotProjectData(projectDir, path.join(`${path.resolve(opts.timeline).replace(/\.json$/i, '')}.assets`, '__asset.wav'));
204
+ }
205
+ distinctOutputs([out, metadataOut, opts.timeline, opts.checkpoint]);
206
+ geometryQuery(opts);
207
+ if (opts.voice && !['real', 'estimate', 'off'].includes(opts.voice))
208
+ throw new JoploError('USAGE', '--voice must be real, estimate or off');
209
+ if (opts.hide?.some(h => !['cover', 'cursor', 'title', 'subtitles'].includes(h)))
210
+ throw new JoploError('USAGE', 'Unknown hide item');
211
+ if (opts.chapterTimeoutMs !== undefined && (!Number.isFinite(opts.chapterTimeoutMs) || opts.chapterTimeoutMs <= 0))
212
+ throw new JoploError('USAGE', 'chapterTimeoutMs must be positive');
213
+ if (opts.sampleMs !== undefined && !Number.isFinite(opts.sampleMs))
214
+ throw new JoploError('USAGE', 'sampleMs must be finite');
215
+ if ((opts.width === undefined) !== (opts.height === undefined))
216
+ throw new JoploError('USAGE', 'Film width and height must be provided together');
217
+ if (opts.width !== undefined && ![opts.width, opts.height].every(n => Number.isInteger(n) && n > 0 && n <= 8192))
218
+ throw new JoploError('USAGE', 'Film dimensions must be integers from 1 to 8192');
150
219
  const sampleMs = Math.max(20, Math.min(250, Math.round(opts.sampleMs ?? 50)));
151
220
  const every = Math.max(sampleMs, Math.round((opts.every ?? 250) / sampleMs) * sampleMs);
152
221
  const stillMs = opts.stillMs ?? 1500;
@@ -154,12 +223,37 @@ export async function renderFilm(opts) {
154
223
  const cellWidth = Math.max(120, Math.min(640, Math.round(opts.cellWidth ?? 224)));
155
224
  const playwright = await loadPlaywright({ home: joploHome(), projectDir });
156
225
  const { server, project } = await compiled(projectDir);
226
+ let fingerprint = '';
227
+ const checkpointFile = opts.checkpoint ? path.resolve(opts.checkpoint) : null;
228
+ if (checkpointFile)
229
+ assertNotProjectData(projectDir, checkpointFile);
230
+ let checkpoint = null;
231
+ if (opts.resume) {
232
+ if (!checkpointFile) {
233
+ await server.close();
234
+ throw new JoploError('USAGE', '--resume requires --checkpoint');
235
+ }
236
+ try {
237
+ checkpoint = JSON.parse(fs.readFileSync(checkpointFile, 'utf8'));
238
+ if (!checkpoint || typeof checkpoint.fingerprint !== 'string' || !Array.isArray(checkpoint.samples) || checkpoint.samples.length === 0 || !Array.isArray(checkpoint.commits) || checkpoint.commits.some(c => typeof c.stepId !== 'string' || !Number.isFinite(c.commitMs)))
239
+ throw new Error('Invalid checkpoint schema');
240
+ }
241
+ catch {
242
+ await server.close();
243
+ throw new JoploError('USAGE', 'Checkpoint is absent or invalid');
244
+ }
245
+ }
246
+ const startedAt = Date.now();
157
247
  let browser = null;
158
248
  try {
159
- const { url, size } = recordUrl(server.url, server.projectId, project, { ...opts, audio: false });
249
+ const audit = opts.auditLayout ? createLayoutAuditSession({ out, project, crop: opts.crop, options: opts.auditLayout, overwrite: opts.overwrite, sampleMs }) : null;
250
+ const canvas = opts.width && opts.height ? { width: opts.width, height: opts.height } : opts.logicalViewport;
251
+ const { url, size: defaultSize } = recordUrl(server.url, server.projectId, project, { ...opts, sampling: true, audio: false, voice: opts.voice ?? (opts.framesOnly ? 'real' : 'estimate'), ...(canvas ? { canvas } : {}) });
252
+ const size = canvas ?? defaultSize;
160
253
  browser = await launch(playwright);
161
- const ctx = await browser.newContext({ viewport: size, deviceScaleFactor: 0.5 });
254
+ const ctx = await browser.newContext({ viewport: size, deviceScaleFactor: opts.framesOnly ? opts.frameScale ?? 1 : 0.5 });
162
255
  const page = await ctx.newPage();
256
+ const captureSession = await ctx.newCDPSession(page);
163
257
  await page.clock.install({ time: 0 });
164
258
  // 先冻结空白页,避免读 now 与 pauseAt 两次调用之间的墙钟竞态。
165
259
  await page.clock.pauseAt(86_400_000);
@@ -180,32 +274,95 @@ export async function renderFilm(opts) {
180
274
  throw new JoploError('RENDER_FAILED', `Render route reported an error: ${err}`);
181
275
  // 加载期间也只按 16ms 网格推进;开播相位不随网络和字体加载耗时改变。
182
276
  await flush(page);
277
+ await page.evaluate(() => window.__JOPLO_RECORD__.prepare());
278
+ if (checkpointFile) {
279
+ const excluded = [out, metadataOut, opts.timeline, opts.timeline ? opts.timeline.replace(/\.json$/i, '') + '.assets' : null, opts.frames, checkpointFile].filter((p) => !!p);
280
+ const outStem = path.basename(out).replace(/\.png$/i, '');
281
+ for (const name of fs.existsSync(path.dirname(out)) ? fs.readdirSync(path.dirname(out)) : [])
282
+ if (name.startsWith(outStem + '-') && name.endsWith('.png'))
283
+ excluded.push(path.join(path.dirname(out), name));
284
+ const sourceIdentity = contentIdentity([projectDir, ...exportRuntimeRoots(projectDir, server.payload().plugins ?? {})], excluded);
285
+ const { projectDir: _projectDir, out: _out, overwrite: _overwrite, resume: _resume, checkpoint: _checkpoint, timeline: _timeline, frames: _frames, ...rendering } = opts;
286
+ const voiceIdentity = await page.evaluate(() => window.__JOPLO_RECORD__.voiceIdentity());
287
+ fingerprint = createHash('sha256').update(JSON.stringify({ version: 2, browser: browser.version(), platform: process.platform, arch: process.arch, node: process.versions.node, project, voiceIdentity, sourceIdentity, rendering, sampleMs, every, stillMs, plugins: server.payload().plugins })).digest('hex');
288
+ if (checkpoint?.fingerprint !== undefined && checkpoint.fingerprint !== fingerprint)
289
+ throw new JoploError('USAGE', 'Checkpoint source, version or rendering options changed; start a fresh render');
290
+ }
183
291
  const helper = await ctx.newPage();
184
292
  await helper.setContent(DIFF_PAGE);
185
293
  // 字幕与步骤标题条浮在画面上(D97):胶片条只看画面本身的运动,采样时把它们藏起来,文字换行不算镜头切换
186
294
  await page.addStyleTag({ content: '[data-jsubtitle],[data-testid="step-title"]{visibility:hidden!important}' });
187
295
  const stageRatio = 1;
188
296
  const samples = [];
297
+ let lastChapter = null;
298
+ let chapterStartedAt = Date.now();
299
+ const rssSamples = [];
300
+ let nextMemoryAt = 0;
189
301
  let tail = -1;
190
302
  // 第一帧在开播之前采(封面 / 第 0 步):开播那一下的切换也要量到
191
- for (let t = 0; t <= MAX_MS; t += sampleMs) {
192
- if (t === sampleMs) {
303
+ let previousTime = 0;
304
+ for (let index = 0;; index++) {
305
+ const t = opts.frameFps ? frameTime(index, opts.frameFps) : index * sampleMs;
306
+ if (t > MAX_MS)
307
+ break;
308
+ if (index === 1) {
193
309
  await page.evaluate(() => window.__JOPLO_RECORD__.play());
194
310
  await flush(page);
195
311
  }
196
312
  if (t > 0)
197
- await page.clock.runFor(sampleMs);
313
+ await page.clock.runFor(t - previousTime);
314
+ previousTime = t;
198
315
  await flush(page);
316
+ await waitForSample(page, t);
199
317
  const p = await page.evaluate(() => window.__JOPLO_RECORD__.progress);
200
318
  if (p.error)
201
319
  throw new JoploError('RENDER_FAILED', `Playback failed at ${t} ms: ${p.error}`);
202
- const jpg = (await page.locator('[data-jexport]').screenshot({ type: 'jpeg', quality: 72 })).toString('base64');
203
- const d = await helper.evaluate(([b64, crop, time, th, st]) => window.step(b64, crop, time, th, st), [jpg, stageRatio, t, PIXEL_THRESHOLD, STILL_CHANGED]);
204
- samples.push({ t, ...d, scenarioId: p.scenarioId, position: p.position, activeStep: p.activeStep, ...(t % every === 0 ? { jpg } : {}) });
205
- if (opts.frames && t % every === 0) {
320
+ if (p.scenarioId !== lastChapter)
321
+ chapterStartedAt = Date.now();
322
+ if (Date.now() - chapterStartedAt > (opts.chapterTimeoutMs ?? 180_000))
323
+ throw new JoploError('RENDER_FAILED', `Chapter ${p.scenarioId} timed out at ${t} ms (wall clock); completed checkpoint was preserved`);
324
+ if (t >= nextMemoryAt) {
325
+ rssSamples.push({ engineMs: t, rssBytes: process.memoryUsage().rss });
326
+ nextMemoryAt = t + 5000;
327
+ }
328
+ const restored = checkpoint?.samples[index];
329
+ if (restored) {
330
+ samples.push(restored);
331
+ if (index === checkpoint.samples.length - 1) {
332
+ const currentStep = p.scenarioId ? project.scenarios[p.scenarioId]?.steps[p.position - 1]?.id ?? null : null;
333
+ if (restored.scenarioId !== p.scenarioId || restored.position !== p.position || restored.activeStep !== p.activeStep || restored.stepId !== currentStep)
334
+ throw new JoploError('RENDER_FAILED', `Checkpoint stable state diverged at ${t} ms; rerun without --resume`);
335
+ const raw = await page.evaluate(() => window.__JOPLO_RECORD__.timeline());
336
+ const commits = playbackTimeline(raw).steps.map(s => ({ stepId: s.stepId, commitMs: s.commitMs }));
337
+ if (!checkpointCommitsMatch(checkpoint.commits, commits))
338
+ throw new JoploError('RENDER_FAILED', 'Checkpoint playback commits differ by more than 50 ms; rerun without --resume');
339
+ await helper.evaluate((state) => window.restore(state), checkpoint.diff);
340
+ }
341
+ lastChapter = p.scenarioId;
342
+ continue;
343
+ }
344
+ const jpg = (await capture(page, '[data-jexport]', opts.crop, 'jpeg', opts.framesOnly ? 95 : 72, captureSession, t)).toString('base64');
345
+ await audit?.sample(page, { atMs: t, scenarioId: p.scenarioId ?? opts.scenarioId, position: p.position, jpg });
346
+ const d = opts.framesOnly ? { diff: 0, changed: 0, still: 0 } : await helper.evaluate(([b64, crop, time, th, st]) => window.step(b64, crop, time, th, st), [jpg, stageRatio, t, PIXEL_THRESHOLD, STILL_CHANGED]);
347
+ samples.push({ t, ...d, scenarioId: p.scenarioId, position: p.position, activeStep: p.activeStep, stepId: p.scenarioId ? project.scenarios[p.scenarioId]?.steps[p.position - 1]?.id ?? null : null, ...(!opts.framesOnly && t % every === 0 ? { jpg } : {}) });
348
+ if (opts.frames && (opts.framesOnly || t % every === 0)) {
206
349
  fs.mkdirSync(opts.frames, { recursive: true });
207
350
  fs.writeFileSync(path.join(opts.frames, `${String(t).padStart(7, '0')}.jpg`), Buffer.from(jpg, 'base64'));
208
351
  }
352
+ if (checkpointFile && lastChapter && lastChapter !== p.scenarioId && samples.length > 4) {
353
+ // Keep a stable final-state anchor before the seam. Its small tail is
354
+ // recomputed, so accepted one-sample scheduling jitter never reuses seam pixels.
355
+ const back = Math.min(10, Math.ceil(100 / sampleMs) + 1), prefix = samples.slice(0, -back);
356
+ const diff = await helper.evaluate(back => window.dump(back), back);
357
+ const raw = await page.evaluate(() => window.__JOPLO_RECORD__.timeline());
358
+ const cutoff = prefix.at(-1).t;
359
+ const commits = playbackTimeline({ ...raw, events: raw.events.filter(e => e.at - (raw.startedAt ?? 0) <= cutoff) }).steps.map(s => ({ stepId: s.stepId, commitMs: s.commitMs }));
360
+ fs.mkdirSync(path.dirname(checkpointFile), { recursive: true });
361
+ const temp = `${checkpointFile}.${process.pid}.tmp`;
362
+ fs.writeFileSync(temp, JSON.stringify({ fingerprint, samples: prefix, diff, commits }));
363
+ fs.renameSync(temp, checkpointFile);
364
+ }
365
+ lastChapter = p.scenarioId;
209
366
  if (p.done && tail < 0)
210
367
  tail = t + 1000;
211
368
  if (tail >= 0 && t >= tail)
@@ -213,6 +370,11 @@ export async function renderFilm(opts) {
213
370
  }
214
371
  if (tail < 0)
215
372
  throw new JoploError('RENDER_FAILED', `Playback did not finish within ${MAX_MS / 60000} minutes of engine time`);
373
+ const raw = await page.evaluate(() => window.__JOPLO_RECORD__.timeline());
374
+ if (opts.timeline) {
375
+ const file = check({ projectDir, out: opts.timeline, overwrite: opts.overwrite });
376
+ await persistTimeline(file, playbackTimeline(raw), project.mediaAssets ?? {}, server.url, opts.overwrite, server.token, project.mediaInfo);
377
+ }
216
378
  const cuts = findCuts(samples);
217
379
  const stills = findStills(samples, stillMs);
218
380
  const boundaries = stepBoundaries(samples);
@@ -256,25 +418,36 @@ export async function renderFilm(opts) {
256
418
  const png = await sheet.screenshot({ type: 'png', fullPage: true });
257
419
  await sheet.close();
258
420
  fs.mkdirSync(path.dirname(file), { recursive: true });
259
- fs.writeFileSync(file, png, opts.overwrite ? undefined : { flag: 'wx' });
421
+ await writeOutput(file, png, opts.overwrite);
260
422
  files.push(file);
261
423
  }
262
424
  await ctx.close();
263
- const result = { path: files[0], files, durationMs, sampleMs, every, samples: samples.length, cuts, stills, boundaries, maxDiff: round(Math.max(0, ...samples.map((s) => s.diff))), warnings: [] };
425
+ const result = { ...(audit ? { audit: audit.finish() } : {}), path: files[0] ?? out, files, durationMs, sampleMs, every, samples: samples.length, cuts, stills, boundaries, maxDiff: round(Math.max(0, ...samples.map((s) => s.diff))), warnings: sampleMs > 50 ? ['Coarse analysis: transitions shorter than the computation interval may be missed; use 50 ms for final QA.'] : [], measurement: { baselineRssBytes, endRssBytes: process.memoryUsage().rss, memoryScope: 'node-process-lifetime', rssSamples, wallMs: Date.now() - startedAt, peakRssBytes: process.resourceUsage().maxRSS * 1024, resumedSamples: checkpoint?.samples.length ?? 0 } };
264
426
  // 完整的判读数据(每一步提交前后的最大帧差、硬切、静止)放在胶片条旁边,评审时可以引用具体数字
265
- fs.writeFileSync(out.replace(/(\.png)?$/i, '.json'), JSON.stringify({ ...result, frames: samples.map(({ jpg: _jpg, ...rest }) => rest) }, null, 1));
427
+ await writeOutput(metadataOut, JSON.stringify({ ...result, frames: samples.map(({ jpg: _jpg, ...rest }) => rest) }, null, 1), opts.overwrite);
266
428
  return result;
267
429
  }
268
430
  finally {
269
431
  await browser?.close().catch(() => undefined);
270
- await server.close();
432
+ await server.close().catch(() => undefined);
271
433
  }
272
434
  }
435
+ export function renderFilm(opts) { return samplePlayback(opts); }
273
436
  const HIDE = ['cover', 'cursor', 'title', 'subtitles'];
274
437
  /** 视频:与看板导出相同的录制器(真实时间)。 */
275
438
  export async function renderVideo(opts) {
276
439
  const projectDir = realProjectDir(opts.projectDir);
277
440
  const out = check({ ...opts, projectDir });
441
+ distinctOutputs([out, opts.timeline, opts.srt]);
442
+ geometryQuery(opts);
443
+ if (opts.auditLayout)
444
+ throw new JoploError('USAGE', 'Layout audit supports static screenshots and --film, not --video');
445
+ if (opts.crop)
446
+ throw new JoploError('USAGE', 'Video crop is not supported; use --viewport/--no-frame or --frames-out with --crop');
447
+ if (opts.timeline) {
448
+ check({ projectDir, out: opts.timeline, overwrite: opts.overwrite });
449
+ assertNotProjectData(projectDir, path.join(`${path.resolve(opts.timeline).replace(/\.json$/i, '')}.assets`, '__asset.wav'));
450
+ }
278
451
  if ((opts.width === undefined) !== (opts.height === undefined))
279
452
  throw new JoploError('USAGE', 'Video width and height must be provided together');
280
453
  const video = opts.width !== undefined ? { width: videoDimension('width', opts.width), height: videoDimension('height', opts.height) } : null;
@@ -288,21 +461,54 @@ export async function renderVideo(opts) {
288
461
  if (srtOut && srtOut === out)
289
462
  throw new JoploError('USAGE', 'The subtitle file must differ from the video file');
290
463
  const { server, project } = await compiled(projectDir);
464
+ let videoWork = null;
291
465
  try {
292
466
  // 输出分辨率(#55):视口就是视频分辨率,渲染路由把舞台等比缩放进这块画布(录屏按 CSS 像素取帧,deviceScaleFactor 不会让它更清晰)
293
467
  const { url, size } = recordUrl(server.url, server.projectId, project, { ...opts, voice, hide: opts.hide ?? [], ...(video ? { canvas: video } : {}) });
294
468
  fs.mkdirSync(path.dirname(out), { recursive: true });
295
- if (opts.overwrite)
296
- fs.rmSync(out, { force: true });
297
469
  const started = Date.now();
298
- const outcome = await defaultRecorder((dir) => loadPlaywright({ home: joploHome(), projectDir: dir }))({ projectDir, url, size: video ?? size, out, total: 0, progress: () => undefined, signal: new AbortController().signal, maxMs: MAX_MS });
470
+ const mp4 = path.extname(out).toLowerCase() === '.mp4';
471
+ videoWork = fs.mkdtempSync(path.join(path.dirname(out), '.joplo-video-'));
472
+ const recordingOut = path.join(videoWork, 'recording.webm');
473
+ const encodedOut = mp4 ? path.join(videoWork, 'encoded.mp4') : recordingOut;
474
+ const outcome = await defaultRecorder((dir) => loadPlaywright({ home: joploHome(), projectDir: dir }))({ projectDir, url, size: video ?? size, out: recordingOut, total: 0, progress: () => undefined, signal: new AbortController().signal, maxMs: MAX_MS });
475
+ if (mp4)
476
+ await encodeMp4(recordingOut, encodedOut);
299
477
  if (srtOut) {
300
478
  fs.mkdirSync(path.dirname(srtOut), { recursive: true });
301
479
  fs.writeFileSync(srtOut, srt(outcome?.cues ?? []), opts.overwrite ? undefined : { flag: 'wx' });
302
480
  }
303
- return { path: out, durationMs: Date.now() - started, size: video ?? size, srt: srtOut, voice: outcome?.voice ?? { mode: voice, missing: [] } };
481
+ if (opts.timeline && outcome?.timeline) {
482
+ const file = check({ projectDir, out: opts.timeline, overwrite: opts.overwrite });
483
+ await persistTimeline(file, outcome.timeline, project.mediaAssets ?? {}, server.url, opts.overwrite, server.token, project.mediaInfo);
484
+ }
485
+ await commitOutput(encodedOut, out, opts.overwrite);
486
+ return { ...(outcome?.sync ? { sync: outcome.sync } : {}), path: out, durationMs: Date.now() - started, size: video ?? size, srt: srtOut, voice: outcome?.voice ?? { mode: voice, missing: [] } };
304
487
  }
305
488
  finally {
306
- await server.close();
489
+ if (videoWork)
490
+ fs.rmSync(videoWork, { recursive: true, force: true });
491
+ await server.close().catch(() => undefined);
307
492
  }
308
493
  }
494
+ /** Public offline frame export. No audio synthesis or private browser bridge is needed by callers. */
495
+ export async function renderFrames(opts) {
496
+ const fps = opts.fps ?? 30;
497
+ if (!Number.isFinite(fps) || fps < 1 || fps > 120)
498
+ throw new JoploError('USAGE', 'fps must be from 1 to 120');
499
+ if (opts.scale !== undefined && (!Number.isFinite(opts.scale) || opts.scale <= 0 || opts.scale > 4))
500
+ throw new JoploError('USAGE', 'Frame scale must be above 0 and at most 4');
501
+ const dir = path.resolve(opts.framesOut);
502
+ assertNotProjectData(opts.projectDir, path.join(dir, '__frame.jpg'));
503
+ if (dir === realProjectDir(opts.projectDir))
504
+ throw new JoploError('USAGE', 'Frame output directory must differ from the project root');
505
+ if (fs.existsSync(dir) && fs.readdirSync(dir).length && !opts.overwrite)
506
+ throw new JoploError('USAGE', 'Frame directory is not empty; use --overwrite');
507
+ const timeline = opts.timeline ?? path.join(dir, 'timeline.json');
508
+ if (opts.overwrite && fs.existsSync(dir))
509
+ for (const name of fs.readdirSync(dir))
510
+ if (/^\d{7}\.jpg$/.test(name))
511
+ fs.rmSync(path.join(dir, name));
512
+ const result = await samplePlayback({ ...opts, hide: opts.hide ?? ['cover', 'cursor', 'title', 'subtitles'], out: path.join(dir, 'film.png'), frames: dir, timeline, frameFps: fps, frameScale: opts.scale, framesOnly: true });
513
+ return { directory: dir, timeline, fps, frames: result.samples, durationMs: result.durationMs, toleranceMs: 50 };
514
+ }
package/dist/index.d.ts CHANGED
@@ -13,9 +13,15 @@ export { startPreview, SITE_CONTENT_TYPES, type PreviewHandle } from './preview.
13
13
  export { generateProjectVoice, type VoiceRunOptions, type VoiceRunResult } from './voice-run.js';
14
14
  export type { CloudSpeechRequest, CloudSpeechResult, CloudVoice, CloudVoiceBridge, CloudVoiceCatalog, CloudVoiceInfo, CloudVoiceStatus, VoiceQuota } from './cloud.js';
15
15
  export { renderSheet, renderStep } from './render.js';
16
- export { renderFilm, renderVideo } from './film.js';
16
+ export { renderFilm, renderVideo, renderFrames } from './film.js';
17
17
  export { EXPORT_DOWNLOAD_MB, PLAYWRIGHT_VERSION, SETUP_COMMAND, exportRuntimeStatus, installExportRuntime, uninstallExportRuntime, type ExportRuntimeStatus, type InstallProgress, type InstallResult } from './export-runtime.js';
18
18
  export { buildFeatureDiff, publicIRFromHtml, type DiffBuildOptions, type DiffBuildResult } from './feature-diff.js';
19
19
  export { generateResources } from './resources-run.js';
20
20
  export { LocalResources } from './local-resources.js';
21
21
  export { inspectResources, mediaDiagnostics } from './media-check.js';
22
+ export { watchConfigDiagnostics } from './watch-config.js';
23
+ export { assetUsage, type AssetUsageReport, type AssetUsageEntry, type AssetUsageReference } from './asset-usage.js';
24
+ export type { ExportCrop, FramesOptions, FilmOptions, FilmResult, VideoOptions, VideoResult } from './contract.js';
25
+ export type { PlaybackTimeline, PlaybackEvent } from './timeline.js';
26
+ export { auditLayout, createLayoutAuditSession, type LayoutAuditOptions, type LayoutFinding, type LayoutAuditSample } from './layout-audit.js';
27
+ export { readAudioTiming, audioDuration } from './audio-timing.js';
package/dist/index.js CHANGED
@@ -3,9 +3,13 @@ export { buildSite } from "./build.js";
3
3
  export { startPreview, SITE_CONTENT_TYPES } from "./preview.js";
4
4
  export { generateProjectVoice } from "./voice-run.js";
5
5
  export { renderSheet, renderStep } from "./render.js";
6
- export { renderFilm, renderVideo } from "./film.js";
6
+ export { renderFilm, renderVideo, renderFrames } from "./film.js";
7
7
  export { EXPORT_DOWNLOAD_MB, PLAYWRIGHT_VERSION, SETUP_COMMAND, exportRuntimeStatus, installExportRuntime, uninstallExportRuntime } from "./export-runtime.js";
8
8
  export { buildFeatureDiff, publicIRFromHtml } from "./feature-diff.js";
9
9
  export { generateResources } from "./resources-run.js";
10
10
  export { LocalResources } from "./local-resources.js";
11
11
  export { inspectResources, mediaDiagnostics } from "./media-check.js";
12
+ export { watchConfigDiagnostics } from "./watch-config.js";
13
+ export { assetUsage } from "./asset-usage.js";
14
+ export { auditLayout, createLayoutAuditSession } from "./layout-audit.js";
15
+ export { readAudioTiming, audioDuration } from "./audio-timing.js";