wp-epub-gen 0.2.1 → 0.2.3
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/build/types.d.ts +57 -63
- package/package.json +22 -22
- 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/build/types.d.ts
CHANGED
|
@@ -1,79 +1,73 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* types.
|
|
2
|
+
* types.ts
|
|
3
3
|
* @author: oldj
|
|
4
4
|
* @homepage: https://oldj.net
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
6
|
export interface IEpubImage {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
id: string;
|
|
8
|
+
url: string;
|
|
9
|
+
dir: string;
|
|
10
|
+
mediaType: string;
|
|
11
|
+
extension: string;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
export interface IEpubGenOptions {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
14
|
+
title: string;
|
|
15
|
+
author?: string | string[];
|
|
16
|
+
publisher?: string;
|
|
17
|
+
cover: string;
|
|
18
|
+
output: string;
|
|
19
|
+
version?: 2 | 3;
|
|
20
|
+
css?: string;
|
|
21
|
+
fonts?: string[];
|
|
22
|
+
lang?: 'en';
|
|
23
|
+
tocTitle?: string;
|
|
24
|
+
appendChapterTitles?: boolean;
|
|
25
|
+
customOpfTemplatePath?: string;
|
|
26
|
+
customHtmlTocTemplatePath?: string;
|
|
27
|
+
customNcxTocTemplatePath?: string;
|
|
28
|
+
content: IChapter[];
|
|
29
|
+
verbose?: boolean;
|
|
30
|
+
description?: string;
|
|
31
|
+
date?: string;
|
|
32
|
+
tmpDir?: string;
|
|
33
|
+
timeoutSeconds?: number;
|
|
34
|
+
tocAutoNumber?: boolean;
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
export interface IEpubData extends IEpubGenOptions {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
id: string;
|
|
38
|
+
docHeader: string;
|
|
39
|
+
dir: string;
|
|
40
|
+
images: IEpubImage[];
|
|
41
|
+
tmpDir: string;
|
|
42
|
+
baseDir: string;
|
|
43
|
+
_coverMediaType?: string;
|
|
44
|
+
_coverExtension?: string;
|
|
45
|
+
log: (msg: any) => void;
|
|
46
|
+
content: IChapterData[];
|
|
47
|
+
timeoutSeconds: number;
|
|
51
48
|
}
|
|
52
|
-
|
|
53
49
|
export interface IChapter {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
id?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
author?: string | string[];
|
|
53
|
+
data: string;
|
|
54
|
+
excludeFromToc?: boolean;
|
|
55
|
+
beforeToc?: boolean;
|
|
56
|
+
filename?: string;
|
|
57
|
+
url?: string;
|
|
58
|
+
children?: IChapter[];
|
|
59
|
+
appendChapterTitle?: boolean;
|
|
64
60
|
}
|
|
65
|
-
|
|
66
61
|
export interface IChapterData extends IChapter {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
id: string;
|
|
63
|
+
href?: string;
|
|
64
|
+
dir?: string;
|
|
65
|
+
children: IChapterData[];
|
|
66
|
+
filePath: string;
|
|
67
|
+
author: string[];
|
|
73
68
|
}
|
|
74
|
-
|
|
75
69
|
export interface IOut {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
success?: boolean;
|
|
71
|
+
message?: string;
|
|
72
|
+
options?: IEpubGenOptions;
|
|
79
73
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wp-epub-gen",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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/cpi.epub
DELETED
|
Binary file
|
package/test.epub
DELETED
|
Binary file
|