@bendyline/squisq-formats 2.3.0 → 2.3.1
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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
THIRD-PARTY LICENSES FOR @bendyline/squisq-formats
|
|
2
|
+
|
|
3
|
+
Generated from the actual esbuild input graph. Package-local license, copying,
|
|
4
|
+
and notice files are reproduced verbatim. When an npm tarball omits its
|
|
5
|
+
repository license, the pinned upstream copy is vendored and identified below.
|
|
6
|
+
|
|
7
|
+
COMPONENTS
|
|
8
|
+
|
|
@@ -167,10 +167,11 @@ ${mode === "static" ? "#squisq-root{display:block}" : ""}
|
|
|
167
167
|
</head>
|
|
168
168
|
<body>
|
|
169
169
|
<div id="squisq-root"></div>
|
|
170
|
+
<script type="application/json" id="squisq-doc" data-squisq-doc="1">${docJson}</script>
|
|
170
171
|
<script>${escapeForScript(playerScript)}</script>
|
|
171
172
|
<script>
|
|
172
173
|
(function(){
|
|
173
|
-
var doc = JSON.parse(
|
|
174
|
+
var doc = JSON.parse(document.getElementById("squisq-doc").textContent);
|
|
174
175
|
var images = JSON.parse(${JSON.stringify(imageMapJson)});
|
|
175
176
|
// Re-expand path/basename aliases that share a payload (see
|
|
176
177
|
// buildInlineImageMaps) so \`images\` has every key the resolver may ask for.
|
|
@@ -221,10 +222,11 @@ ${mode === "static" ? "#squisq-root{display:block}" : ""}
|
|
|
221
222
|
</head>
|
|
222
223
|
<body>
|
|
223
224
|
<div id="squisq-root"></div>
|
|
225
|
+
<script type="application/json" id="squisq-doc" data-squisq-doc="1">${docJson}</script>
|
|
224
226
|
<script src="${escapeHtml(playerScriptPath)}"></script>
|
|
225
227
|
<script>
|
|
226
228
|
(function(){
|
|
227
|
-
var doc = JSON.parse(
|
|
229
|
+
var doc = JSON.parse(document.getElementById("squisq-doc").textContent);
|
|
228
230
|
var images = JSON.parse(${JSON.stringify(imageMapJson)});
|
|
229
231
|
var audio = ${audioMapJson};
|
|
230
232
|
SquisqPlayer.mount(document.getElementById("squisq-root"), doc, {
|
|
@@ -1223,6 +1225,7 @@ import {
|
|
|
1223
1225
|
sanitizeHtmlNodes as sanitizeHtmlNodes2,
|
|
1224
1226
|
stringifyMarkdown
|
|
1225
1227
|
} from "@bendyline/squisq/markdown";
|
|
1228
|
+
import { docToMarkdown } from "@bendyline/squisq/doc";
|
|
1226
1229
|
var HEADINGS = {
|
|
1227
1230
|
h1: 1,
|
|
1228
1231
|
h2: 2,
|
|
@@ -1409,6 +1412,33 @@ function toHtmlString(data) {
|
|
|
1409
1412
|
const bytes = data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
1410
1413
|
return new TextDecoder("utf-8").decode(bytes);
|
|
1411
1414
|
}
|
|
1415
|
+
function findEmbeddedSquisqDoc(nodes) {
|
|
1416
|
+
for (const node of nodes) {
|
|
1417
|
+
if (!isElement(node)) continue;
|
|
1418
|
+
if (node.tagName.toLowerCase() === "script" && "data-squisq-doc" in node.attributes) {
|
|
1419
|
+
return node;
|
|
1420
|
+
}
|
|
1421
|
+
const nested = findEmbeddedSquisqDoc(node.children);
|
|
1422
|
+
if (nested) return nested;
|
|
1423
|
+
}
|
|
1424
|
+
return void 0;
|
|
1425
|
+
}
|
|
1426
|
+
function parseEmbeddedSquisqDoc(script) {
|
|
1427
|
+
const version = script.attributes["data-squisq-doc"];
|
|
1428
|
+
if (version !== "1") {
|
|
1429
|
+
throw new Error(`Unsupported embedded Squisq Doc version "${version || "(missing)"}"`);
|
|
1430
|
+
}
|
|
1431
|
+
let value;
|
|
1432
|
+
try {
|
|
1433
|
+
value = JSON.parse(textContent(script));
|
|
1434
|
+
} catch {
|
|
1435
|
+
throw new SyntaxError("Invalid embedded Squisq Doc JSON");
|
|
1436
|
+
}
|
|
1437
|
+
if (value === null || typeof value !== "object" || typeof value.articleId !== "string" || !Number.isFinite(value.duration) || !Array.isArray(value.blocks) || value.audio === null || typeof value.audio !== "object") {
|
|
1438
|
+
throw new TypeError("Embedded Squisq Doc has an invalid shape");
|
|
1439
|
+
}
|
|
1440
|
+
return value;
|
|
1441
|
+
}
|
|
1412
1442
|
function htmlToMarkdownDocSync(html, options = {}) {
|
|
1413
1443
|
options.signal?.throwIfAborted();
|
|
1414
1444
|
const maxInputChars = options.maxInputChars ?? 16 * 1024 * 1024;
|
|
@@ -1419,6 +1449,8 @@ function htmlToMarkdownDocSync(html, options = {}) {
|
|
|
1419
1449
|
throw new RangeError(`HTML exceeds the ${maxInputChars}-character safety limit`);
|
|
1420
1450
|
}
|
|
1421
1451
|
let nodes = parseHtmlToNodes(html);
|
|
1452
|
+
const embedded = findEmbeddedSquisqDoc(nodes);
|
|
1453
|
+
if (embedded) return docToMarkdown(parseEmbeddedSquisqDoc(embedded));
|
|
1422
1454
|
if (options.sanitize !== false) nodes = sanitizeHtmlNodes2(nodes);
|
|
1423
1455
|
return { type: "document", children: blocksFromNodes(nodes) };
|
|
1424
1456
|
}
|
package/dist/html/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
defaultRegistry,
|
|
12
12
|
prepareConversion,
|
|
13
13
|
resolveConversionLimits
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LBHZSY7N.js";
|
|
15
15
|
import {
|
|
16
16
|
inferThemeFromFile
|
|
17
17
|
} from "./chunk-6S6GU3ZG.js";
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
htmlToMarkdown,
|
|
72
72
|
htmlToMarkdownDoc,
|
|
73
73
|
htmlToMarkdownDocSync
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-T7M52LHF.js";
|
|
75
75
|
import "./chunk-6RQOV3B3.js";
|
|
76
76
|
import "./chunk-AONELFLA.js";
|
|
77
77
|
export {
|
package/dist/registry/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/squisq-formats",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Document format converters — DOCX, PDF, OOXML import/export",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"dist",
|
|
35
35
|
"!dist/**/*.map",
|
|
36
36
|
"LICENSE",
|
|
37
|
-
"NOTICE.md"
|
|
37
|
+
"NOTICE.md",
|
|
38
|
+
"THIRD_PARTY_LICENSES.txt"
|
|
38
39
|
],
|
|
39
40
|
"exports": {
|
|
40
41
|
".": {
|
|
@@ -99,14 +100,14 @@
|
|
|
99
100
|
}
|
|
100
101
|
},
|
|
101
102
|
"scripts": {
|
|
102
|
-
"build": "tsup && node ../../scripts/remove-empty-chunks.mjs dist",
|
|
103
|
+
"build": "tsup && node ../../scripts/generate-bundle-licenses.mjs . && node ../../scripts/remove-empty-chunks.mjs dist",
|
|
103
104
|
"dev": "concurrently -n js,dts -c blue,gray -r \"tsup --watch --no-dts --no-clean\" \"tsup --watch --dts-only --no-clean\"",
|
|
104
105
|
"typecheck": "tsc --noEmit"
|
|
105
106
|
},
|
|
106
107
|
"dependencies": {
|
|
107
108
|
"@pdf-lib/upng": "1.0.1",
|
|
108
109
|
"@xmldom/xmldom": "0.9.10",
|
|
109
|
-
"@bendyline/squisq": "2.3.
|
|
110
|
+
"@bendyline/squisq": "2.3.1",
|
|
110
111
|
"jszip": "3.10.1",
|
|
111
112
|
"pdf-lib": "1.17.1",
|
|
112
113
|
"pdfjs-dist": "4.10.38"
|
|
File without changes
|