@glissade/narrate 0.5.0-pre.3 → 0.5.0-pre.4

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/index.d.ts CHANGED
@@ -97,6 +97,12 @@ interface NarrationAnchors {
97
97
  duration(id: string): number;
98
98
  /** start + offset — a sub-beat inside a segment or pause window */
99
99
  at(id: string, offset?: number): number;
100
+ /**
101
+ * Assert every id exists in the manifest — a build-time fast-fail that lists
102
+ * ALL unknown ids at once (vs. discovering stale refs one render at a time
103
+ * after rewiring). Returns the anchors, so chain it: `narration(t).require([...])`.
104
+ */
105
+ require(ids: readonly string[]): NarrationAnchors;
100
106
  readonly totalDuration: number;
101
107
  /** '<id>.start' / '<id>.end' labels (segments + pauses) — merge into the timeline for studio visibility */
102
108
  labels(): Record<string, number>;
package/dist/index.js CHANGED
@@ -39,11 +39,16 @@ function narration(timing) {
39
39
  if (!b) throw new NarrationError(`no narration beat '${id}' (have: ${[...byId.keys()].join(", ")})`);
40
40
  return b;
41
41
  };
42
- return {
42
+ const anchors = {
43
43
  start: (id) => beat(id).start,
44
44
  end: (id) => beat(id).start + beat(id).duration,
45
45
  duration: (id) => beat(id).duration,
46
46
  at: (id, offset = 0) => beat(id).start + offset,
47
+ require: (ids) => {
48
+ const missing = ids.filter((id) => !byId.has(id));
49
+ if (missing.length > 0) throw new NarrationError(`narration references unknown id${missing.length > 1 ? "s" : ""} ${missing.map((m) => `'${m}'`).join(", ")} — have: ${[...byId.keys()].join(", ")}`);
50
+ return anchors;
51
+ },
47
52
  totalDuration: timing.totalDuration,
48
53
  labels: () => {
49
54
  const out = {};
@@ -69,6 +74,7 @@ function narration(timing) {
69
74
  return out;
70
75
  }
71
76
  };
77
+ return anchors;
72
78
  }
73
79
  function captionTrack(timing, opts = {}) {
74
80
  const target = opts.target ?? "captions/text";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/narrate",
3
- "version": "0.5.0-pre.3",
3
+ "version": "0.5.0-pre.4",
4
4
  "description": "glissade narration + captions: TTS at prepare time (gs narrate), deterministic caching, narration-anchored timeline beats, and captions as plain tracks. Render stays offline.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -19,8 +19,8 @@
19
19
  "dist"
20
20
  ],
21
21
  "dependencies": {
22
- "@glissade/core": "0.5.0-pre.3",
23
- "@glissade/scene": "0.5.0-pre.3"
22
+ "@glissade/core": "0.5.0-pre.4",
23
+ "@glissade/scene": "0.5.0-pre.4"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",