wp-epub-gen 0.1.0
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/.eslintrc.js +24 -0
- package/.mocharc.json +3 -0
- package/.prettierrc.json +19 -0
- package/README.md +87 -0
- package/dist/downloadImage.d.ts +7 -0
- package/dist/downloadImage.js +82 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.js +14 -0
- package/dist/generateTempFile.d.ts +7 -0
- package/dist/generateTempFile.js +121 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +128 -0
- package/dist/makeCover.d.ts +7 -0
- package/dist/makeCover.js +63 -0
- package/dist/parseContent.d.ts +7 -0
- package/dist/parseContent.js +330 -0
- package/dist/render.d.ts +7 -0
- package/dist/render.js +90 -0
- package/dist/utils.d.ts +13 -0
- package/dist/utils.js +48 -0
- package/package.json +66 -0
- package/src/downloadImage.ts +75 -0
- package/src/errors.ts +11 -0
- package/src/generateTempFile.ts +144 -0
- package/src/index.ts +152 -0
- package/src/makeCover.ts +52 -0
- package/src/parseContent.ts +350 -0
- package/src/render.ts +84 -0
- package/src/types.d.ts +79 -0
- package/src/utils.ts +39 -0
- package/templates/epub2/content.opf.ejs +57 -0
- package/templates/epub2/toc.xhtml.ejs +26 -0
- package/templates/epub3/content.opf.ejs +86 -0
- package/templates/epub3/toc.xhtml.ejs +38 -0
- package/templates/template.css +46 -0
- package/templates/toc.ncx.ejs +45 -0
- package/test/basic.test.js +28 -0
- package/test/child-page-image.test.js +21 -0
- package/test/data/1.json +21 -0
- package/test/tt.js +16 -0
- package/tsconfig.json +31 -0
- package/webpack.config.js +75 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author oldj
|
|
3
|
+
* @blog http://oldj.net
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict'
|
|
7
|
+
|
|
8
|
+
const path = require('path')
|
|
9
|
+
const webpack = require('webpack')
|
|
10
|
+
const WebpackNotifierPlugin = require('webpack-notifier')
|
|
11
|
+
//const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
12
|
+
//const TerserPlugin = require('terser-webpack-plugin')
|
|
13
|
+
const basedir = __dirname
|
|
14
|
+
|
|
15
|
+
module.exports = {
|
|
16
|
+
mode: process.env.ENV === 'dev' ? 'development' : 'production',
|
|
17
|
+
entry: {
|
|
18
|
+
index: ['./src/index.ts']
|
|
19
|
+
},
|
|
20
|
+
devtool: 'source-map',
|
|
21
|
+
output: {
|
|
22
|
+
filename: '[name].js',
|
|
23
|
+
path: path.join(basedir, 'dist')
|
|
24
|
+
},
|
|
25
|
+
target: 'node',
|
|
26
|
+
resolve: {
|
|
27
|
+
modules: ['node_modules', 'src'],
|
|
28
|
+
alias: {
|
|
29
|
+
'@': path.join(basedir, 'src')
|
|
30
|
+
},
|
|
31
|
+
extensions: ['.ts', '.js', '.d.ts']
|
|
32
|
+
},
|
|
33
|
+
watchOptions: {
|
|
34
|
+
ignored: []
|
|
35
|
+
},
|
|
36
|
+
module: {
|
|
37
|
+
rules: [
|
|
38
|
+
{
|
|
39
|
+
test: /\.ts$/,
|
|
40
|
+
loader: 'ts-loader'
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
optimization: {
|
|
45
|
+
minimize: true,
|
|
46
|
+
minimizer: [
|
|
47
|
+
//new TerserPlugin({
|
|
48
|
+
// terserOptions: {
|
|
49
|
+
// output: {
|
|
50
|
+
// ecma: 6,
|
|
51
|
+
// comments: false,
|
|
52
|
+
// ascii_only: true
|
|
53
|
+
// }
|
|
54
|
+
// },
|
|
55
|
+
// parallel: true,
|
|
56
|
+
// cache: true,
|
|
57
|
+
// sourceMap: true
|
|
58
|
+
//})
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
plugins: [
|
|
62
|
+
new webpack.DefinePlugin({
|
|
63
|
+
'process.env': {
|
|
64
|
+
NODE_ENV: JSON.stringify('production')
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
new webpack.IgnorePlugin(new RegExp('^(fs|path|window)$')),
|
|
68
|
+
new WebpackNotifierPlugin({
|
|
69
|
+
title: 'epub-gen',
|
|
70
|
+
alwaysNotify: true,
|
|
71
|
+
excludeWarnings: true
|
|
72
|
+
})
|
|
73
|
+
//new webpack.BannerPlugin(`WonderPen ${s_version}, ${moment().format('YYYY-MM-DD HH:mm:ss')}`)
|
|
74
|
+
]
|
|
75
|
+
}
|