bump dependencies

This commit is contained in:
daniel-j 2021-05-25 01:42:43 +02:00
parent d2e6c11eb8
commit bd279a6186
7 changed files with 3220 additions and 3087 deletions

View file

@ -18,7 +18,7 @@
"content_scripts": [ "content_scripts": [
{ {
"matches": ["https://www.fimfiction.net/*", "https://fimfiction.net/*"], "matches": ["https://www.fimfiction.net/*", "https://fimfiction.net/*"],
"js": ["build/vendors_fimfic2epub.js", "build/fimfic2epub.js"], "js": ["build/vendors-node_modules_autosize_dist_autosize_js-node_modules_font-awesome_fonts_fontawesome-we-7f0b12.js", "build/fimfic2epub.js"],
"css": ["inject.css"] "css": ["inject.css"]
} }
], ],

View file

@ -15,8 +15,6 @@ import jsonedit from 'gulp-json-editor'
import zip from 'gulp-zip' import zip from 'gulp-zip'
import removeNPMAbsolutePaths from 'removeNPMAbsolutePaths' import removeNPMAbsolutePaths from 'removeNPMAbsolutePaths'
// import { execFile, exec } from 'child_process'
// script // script
import standard from 'gulp-standard' import standard from 'gulp-standard'
import webpack from 'webpack' import webpack from 'webpack'

