Skip to content

Commit

Permalink
Fix Axios http adapter and update deps (marktext#1989)
Browse files Browse the repository at this point in the history
  • Loading branch information
fxha authored Mar 21, 2020
1 parent 6491add commit cf49093
Show file tree
Hide file tree
Showing 5 changed files with 1,057 additions and 806 deletions.
5 changes: 5 additions & 0 deletions .electron-vue/webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ const rendererConfig = {
}),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin(getRendererEnvironmentDefinitions()),
// Use node http request instead axios's XHR adapter.
new webpack.NormalModuleReplacementPlugin(
/.+\/node_modules\/axios\/lib\/adapters\/xhr\.js$/,
'http.js'
),
new VueLoaderPlugin()
],
output: {
Expand Down
72 changes: 36 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
"axios": "^0.19.2",
"ced": "^1.0.0",
"chokidar": "^3.3.1",
"codemirror": "^5.51.0",
"codemirror": "^5.52.0",
"command-exists": "^1.2.8",
"dayjs": "^1.8.20",
"dayjs": "^1.8.23",
"dom-autoscroller": "^2.3.4",
"dompurify": "^2.0.8",
"dragula": "^3.7.2",
"electron-is-accelerator": "^0.1.2",
"electron-log": "^4.0.6",
"electron-store": "^5.0.0",
"electron-log": "^4.1.0",
"electron-store": "^5.1.1",
"electron-window-state": "^5.0.3",
"element-resize-detector": "^1.2.1",
"element-ui": "^2.13.0",
Expand All @@ -59,65 +59,65 @@
"fs-extra": "^8.1.0",
"fuzzaldrin": "^2.1.0",
"github-markdown-css": "^3.0.1",
"html-tags": "^3.0.0",
"html-tags": "^3.1.0",
"iconv-lite": "^0.5.1",
"iso-639-1": "^2.1.0",
"iso-639-1": "^2.1.1",
"joplin-turndown-plugin-gfm": "^1.0.12",
"katex": "^0.11.1",
"keyboard-layout": "^2.0.16",
"keytar": "5.2.0",
"mermaid": "^8.4.6",
"keytar": "5.4.0",
"mermaid": "^8.4.8",
"plist": "^3.0.1",
"popper.js": "^1.16.1",
"prismjs": "^1.19.0",
"snabbdom": "^0.7.4",
"snabbdom-to-html": "^5.1.1",
"source-map-support": "^0.5.12",
"turndown": "^5.0.3",
"source-map-support": "^0.5.16",
"turndown": "^6.0.0",
"underscore": "^1.9.2",
"unsplash-js": "^6.0.0",
"vega": "^5.9.1",
"vega-embed": "^6.2.2",
"vega-lite": "^4.3.1",
"vega": "^5.10.0",
"vega-embed": "^6.4.0",
"vega-lite": "^4.7.0",
"view-image": "^0.0.1",
"vscode-ripgrep": "^1.5.8",
"vue": "^2.6.11",
"vue-electron": "^1.0.6",
"vue-router": "^3.1.5",
"vuex": "^3.1.2",
"vue-router": "^3.1.6",
"vuex": "^3.1.3",
"webfontloader": "^1.6.28"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/core": "^7.8.7",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-export-default-from": "^7.8.3",
"@babel/plugin-proposal-function-bind": "^7.8.3",
"@babel/plugin-syntax-class-properties": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@babel/register": "^7.8.3",
"@babel/runtime": "^7.8.4",
"@babel/preset-env": "^7.8.7",
"@babel/register": "^7.8.6",
"@babel/runtime": "^7.8.7",
"@markedjs/html-differ": "^3.0.0",
"babel-eslint": "^10.0.2",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.0.6",
"babel-plugin-component": "^1.1.1",
"babel-plugin-istanbul": "^6.0.0",
"cfonts": "^2.7.0",
"cfonts": "^2.8.1",
"chai": "^4.2.0",
"chalk": "^3.0.0",
"cheerio": "^1.0.0-rc.3",
"copy-webpack-plugin": "^5.1.1",
"cross-env": "^7.0.0",
"cross-env": "^7.0.2",
"css-loader": "^3.4.2",
"del": "^5.1.0",
"devtron": "^1.4.0",
"dotenv": "^8.2.0",
"electron": "^8.0.1",
"electron-builder": "^22.3.2",
"electron": "^8.1.1",
"electron-builder": "^22.4.1",
"electron-devtools-installer": "^2.2.4",
"electron-rebuild": "^1.10.0",
"electron-updater": "^4.1.2",
"electron-rebuild": "^1.10.1",
"electron-updater": "^4.2.5",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-friendly-formatter": "^4.0.1",
Expand All @@ -127,10 +127,10 @@
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.1.2",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^6.2.2",
"esm": "^3.2.25",
"file-loader": "^5.0.2",
"file-loader": "^6.0.0",
"git-revision-webpack-plugin": "^3.0.4",
"html-webpack-plugin": "^3.2.0",
"imports-loader": "^0.8.0",
Expand All @@ -145,31 +145,31 @@
"license-checker": "^25.0.1",
"marked": "^0.8.0",
"mini-css-extract-plugin": "^0.9.0",
"mocha": "^7.0.1",
"mocha": "^7.1.0",
"multispinner": "^0.2.1",
"node-fetch": "^2.6.0",
"node-loader": "^0.6.0",
"postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.6.0",
"postcss-preset-env": "^6.7.0",
"raw-loader": "^4.0.0",
"require-dir": "^1.2.0",
"spectron": "^10.0.1",
"style-loader": "^1.1.3",
"svg-sprite-loader": "^4.2.1",
"svgo": "^1.3.0",
"svgo": "^1.3.2",
"svgo-loader": "^2.2.1",
"to-string-loader": "^1.1.6",
"url-loader": "^3.0.0",
"url-loader": "^4.0.0",
"vue-html-loader": "^1.2.4",
"vue-loader": "^15.9.0",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.41.6",
"webpack-bundle-analyzer": "^3.6.0",
"webpack": "^4.42.0",
"webpack-bundle-analyzer": "^3.6.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.1"
"webpack-merge": "^4.2.2"
},
"repository": {
"type": "git",
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/axios/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import axios from 'axios'
import adapter from 'axios/lib/adapters/xhr'
import adapter from 'axios/lib/adapters/http'

axios.defaults.adapter = adapter

const http = axios.create({
adapter
Expand Down
6 changes: 2 additions & 4 deletions src/renderer/spellchecker/dictionaryDownloader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs-extra'
import path from 'path'
import axios from 'axios'
import { SpellChecker } from '@hfelix/electron-spellchecker'
import axios from '../axios'
import { dictionaryPath } from '../spellchecker'

/**
Expand All @@ -11,9 +11,7 @@ import { dictionaryPath } from '../spellchecker'
*/
export const downloadHunspellDictionary = async lang => {
const url = SpellChecker.getURLForHunspellDictionary(lang)
const response = await axios({
method: 'get',
url,
const response = await axios.get(url, {
responseType: 'stream'
})

Expand Down
Loading

0 comments on commit cf49093

Please sign in to comment.