epub-codec 1.2.11 → 1.3.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/README.md +24 -10
- package/dist/base64--HuymRl_.d.cts +5 -0
- package/dist/base64--HuymRl_.d.ts +5 -0
- package/dist/build-B1UxbO20.d.cts +5 -0
- package/dist/build-BCUsHLYw.d.ts +5 -0
- package/dist/codec-CX2Pa6Jq.d.ts +2876 -0
- package/dist/codec-qyKMOMt6.d.cts +2876 -0
- package/dist/codec.cjs +16 -0
- package/dist/codec.d.cts +2 -2702
- package/dist/codec.d.ts +2 -2702
- package/dist/codec.js +14 -1
- package/dist/container-B6cHHiY9.d.cts +4 -0
- package/dist/container-B6cHHiY9.d.ts +4 -0
- package/dist/context-CTgx7PwU.d.ts +28 -0
- package/dist/context-CXs2Yc9w.d.cts +28 -0
- package/dist/dimensions-B7ogpvKQ.d.cts +11 -0
- package/dist/dimensions-B7ogpvKQ.d.ts +11 -0
- package/dist/entities-CfQKtI34.d.ts +7 -0
- package/dist/entities-wt9zCx5q.d.cts +7 -0
- package/dist/footnote-CxsO5tCV.d.cts +7 -0
- package/dist/footnote-iZAPC_NT.d.ts +7 -0
- package/dist/format-DxUddUPj.d.cts +6 -0
- package/dist/format-DxUddUPj.d.ts +6 -0
- package/dist/format.d.cts +1 -5
- package/dist/format.d.ts +1 -5
- package/dist/image/dimensions.d.cts +1 -10
- package/dist/image/dimensions.d.ts +1 -10
- package/dist/index.cjs +24 -8
- package/dist/index.d.cts +31 -31
- package/dist/index.d.ts +31 -31
- package/dist/index.js +13 -10
- package/dist/inline-DDj6Sl3e.d.ts +12 -0
- package/dist/inline-YZOQY2wR.d.cts +12 -0
- package/dist/list-id-BB_yxm1H.d.cts +13 -0
- package/dist/list-id-BB_yxm1H.d.ts +13 -0
- package/dist/metadata-DXto7sM6.d.cts +7 -0
- package/dist/metadata-T5V2ovtS.d.ts +7 -0
- package/dist/model/package.cjs +19 -0
- package/dist/model/package.d.cts +2 -0
- package/dist/model/package.d.ts +2 -0
- package/dist/model/package.js +15 -0
- package/dist/nav/nav3.cjs +1 -1
- package/dist/nav/nav3.d.cts +1 -3
- package/dist/nav/nav3.d.ts +1 -3
- package/dist/nav/nav3.js +1 -1
- package/dist/nav/ncx.cjs +1 -1
- package/dist/nav/ncx.d.cts +1 -3
- package/dist/nav/ncx.d.ts +1 -3
- package/dist/nav/ncx.js +1 -1
- package/dist/nav/reconcile.d.cts +1 -3
- package/dist/nav/reconcile.d.ts +1 -3
- package/dist/nav/write.cjs +1 -1
- package/dist/nav/write.d.cts +1 -9
- package/dist/nav/write.d.ts +1 -9
- package/dist/nav/write.js +1 -1
- package/dist/nav3-SbAp8zlu.d.cts +4 -0
- package/dist/nav3-SbAp8zlu.d.ts +4 -0
- package/dist/ncx-kYhlXucj.d.cts +4 -0
- package/dist/ncx-kYhlXucj.d.ts +4 -0
- package/dist/node-CJLSSs1k.d.cts +84 -0
- package/dist/node-CJLSSs1k.d.ts +84 -0
- package/dist/ocf/container.cjs +1 -1
- package/dist/ocf/container.d.cts +1 -3
- package/dist/ocf/container.d.ts +1 -3
- package/dist/ocf/container.js +1 -1
- package/dist/ocf/write.d.cts +1 -3
- package/dist/ocf/write.d.ts +1 -3
- package/dist/opf/metadata.d.cts +1 -6
- package/dist/opf/metadata.d.ts +1 -6
- package/dist/opf/parse.cjs +1 -1
- package/dist/opf/parse.d.cts +1 -5
- package/dist/opf/parse.d.ts +1 -5
- package/dist/opf/parse.js +1 -1
- package/dist/opf/types.d.cts +1 -19
- package/dist/opf/types.d.ts +1 -19
- package/dist/opf/write.cjs +1 -1
- package/dist/opf/write.d.cts +1 -11
- package/dist/opf/write.d.ts +1 -11
- package/dist/opf/write.js +1 -1
- package/dist/package-io/read.cjs +39 -0
- package/dist/package-io/read.d.cts +2 -0
- package/dist/package-io/read.d.ts +2 -0
- package/dist/package-io/read.js +37 -0
- package/dist/package-io/write.cjs +34 -0
- package/dist/package-io/write.d.cts +2 -0
- package/dist/package-io/write.d.ts +2 -0
- package/dist/package-io/write.js +32 -0
- package/dist/parse-Bkkb7qXz.d.cts +6 -0
- package/dist/parse-C5GxodcX.d.ts +6 -0
- package/dist/parse-CmCjyz8i.d.cts +5 -0
- package/dist/parse-Dc76LQIj.d.ts +5 -0
- package/dist/path-Cx8-QMD6.d.cts +5 -0
- package/dist/path-Cx8-QMD6.d.ts +5 -0
- package/dist/path.d.cts +1 -4
- package/dist/path.d.ts +1 -4
- package/dist/query-B79eElol.d.ts +12 -0
- package/dist/query-C6ftPqNQ.d.cts +12 -0
- package/dist/read-B7kc_MeO.d.cts +10 -0
- package/dist/read-BMGq_D9y.d.cts +30 -0
- package/dist/read-Czqr3aop.d.ts +30 -0
- package/dist/read-DPkpZsYG.d.ts +10 -0
- package/dist/read.cjs +51 -6
- package/dist/read.d.cts +1 -9
- package/dist/read.d.ts +1 -9
- package/dist/read.js +52 -7
- package/dist/reconcile-BHky0kta.d.cts +4 -0
- package/dist/reconcile-BHky0kta.d.ts +4 -0
- package/dist/style-constants-RVoHdmju.d.cts +8 -0
- package/dist/style-constants-RVoHdmju.d.ts +8 -0
- package/dist/types-BxmkPT_F.d.cts +20 -0
- package/dist/types-BxmkPT_F.d.ts +20 -0
- package/dist/util/base64.d.cts +1 -4
- package/dist/util/base64.d.ts +1 -4
- package/dist/write-B89sagtw.d.cts +12 -0
- package/dist/write-BQcrPQvx.d.ts +10 -0
- package/dist/write-Boxi3aK0.d.cts +10 -0
- package/dist/write-COdkb8lG.d.cts +10 -0
- package/dist/write-COdkb8lG.d.ts +10 -0
- package/dist/write-DwaEwwgZ.d.ts +12 -0
- package/dist/write-DxiR-9eH.d.cts +4 -0
- package/dist/write-DxiR-9eH.d.ts +4 -0
- package/dist/write-Klo0WDhT.d.ts +13 -0
- package/dist/write-WSIgARHT.d.cts +13 -0
- package/dist/write.cjs +28 -6
- package/dist/write.d.cts +1 -9
- package/dist/write.d.ts +1 -9
- package/dist/write.js +28 -6
- package/dist/xhtml/context.d.cts +2 -22
- package/dist/xhtml/context.d.ts +2 -22
- package/dist/xhtml/footnote.cjs +4 -8
- package/dist/xhtml/footnote.d.cts +2 -7
- package/dist/xhtml/footnote.d.ts +2 -7
- package/dist/xhtml/footnote.js +4 -8
- package/dist/xhtml/inline.cjs +13 -7
- package/dist/xhtml/inline.d.cts +1 -11
- package/dist/xhtml/inline.d.ts +1 -11
- package/dist/xhtml/inline.js +13 -7
- package/dist/xhtml/link-target.cjs +18 -0
- package/dist/xhtml/link-target.d.cts +8 -0
- package/dist/xhtml/link-target.d.ts +8 -0
- package/dist/xhtml/link-target.js +17 -0
- package/dist/xhtml/list-id.d.cts +1 -12
- package/dist/xhtml/list-id.d.ts +1 -12
- package/dist/xhtml/read.cjs +50 -18
- package/dist/xhtml/read.d.cts +2 -20
- package/dist/xhtml/read.d.ts +2 -20
- package/dist/xhtml/read.js +49 -19
- package/dist/xhtml/style-constants.d.cts +1 -7
- package/dist/xhtml/style-constants.d.ts +1 -7
- package/dist/xhtml/write.cjs +44 -19
- package/dist/xhtml/write.d.cts +1 -11
- package/dist/xhtml/write.d.ts +1 -11
- package/dist/xhtml/write.js +44 -19
- package/dist/xml/build.d.cts +1 -4
- package/dist/xml/build.d.ts +1 -4
- package/dist/xml/entities.d.cts +1 -6
- package/dist/xml/entities.d.ts +1 -6
- package/dist/xml/node.d.cts +1 -83
- package/dist/xml/node.d.ts +1 -83
- package/dist/xml/parse.d.cts +1 -4
- package/dist/xml/parse.d.ts +1 -4
- package/dist/xml/query.cjs +1 -1
- package/dist/xml/query.d.cts +1 -11
- package/dist/xml/query.d.ts +1 -11
- package/dist/xml/query.js +1 -1
- package/dist/zip-ie17sOo5.d.cts +9 -0
- package/dist/zip-ie17sOo5.d.ts +9 -0
- package/dist/zip.d.cts +1 -8
- package/dist/zip.d.ts +1 -8
- package/package.json +19 -22
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { i as EpubDiagnosticSink } from "./diagnostics-C0CRdoda.js";
|
|
2
|
+
import { l as XmlElement } from "./node-CJLSSs1k.js";
|
|
3
|
+
import { LayoutMetadata } from "document-schema.js";
|
|
4
|
+
//#region src/opf/metadata.d.ts
|
|
5
|
+
declare function readOpfMetadata(metadataElement: XmlElement, sink: EpubDiagnosticSink): LayoutMetadata;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { readOpfMetadata as t };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_xml_node = require("../xml/node.cjs");
|
|
3
|
+
let zod = require("zod");
|
|
4
|
+
//#region src/model/package.ts
|
|
5
|
+
const XmlPartSchema = zod.z.object({
|
|
6
|
+
kind: zod.z.literal("xml"),
|
|
7
|
+
nodes: zod.z.array(require_xml_node.XmlNodeSchema)
|
|
8
|
+
});
|
|
9
|
+
const BinaryPartSchema = zod.z.object({
|
|
10
|
+
kind: zod.z.literal("binary"),
|
|
11
|
+
base64: zod.z.string()
|
|
12
|
+
});
|
|
13
|
+
const PartSchema = zod.z.discriminatedUnion("kind", [XmlPartSchema, BinaryPartSchema]);
|
|
14
|
+
const EpubPackageSchema = zod.z.object({ parts: zod.z.record(zod.z.string(), PartSchema) });
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.BinaryPartSchema = BinaryPartSchema;
|
|
17
|
+
exports.EpubPackageSchema = EpubPackageSchema;
|
|
18
|
+
exports.PartSchema = PartSchema;
|
|
19
|
+
exports.XmlPartSchema = XmlPartSchema;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as XmlPart, d as BinaryPart, f as BinaryPartSchema, g as PartSchema, h as Part, m as EpubPackageSchema, p as EpubPackage, v as XmlPartSchema } from "../codec-qyKMOMt6.cjs";
|
|
2
|
+
export { BinaryPart, BinaryPartSchema, EpubPackage, EpubPackageSchema, Part, PartSchema, XmlPart, XmlPartSchema };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as XmlPart, d as BinaryPart, f as BinaryPartSchema, g as PartSchema, h as Part, m as EpubPackageSchema, p as EpubPackage, v as XmlPartSchema } from "../codec-CX2Pa6Jq.js";
|
|
2
|
+
export { BinaryPart, BinaryPartSchema, EpubPackage, EpubPackageSchema, Part, PartSchema, XmlPart, XmlPartSchema };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { XmlNodeSchema } from "../xml/node.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/model/package.ts
|
|
4
|
+
const XmlPartSchema = z.object({
|
|
5
|
+
kind: z.literal("xml"),
|
|
6
|
+
nodes: z.array(XmlNodeSchema)
|
|
7
|
+
});
|
|
8
|
+
const BinaryPartSchema = z.object({
|
|
9
|
+
kind: z.literal("binary"),
|
|
10
|
+
base64: z.string()
|
|
11
|
+
});
|
|
12
|
+
const PartSchema = z.discriminatedUnion("kind", [XmlPartSchema, BinaryPartSchema]);
|
|
13
|
+
const EpubPackageSchema = z.object({ parts: z.record(z.string(), PartSchema) });
|
|
14
|
+
//#endregion
|
|
15
|
+
export { BinaryPartSchema, EpubPackageSchema, PartSchema, XmlPartSchema };
|
package/dist/nav/nav3.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_xml_query = require("../xml/query.cjs");
|
|
3
2
|
const require_xml_parse = require("../xml/parse.cjs");
|
|
3
|
+
const require_xml_query = require("../xml/query.cjs");
|
|
4
4
|
//#region src/nav/nav3.ts
|
|
5
5
|
function readNav3TocHrefs(navXhtml) {
|
|
6
6
|
const nodes = require_xml_parse.parseXml(navXhtml);
|
package/dist/nav/nav3.d.cts
CHANGED
package/dist/nav/nav3.d.ts
CHANGED
package/dist/nav/nav3.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { attrValue, elementsWithTag, findChildElement, findElement, rootElement } from "../xml/query.js";
|
|
2
1
|
import { parseXml } from "../xml/parse.js";
|
|
2
|
+
import { attrValue, elementsWithTag, findChildElement, findElement, rootElement } from "../xml/query.js";
|
|
3
3
|
//#region src/nav/nav3.ts
|
|
4
4
|
function readNav3TocHrefs(navXhtml) {
|
|
5
5
|
const nodes = parseXml(navXhtml);
|
package/dist/nav/ncx.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_xml_query = require("../xml/query.cjs");
|
|
3
2
|
const require_xml_parse = require("../xml/parse.cjs");
|
|
3
|
+
const require_xml_query = require("../xml/query.cjs");
|
|
4
4
|
//#region src/nav/ncx.ts
|
|
5
5
|
function readNcxHrefs(ncxXml) {
|
|
6
6
|
const nodes = require_xml_parse.parseXml(ncxXml);
|
package/dist/nav/ncx.d.cts
CHANGED
package/dist/nav/ncx.d.ts
CHANGED
package/dist/nav/ncx.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { attrValue, elementsWithTag, findChildElement, rootElement } from "../xml/query.js";
|
|
2
1
|
import { parseXml } from "../xml/parse.js";
|
|
2
|
+
import { attrValue, elementsWithTag, findChildElement, rootElement } from "../xml/query.js";
|
|
3
3
|
//#region src/nav/ncx.ts
|
|
4
4
|
function readNcxHrefs(ncxXml) {
|
|
5
5
|
const nodes = parseXml(ncxXml);
|
package/dist/nav/reconcile.d.cts
CHANGED
package/dist/nav/reconcile.d.ts
CHANGED
package/dist/nav/write.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_xml_entities = require("../xml/entities.cjs");
|
|
3
2
|
const require_xml_build = require("../xml/build.cjs");
|
|
3
|
+
const require_xml_entities = require("../xml/entities.cjs");
|
|
4
4
|
//#region src/nav/write.ts
|
|
5
5
|
function element(tag, attrs = {}, children = []) {
|
|
6
6
|
return {
|
package/dist/nav/write.d.cts
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/nav/write.d.ts
|
|
3
|
-
interface NavSectionEntry {
|
|
4
|
-
readonly href: string;
|
|
5
|
-
readonly section: ContentSection;
|
|
6
|
-
}
|
|
7
|
-
declare function sectionTitle(section: ContentSection, index: number): string;
|
|
8
|
-
declare function writeNav3Document(entries: readonly NavSectionEntry[]): string;
|
|
9
|
-
//#endregion
|
|
1
|
+
import { n as sectionTitle, r as writeNav3Document, t as NavSectionEntry } from "../write-COdkb8lG.cjs";
|
|
10
2
|
export { NavSectionEntry, sectionTitle, writeNav3Document };
|
package/dist/nav/write.d.ts
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/nav/write.d.ts
|
|
3
|
-
interface NavSectionEntry {
|
|
4
|
-
readonly href: string;
|
|
5
|
-
readonly section: ContentSection;
|
|
6
|
-
}
|
|
7
|
-
declare function sectionTitle(section: ContentSection, index: number): string;
|
|
8
|
-
declare function writeNav3Document(entries: readonly NavSectionEntry[]): string;
|
|
9
|
-
//#endregion
|
|
1
|
+
import { n as sectionTitle, r as writeNav3Document, t as NavSectionEntry } from "../write-COdkb8lG.js";
|
|
10
2
|
export { NavSectionEntry, sectionTitle, writeNav3Document };
|
package/dist/nav/write.js
CHANGED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/xml/node.d.ts
|
|
3
|
+
declare const AttributeSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
value: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
type Attribute = z.infer<typeof AttributeSchema>;
|
|
8
|
+
declare const XmlTextSchema: z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"text">;
|
|
10
|
+
value: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
type XmlText = z.infer<typeof XmlTextSchema>;
|
|
13
|
+
declare const XmlCdataSchema: z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"cdata">;
|
|
15
|
+
value: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type XmlCdata = z.infer<typeof XmlCdataSchema>;
|
|
18
|
+
declare const XmlCommentSchema: z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<"comment">;
|
|
20
|
+
value: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
type XmlComment = z.infer<typeof XmlCommentSchema>;
|
|
23
|
+
declare const XmlDeclarationSchema: z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"declaration">;
|
|
25
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
value: z.ZodString;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
type XmlDeclaration = z.infer<typeof XmlDeclarationSchema>;
|
|
31
|
+
declare const XmlPiSchema: z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"pi">;
|
|
33
|
+
target: z.ZodString;
|
|
34
|
+
content: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
type XmlPi = z.infer<typeof XmlPiSchema>;
|
|
37
|
+
interface XmlElement {
|
|
38
|
+
type: "element";
|
|
39
|
+
tag: string;
|
|
40
|
+
attributes: Attribute[];
|
|
41
|
+
children: XmlNode[];
|
|
42
|
+
}
|
|
43
|
+
type XmlNode = XmlText | XmlCdata | XmlComment | XmlDeclaration | XmlPi | XmlElement;
|
|
44
|
+
declare function isTextLikeNode(node: XmlNode): node is XmlText | XmlCdata;
|
|
45
|
+
declare function isXmlNode(value: unknown): value is XmlNode;
|
|
46
|
+
declare const XmlElementSchema: z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"element">;
|
|
48
|
+
tag: z.ZodString;
|
|
49
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
value: z.ZodString;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
declare const XmlNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
56
|
+
type: z.ZodLiteral<"text">;
|
|
57
|
+
value: z.ZodString;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"cdata">;
|
|
60
|
+
value: z.ZodString;
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
62
|
+
type: z.ZodLiteral<"comment">;
|
|
63
|
+
value: z.ZodString;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
type: z.ZodLiteral<"declaration">;
|
|
66
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
value: z.ZodString;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"pi">;
|
|
72
|
+
target: z.ZodString;
|
|
73
|
+
content: z.ZodString;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"element">;
|
|
76
|
+
tag: z.ZodString;
|
|
77
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
78
|
+
name: z.ZodString;
|
|
79
|
+
value: z.ZodString;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
82
|
+
}, z.core.$strip>], "type">;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { isTextLikeNode as _, XmlComment as a, XmlDeclarationSchema as c, XmlNode as d, XmlNodeSchema as f, XmlTextSchema as g, XmlText as h, XmlCdataSchema as i, XmlElement as l, XmlPiSchema as m, AttributeSchema as n, XmlCommentSchema as o, XmlPi as p, XmlCdata as r, XmlDeclaration as s, Attribute as t, XmlElementSchema as u, isXmlNode as v };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/xml/node.d.ts
|
|
3
|
+
declare const AttributeSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
value: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
type Attribute = z.infer<typeof AttributeSchema>;
|
|
8
|
+
declare const XmlTextSchema: z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"text">;
|
|
10
|
+
value: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
type XmlText = z.infer<typeof XmlTextSchema>;
|
|
13
|
+
declare const XmlCdataSchema: z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"cdata">;
|
|
15
|
+
value: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type XmlCdata = z.infer<typeof XmlCdataSchema>;
|
|
18
|
+
declare const XmlCommentSchema: z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<"comment">;
|
|
20
|
+
value: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
type XmlComment = z.infer<typeof XmlCommentSchema>;
|
|
23
|
+
declare const XmlDeclarationSchema: z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"declaration">;
|
|
25
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
value: z.ZodString;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
type XmlDeclaration = z.infer<typeof XmlDeclarationSchema>;
|
|
31
|
+
declare const XmlPiSchema: z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"pi">;
|
|
33
|
+
target: z.ZodString;
|
|
34
|
+
content: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
type XmlPi = z.infer<typeof XmlPiSchema>;
|
|
37
|
+
interface XmlElement {
|
|
38
|
+
type: "element";
|
|
39
|
+
tag: string;
|
|
40
|
+
attributes: Attribute[];
|
|
41
|
+
children: XmlNode[];
|
|
42
|
+
}
|
|
43
|
+
type XmlNode = XmlText | XmlCdata | XmlComment | XmlDeclaration | XmlPi | XmlElement;
|
|
44
|
+
declare function isTextLikeNode(node: XmlNode): node is XmlText | XmlCdata;
|
|
45
|
+
declare function isXmlNode(value: unknown): value is XmlNode;
|
|
46
|
+
declare const XmlElementSchema: z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"element">;
|
|
48
|
+
tag: z.ZodString;
|
|
49
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
value: z.ZodString;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
declare const XmlNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
56
|
+
type: z.ZodLiteral<"text">;
|
|
57
|
+
value: z.ZodString;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"cdata">;
|
|
60
|
+
value: z.ZodString;
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
62
|
+
type: z.ZodLiteral<"comment">;
|
|
63
|
+
value: z.ZodString;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
type: z.ZodLiteral<"declaration">;
|
|
66
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
value: z.ZodString;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"pi">;
|
|
72
|
+
target: z.ZodString;
|
|
73
|
+
content: z.ZodString;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"element">;
|
|
76
|
+
tag: z.ZodString;
|
|
77
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
78
|
+
name: z.ZodString;
|
|
79
|
+
value: z.ZodString;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
82
|
+
}, z.core.$strip>], "type">;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { isTextLikeNode as _, XmlComment as a, XmlDeclarationSchema as c, XmlNode as d, XmlNodeSchema as f, XmlTextSchema as g, XmlText as h, XmlCdataSchema as i, XmlElement as l, XmlPiSchema as m, AttributeSchema as n, XmlCommentSchema as o, XmlPi as p, XmlCdata as r, XmlDeclaration as s, Attribute as t, XmlElementSchema as u, isXmlNode as v };
|
package/dist/ocf/container.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_xml_parse = require("../xml/parse.cjs");
|
|
2
3
|
const require_diagnostics = require("../diagnostics.cjs");
|
|
3
4
|
const require_xml_query = require("../xml/query.cjs");
|
|
4
|
-
const require_xml_parse = require("../xml/parse.cjs");
|
|
5
5
|
//#region src/ocf/container.ts
|
|
6
6
|
const OPF_MEDIA_TYPE = "application/oebps-package+xml";
|
|
7
7
|
function resolveOpfPath(containerXml) {
|
package/dist/ocf/container.d.cts
CHANGED
package/dist/ocf/container.d.ts
CHANGED
package/dist/ocf/container.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { parseXml } from "../xml/parse.js";
|
|
1
2
|
import { EpubInvalidContainerError } from "../diagnostics.js";
|
|
2
3
|
import { attrValue, childrenWithTag, findChildElement, rootElement } from "../xml/query.js";
|
|
3
|
-
import { parseXml } from "../xml/parse.js";
|
|
4
4
|
//#region src/ocf/container.ts
|
|
5
5
|
const OPF_MEDIA_TYPE = "application/oebps-package+xml";
|
|
6
6
|
function resolveOpfPath(containerXml) {
|
package/dist/ocf/write.d.cts
CHANGED
package/dist/ocf/write.d.ts
CHANGED
package/dist/opf/metadata.d.cts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { XmlElement } from "../xml/node.cjs";
|
|
3
|
-
import { LayoutMetadata } from "document-schema.js";
|
|
4
|
-
//#region src/opf/metadata.d.ts
|
|
5
|
-
declare function readOpfMetadata(metadataElement: XmlElement, sink: EpubDiagnosticSink): LayoutMetadata;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { t as readOpfMetadata } from "../metadata-DXto7sM6.cjs";
|
|
7
2
|
export { readOpfMetadata };
|
package/dist/opf/metadata.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { XmlElement } from "../xml/node.js";
|
|
3
|
-
import { LayoutMetadata } from "document-schema.js";
|
|
4
|
-
//#region src/opf/metadata.d.ts
|
|
5
|
-
declare function readOpfMetadata(metadataElement: XmlElement, sink: EpubDiagnosticSink): LayoutMetadata;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { t as readOpfMetadata } from "../metadata-T5V2ovtS.js";
|
|
7
2
|
export { readOpfMetadata };
|
package/dist/opf/parse.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_xml_parse = require("../xml/parse.cjs");
|
|
2
3
|
const require_diagnostics = require("../diagnostics.cjs");
|
|
3
4
|
const require_xml_query = require("../xml/query.cjs");
|
|
4
|
-
const require_xml_parse = require("../xml/parse.cjs");
|
|
5
5
|
const require_opf_metadata = require("./metadata.cjs");
|
|
6
6
|
//#region src/opf/parse.ts
|
|
7
7
|
function parseOpf(opfXml, sink = require_diagnostics.NOOP_EPUB_DIAGNOSTIC_SINK) {
|
package/dist/opf/parse.d.cts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OpfPackage } from "./types.cjs";
|
|
3
|
-
//#region src/opf/parse.d.ts
|
|
4
|
-
declare function parseOpf(opfXml: string, sink?: EpubDiagnosticSink): OpfPackage;
|
|
5
|
-
//#endregion
|
|
1
|
+
import { t as parseOpf } from "../parse-Bkkb7qXz.cjs";
|
|
6
2
|
export { parseOpf };
|
package/dist/opf/parse.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OpfPackage } from "./types.js";
|
|
3
|
-
//#region src/opf/parse.d.ts
|
|
4
|
-
declare function parseOpf(opfXml: string, sink?: EpubDiagnosticSink): OpfPackage;
|
|
5
|
-
//#endregion
|
|
1
|
+
import { t as parseOpf } from "../parse-C5GxodcX.js";
|
|
6
2
|
export { parseOpf };
|
package/dist/opf/parse.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { parseXml } from "../xml/parse.js";
|
|
1
2
|
import { EpubInvalidOpfError, NOOP_EPUB_DIAGNOSTIC_SINK } from "../diagnostics.js";
|
|
2
3
|
import { attrValue, childrenWithTag, findChildElement, rootElement } from "../xml/query.js";
|
|
3
|
-
import { parseXml } from "../xml/parse.js";
|
|
4
4
|
import { readOpfMetadata } from "./metadata.js";
|
|
5
5
|
//#region src/opf/parse.ts
|
|
6
6
|
function parseOpf(opfXml, sink = NOOP_EPUB_DIAGNOSTIC_SINK) {
|
package/dist/opf/types.d.cts
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/opf/types.d.ts
|
|
3
|
-
interface OpfManifestItem {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly href: string;
|
|
6
|
-
readonly mediaType: string;
|
|
7
|
-
readonly properties: readonly string[];
|
|
8
|
-
}
|
|
9
|
-
interface OpfSpineItemRef {
|
|
10
|
-
readonly idref: string;
|
|
11
|
-
readonly linear: boolean;
|
|
12
|
-
}
|
|
13
|
-
interface OpfPackage {
|
|
14
|
-
readonly metadata: LayoutMetadata;
|
|
15
|
-
readonly manifest: readonly OpfManifestItem[];
|
|
16
|
-
readonly spine: readonly OpfSpineItemRef[];
|
|
17
|
-
readonly ncxId: string | undefined;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
1
|
+
import { n as OpfPackage, r as OpfSpineItemRef, t as OpfManifestItem } from "../types-BxmkPT_F.cjs";
|
|
20
2
|
export { OpfManifestItem, OpfPackage, OpfSpineItemRef };
|
package/dist/opf/types.d.ts
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/opf/types.d.ts
|
|
3
|
-
interface OpfManifestItem {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly href: string;
|
|
6
|
-
readonly mediaType: string;
|
|
7
|
-
readonly properties: readonly string[];
|
|
8
|
-
}
|
|
9
|
-
interface OpfSpineItemRef {
|
|
10
|
-
readonly idref: string;
|
|
11
|
-
readonly linear: boolean;
|
|
12
|
-
}
|
|
13
|
-
interface OpfPackage {
|
|
14
|
-
readonly metadata: LayoutMetadata;
|
|
15
|
-
readonly manifest: readonly OpfManifestItem[];
|
|
16
|
-
readonly spine: readonly OpfSpineItemRef[];
|
|
17
|
-
readonly ncxId: string | undefined;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
1
|
+
import { n as OpfPackage, r as OpfSpineItemRef, t as OpfManifestItem } from "../types-BxmkPT_F.js";
|
|
20
2
|
export { OpfManifestItem, OpfPackage, OpfSpineItemRef };
|
package/dist/opf/write.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_xml_entities = require("../xml/entities.cjs");
|
|
3
2
|
const require_xml_build = require("../xml/build.cjs");
|
|
3
|
+
const require_xml_entities = require("../xml/entities.cjs");
|
|
4
4
|
//#region src/opf/write.ts
|
|
5
5
|
function element(tag, attrs = {}, children = []) {
|
|
6
6
|
return {
|
package/dist/opf/write.d.cts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LayoutMetadata } from "document-schema.js";
|
|
3
|
-
//#region src/opf/write.d.ts
|
|
4
|
-
interface WriteOpfInput {
|
|
5
|
-
readonly metadata: LayoutMetadata;
|
|
6
|
-
readonly manifestItems: readonly OpfManifestItem[];
|
|
7
|
-
readonly spineIdrefs: readonly string[];
|
|
8
|
-
readonly identifier: string;
|
|
9
|
-
}
|
|
10
|
-
declare function writeOpf(input: WriteOpfInput): string;
|
|
11
|
-
//#endregion
|
|
1
|
+
import { n as writeOpf, t as WriteOpfInput } from "../write-B89sagtw.cjs";
|
|
12
2
|
export { WriteOpfInput, writeOpf };
|
package/dist/opf/write.d.ts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LayoutMetadata } from "document-schema.js";
|
|
3
|
-
//#region src/opf/write.d.ts
|
|
4
|
-
interface WriteOpfInput {
|
|
5
|
-
readonly metadata: LayoutMetadata;
|
|
6
|
-
readonly manifestItems: readonly OpfManifestItem[];
|
|
7
|
-
readonly spineIdrefs: readonly string[];
|
|
8
|
-
readonly identifier: string;
|
|
9
|
-
}
|
|
10
|
-
declare function writeOpf(input: WriteOpfInput): string;
|
|
11
|
-
//#endregion
|
|
1
|
+
import { n as writeOpf, t as WriteOpfInput } from "../write-DwaEwwgZ.js";
|
|
12
2
|
export { WriteOpfInput, writeOpf };
|
package/dist/opf/write.js
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_util_base64 = require("../util/base64.cjs");
|
|
3
|
+
const require_xml_parse = require("../xml/parse.cjs");
|
|
4
|
+
const require_zip = require("../zip.cjs");
|
|
5
|
+
//#region src/package-io/read.ts
|
|
6
|
+
function parsePackage(bytes) {
|
|
7
|
+
return packageFromEntries(require_zip.unzipPackage(bytes));
|
|
8
|
+
}
|
|
9
|
+
function packageFromEntries(entries) {
|
|
10
|
+
const parts = {};
|
|
11
|
+
for (const [path, partBytes] of Object.entries(entries)) if (looksLikeXml(partBytes)) {
|
|
12
|
+
const xml = new TextDecoder("utf-8").decode(partBytes);
|
|
13
|
+
parts[path] = {
|
|
14
|
+
kind: "xml",
|
|
15
|
+
nodes: require_xml_parse.parseXml(xml)
|
|
16
|
+
};
|
|
17
|
+
} else parts[path] = {
|
|
18
|
+
kind: "binary",
|
|
19
|
+
base64: require_util_base64.bytesToBase64(partBytes)
|
|
20
|
+
};
|
|
21
|
+
return { parts };
|
|
22
|
+
}
|
|
23
|
+
function looksLikeXml(bytes) {
|
|
24
|
+
let i = 0;
|
|
25
|
+
if (bytes.length >= 3 && bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191) i = 3;
|
|
26
|
+
while (i < bytes.length) {
|
|
27
|
+
const b = bytes[i];
|
|
28
|
+
if (b === void 0) return false;
|
|
29
|
+
if (b === 32 || b === 9 || b === 10 || b === 13) {
|
|
30
|
+
i = i + 1;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
return b === 60;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.packageFromEntries = packageFromEntries;
|
|
39
|
+
exports.parsePackage = parsePackage;
|