mulmocast 2.7.1 → 2.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.
@@ -1,5 +1,5 @@
1
1
  export * from "./mulmo_presentation_style.js";
2
2
  export * from "./mulmo_studio_context.js";
3
3
  export * from "./mulmo_media_source.js";
4
- export * from "./mulmo_beat.js";
4
+ export * from "./mulmo_beat_node.js";
5
5
  export * from "./mulmo_script.js";
@@ -1,5 +1,7 @@
1
1
  export * from "./mulmo_presentation_style.js";
2
2
  export * from "./mulmo_studio_context.js";
3
3
  export * from "./mulmo_media_source.js";
4
- export * from "./mulmo_beat.js";
4
+ // Node-only MulmoBeatMethods (includes getPlugin). The browser-safe subset lives in
5
+ // ./mulmo_beat.js and is re-exported by ../index.common.js for mulmocast/browser.
6
+ export * from "./mulmo_beat_node.js";
5
7
  export * from "./mulmo_script.js";
@@ -9,13 +9,6 @@ export declare const MulmoBeatMethods: {
9
9
  isAnimatedHtmlTailwind: (beat: MulmoBeat) => boolean;
10
10
  isMovieMode: (animation: unknown) => boolean;
11
11
  getHtmlPrompt(beat: MulmoBeat): string | undefined;
12
- getPlugin(beat: MulmoBeat): {
13
- imageType: string;
14
- process: (params: import("../types/type.js").ImageProcessorParams) => Promise<string | undefined> | void;
15
- path: (params: import("../types/type.js").ImageProcessorParams) => string | undefined;
16
- markdown?: (params: import("../types/type.js").ImageProcessorParams) => string | undefined;
17
- html?: (params: import("../types/type.js").ImageProcessorParams) => Promise<string | undefined>;
18
- };
19
12
  getImageReferenceForImageGenerator(beat: MulmoBeat, imageRefs: Record<string, string>): string[];
20
13
  };
21
14
  export {};
@@ -1,4 +1,3 @@
1
- import { findImagePlugin } from "../utils/image_plugins/index.js";
2
1
  /** Type guard: checks if animation value is an object config like { fps: 30 } */
3
2
  const isAnimationObject = (animation) => {
4
3
  return typeof animation === "object" && animation !== null && !Array.isArray(animation);
@@ -29,13 +28,6 @@ export const MulmoBeatMethods = {
29
28
  }
30
29
  return beat?.htmlPrompt?.prompt;
31
30
  },
