build: update dependences (#2898)

This commit is contained in:
Ran Luo 2022-01-21 23:56:01 +08:00 committed by GitHub
parent 7242204508
commit 5f47f29575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1035 additions and 687 deletions

View File

@ -49,7 +49,7 @@
"dompurify": "^2.3.4",
"dragula": "^3.7.3",
"electron-is-accelerator": "^0.2.0",
"electron-log": "^4.4.3",
"electron-log": "^4.4.4",
"electron-store": "^8.0.1",
"electron-window-state": "^5.0.3",
"element-resize-detector": "^1.2.4",
@ -64,7 +64,7 @@
"iconv-lite": "^0.6.3",
"iso-639-1": "^2.1.11",
"joplin-turndown-plugin-gfm": "^1.0.12",
"katex": "^0.15.1",
"katex": "^0.15.2",
"keyboard-layout": "^2.0.17",
"keytar": "^7.7.0",
"mermaid": "8.8.4",
@ -72,12 +72,12 @@
"plist": "^3.0.4",
"popper.js": "^1.16.1",
"prismjs": "^1.26.0",
"snabbdom": "^0.7.4",
"snabbdom-to-html": "^6.0.0",
"snabbdom": "^3.2.0",
"snabbdom-to-html": "^7.0.0",
"source-map-support": "^0.5.21",
"turndown": "^7.1.1",
"underscore": "^1.13.1",
"unsplash-js": "^6.3.0",
"underscore": "^1.13.2",
"unsplash-js": "^7.0.15",
"vega": "^5.17.3",
"vega-embed": "^6.14.2",
"vega-lite": "^4.17.0",
@ -89,19 +89,19 @@
"webfontloader": "^1.6.28"
},
"devDependencies": {
"@babel/core": "^7.16.5",
"@babel/core": "^7.16.7",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-proposal-class-properties": "^7.16.5",
"@babel/plugin-proposal-export-default-from": "^7.16.5",
"@babel/plugin-proposal-function-bind": "^7.16.5",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-export-default-from": "^7.16.7",
"@babel/plugin-proposal-function-bind": "^7.16.7",
"@babel/plugin-syntax-class-properties": "^7.12.13",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.16.5",
"@babel/preset-env": "^7.16.5",
"@babel/register": "^7.16.5",
"@babel/runtime": "^7.16.5",
"@babel/plugin-transform-runtime": "^7.16.8",
"@babel/preset-env": "^7.16.8",
"@babel/register": "^7.16.9",
"@babel/runtime": "^7.16.7",
"@markedjs/html-differ": "^4.0.0",
"@playwright/test": "^1.17.1",
"@playwright/test": "^1.17.2",
"babel-loader": "^8.2.3",
"babel-plugin-component": "^1.1.1",
"babel-plugin-istanbul": "^6.1.1",
@ -120,12 +120,12 @@
"electron-devtools-installer": "^3.2.0",
"electron-rebuild": "^3.2.5",
"electron-updater": "^4.6.3",
"eslint": "^8.5.0",
"eslint": "^8.7.0",
"eslint-config-standard": "^16.0.3",
"eslint-friendly-formatter": "^4.0.1",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-standard": "^4.1.0",
@ -136,7 +136,7 @@
"git-revision-webpack-plugin": "^5.0.0",
"html-webpack-plugin": "^5.5.0",
"imports-loader": "^0.8.0",
"karma": "^6.3.9",
"karma": "^6.3.11",
"karma-chai": "^0.1.0",
"karma-coverage": "^2.1.0",
"karma-electron": "^7.1.0",
@ -147,15 +147,15 @@
"license-checker": "^25.0.1",
"listr": "^0.14.3",
"marked": "^1.2.9",
"mini-css-extract-plugin": "^2.4.5",
"mini-css-extract-plugin": "^2.5.1",
"mocha": "^8.4.0",
"node-fetch": "^2.6.6",
"node-loader": "^2.0.0",
"path-browserify": "^1.0.1",
"playwright": "^1.17.1",
"playwright": "^1.17.2",
"postcss": "^8.4.5",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.1.0",
"postcss-preset-env": "^7.2.3",
"raw-loader": "^4.0.2",
"require-dir": "^1.2.0",
"style-loader": "^3.3.1",
@ -168,10 +168,10 @@
"vue-loader": "^15.9.8",
"vue-style-loader": "^4.1.3",
"vue-template-compiler": "^2.6.14",
"webpack": "^5.65.0",
"webpack": "^5.66.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.7.1",
"webpack-dev-server": "^4.7.3",
"webpack-hot-middleware": "^2.25.1",
"webpack-merge": "^5.8.0"
},