6174
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -22,19 +22,19 @@
"LICENSE" "LICENSE"
], ],
"dependencies": { "dependencies": {
"canvas": "^2.6.1", "canvas": "^2.8.0",
"commander": "^6.2.0", "commander": "^7.2.0",
"crc-32": "^1.2.0", "crc-32": "^1.2.0",
"detect-node": "^2.0.4", "detect-node": "^2.1.0",
"elementtree": "^0.1.7", "elementtree": "^0.1.7",
"escape-string-regexp": "^4.0.0", "escape-string-regexp": "^4.0.0",
"file-type": "^16.0.0", "file-type": "^16.4.0",
"fonteditor-core": "2.1.2", "fonteditor-core": "^2.1.7",
"html-entities": "^1.3.1", "html-entities": "^2.3.2",
"html-to-text": "^5.1.1", "html-to-text": "^7.1.1",
"image-size": "^0.9.2", "image-size": "^1.0.0",
"is-svg": "^4.2.1", "is-svg": "^4.3.1",
"jszip": "^3.5.0", "jszip": "^3.6.0",
"match-words": "^1.0.0", "match-words": "^1.0.0",
"mithril": "^2.0.4", "mithril": "^2.0.4",
"mithril-node-render": "^2.3.2", "mithril-node-render": "^2.3.2",
@ -43,45 +43,48 @@
"pretty-data": "^0.40.0", "pretty-data": "^0.40.0",
"sanitize-filename": "^1.6.3", "sanitize-filename": "^1.6.3",
"syllable": "^4.1.0", "syllable": "^4.1.0",
"twemoji": "^13.0.1", "twemoji": "^13.0.2",
"typogr": "^0.6.8", "typogr": "^0.6.8",
"url-regex-safe": "^1.0.2", "url-regex-safe": "^2.0.2",
"zero-fill": "^2.2.4" "zero-fill": "^2.2.4"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.3", "@babel/core": "^7.14.3",
"@babel/preset-env": "^7.12.1", "@babel/preset-env": "^7.14.2",
"@babel/register": "^7.12.1", "@babel/register": "^7.13.16",
"autosize": "^4.0.2", "assert": "^2.0.0",
"babel-loader": "^8.1.0", "autosize": "^4.0.4",
"babel-loader": "^8.2.2",
"binary-loader": "0.0.1", "binary-loader": "0.0.1",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"del": "^6.0.0", "del": "^6.0.0",
"eslint": "^7.12.0", "exports-loader": "^3.0.0",
"eslint-plugin-standard": "^4.0.2",
"exports-loader": "^1.1.1",
"fancy-log": "^1.3.3", "fancy-log": "^1.3.3",
"file-saver": "^2.0.2", "file-saver": "^2.0.5",
"font-awesome": "4.7.0", "font-awesome": "4.7.0",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-change": "^1.0.2", "gulp-change": "^1.0.2",
"gulp-chmod": "^3.0.0", "gulp-chmod": "^3.0.0",
"gulp-filter": "^6.0.0", "gulp-filter": "^7.0.0",
"gulp-header": "^2.0.9", "gulp-header": "^2.0.9",
"gulp-json-editor": "^2.5.4", "gulp-json-editor": "^2.5.6",
"gulp-rename": "^2.0.0", "gulp-rename": "^2.0.0",
"gulp-standard": "^14.0.0", "gulp-standard": "^14.0.0",
"gulp-watch": "^5.0.1", "gulp-watch": "^5.0.1",
"gulp-zip": "^5.0.2", "gulp-zip": "^5.1.0",
"node-loader": "^1.0.2", "node-loader": "^2.0.0",
"path-browserify": "^1.0.1",
"plugin-error": "^1.0.1", "plugin-error": "^1.0.1",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"regenerator-runtime": "^0.13.7", "regenerator-runtime": "^0.13.7",
"removeNPMAbsolutePaths": "^2.0.0", "removeNPMAbsolutePaths": "^2.0.0",
"standard": "^14.3.4", "standard": "^16.0.3",
"stream-browserify": "^3.0.0",
"stylus": "^0.54.8", "stylus": "^0.54.8",
"stylus-loader": "^4.1.1", "stylus-loader": "^6.0.0",
"webpack": "^4.44.2", "webpack": "^5.37.1",
"webpack-node-externals": "^2.5.2" "webpack-node-externals": "^3.0.0"
}, },
"standard": { "standard": {
"env": { "env": {

View file

@ -2,7 +2,7 @@
import JSZip from 'jszip' import JSZip from 'jszip'
import escapeStringRegexp from 'escape-string-regexp' import escapeStringRegexp from 'escape-string-regexp'
import zeroFill from 'zero-fill' import zeroFill from 'zero-fill'
import { XmlEntities } from 'html-entities' import { decode } from 'html-entities'
import sanitize from 'sanitize-filename' import sanitize from 'sanitize-filename'
import { URL } from 'url' import { URL } from 'url'
import isNode from 'detect-node' import isNode from 'detect-node'
@ -20,11 +20,10 @@ import { styleCss, coverstyleCss, titlestyleCss, iconsCss, navstyleCss, paragrap
import * as utils from './utils' import * as utils from './utils'
import kepubify from './kepubify' import kepubify from './kepubify'
import subsetFont from './subsetFont' import subsetFont from './subsetFont'
import fontAwesomeCodes from '../build/font-awesome-codes.json'
import { containerXml } from './constants' import { containerXml } from './constants'
const entities = new XmlEntities() const fontAwesomeCodes = require('../build/font-awesome-codes.json')
const trimWhitespace = /^\s*(<br\s*\/?\s*>)+|(<br\s*\/?\s*>)+\s*$/ig const trimWhitespace = /^\s*(<br\s*\/?\s*>)+|(<br\s*\/?\s*>)+\s*$/ig
@ -632,7 +631,7 @@ class FimFic2Epub extends EventEmitter {
for (let ma; (ma = matchUrl.exec(html));) { for (let ma; (ma = matchUrl.exec(html));) {
const url = ma[1] const url = ma[1]
const cleanurl = entities.decode(url) const cleanurl = decode(url, { level: 'xml' })
if (this.remoteResources.has(cleanurl)) { if (this.remoteResources.has(cleanurl)) {
const r = this.remoteResources.get(cleanurl) const r = this.remoteResources.get(cleanurl)
if (r.where.indexOf(where) === -1) { if (r.where.indexOf(where) === -1) {
@ -816,7 +815,7 @@ class FimFic2Epub extends EventEmitter {
const cat = { const cat = {
url: 'https://www.fimfiction.net' + c[1], url: 'https://www.fimfiction.net' + c[1],
className: 'story-tag ' + c[2], className: 'story-tag ' + c[2],
name: entities.decode(c[4]), name: decode(c[4], { level: 'xml' }),
type: c[2].replace('tag-', '') type: c[2].replace('tag-', '')
} }
tags.push(cat) tags.push(cat)
@ -831,7 +830,7 @@ class FimFic2Epub extends EventEmitter {
if (ma) { if (ma) {
this.storyInfo.prequel = { this.storyInfo.prequel = {
url: 'https://www.fimfiction.net' + ma[1], url: 'https://www.fimfiction.net' + ma[1],
title: entities.decode(ma[2]) title: decode(ma[2], { level: 'xml' })
} }
html = html.substring(html.indexOf('<hr />') + 6) html = html.substring(html.indexOf('<hr />') + 6)
} }

View file

@ -1,6 +1,6 @@
import m from 'mithril' import m from 'mithril'
import { XmlEntities } from 'html-entities' import { decode } from 'html-entities'
import twemoji from 'twemoji' import twemoji from 'twemoji'
import render from 'mithril-node-render' import render from 'mithril-node-render'
@ -8,8 +8,6 @@ import fetchRemote from './fetchRemote'
import { youtubeKey } from './constants' import { youtubeKey } from './constants'
import { replaceAsync } from './utils' import { replaceAsync } from './utils'
const entities = new XmlEntities()
export async function cleanMarkup (html) { export async function cleanMarkup (html) {
if (!html) { if (!html) {
return Promise.resolve('') return Promise.resolve('')
@ -47,7 +45,7 @@ export async function cleanMarkup (html) {
// add alt attributes to images that don't have them // add alt attributes to images that don't have them
const imageEmbed = /<img src="(.*?)" \/>/g const imageEmbed = /<img src="(.*?)" \/>/g
html = await replaceAsync(html, imageEmbed, (match, src) => render(m('img', { src: entities.decode(src), alt: 'Image' }), { strict: true })) html = await replaceAsync(html, imageEmbed, (match, src) => render(m('img', { src: decode(src, { level: 'xml' }), alt: 'Image' }), { strict: true }))
// Fix links pointing to pages on fimfiction // Fix links pointing to pages on fimfiction
// Example: <a href="/user/djazz" rel="nofollow">djazz</a> // Example: <a href="/user/djazz" rel="nofollow">djazz</a>
@ -68,13 +66,13 @@ export async function cleanMarkup (html) {
for (let ma; (ma = matchYouTube.exec(html));) { for (let ma; (ma = matchYouTube.exec(html));) {
const youtubeId = ma[1].match(/^[^&]+/)[0] const youtubeId = ma[1].match(/^[^&]+/)[0]
cache.set(youtubeId, null) cache.set(youtubeId, null)
query.set(entities.decode(ma[1]), youtubeId) query.set(decode(ma[1], { level: 'xml' }), youtubeId)
} }
const matchSoundCloud = /<p><a class="embed" href="(https:\/\/soundcloud\.com\/.*?)">.*?<\/a><\/p>/g const matchSoundCloud = /<p><a class="embed" href="(https:\/\/soundcloud\.com\/.*?)">.*?<\/a><\/p>/g
html = await replaceAsync(html, matchSoundCloud, (match, url) => { html = await replaceAsync(html, matchSoundCloud, (match, url) => {
return render(m('.soundcloud.leftalign', [ return render(m('.soundcloud.leftalign', [
'SoundCloud: ', m('a', { href: entities.decode(url), rel: 'nofollow' }, url.replace('https://soundcloud.com/', '').replace(/[-_]/g, ' ').replace('/', ' - ').replace(/ {2}/g, ' ')) 'SoundCloud: ', m('a', { href: decode(url, { level: 'xml' }), rel: 'nofollow' }, url.replace('https://soundcloud.com/', '').replace(/[-_]/g, ' ').replace('/', ' - ').replace(/ {2}/g, ' '))
]), { strict: true }) ]), { strict: true })
}) })
@ -108,7 +106,7 @@ export async function cleanMarkup (html) {
} }
function replaceYouTube (match, queryString) { function replaceYouTube (match, queryString) {
queryString = entities.decode(queryString) queryString = decode(queryString, { level: 'xml' })
const youtubeId = query.get(queryString) const youtubeId = query.get(queryString)
let thumbnail = 'https://img.youtube.com/vi/' + youtubeId + '/hqdefault.jpg' let thumbnail = 'https://img.youtube.com/vi/' + youtubeId + '/hqdefault.jpg'
const youtubeUrl = 'https://youtube.com/watch?v=' + queryString const youtubeUrl = 'https://youtube.com/watch?v=' + queryString

View file

@ -1,4 +1,4 @@
import webpack from 'webpack'
import path from 'path' import path from 'path'
import nodeExternals from 'webpack-node-externals' import nodeExternals from 'webpack-node-externals'
@ -26,15 +26,15 @@ const bundleExtensionConfig = {
presets: [['@babel/env', { presets: [['@babel/env', {
targets: { targets: {
browsers: ['chrome 50', 'firefox 47'] browsers: ['chrome 50', 'firefox 47']
}, }
modules: false
}]] }]]
} }
} }
}, },
{ {
test: /\.styl$/, test: /\.styl$/,
use: ['raw-loader', 'stylus-loader'] use: ['stylus-loader'],
type: 'asset/source'
}, },
{ {
test: /\.ttf$/, test: /\.ttf$/,
@ -43,22 +43,34 @@ const bundleExtensionConfig = {
] ]
}, },
target: 'web',
resolve: { resolve: {
extensions: ['.js', '.json', '.styl'], extensions: ['.js', '.json', '.styl'],
modules: [ modules: [
path.resolve('./src'), path.resolve('./src'),
'node_modules' 'node_modules'
] ],
}, fallback: {
url: false,
node: { fs: false,
fs: 'empty' zlib: require.resolve('browserify-zlib'),
buffer: require.resolve('buffer/'),
assert: require.resolve('assert/'),
stream: require.resolve('stream-browserify')
},
alias: {
path: false
}
}, },
externals: ['node-fetch'], externals: ['node-fetch'],
plugins: [ plugins: [
// new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)() // new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)()
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
})
], ],
performance: { performance: {
hints: false hints: false
@ -105,7 +117,8 @@ const bundleNpmModuleConfig = {
}, },
{ {
test: /\.styl$/, test: /\.styl$/,
use: ['raw-loader', 'stylus-loader'] use: ['stylus-loader'],
type: 'asset/source'
}, },
{ {
test: /\.ttf$/, test: /\.ttf$/,
@ -161,17 +174,22 @@ const bundleNpmBinaryConfig = {
sourceMaps: !inProduction, sourceMaps: !inProduction,
presets: [['@babel/env', { presets: [['@babel/env', {
targets: { targets: {
node: '8.0.0' node: '14.0.0'
} }
}]] }]]
} }
} }
},
{
test: /\.styl$/,
use: ['stylus-loader'],
type: 'asset/resource'
} }
] ]
}, },
resolve: { resolve: {
extensions: ['.js', '.json', '.node'], extensions: ['.js', '.json', '.node', '.styl'],
modules: [ modules: [
path.resolve('./src'), path.resolve('./src'),
'node_modules' 'node_modules'
@ -213,7 +231,8 @@ const bundleStaticNpmModuleConfig = {
rules: [ rules: [
{ {
test: /\.styl$/, test: /\.styl$/,
use: ['raw-loader', 'stylus-loader'] use: ['stylus-loader'],
type: 'asset/source'
}, },
{ {
test: /\.ttf$/, test: /\.ttf$/,