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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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