1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-02 14:49:16 +02:00

Update deps, fix build and toJSON methods

This commit is contained in:
fredc 2022-04-08 11:23:12 -07:00
parent 4ae139f40a
commit 6c8f02db9f
11 changed files with 5450 additions and 580 deletions

View file

@ -2,7 +2,7 @@
"presets": [ "presets": [
["@babel/preset-env", { ["@babel/preset-env", {
"targets": "last 2 Chrome versions, last 2 Safari versions, last 2 ChromeAndroid versions, last 2 iOS versions, last 2 Firefox versions, last 2 Edge versions", "targets": "last 2 Chrome versions, last 2 Safari versions, last 2 ChromeAndroid versions, last 2 iOS versions, last 2 Firefox versions, last 2 Edge versions",
"corejs": 3, "corejs": "3.21",
"useBuiltIns": "usage", "useBuiltIns": "usage",
"bugfixes": true, "bugfixes": true,
"modules": "auto" "modules": "auto"

5960
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,34 +3,34 @@
"version": "0.5.0", "version": "0.5.0",
"description": "Parse and Render Epubs", "description": "Parse and Render Epubs",
"main": "src/index.js", "main": "src/index.js",
"module": "src/index.js",
"browser": "dist/epub.js", "browser": "dist/epub.js",
"exports": "./src/index.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"repository": "https://github.com/futurepress/epub.js", "repository": "https://github.com/futurepress/epub.js",
"type": "module",
"scripts": { "scripts": {
"test": "", "test": "",
"lint": "eslint -c .eslintrc.js src; exit 0", "lint": "eslint -c .eslintrc.js src; exit 0",
"start": "rollup -w -c rollup.server.config.js", "start": "rollup -w -c rollup.server.config.js",
"build": "rollup -c", "build": "rollup -c",
"compile": "babel src/ -d lib/", "watch": "rollup -w -c rollup.config.js",
"watch": "babel --watch --optional runtime -d lib/ src/", "prepare": "npm run build"
"prepare": "npm run compile && npm run build"
}, },
"author": "fchasen@gmail.com", "author": "fchasen@gmail.com",
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.16.7", "@babel/core": "^7.17.9",
"@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-commonjs": "^21.0.3",
"@rollup/plugin-node-resolve": "^13.1.3", "@rollup/plugin-node-resolve": "^13.1.3",
"rollup": "^2.63.0", "rollup": "^2.70.1",
"rollup-plugin-license": "^2.6.1", "rollup-plugin-license": "^2.6.1",
"rollup-plugin-serve": "^1.1.0", "rollup-plugin-serve": "^1.1.0",
"serve": "^13.0.2" "serve": "^13.0.2"
}, },
"dependencies": { "dependencies": {
"@xmldom/xmldom": "^0.8.0", "@xmldom/xmldom": "^0.8.2",
"jszip": "^3.7.1", "jszip": "^3.9.1",
"lodash": "^4.17.21" "lodash": "^4.17.21"
} }
} }

View file

@ -203,7 +203,7 @@ class Epub extends Publication {
} }
toJSON() { toJSON() {
return super.toJSON();
} }
/** /**

View file

@ -269,7 +269,7 @@ class PageList {
* @return {json} * @return {json}
*/ */
toJSON() { toJSON() {
return JSON.stringify(this.locations); return this.locations;
} }
/** /**

View file

@ -12,9 +12,9 @@ class Locator {
cfi: item.cfi, cfi: item.cfi,
type: item.type, type: item.type,
name: item.name, name: item.name,
parent: undefined, parent: undefined,
children: new ResourceList() children: new ResourceList()
} };
} }
get url() { get url() {
@ -65,21 +65,21 @@ class Locator {
return this.data.name; return this.data.name;
} }
get parent() { get parent() {
return this.data.parent;
}
set parent(item) {
this.data.parent = item;
return this.data.parent; return this.data.parent;
} }
get children() { set parent(item) {
return this.data.children; this.data.parent = item;
} return this.data.parent;
}
get children() {
return this.data.children;
}
set children(items) { set children(items) {
for (const childItem of items) { for (const childItem of items) {
const child = new Locator(childItem); const child = new Locator(childItem);
child.parent = this; child.parent = this;
this.children.append(child); this.children.append(child);
@ -89,7 +89,7 @@ class Locator {
toJSON() { toJSON() {
return JSON.stringify(this); return this.data;
} }
destroy() { destroy() {

View file

@ -412,7 +412,7 @@ class Publication {
* Generates a JSON output of the publication structure * Generates a JSON output of the publication structure
*/ */
toJSON() { toJSON() {
return JSON.stringify(this.data); return this.data;
} }
/** /**

View file

@ -124,7 +124,7 @@ class Resource {
toJSON() { toJSON() {
return this.data;
} }
destroy() { destroy() {

View file

@ -188,7 +188,7 @@ class ResourceList extends Map {
} }
toJSON() { toJSON() {
return JSON.stringify(this.toArray()); return this.toArray();
} }
} }

View file

@ -3,7 +3,8 @@
* @param {string} _query The query string to find * @param {string} _query The query string to find
* @return {object[]} A list of matches, with form {cfi, excerpt} * @return {object[]} A list of matches, with form {cfi, excerpt}
*/ */
find(_query){ /*
find(_query) {
var section = this; var section = this;
var matches = []; var matches = [];
var query = _query.toLowerCase(); var query = _query.toLowerCase();
@ -54,3 +55,4 @@ find(_query){
return matches; return matches;
} }
*/

View file

@ -203,10 +203,10 @@ class Sections {
} }
toJSON() { toJSON() {
return JSON.stringify({ return {
readingOrder: this.toOrderedArray(), readingOrder: this.toOrderedArray(),
unordered: this.toUnorderedArray() unordered: this.toUnorderedArray()
}); };
} }
destroy() { destroy() {