@bendyline/squisq-cli 2.4.4 → 2.5.0
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
|
@@ -558,7 +558,7 @@ async function readUtf8File(filePath, signal) {
|
|
|
558
558
|
async function readMarkdownFile(filePath, signal) {
|
|
559
559
|
const content = await readUtf8File(filePath, signal);
|
|
560
560
|
const markdownDoc = parseMarkdown(content);
|
|
561
|
-
const doc = markdownToDoc(markdownDoc);
|
|
561
|
+
const doc = markdownToDoc(markdownDoc, { fileName: basename(filePath) });
|
|
562
562
|
const container = await buildBareMarkdownContainer(filePath, content, doc, signal);
|
|
563
563
|
return { doc, container, markdownDoc, sourceFormat: "md" };
|
|
564
564
|
}
|
|
@@ -749,10 +749,15 @@ async function readViaImporter(filePath, def, options) {
|
|
|
749
749
|
throwIfAborted(signal);
|
|
750
750
|
container = mem;
|
|
751
751
|
}
|
|
752
|
-
return {
|
|
752
|
+
return {
|
|
753
|
+
doc: markdownToDoc(markdownDoc, { fileName: basename(filePath) }),
|
|
754
|
+
container,
|
|
755
|
+
markdownDoc,
|
|
756
|
+
sourceFormat: def.id
|
|
757
|
+
};
|
|
753
758
|
}
|
|
754
759
|
var DOC_JSON_NAMES = ["doc.json", "story.json"];
|
|
755
|
-
async function resolveContainer(container, sourceFormat, missingMessage, signal) {
|
|
760
|
+
async function resolveContainer(container, sourceFormat, missingMessage, signal, coverFileName) {
|
|
756
761
|
for (const name of DOC_JSON_NAMES) {
|
|
757
762
|
throwIfAborted(signal);
|
|
758
763
|
const jsonData = await container.readFile(name);
|
|
@@ -769,7 +774,12 @@ async function resolveContainer(container, sourceFormat, missingMessage, signal)
|
|
|
769
774
|
throw new Error(missingMessage);
|
|
770
775
|
}
|
|
771
776
|
const markdownDoc = parseMarkdown(markdown);
|
|
772
|
-
return {
|
|
777
|
+
return {
|
|
778
|
+
doc: markdownToDoc(markdownDoc, { fileName: coverFileName }),
|
|
779
|
+
container,
|
|
780
|
+
markdownDoc,
|
|
781
|
+
sourceFormat
|
|
782
|
+
};
|
|
773
783
|
}
|
|
774
784
|
async function readContainer(filePath, signal) {
|
|
775
785
|
throwIfAborted(signal);
|
|
@@ -779,7 +789,8 @@ async function readContainer(filePath, signal) {
|
|
|
779
789
|
container,
|
|
780
790
|
"dbk",
|
|
781
791
|
`No markdown document or doc.json found in container: ${filePath}`,
|
|
782
|
-
signal
|
|
792
|
+
signal,
|
|
793
|
+
basename(filePath)
|
|
783
794
|
);
|
|
784
795
|
}
|
|
785
796
|
async function readFolder(dirPath, signal) {
|
|
@@ -803,7 +814,8 @@ async function readFolder(dirPath, signal) {
|
|
|
803
814
|
container,
|
|
804
815
|
"folder",
|
|
805
816
|
`No markdown document or doc.json found in folder: ${dirPath}`,
|
|
806
|
-
signal
|
|
817
|
+
signal,
|
|
818
|
+
basename(dirPath)
|
|
807
819
|
);
|
|
808
820
|
}
|
|
809
821
|
function throwIfAborted(signal) {
|
|
@@ -330,7 +330,7 @@ function mp4Format() {
|
|
|
330
330
|
const animationsEnabled = typeof mp4Opts.animationsEnabled === "boolean" ? mp4Opts.animationsEnabled : MP4_DEFAULTS.animationsEnabled;
|
|
331
331
|
const outputPath = join(tmpdir(), `squisq-mp4-${randomBytes(8).toString("hex")}.mp4`);
|
|
332
332
|
try {
|
|
333
|
-
const { renderDocToMp4: renderDocToMp42 } = await import("./api-
|
|
333
|
+
const { renderDocToMp4: renderDocToMp42 } = await import("./api-E5PDCULT.js");
|
|
334
334
|
await renderDocToMp42(input.doc, input.container, {
|
|
335
335
|
outputPath,
|
|
336
336
|
fps,
|
|
@@ -371,7 +371,7 @@ function gifFormat() {
|
|
|
371
371
|
const defaultHeight = portrait ? GIF_DEFAULTS.width : GIF_DEFAULTS.height;
|
|
372
372
|
const outputPath = join(tmpdir(), `squisq-gif-${randomBytes(8).toString("hex")}.gif`);
|
|
373
373
|
try {
|
|
374
|
-
const { renderDocToGif: renderDocToGif2 } = await import("./api-
|
|
374
|
+
const { renderDocToGif: renderDocToGif2 } = await import("./api-E5PDCULT.js");
|
|
375
375
|
const result = await renderDocToGif2(input.doc, input.container, {
|
|
376
376
|
outputPath,
|
|
377
377
|
fps: typeof gifOpts.fps === "number" ? gifOpts.fps : GIF_DEFAULTS.fps,
|
|
@@ -555,7 +555,7 @@ async function readUtf8File(filePath, signal) {
|
|
|
555
555
|
async function readMarkdownFile(filePath, signal) {
|
|
556
556
|
const content = await readUtf8File(filePath, signal);
|
|
557
557
|
const markdownDoc = parseMarkdown(content);
|
|
558
|
-
const doc = markdownToDoc(markdownDoc);
|
|
558
|
+
const doc = markdownToDoc(markdownDoc, { fileName: basename(filePath) });
|
|
559
559
|
const container = await buildBareMarkdownContainer(filePath, content, doc, signal);
|
|
560
560
|
return { doc, container, markdownDoc, sourceFormat: "md" };
|
|
561
561
|
}
|
|
@@ -746,10 +746,15 @@ async function readViaImporter(filePath, def, options) {
|
|
|
746
746
|
throwIfAborted(signal);
|
|
747
747
|
container = mem;
|
|
748
748
|
}
|
|
749
|
-
return {
|
|
749
|
+
return {
|
|
750
|
+
doc: markdownToDoc(markdownDoc, { fileName: basename(filePath) }),
|
|
751
|
+
container,
|
|
752
|
+
markdownDoc,
|
|
753
|
+
sourceFormat: def.id
|
|
754
|
+
};
|
|
750
755
|
}
|
|
751
756
|
var DOC_JSON_NAMES = ["doc.json", "story.json"];
|
|
752
|
-
async function resolveContainer(container, sourceFormat, missingMessage, signal) {
|
|
757
|
+
async function resolveContainer(container, sourceFormat, missingMessage, signal, coverFileName) {
|
|
753
758
|
for (const name of DOC_JSON_NAMES) {
|
|
754
759
|
throwIfAborted(signal);
|
|
755
760
|
const jsonData = await container.readFile(name);
|
|
@@ -766,7 +771,12 @@ async function resolveContainer(container, sourceFormat, missingMessage, signal)
|
|
|
766
771
|
throw new Error(missingMessage);
|
|
767
772
|
}
|
|
768
773
|
const markdownDoc = parseMarkdown(markdown);
|
|
769
|
-
return {
|
|
774
|
+
return {
|
|
775
|
+
doc: markdownToDoc(markdownDoc, { fileName: coverFileName }),
|
|
776
|
+
container,
|
|
777
|
+
markdownDoc,
|
|
778
|
+
sourceFormat
|
|
779
|
+
};
|
|
770
780
|
}
|
|
771
781
|
async function readContainer(filePath, signal) {
|
|
772
782
|
throwIfAborted(signal);
|
|
@@ -776,7 +786,8 @@ async function readContainer(filePath, signal) {
|
|
|
776
786
|
container,
|
|
777
787
|
"dbk",
|
|
778
788
|
`No markdown document or doc.json found in container: ${filePath}`,
|
|
779
|
-
signal
|
|
789
|
+
signal,
|
|
790
|
+
basename(filePath)
|
|
780
791
|
);
|
|
781
792
|
}
|
|
782
793
|
async function readFolder(dirPath, signal) {
|
|
@@ -800,7 +811,8 @@ async function readFolder(dirPath, signal) {
|
|
|
800
811
|
container,
|
|
801
812
|
"folder",
|
|
802
813
|
`No markdown document or doc.json found in folder: ${dirPath}`,
|
|
803
|
-
signal
|
|
814
|
+
signal,
|
|
815
|
+
basename(dirPath)
|
|
804
816
|
);
|
|
805
817
|
}
|
|
806
818
|
function throwIfAborted(signal) {
|