wp-epub-gen 0.2.1 → 0.2.2
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/build/index.js +4 -3
- package/package.json +22 -22
- package/build/types.d.ts +0 -79
- package/cpi.epub +0 -0
- package/test.epub +0 -0
package/build/index.js
CHANGED
|
@@ -366,9 +366,9 @@ const writeFile = util.promisify(fs__namespace.writeFile);
|
|
|
366
366
|
const USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36";
|
|
367
367
|
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
368
368
|
async function fileIsStable(filename, max_wait = 3e4) {
|
|
369
|
-
let start_time = new Date().getTime();
|
|
369
|
+
let start_time = (/* @__PURE__ */ new Date()).getTime();
|
|
370
370
|
let last_size = fs__namespace.statSync(filename).size;
|
|
371
|
-
while (new Date().getTime() - start_time <= max_wait) {
|
|
371
|
+
while ((/* @__PURE__ */ new Date()).getTime() - start_time <= max_wait) {
|
|
372
372
|
await wait(1e3);
|
|
373
373
|
let size = fs__namespace.statSync(filename).size;
|
|
374
374
|
if (size === last_size)
|
|
@@ -674,12 +674,13 @@ function parseOptions(options) {
|
|
|
674
674
|
author: ["anonymous"],
|
|
675
675
|
tocTitle: "Table Of Contents",
|
|
676
676
|
appendChapterTitles: true,
|
|
677
|
-
date: new Date().toISOString(),
|
|
677
|
+
date: (/* @__PURE__ */ new Date()).toISOString(),
|
|
678
678
|
lang: "en",
|
|
679
679
|
fonts: [],
|
|
680
680
|
version: 3,
|
|
681
681
|
verbose: true,
|
|
682
682
|
timeoutSeconds: 15 * 60,
|
|
683
|
+
// 15 min
|
|
683
684
|
tocAutoNumber: false,
|
|
684
685
|
...options,
|
|
685
686
|
id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wp-epub-gen",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Epub generator.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -28,39 +28,39 @@
|
|
|
28
28
|
"archiver": "^5.3.1",
|
|
29
29
|
"cheerio": "^0.22.0",
|
|
30
30
|
"diacritics": "^1.3.0",
|
|
31
|
-
"ejs": "^3.1.
|
|
32
|
-
"entities": "^4.
|
|
33
|
-
"fs-extra": "^11.1.
|
|
31
|
+
"ejs": "^3.1.9",
|
|
32
|
+
"entities": "^4.5.0",
|
|
33
|
+
"fs-extra": "^11.1.1",
|
|
34
34
|
"mime": "^3.0.0",
|
|
35
|
-
"superagent": "^8.0
|
|
35
|
+
"superagent": "^8.1.0",
|
|
36
36
|
"uslug": "^1.0.4",
|
|
37
37
|
"uuid": "^9.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@types/archiver": "^5.3.
|
|
40
|
+
"@types/archiver": "^5.3.2",
|
|
41
41
|
"@types/cheerio": "^0.22.31",
|
|
42
42
|
"@types/diacritics": "^1.3.1",
|
|
43
|
-
"@types/ejs": "^3.1.
|
|
44
|
-
"@types/fs-extra": "^
|
|
43
|
+
"@types/ejs": "^3.1.2",
|
|
44
|
+
"@types/fs-extra": "^11.0.1",
|
|
45
45
|
"@types/mime": "^3.0.1",
|
|
46
|
-
"@types/superagent": "^4.1.
|
|
46
|
+
"@types/superagent": "^4.1.18",
|
|
47
47
|
"@types/uslug": "^1.0.1",
|
|
48
|
-
"@types/uuid": "^9.0.
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
50
|
-
"@typescript-eslint/parser": "^
|
|
48
|
+
"@types/uuid": "^9.0.2",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
|
50
|
+
"@typescript-eslint/parser": "^6.4.0",
|
|
51
51
|
"chai": "^4.3.7",
|
|
52
52
|
"cross-env": "^7.0.3",
|
|
53
|
-
"eslint": "^8.
|
|
54
|
-
"eslint-config-prettier": "^
|
|
55
|
-
"eslint-plugin-import": "^2.
|
|
53
|
+
"eslint": "^8.47.0",
|
|
54
|
+
"eslint-config-prettier": "^9.0.0",
|
|
55
|
+
"eslint-plugin-import": "^2.28.0",
|
|
56
56
|
"espower-typescript": "^10.0.1",
|
|
57
57
|
"mocha": "^10.2.0",
|
|
58
|
-
"prettier": "^
|
|
59
|
-
"ts-loader": "^9.4.
|
|
60
|
-
"tsconfig-paths": "^4.
|
|
61
|
-
"typescript": "^
|
|
62
|
-
"vite": "^4.
|
|
63
|
-
"vite-plugin-dts": "^
|
|
64
|
-
"vite-tsconfig-paths": "^4.0
|
|
58
|
+
"prettier": "^3.0.1",
|
|
59
|
+
"ts-loader": "^9.4.4",
|
|
60
|
+
"tsconfig-paths": "^4.2.0",
|
|
61
|
+
"typescript": "^5.1.6",
|
|
62
|
+
"vite": "^4.4.9",
|
|
63
|
+
"vite-plugin-dts": "^3.5.2",
|
|
64
|
+
"vite-tsconfig-paths": "^4.2.0"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/build/types.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* types.d.ts
|
|
3
|
-
* @author: oldj
|
|
4
|
-
* @homepage: https://oldj.net
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export interface IEpubImage {
|
|
8
|
-
id: string
|
|
9
|
-
url: string
|
|
10
|
-
dir: string
|
|
11
|
-
mediaType: string
|
|
12
|
-
extension: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface IEpubGenOptions {
|
|
16
|
-
title: string
|
|
17
|
-
author?: string | string[]
|
|
18
|
-
publisher?: string
|
|
19
|
-
cover: string
|
|
20
|
-
output: string
|
|
21
|
-
version?: 2 | 3
|
|
22
|
-
css?: string
|
|
23
|
-
fonts?: string[]
|
|
24
|
-
lang?: 'en'
|
|
25
|
-
tocTitle?: string
|
|
26
|
-
appendChapterTitles?: boolean // For advanced customizations: absolute path to an OPF template.
|
|
27
|
-
customOpfTemplatePath?: string // For advanced customizations: absolute path to a NCX toc template.
|
|
28
|
-
customHtmlTocTemplatePath?: string // For advanced customizations: absolute path to a HTML toc template.
|
|
29
|
-
customNcxTocTemplatePath?: string
|
|
30
|
-
content: IChapter[] // Book Chapters content. It's should be an array of objects. eg. [{title: "Chapter 1",data: "<div>..."}, {data: ""},...]
|
|
31
|
-
verbose?: boolean // specify whether or not to console.log progress messages, default: false
|
|
32
|
-
description?: string
|
|
33
|
-
date?: string
|
|
34
|
-
tmpDir?: string
|
|
35
|
-
timeoutSeconds?: number
|
|
36
|
-
tocAutoNumber?: boolean
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface IEpubData extends IEpubGenOptions {
|
|
40
|
-
id: string
|
|
41
|
-
docHeader: string
|
|
42
|
-
dir: string
|
|
43
|
-
images: IEpubImage[]
|
|
44
|
-
tmpDir: string
|
|
45
|
-
baseDir: string
|
|
46
|
-
_coverMediaType?: string
|
|
47
|
-
_coverExtension?: string
|
|
48
|
-
log: (msg: any) => void
|
|
49
|
-
content: IChapterData[]
|
|
50
|
-
timeoutSeconds: number
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface IChapter {
|
|
54
|
-
id?: string
|
|
55
|
-
title?: string
|
|
56
|
-
author?: string | string[]
|
|
57
|
-
data: string // HTML String of the chapter content. image paths should be absolute path (should start with "http" or "https"), so that they could be downloaded. With the upgrade is possible to use local images (for this the path must start with file: //)
|
|
58
|
-
excludeFromToc?: boolean // default: false
|
|
59
|
-
beforeToc?: boolean // if is shown before Table of content, such like copyright pages. default: false
|
|
60
|
-
filename?: string // specify filename for each chapter
|
|
61
|
-
url?: string
|
|
62
|
-
children?: IChapter[]
|
|
63
|
-
appendChapterTitle?: boolean
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface IChapterData extends IChapter {
|
|
67
|
-
id: string
|
|
68
|
-
href?: string
|
|
69
|
-
dir?: string
|
|
70
|
-
children: IChapterData[]
|
|
71
|
-
filePath: string
|
|
72
|
-
author: string[]
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface IOut {
|
|
76
|
-
success?: boolean
|
|
77
|
-
message?: string
|
|
78
|
-
options?: IEpubGenOptions
|
|
79
|
-
}
|
package/cpi.epub
DELETED
|
Binary file
|
package/test.epub
DELETED
|
Binary file
|