epub-codec 1.2.0 → 1.2.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.
package/dist/codec.d.cts CHANGED
@@ -1425,10 +1425,10 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1425
1425
  endColumn: z.ZodNumber;
1426
1426
  }, z.core.$strip>>;
1427
1427
  type: z.ZodEnum<{
1428
- decimal: "decimal";
1429
- list: "list";
1430
1428
  date: "date";
1431
1429
  custom: "custom";
1430
+ decimal: "decimal";
1431
+ list: "list";
1432
1432
  time: "time";
1433
1433
  whole: "whole";
1434
1434
  textLength: "textLength";
package/dist/codec.d.ts CHANGED
@@ -1425,10 +1425,10 @@ declare const epubContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>,
1425
1425
  endColumn: z.ZodNumber;
1426
1426
  }, z.core.$strip>>;
1427
1427
  type: z.ZodEnum<{
1428
- decimal: "decimal";
1429
- list: "list";
1430
1428
  date: "date";
1431
1429
  custom: "custom";
1430
+ decimal: "decimal";
1431
+ list: "list";
1432
1432
  time: "time";
1433
1433
  whole: "whole";
1434
1434
  textLength: "textLength";
@@ -1,16 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let entities = require("entities");
2
3
  //#region src/xml/entities.ts
3
4
  function decodeEntities(value) {
4
- return value.replace(/&(?:amp|lt|gt|quot|apos);/g, (entity) => {
5
- switch (entity) {
6
- case "&amp;": return "&";
7
- case "&lt;": return "<";
8
- case "&gt;": return ">";
9
- case "&quot;": return "\"";
10
- case "&apos;": return "'";
11
- default: return entity;
12
- }
13
- });
5
+ return (0, entities.decode)(value, entities.EntityLevel.HTML);
14
6
  }
15
7
  function decodeTextLikeNode(node) {
16
8
  return node.type === "cdata" ? node.value : decodeEntities(node.value);
@@ -1,15 +1,7 @@
1
+ import { EntityLevel, decode } from "entities";
1
2
  //#region src/xml/entities.ts
2
3
  function decodeEntities(value) {
3
- return value.replace(/&(?:amp|lt|gt|quot|apos);/g, (entity) => {
4
- switch (entity) {
5
- case "&amp;": return "&";
6
- case "&lt;": return "<";
7
- case "&gt;": return ">";
8
- case "&quot;": return "\"";
9
- case "&apos;": return "'";
10
- default: return entity;
11
- }
12
- });
4
+ return decode(value, EntityLevel.HTML);
13
5
  }
14
6
  function decodeTextLikeNode(node) {
15
7
  return node.type === "cdata" ? node.value : decodeEntities(node.value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epub-codec",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "EPUB 2/3 reading and deterministic EPUB 3 writing against the shared document-schema.js content pivot.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -79,6 +79,7 @@
79
79
  "packageManager": "pnpm@11.6.0",
80
80
  "dependencies": {
81
81
  "document-schema.js": "^6.2.0",
82
+ "entities": "^8.0.0",
82
83
  "fast-xml-parser": "^5.10.1",
83
84
  "fflate": "^0.8.3",
84
85
  "zod": "^4.4.3"