32
- getPlugin(beat) {
33
- const plugin = findImagePlugin(beat?.image?.type);
34
- if (!plugin) {
35
- throw new Error(`invalid beat image type: ${beat.image}`); // TODO: cause
36
- }
37
- return plugin;
38
- },
39
31
  getImageReferenceForImageGenerator(beat, imageRefs) {
40
32
  const imageNames = beat.imageNames ?? Object.keys(imageRefs); // use all images if imageNames is not specified
41
33
  const sources = imageNames.map((name) => imageRefs[name]);
@@ -0,0 +1,22 @@
1
+ import { MulmoBeat } from "../types/index.js";
2
+ export declare const MulmoBeatMethods: {
3
+ getPlugin(beat: MulmoBeat): {
4
+ imageType: string;
5
+ process: (params: import("../types/type.js").ImageProcessorParams) => Promise<string | undefined> | void;
6
+ path: (params: import("../types/type.js").ImageProcessorParams) => string | undefined;
7
+ markdown?: (params: import("../types/type.js").ImageProcessorParams) => string | undefined;
8
+ html?: (params: import("../types/type.js").ImageProcessorParams) => Promise<string | undefined>;
9
+ };
10
+ isAnimationEnabled: (animation: unknown) => animation is true | {
11
+ fps?: number;
12
+ movie?: boolean;
13
+ };
14
+ isAnimationObject: (animation: unknown) => animation is {
15
+ fps?: number;
16
+ movie?: boolean;
17
+ };
18
+ isAnimatedHtmlTailwind: (beat: MulmoBeat) => boolean;
19
+ isMovieMode: (animation: unknown) => boolean;
20
+ getHtmlPrompt(beat: MulmoBeat): string | undefined;
21
+ getImageReferenceForImageGenerator(beat: MulmoBeat, imageRefs: Record<string, string>): string[];
22
+ };
@@ -0,0 +1,10 @@
1
+ import { MulmoBeatMethods as MulmoBeatMethodsBrowser } from "./mulmo_beat.js";
2
+ import { getBeatPlugin } from "../utils/image_plugins/index.js";
3
+ // Node-only extension of MulmoBeatMethods. Kept out of methods/mulmo_beat.ts so
4
+ // browser bundles (mulmocast/browser) do not pull in image_plugins → mulmocast-vision → puppeteer.
5
+ export const MulmoBeatMethods = {
6
+ ...MulmoBeatMethodsBrowser,
7
+ getPlugin(beat) {
8
+ return getBeatPlugin(beat);
9
+ },
10
+ };
@@ -423,8 +423,16 @@ export const audioParamsSchema = z
423
423
  .object({
424
424
  padding: z.number().optional().default(0.3).describe("Padding between beats"), // seconds
425
425
  introPadding: z.number().optional().default(1.0).describe("Padding at the beginning of the audio"), // seconds
426
- closingPadding: z.number().optional().default(0.8).describe("Padding before the last beat"), // seconds
427
- outroPadding: z.number().optional().default(1.0).describe("Padding at the end of the audio"), // seconds
426
+ closingPadding: z
427
+ .number()
428
+ .optional()
429
+ .default(0.8)
430
+ .describe("Padding before the last beat (typically the closing credit). For padding after the last beat, use outroPadding"), // seconds
431
+ outroPadding: z
432
+ .number()
433
+ .optional()
434
+ .default(1.0)
435
+ .describe("Padding after the last beat, at the very end of the audio where the BGM fades out (distinct from closingPadding, which comes before the last beat)"), // seconds
428
436
  bgm: mediaSourceSchema.optional(),
429
437
  bgmVolume: z.number().optional().default(0.2).describe("Volume of the background music"),
430
438
  audioVolume: z.number().optional().default(1.0).describe("Volume of the audio"),
@@ -1,4 +1,4 @@
1
- import { ImageProcessorParams } from "../../types/index.js";
1
+ import { ImageProcessorParams, MulmoBeat } from "../../types/index.js";
2
2
  export declare const findImagePlugin: (imageType?: string) => {
3
3
  imageType: string;
4
4
  process: (params: ImageProcessorParams) => Promise<string | undefined> | void;
@@ -6,3 +6,10 @@ export declare const findImagePlugin: (imageType?: string) => {
6
6
  markdown?: (params: ImageProcessorParams) => string | undefined;
7
7
  html?: (params: ImageProcessorParams) => Promise<string | undefined>;
8
8
  } | undefined;
9
+ export declare const getBeatPlugin: (beat: MulmoBeat) => {
10
+ imageType: string;
11
+ process: (params: ImageProcessorParams) => Promise<string | undefined> | void;
12
+ path: (params: ImageProcessorParams) => string | undefined;
13
+ markdown?: (params: ImageProcessorParams) => string | undefined;
14
+ html?: (params: ImageProcessorParams) => Promise<string | undefined>;
15
+ };
@@ -25,3 +25,10 @@ const imagePlugins = [
25
25
  export const findImagePlugin = (imageType) => {
26
26
  return imagePlugins.find((plugin) => plugin.imageType === imageType);
27
27
  };
28
+ export const getBeatPlugin = (beat) => {
29
+ const plugin = findImagePlugin(beat?.image?.type);
30
+ if (!plugin) {
31
+ throw new Error(`invalid beat image type: ${beat.image}`);
32
+ }
33
+ return plugin;
34
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "2.7.1",
3
+ "version": "2.7.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",