react-book-reader 1.0.1 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-book-reader",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "main": "lib/react-book-reader.cjs.js",
6
6
  "module": "lib/react-book-reader.es.js",
@@ -8,7 +8,8 @@
8
8
  "lib"
9
9
  ],
10
10
  "keywords": [
11
- "vue3",
11
+ "react",
12
+ "ebook",
12
13
  "reader",
13
14
  "epub",
14
15
  "MOBI",
@@ -18,11 +19,16 @@
18
19
  "CBZ",
19
20
  "PDF"
20
21
  ],
22
+ "homepage": "https://jinhuan138.github.io/react-book-reader/",
21
23
  "scripts": {
24
+ "preinstall": "npx only-allow pnpm",
22
25
  "dev": "vite",
23
- "build": "tsc && vite build",
26
+ "build": "vite build",
24
27
  "preview": "vite preview",
25
- "compile": "vite build"
28
+ "compile": "vite build",
29
+ "docs:dev": "npm -C docs run dev",
30
+ "docs:build": "npm -C docs run docs:build",
31
+ "docs:preview": "npm -C docs run docs:preview"
26
32
  },
27
33
  "devDependencies": {
28
34
  "@types/react": "^18.2.66",
@@ -34,10 +40,14 @@
34
40
  "eslint-plugin-react-hooks": "^4.6.0",
35
41
  "eslint-plugin-react-refresh": "^0.4.6",
36
42
  "prettier": "^3.2.5",
37
- "react": "^18.2.0",
43
+ "react": "^18.3.1",
44
+ "react-book-reader": "^1.0.1",
38
45
  "react-dom": "^18.2.0",
39
46
  "typescript": "^5.2.2",
40
- "vite": "^5.2.0",
47
+ "vite": "^7.3.1",
41
48
  "vite-plugin-css-injected-by-js": "^3.5.1"
49
+ },
50
+ "dependencies": {
51
+ "core-js": "^3.48.0"
42
52
  }
43
53
  }
@@ -1,29 +0,0 @@
1
- const h = ({ entries: l, loadBlob: i, getSize: a }, p) => {
2
- const s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), d = async (e) => {
3
- if (s.has(e))
4
- return s.get(e);
5
- const t = URL.createObjectURL(await i(e)), r = URL.createObjectURL(
6
- new Blob([`<img src="${t}">`], { type: "text/html" })
7
- );
8
- return c.set(e, [t, r]), s.set(e, r), r;
9
- }, f = (e) => {
10
- var t, r;
11
- (r = (t = c.get(e)) == null ? void 0 : t.forEach) == null || r.call(t, (u) => URL.revokeObjectURL(u)), c.delete(e), s.delete(e);
12
- }, g = [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp", ".svg", ".jxl", ".avif"], n = l.map((e) => e.filename).filter((e) => g.some((t) => e.endsWith(t))).sort();
13
- if (!n.length)
14
- throw new Error("No supported image files in archive");
15
- const o = {};
16
- return o.getCover = () => i(n[0]), o.metadata = { title: p.name }, o.sections = n.map((e) => ({
17
- id: e,
18
- load: () => d(e),
19
- unload: () => f(e),
20
- size: a(e)
21
- })), o.toc = n.map((e) => ({ label: e, href: e })), o.rendition = { layout: "pre-paginated" }, o.resolveHref = (e) => ({ index: o.sections.findIndex((t) => t.id === e) }), o.splitTOCHref = (e) => [e, null], o.getTOCFragment = (e) => e.documentElement, o.destroy = () => {
22
- for (const e of c.values())
23
- for (const t of e)
24
- URL.revokeObjectURL(t);
25
- }, o;
26
- };
27
- export {
28
- h as makeComicBook
29
- };