View File

@ -1,4 +1,4 @@
import execall from 'execall'
import execAll from 'execall'
import { defaultSearchOption } from '../config'
const matchString = (text, value, options) => {
@ -27,7 +27,7 @@ const matchString = (text, value, options) => {
try {
// Add try catch expression because not all string can generate a valid RegExp. for example `\`.
SEARCH_REG = new RegExp(regStr, flag)
return execall(SEARCH_REG, text)
return execAll(SEARCH_REG, text)
} catch (err) {
return []
}

View File

@ -1,20 +1,32 @@
// import virtualize from 'snabbdom-virtualize/strings'
const snabbdom = require('snabbdom')
import {
init,
classModule,
attributesModule,
datasetModule,
propsModule,
styleModule,
eventListenersModule,
h as sh,
toVNode as sToVNode
} from 'snabbdom'
export const patch = snabbdom.init([ // Init patch function with chosen modules
require('snabbdom/modules/class').default, // makes it easy to toggle classes
require('snabbdom/modules/attributes').default,
require('snabbdom/modules/style').default, // handles styling on elements with support for animations
require('snabbdom/modules/props').default, // for setting properties on DOM elements
require('snabbdom/modules/dataset').default,
require('snabbdom/modules/eventlisteners').default // attaches event listeners
export const patch = init([
classModule,
attributesModule,
styleModule,
propsModule,
datasetModule,
eventListenersModule
])
export const h = require('snabbdom/h').default // helper function for creating vnodes
export const h = sh
export const toVNode = sToVNode
export const toHTML = require('snabbdom-to-html') // helper function for convert vnode to HTML string
export const toVNode = require('snabbdom/tovnode').default // helper function for convert DOM to vnode
export const htmlToVNode = html => { // helper function for convert html to vnode
const wrapper = document.createElement('div')
wrapper.innerHTML = html
return toVNode(wrapper).children
}

View File

@ -1,4 +1,4 @@
import Unsplash, { toJson } from 'unsplash-js'
import { createApi } from 'unsplash-js'
import BaseFloat from '../baseFloat'
import { patch, h } from '../../parser/render/snabbdom'
import { EVENT_KEYS, URL_REG, isWin } from '../../config'
@ -7,6 +7,14 @@ import { getImageInfo } from '../../utils/getImageInfo'
import './index.css'
const toJson = res => {
if (res.type === 'success') {
return Promise.resolve(res.response)
} else {
return Promise.reject(new Error(res.type))
}
}
class ImageSelector extends BaseFloat {
static pluginName = 'imageSelector'
@ -29,7 +37,7 @@ class ImageSelector extends BaseFloat {
if (!unsplashAccessKey) {
this.unsplash = null
} else {
this.unsplash = new Unsplash({
this.unsplash = createApi({
accessKey: unsplashAccessKey
})
}
@ -74,12 +82,14 @@ class ImageSelector extends BaseFloat {
if (this.unsplash) {
// Load latest unsplash photos.
this.loading = true
this.unsplash.photos.listPhotos(1, 40, 'latest')
this.unsplash.photos.list({
perPage: 40
})
.then(toJson)
.then(json => {
this.loading = false
if (Array.isArray(json)) {
this.photoList = json
if (Array.isArray(json.results)) {
this.photoList = json.results
if (this.tab === 'unsplash') {
this.render()
}
@ -110,7 +120,11 @@ class ImageSelector extends BaseFloat {
this.loading = true
this.photoList = []
this.unsplash.search.photos(keyword, 1, 40)
this.unsplash.search.getPhotos({
query: keyword,
page: 1,
perPage: 40
})
.then(toJson)
.then(json => {
this.loading = false
@ -438,11 +452,13 @@ class ImageSelector extends BaseFloat {
const title = photo.user.name
const alt = photo.alt_description
const src = photo.urls.regular
const { id } = photo
this.unsplash.photos.getPhoto(id)
const { id: photoId } = photo
this.unsplash.photos.get({ photoId })
.then(toJson)
.then(json => {
this.unsplash.photos.downloadPhoto(json)
.then(result => {
this.unsplash.photos.trackDownload({
downloadLocation: result.links.download_location
})
})
return this.replaceImageAsync({ alt, title, src })
}

1602
yarn.lock

File diff suppressed because it is too large Load Diff