mirror of
https://github.com/daniel-j/fimfic2epub.git
synced 2024-05-07 05:52:48 +12:00
upgrade deps and some minor fixes
This commit is contained in:
parent
ed691a43a9
commit
a58f4d5254
1564
package-lock.json
generated
1564
package-lock.json
generated
File diff suppressed because it is too large
Load diff
26
package.json
26
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "fimfic2epub",
|
||||
"version": "1.7.38",
|
||||
"version": "1.7.39",
|
||||
"description": "Tool to generate improved EPUB ebooks from Fimfiction stories",
|
||||
"author": "djazz",
|
||||
"license": "MIT",
|
||||
|
@ -22,13 +22,13 @@
|
|||
"LICENSE"
|
||||
],
|
||||
"dependencies": {
|
||||
"canvas": "^2.6.0",
|
||||
"commander": "^3.0.2",
|
||||
"canvas": "^2.6.1",
|
||||
"commander": "^4.1.0",
|
||||
"crc-32": "^1.2.0",
|
||||
"detect-node": "^2.0.4",
|
||||
"elementtree": "^0.1.7",
|
||||
"escape-string-regexp": "^2.0.0",
|
||||
"file-type": "^12.3.0",
|
||||
"file-type": "^13.1.0",
|
||||
"fonteditor-core": "^1.0.5",
|
||||
"html-entities": "^1.2.1",
|
||||
"html-to-text": "^5.1.1",
|
||||
|
@ -43,20 +43,20 @@
|
|||
"request": "^2.88.0",
|
||||
"sanitize-filename": "^1.6.3",
|
||||
"syllable": "^4.0.0",
|
||||
"twemoji": "^12.1.3",
|
||||
"twemoji": "^12.1.4",
|
||||
"typogr": "^0.6.8",
|
||||
"url-regex": "^5.0.0",
|
||||
"zero-fill": "^2.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.6.3",
|
||||
"@babel/preset-env": "^7.6.3",
|
||||
"@babel/register": "^7.6.2",
|
||||
"@babel/core": "^7.8.3",
|
||||
"@babel/preset-env": "^7.8.3",
|
||||
"@babel/register": "^7.8.3",
|
||||
"autosize": "^4.0.2",
|
||||
"babel-loader": "^8.0.6",
|
||||
"binary-loader": "0.0.1",
|
||||
"del": "^5.1.0",
|
||||
"eslint": "^6.5.1",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"exports-loader": "^0.7.0",
|
||||
"fancy-log": "^1.3.3",
|
||||
|
@ -67,19 +67,19 @@
|
|||
"gulp-chmod": "^3.0.0",
|
||||
"gulp-filter": "^6.0.0",
|
||||
"gulp-header": "^2.0.9",
|
||||
"gulp-json-editor": "^2.5.3",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"gulp-json-editor": "^2.5.4",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-standard": "^14.0.0",
|
||||
"gulp-watch": "^5.0.1",
|
||||
"gulp-zip": "^5.0.1",
|
||||
"plugin-error": "^1.0.1",
|
||||
"raw-loader": "^3.1.0",
|
||||
"raw-loader": "^4.0.0",
|
||||
"regenerator-runtime": "^0.13.3",
|
||||
"removeNPMAbsolutePaths": "^2.0.0",
|
||||
"standard": "^14.3.1",
|
||||
"stylus": "^0.54.7",
|
||||
"stylus-loader": "^3.0.2",
|
||||
"webpack": "^4.41.0",
|
||||
"webpack": "^4.41.5",
|
||||
"webpack-node-externals": "^1.7.2"
|
||||
},
|
||||
"standard": {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { XmlEntities } from 'html-entities'
|
|||
import sanitize from 'sanitize-filename'
|
||||
import { URL } from 'url'
|
||||
import isNode from 'detect-node'
|
||||
import fileType from 'file-type'
|
||||
import FileType from 'file-type'
|
||||
import isSvg from 'is-svg'
|
||||
import sizeOf from 'image-size'
|
||||
import EventEmitter from 'events'
|
||||
|
@ -324,7 +324,7 @@ class FimFic2Epub extends EventEmitter {
|
|||
|
||||
fetchRemote(url, 'arraybuffer').then(async (data) => {
|
||||
r.dest = null
|
||||
let info = fileType(isNode ? data : new Uint8Array(data))
|
||||
let info = await FileType.fromBuffer(isNode ? data : new Uint8Array(data))
|
||||
if (!info || info.mime === 'application/xml') {
|
||||
// file-type doesn't support SVG, extra check:
|
||||
if (isSvg(Buffer.from(data).toString('utf8'))) {
|
||||
|
@ -346,7 +346,7 @@ class FimFic2Epub extends EventEmitter {
|
|||
checksums.set(checksum, url)
|
||||
if (info.mime === 'image/webp') {
|
||||
data = await utils.webp2png(isNode ? data : new Uint8Array(data))
|
||||
info = fileType(data)
|
||||
info = await FileType.fromBuffer(data)
|
||||
}
|
||||
const type = info.mime
|
||||
r.type = type
|
||||
|
@ -593,9 +593,9 @@ class FimFic2Epub extends EventEmitter {
|
|||
this.filename = FimFic2Epub.getFilename(this.storyInfo)
|
||||
}
|
||||
|
||||
setCoverImage (buffer) {
|
||||
async setCoverImage (buffer) {
|
||||
buffer = isNode ? buffer : Buffer.from(new Uint8Array(buffer))
|
||||
const info = fileType(buffer)
|
||||
const info = await FileType.fromBuffer(buffer)
|
||||
if (!info || !info.mime.startsWith('image/')) {
|
||||
throw new Error('Invalid image')
|
||||
}
|
||||
|
@ -603,6 +603,7 @@ class FimFic2Epub extends EventEmitter {
|
|||
this.coverFilename = 'Images/cover.' + info.ext
|
||||
this.coverType = info.mime
|
||||
this.coverImageDimensions = sizeOf(Buffer.from(buffer))
|
||||
return this.coverImage
|
||||
}
|
||||
|
||||
// Internal/private methods
|
||||
|
@ -737,16 +738,14 @@ class FimFic2Epub extends EventEmitter {
|
|||
|
||||
ctx.fillText(author, canvas.width / 2, canvas.height * 0.9)
|
||||
|
||||
this.setCoverImage(Buffer.from(canvas.toDataURL('image/jpeg').split(',')[1], 'base64'))
|
||||
|
||||
return Promise.resolve(this.coverImage)
|
||||
return this.setCoverImage(Buffer.from(canvas.toDataURL('image/jpeg').split(',')[1], 'base64'))
|
||||
}
|
||||
|
||||
this.progress(0, 0, 'Fetching cover image...')
|
||||
|
||||
this.pcache.coverImage = fetchRemote(url, 'arraybuffer').then((data) => {
|
||||
this.pcache.coverImage = fetchRemote(url, 'arraybuffer').then(async (data) => {
|
||||
data = isNode ? data : new Uint8Array(data)
|
||||
const info = fileType(data)
|
||||
const info = await FileType.fromBuffer(data)
|
||||
if (info) {
|
||||
const type = info.mime
|
||||
const isImage = type.startsWith('image/')
|
||||
|
|
|
@ -329,9 +329,8 @@ function createEpub (model) {
|
|||
} else if (model.coverFile()) {
|
||||
chain = chain
|
||||
.then(() => blobToArrayBuffer(model.coverFile()))
|
||||
.then((buf) => {
|
||||
ffc.setCoverImage(buf)
|
||||
}).catch((err) => console.error(err))
|
||||
.then((buf) => ffc.setCoverImage(buf))
|
||||
.catch((err) => console.error(err))
|
||||
}
|
||||
|
||||
ffc.setTitle(model.title())
|
||||
|
|
|
@ -340,9 +340,9 @@ figure.youtube {
|
|||
}
|
||||
|
||||
svg.chapterbars {
|
||||
width: 100%;
|
||||
height: 6em;
|
||||
display: block;
|
||||
margin: 1em 0;
|
||||
margin: 1em auto;
|
||||
page-break-inside: avoid;
|
||||
break-inside: avoid;
|
||||
-webkit-column-break-inside: avoid;
|
||||
|
|
|
@ -3,12 +3,12 @@ import isNode from 'detect-node'
|
|||
import { Font } from 'fonteditor-core'
|
||||
import fs from 'fs'
|
||||
import fetch from './fetch'
|
||||
import fileType from 'file-type'
|
||||
import FileType from 'file-type'
|
||||
|
||||
async function subsetFont (fontPath, glyphs, options = {}) {
|
||||
let data
|
||||
const fontdata = Buffer.from(fontPath, 'binary')
|
||||
const type = fileType(fontdata)
|
||||
const type = await FileType.fromBuffer(fontdata)
|
||||
if (type && type.mime === 'font/ttf') {
|
||||
data = fontdata.buffer
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue