@bendyline/squisq-cli 2.8.18 → 2.8.19
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/api.js
CHANGED
|
@@ -15,6 +15,7 @@ import { tmpdir as tmpdir2 } from "os";
|
|
|
15
15
|
import { dirname as dirname2, join as join4, resolve as resolvePath } from "path";
|
|
16
16
|
import { resolveMediaSchedule as resolveMediaSchedule2 } from "@bendyline/squisq/schemas";
|
|
17
17
|
import { flattenBlocks as flattenBlocks2 } from "@bendyline/squisq/doc";
|
|
18
|
+
import { usesDynamicPresentation } from "@bendyline/squisq/transform";
|
|
18
19
|
import { ffmpegGifOutputArgs, frameTimeSeconds, generateRenderHtml } from "@bendyline/squisq-video";
|
|
19
20
|
import { resolveDashboardDimensions, resolveDimensions } from "@bendyline/squisq-video";
|
|
20
21
|
import {
|
|
@@ -822,7 +823,7 @@ async function buildBareMarkdownContainer(filePath, content, doc, signal) {
|
|
|
822
823
|
}
|
|
823
824
|
refs.add("timing.json");
|
|
824
825
|
for (const ref of [...refs]) {
|
|
825
|
-
if (NARRATION_EXTENSIONS.has(extname(stripUrlSuffix(ref)).toLowerCase())) {
|
|
826
|
+
if (NARRATION_EXTENSIONS.has(extname(stripUrlSuffix(ref)).toLowerCase()) || /\.(?:webm|mp4)$/i.test(stripUrlSuffix(ref))) {
|
|
826
827
|
refs.add(`${stripUrlSuffix(ref)}.timing.json`);
|
|
827
828
|
}
|
|
828
829
|
}
|
|
@@ -1623,6 +1624,12 @@ async function renderDocToDashboardPng(doc, container, options = {}) {
|
|
|
1623
1624
|
}
|
|
1624
1625
|
async function renderDocToMp4(doc, container, options) {
|
|
1625
1626
|
options.signal?.throwIfAborted();
|
|
1627
|
+
if ((Object.prototype.hasOwnProperty.call(doc.frontmatter ?? {}, "squisq-presentation") || usesDynamicPresentation(doc)) && !doc.presentationApplied) {
|
|
1628
|
+
const { resolveAudioMapping: resolveAudioMapping2, buildPreviewDoc } = await import("@bendyline/squisq/doc");
|
|
1629
|
+
doc = buildPreviewDoc(await resolveAudioMapping2(doc, container));
|
|
1630
|
+
}
|
|
1631
|
+
const presentationError = doc.diagnostics?.find((item) => item.code === "presentation-invalid");
|
|
1632
|
+
if (presentationError) throw new Error(presentationError.message);
|
|
1626
1633
|
const fps = options.fps ?? 30;
|
|
1627
1634
|
const quality = options.quality ?? "normal";
|
|
1628
1635
|
const orientation = options.orientation ?? "landscape";
|
|
@@ -12,6 +12,7 @@ import { tmpdir as tmpdir2 } from "os";
|
|
|
12
12
|
import { dirname as dirname2, join as join4, resolve as resolvePath } from "path";
|
|
13
13
|
import { resolveMediaSchedule as resolveMediaSchedule2 } from "@bendyline/squisq/schemas";
|
|
14
14
|
import { flattenBlocks as flattenBlocks2 } from "@bendyline/squisq/doc";
|
|
15
|
+
import { usesDynamicPresentation } from "@bendyline/squisq/transform";
|
|
15
16
|
import { ffmpegGifOutputArgs, frameTimeSeconds, generateRenderHtml } from "@bendyline/squisq-video";
|
|
16
17
|
import { resolveDashboardDimensions, resolveDimensions } from "@bendyline/squisq-video";
|
|
17
18
|
import {
|
|
@@ -542,7 +543,7 @@ function mp4Format() {
|
|
|
542
543
|
const animationsEnabled = typeof mp4Opts.animationsEnabled === "boolean" ? mp4Opts.animationsEnabled : MP4_DEFAULTS.animationsEnabled;
|
|
543
544
|
const outputPath = join2(tmpdir(), `squisq-mp4-${randomBytes(8).toString("hex")}.mp4`);
|
|
544
545
|
try {
|
|
545
|
-
const { renderDocToMp4: renderDocToMp42 } = await import("./api-
|
|
546
|
+
const { renderDocToMp4: renderDocToMp42 } = await import("./api-6NVYOTM6.js");
|
|
546
547
|
await renderDocToMp42(input.doc, input.container, {
|
|
547
548
|
outputPath,
|
|
548
549
|
fps,
|
|
@@ -583,7 +584,7 @@ function gifFormat() {
|
|
|
583
584
|
const defaultHeight = portrait ? GIF_DEFAULTS.width : GIF_DEFAULTS.height;
|
|
584
585
|
const outputPath = join2(tmpdir(), `squisq-gif-${randomBytes(8).toString("hex")}.gif`);
|
|
585
586
|
try {
|
|
586
|
-
const { renderDocToGif: renderDocToGif2 } = await import("./api-
|
|
587
|
+
const { renderDocToGif: renderDocToGif2 } = await import("./api-6NVYOTM6.js");
|
|
587
588
|
const result = await renderDocToGif2(input.doc, input.container, {
|
|
588
589
|
outputPath,
|
|
589
590
|
fps: typeof gifOpts.fps === "number" ? gifOpts.fps : GIF_DEFAULTS.fps,
|
|
@@ -626,7 +627,7 @@ function pngFormat() {
|
|
|
626
627
|
async exportDoc(input, options) {
|
|
627
628
|
options.signal?.throwIfAborted();
|
|
628
629
|
const pngOpts = options.formatOptions?.png ?? {};
|
|
629
|
-
const { renderDocToDashboardPng: renderDocToDashboardPng2 } = await import("./api-
|
|
630
|
+
const { renderDocToDashboardPng: renderDocToDashboardPng2 } = await import("./api-6NVYOTM6.js");
|
|
630
631
|
const result = await renderDocToDashboardPng2(input.doc, input.container, {
|
|
631
632
|
resolution: pngOpts.resolution,
|
|
632
633
|
width: pngOpts.width,
|
|
@@ -819,7 +820,7 @@ async function buildBareMarkdownContainer(filePath, content, doc, signal) {
|
|
|
819
820
|
}
|
|
820
821
|
refs.add("timing.json");
|
|
821
822
|
for (const ref of [...refs]) {
|
|
822
|
-
if (NARRATION_EXTENSIONS.has(extname(stripUrlSuffix(ref)).toLowerCase())) {
|
|
823
|
+
if (NARRATION_EXTENSIONS.has(extname(stripUrlSuffix(ref)).toLowerCase()) || /\.(?:webm|mp4)$/i.test(stripUrlSuffix(ref))) {
|
|
823
824
|
refs.add(`${stripUrlSuffix(ref)}.timing.json`);
|
|
824
825
|
}
|
|
825
826
|
}
|
|
@@ -1620,6 +1621,12 @@ async function renderDocToDashboardPng(doc, container, options = {}) {
|
|
|
1620
1621
|
}
|
|
1621
1622
|
async function renderDocToMp4(doc, container, options) {
|
|
1622
1623
|
options.signal?.throwIfAborted();
|
|
1624
|
+
if ((Object.prototype.hasOwnProperty.call(doc.frontmatter ?? {}, "squisq-presentation") || usesDynamicPresentation(doc)) && !doc.presentationApplied) {
|
|
1625
|
+
const { resolveAudioMapping: resolveAudioMapping2, buildPreviewDoc } = await import("@bendyline/squisq/doc");
|
|
1626
|
+
doc = buildPreviewDoc(await resolveAudioMapping2(doc, container));
|
|
1627
|
+
}
|
|
1628
|
+
const presentationError = doc.diagnostics?.find((item) => item.code === "presentation-invalid");
|
|
1629
|
+
if (presentationError) throw new Error(presentationError.message);
|
|
1623
1630
|
const fps = options.fps ?? 30;
|
|
1624
1631
|
const quality = options.quality ?? "normal";
|
|
1625
1632
|
const orientation = options.orientation ?? "landscape";
|