@bendyline/squisq-cli 2.4.0 → 2.4.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.
- package/NOTICE.md +1 -1
- package/README.md +1 -1
- package/THIRD_PARTY_LICENSES.txt +1 -1
- package/dist/{api-HBPJQ7MA.js → api-KYHSJM5T.js} +1 -1
- package/dist/api.d.ts +1 -2
- package/dist/api.js +32 -3
- package/dist/chunk-GGVASRPG.js +0 -0
- package/dist/{chunk-WR2BZJ77.js → chunk-VK6WPOSG.js} +34 -5
- package/dist/index.js +1 -1
- package/dist/nativeEncoder-PMVSFLMN.js +0 -0
- package/dist/squisq-player.full.global.js +4169 -0
- package/dist/squisq-player.global.js +63 -61
- package/package.json +8 -8
package/NOTICE.md
CHANGED
|
@@ -9,7 +9,7 @@ Third-party components remain under their respective license terms.
|
|
|
9
9
|
| Package | Version | License | Repository |
|
|
10
10
|
| --------------- | ------- | ---------- | --------------------------------------- |
|
|
11
11
|
| commander | 12.1.0 | MIT | https://github.com/tj/commander.js |
|
|
12
|
-
| playwright-core | 1.
|
|
12
|
+
| playwright-core | 1.61.1 | Apache-2.0 | https://github.com/microsoft/playwright |
|
|
13
13
|
|
|
14
14
|
Copyright and complete license texts for these dependencies are included in
|
|
15
15
|
their respective npm distributions and source repositories.
|
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ Notes:
|
|
|
58
58
|
|
|
59
59
|
### `squisq video <input> [output]`
|
|
60
60
|
|
|
61
|
-
Render a document to MP4 or animated GIF. Playwright captures deterministic frames from a headless player page; native ffmpeg encodes H.264 + AAC for MP4 or a generated global palette for GIF. GIF has no audio track.
|
|
61
|
+
Render a document to MP4 or animated GIF. Playwright captures deterministic frames from a headless player page; native ffmpeg encodes H.264 + AAC for MP4 or a generated global palette for GIF. Documents with Mermaid fences automatically use the full standalone player so diagrams are captured; other documents keep the smaller light player. GIF has no audio track.
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
64
|
squisq video input.md output.mp4
|
package/THIRD_PARTY_LICENSES.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
THIRD-PARTY LICENSES FOR @bendyline/squisq-cli
|
|
2
2
|
|
|
3
|
-
The inventory below covers the bundled light standalone player
|
|
3
|
+
The inventory below covers the bundled light and full standalone player artifacts.
|
|
4
4
|
|
|
5
5
|
Generated from the actual esbuild input graph. Package-local license, copying,
|
|
6
6
|
and notice files are reproduced verbatim. When an npm tarball omits its
|
package/dist/api.d.ts
CHANGED
|
@@ -191,8 +191,7 @@ declare function framesToGifNativeBytes(ffmpegPath: string, frames: Uint8Array[]
|
|
|
191
191
|
* Programmatic Rendered-Media API
|
|
192
192
|
*
|
|
193
193
|
* Provides library-style entry points for rendering Squisq documents to MP4
|
|
194
|
-
* or animated GIF from Node.js callers
|
|
195
|
-
* the need to shell
|
|
194
|
+
* or animated GIF from Node.js callers. This avoids the need to shell
|
|
196
195
|
* out to the `squisq video` CLI and gives callers full control over the Doc,
|
|
197
196
|
* MemoryContentContainer, and encoding options.
|
|
198
197
|
*
|
package/dist/api.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
// src/api.ts
|
|
11
11
|
import { readFile as readFile3 } from "fs/promises";
|
|
12
12
|
import { resolveMediaSchedule } from "@bendyline/squisq/schemas";
|
|
13
|
-
import { flattenBlocks } from "@bendyline/squisq/doc";
|
|
13
|
+
import { flattenBlocks as flattenBlocks2 } from "@bendyline/squisq/doc";
|
|
14
14
|
import { ffmpegGifOutputArgs, generateRenderHtml } from "@bendyline/squisq-video";
|
|
15
15
|
import { resolveDimensions } from "@bendyline/squisq-video";
|
|
16
16
|
import {
|
|
@@ -271,6 +271,27 @@ function createMediaBudget() {
|
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
// src/util/playerBundle.ts
|
|
275
|
+
import { flattenBlocks } from "@bendyline/squisq/doc";
|
|
276
|
+
function selectStandalonePlayerVariant(doc) {
|
|
277
|
+
for (const block of flattenBlocks(doc.blocks)) {
|
|
278
|
+
if (block.layers?.some((layer) => layer.type === "mermaid")) return "full";
|
|
279
|
+
if (containsMermaidFence(block.contents)) return "full";
|
|
280
|
+
}
|
|
281
|
+
return "light";
|
|
282
|
+
}
|
|
283
|
+
function containsMermaidFence(value) {
|
|
284
|
+
if (Array.isArray(value)) return value.some(containsMermaidFence);
|
|
285
|
+
if (!isRecord(value)) return false;
|
|
286
|
+
if (value.type === "code" && typeof value.lang === "string" && value.lang.trim().toLowerCase() === "mermaid") {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
return containsMermaidFence(value.children);
|
|
290
|
+
}
|
|
291
|
+
function isRecord(value) {
|
|
292
|
+
return typeof value === "object" && value !== null;
|
|
293
|
+
}
|
|
294
|
+
|
|
274
295
|
// src/registry.ts
|
|
275
296
|
import { randomBytes } from "crypto";
|
|
276
297
|
import { readFile, rm } from "fs/promises";
|
|
@@ -667,6 +688,7 @@ function throwIfAborted(signal) {
|
|
|
667
688
|
// src/api.ts
|
|
668
689
|
import { ConversionError } from "@bendyline/squisq-formats";
|
|
669
690
|
var playerBundlePromise;
|
|
691
|
+
var fullPlayerBundlePromise;
|
|
670
692
|
function loadPlayerBundle() {
|
|
671
693
|
playerBundlePromise ??= readFile3(
|
|
672
694
|
new URL("../dist/squisq-player.global.js", import.meta.url),
|
|
@@ -674,6 +696,13 @@ function loadPlayerBundle() {
|
|
|
674
696
|
);
|
|
675
697
|
return playerBundlePromise;
|
|
676
698
|
}
|
|
699
|
+
function loadFullPlayerBundle() {
|
|
700
|
+
fullPlayerBundlePromise ??= readFile3(
|
|
701
|
+
new URL("../dist/squisq-player.full.global.js", import.meta.url),
|
|
702
|
+
"utf8"
|
|
703
|
+
);
|
|
704
|
+
return fullPlayerBundlePromise;
|
|
705
|
+
}
|
|
677
706
|
async function convert(source, to, options = {}) {
|
|
678
707
|
return formatsConvert(source, to, {
|
|
679
708
|
registry: createCliRegistry(),
|
|
@@ -726,7 +755,7 @@ async function captureDocFrames(doc, container, options) {
|
|
|
726
755
|
}
|
|
727
756
|
}
|
|
728
757
|
const mediaSrcs = new Set(resolveMediaSchedule(doc).map((clip) => clip.src));
|
|
729
|
-
for (const block of
|
|
758
|
+
for (const block of flattenBlocks2(doc.blocks)) {
|
|
730
759
|
for (const layer of block.layers ?? []) {
|
|
731
760
|
if (layer.type === "video") mediaSrcs.add(layer.content.src);
|
|
732
761
|
}
|
|
@@ -743,7 +772,7 @@ async function captureDocFrames(doc, container, options) {
|
|
|
743
772
|
}
|
|
744
773
|
onProgress?.("generating render HTML", 10);
|
|
745
774
|
signal?.throwIfAborted();
|
|
746
|
-
const playerBundle = await loadPlayerBundle();
|
|
775
|
+
const playerBundle = await (selectStandalonePlayerVariant(doc) === "full" ? loadFullPlayerBundle() : loadPlayerBundle());
|
|
747
776
|
signal?.throwIfAborted();
|
|
748
777
|
const renderHtml = generateRenderHtml(doc, {
|
|
749
778
|
playerScript: playerBundle,
|
package/dist/chunk-GGVASRPG.js
CHANGED
|
File without changes
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
// src/api.ts
|
|
8
8
|
import { readFile as readFile3 } from "fs/promises";
|
|
9
9
|
import { resolveMediaSchedule } from "@bendyline/squisq/schemas";
|
|
10
|
-
import { flattenBlocks } from "@bendyline/squisq/doc";
|
|
10
|
+
import { flattenBlocks as flattenBlocks2 } from "@bendyline/squisq/doc";
|
|
11
11
|
import { ffmpegGifOutputArgs, generateRenderHtml } from "@bendyline/squisq-video";
|
|
12
12
|
import { resolveDimensions } from "@bendyline/squisq-video";
|
|
13
13
|
import {
|
|
@@ -268,6 +268,27 @@ function createMediaBudget() {
|
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
// src/util/playerBundle.ts
|
|
272
|
+
import { flattenBlocks } from "@bendyline/squisq/doc";
|
|
273
|
+
function selectStandalonePlayerVariant(doc) {
|
|
274
|
+
for (const block of flattenBlocks(doc.blocks)) {
|
|
275
|
+
if (block.layers?.some((layer) => layer.type === "mermaid")) return "full";
|
|
276
|
+
if (containsMermaidFence(block.contents)) return "full";
|
|
277
|
+
}
|
|
278
|
+
return "light";
|
|
279
|
+
}
|
|
280
|
+
function containsMermaidFence(value) {
|
|
281
|
+
if (Array.isArray(value)) return value.some(containsMermaidFence);
|
|
282
|
+
if (!isRecord(value)) return false;
|
|
283
|
+
if (value.type === "code" && typeof value.lang === "string" && value.lang.trim().toLowerCase() === "mermaid") {
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
return containsMermaidFence(value.children);
|
|
287
|
+
}
|
|
288
|
+
function isRecord(value) {
|
|
289
|
+
return typeof value === "object" && value !== null;
|
|
290
|
+
}
|
|
291
|
+
|
|
271
292
|
// src/registry.ts
|
|
272
293
|
import { randomBytes } from "crypto";
|
|
273
294
|
import { readFile, rm } from "fs/promises";
|
|
@@ -309,7 +330,7 @@ function mp4Format() {
|
|
|
309
330
|
const animationsEnabled = typeof mp4Opts.animationsEnabled === "boolean" ? mp4Opts.animationsEnabled : MP4_DEFAULTS.animationsEnabled;
|
|
310
331
|
const outputPath = join(tmpdir(), `squisq-mp4-${randomBytes(8).toString("hex")}.mp4`);
|
|
311
332
|
try {
|
|
312
|
-
const { renderDocToMp4: renderDocToMp42 } = await import("./api-
|
|
333
|
+
const { renderDocToMp4: renderDocToMp42 } = await import("./api-KYHSJM5T.js");
|
|
313
334
|
await renderDocToMp42(input.doc, input.container, {
|
|
314
335
|
outputPath,
|
|
315
336
|
fps,
|
|
@@ -350,7 +371,7 @@ function gifFormat() {
|
|
|
350
371
|
const defaultHeight = portrait ? GIF_DEFAULTS.width : GIF_DEFAULTS.height;
|
|
351
372
|
const outputPath = join(tmpdir(), `squisq-gif-${randomBytes(8).toString("hex")}.gif`);
|
|
352
373
|
try {
|
|
353
|
-
const { renderDocToGif: renderDocToGif2 } = await import("./api-
|
|
374
|
+
const { renderDocToGif: renderDocToGif2 } = await import("./api-KYHSJM5T.js");
|
|
354
375
|
const result = await renderDocToGif2(input.doc, input.container, {
|
|
355
376
|
outputPath,
|
|
356
377
|
fps: typeof gifOpts.fps === "number" ? gifOpts.fps : GIF_DEFAULTS.fps,
|
|
@@ -664,6 +685,7 @@ function throwIfAborted(signal) {
|
|
|
664
685
|
// src/api.ts
|
|
665
686
|
import { ConversionError } from "@bendyline/squisq-formats";
|
|
666
687
|
var playerBundlePromise;
|
|
688
|
+
var fullPlayerBundlePromise;
|
|
667
689
|
function loadPlayerBundle() {
|
|
668
690
|
playerBundlePromise ??= readFile3(
|
|
669
691
|
new URL("../dist/squisq-player.global.js", import.meta.url),
|
|
@@ -671,6 +693,13 @@ function loadPlayerBundle() {
|
|
|
671
693
|
);
|
|
672
694
|
return playerBundlePromise;
|
|
673
695
|
}
|
|
696
|
+
function loadFullPlayerBundle() {
|
|
697
|
+
fullPlayerBundlePromise ??= readFile3(
|
|
698
|
+
new URL("../dist/squisq-player.full.global.js", import.meta.url),
|
|
699
|
+
"utf8"
|
|
700
|
+
);
|
|
701
|
+
return fullPlayerBundlePromise;
|
|
702
|
+
}
|
|
674
703
|
async function convert(source, to, options = {}) {
|
|
675
704
|
return formatsConvert(source, to, {
|
|
676
705
|
registry: createCliRegistry(),
|
|
@@ -723,7 +752,7 @@ async function captureDocFrames(doc, container, options) {
|
|
|
723
752
|
}
|
|
724
753
|
}
|
|
725
754
|
const mediaSrcs = new Set(resolveMediaSchedule(doc).map((clip) => clip.src));
|
|
726
|
-
for (const block of
|
|
755
|
+
for (const block of flattenBlocks2(doc.blocks)) {
|
|
727
756
|
for (const layer of block.layers ?? []) {
|
|
728
757
|
if (layer.type === "video") mediaSrcs.add(layer.content.src);
|
|
729
758
|
}
|
|
@@ -740,7 +769,7 @@ async function captureDocFrames(doc, container, options) {
|
|
|
740
769
|
}
|
|
741
770
|
onProgress?.("generating render HTML", 10);
|
|
742
771
|
signal?.throwIfAborted();
|
|
743
|
-
const playerBundle = await loadPlayerBundle();
|
|
772
|
+
const playerBundle = await (selectStandalonePlayerVariant(doc) === "full" ? loadFullPlayerBundle() : loadPlayerBundle());
|
|
744
773
|
signal?.throwIfAborted();
|
|
745
774
|
const renderHtml = generateRenderHtml(doc, {
|
|
746
775
|
playerScript: playerBundle,
|
package/dist/index.js
CHANGED
|
File without changes
|