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 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.d.ts
2
+ * types.ts
3
3
  * @author: oldj
4
4
  * @homepage: https://oldj.net
5
5
  */
6
-
7
6
  export interface IEpubImage {
8
- id: string
9
- url: string
10
- dir: string
11
- mediaType: string
12
- extension: string
7
+ id: string;
8
+ url: string;
9
+ dir: string;
10
+ mediaType: string;
11
+ extension: string;
13
12
  }
14
-
15
13
  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
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
- 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
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
- 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
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
- id: string
68
- href?: string
69
- dir?: string
70
- children: IChapterData[]
71
- filePath: string
72
- author: string[]
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
- success?: boolean
77
- message?: string
78
- options?: IEpubGenOptions
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.1",
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.8",
32
- "entities": "^4.4.0",
33
- "fs-extra": "^11.1.0",
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.6",
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.1",
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.1",
44
- "@types/fs-extra": "^9.0.13",
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.16",
46
+ "@types/superagent": "^4.1.18",
47
47
  "@types/uslug": "^1.0.1",
48
- "@types/uuid": "^9.0.0",
49
- "@typescript-eslint/eslint-plugin": "^5.47.0",
50
- "@typescript-eslint/parser": "^5.47.0",
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.30.0",
54
- "eslint-config-prettier": "^8.5.0",
55
- "eslint-plugin-import": "^2.26.0",
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": "^2.8.1",
59
- "ts-loader": "^9.4.2",
60
- "tsconfig-paths": "^4.1.1",
61
- "typescript": "^4.9.4",
62
- "vite": "^4.0.3",
63
- "vite-plugin-dts": "^1.7.1",
64
- "vite-tsconfig-paths": "^4.0.3"
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