feat: upgrade to launch-editor 2.0.0

This commit is contained in:
Pooya Parsa 2018-01-07 11:51:36 +03:30
parent 4e24ec7eba
commit 9fc2bace44
5 changed files with 79 additions and 92 deletions

View File

@ -46,7 +46,7 @@ module.exports = function errorMiddleware(err, req, res, next) {
}
// Show stack trace
const youch = new Youch(err, req, readSource.bind(this), this.options.router.base)
const youch = new Youch(err, req, readSource.bind(this), this.options.router.base, true)
if (isJson) {
youch.toJSON().then(json => { sendResponse(JSON.stringify(json, undefined, 2), 'text/json') })
} else {
@ -69,7 +69,8 @@ async function readSource(frame) {
this.options.srcDir,
this.options.rootDir,
join(this.options.buildDir, 'dist'),
this.options.buildDir
this.options.buildDir,
process.cwd()
]
// Scan filesystem for real source

View File

@ -1,21 +0,0 @@
const url = require('url')
const launch = require('launch-editor')
const lineNumberRE = /:(\d+)$/
// Temporary middleware until https://github.com/yyx990803/launch-editor/pull/1 releases
module.exports = (specifiedEditor, onErrorCallback) => {
return function launchEditorMiddleware(req, res, next) {
const { file } = url.parse(req.url, true).query || {}
if (!file) {
res.statusCode = 500
res.end(`launch-editor-middleware: required query param "file" is missing.`)
} else {
const fileName = file.replace(lineNumberRE, '')
const lineNumberMatch = file.match(lineNumberRE)
const lineNumber = lineNumberMatch && lineNumberMatch[1]
launch(fileName, lineNumber, specifiedEditor, onErrorCallback)
res.end()
}
}
}

View File

@ -8,7 +8,7 @@ const fs = require('fs-extra')
const { createBundleRenderer } = require('vue-server-renderer')
const Debug = require('debug')
const connect = require('connect')
const launchMiddleware = require('./middleware/launch-editor-middleware')
const launchMiddleware = require('launch-editor-middleware')
const { setAnsiColors, isUrl, waitFor } = require('../common/utils')
const { Options } = require('../common')

View File

@ -56,7 +56,7 @@
"npm": ">=5.0.0"
},
"dependencies": {
"@nuxtjs/youch": "^4.2.2",
"@nuxtjs/youch": "^4.2.3",
"ansi-html": "^0.0.7",
"autoprefixer": "^7.2.4",
"babel-core": "^6.26.0",
@ -82,8 +82,8 @@
"hash-sum": "^1.0.2",
"html-minifier": "3.5.8",
"html-webpack-plugin": "^2.30.1",
"launch-editor": "^1.0.0",
"launch-editor-middleware": "^1.0.0",
"launch-editor": "^2.0.0",
"launch-editor-middleware": "^2.1.0",
"lodash": "^4.17.4",
"lru-cache": "^4.1.1",
"memory-fs": "^0.4.1",

137
yarn.lock
View File

@ -97,9 +97,9 @@
dependencies:
arrify "^1.0.1"
"@nuxtjs/youch@^4.2.1":
version "4.2.1"
resolved "https://registry.yarnpkg.com/@nuxtjs/youch/-/youch-4.2.1.tgz#5ac7bc56ab554a7bfc2f173ee764db16f33b01ca"
"@nuxtjs/youch@^4.2.3":
version "4.2.3"
resolved "https://registry.yarnpkg.com/@nuxtjs/youch/-/youch-4.2.3.tgz#36f8b22df5a0efaa81373109851e1d857aca6bed"
dependencies:
cookie "^0.3.1"
mustache "^2.3.0"
@ -110,8 +110,8 @@
resolved "https://registry.yarnpkg.com/@std/esm/-/esm-0.16.0.tgz#2a7a33ecb7f1701cebd4c87df6d0d945ed51f730"
"@types/node@*":
version "8.5.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.5.tgz#6f9e8164ae1a55a9beb1d2571cfb7acf9d720c61"
version "8.5.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.7.tgz#9c498c35af354dcfbca3790fb2e81129e93cf0e2"
abab@^1.0.3:
version "1.0.4"
@ -560,7 +560,7 @@ aws4@^1.2.1, aws4@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"
babel-code-frame@^6.11.0, babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
dependencies:
@ -1385,9 +1385,9 @@ bytes@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
cacache@^10.0.0, cacache@^10.0.1:
version "10.0.1"
resolved "https://registry.yarnpkg.com/cacache/-/cacache-10.0.1.tgz#3e05f6e616117d9b54665b1b20c8aeb93ea5d36f"
cacache@^10.0.1:
version "10.0.2"
resolved "https://registry.yarnpkg.com/cacache/-/cacache-10.0.2.tgz#105a93a162bbedf3a25da42e1939ed99ffb145f8"
dependencies:
bluebird "^3.5.0"
chownr "^1.0.1"
@ -1493,16 +1493,16 @@ caniuse-api@^2.0.0:
lodash.uniq "^4.5.0"
caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:
version "1.0.30000787"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000787.tgz#ca07a281be536a88bd7fac96ba895f3cf53f811b"
version "1.0.30000789"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000789.tgz#5cf3fec75480041ab162ca06413153141e234325"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000784, caniuse-lite@^1.0.30000787:
version "1.0.30000787"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000787.tgz#a76c4fa1d6ac00640447ec83c1e7c6b33dd615c5"
version "1.0.30000789"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000789.tgz#2e3d937b267133f63635ef7f441fac66360fc889"
capture-stack-trace@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz#4a6fa07399c26bba47f0b2496b4d0fb408c5550d"
resolved "http://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz#4a6fa07399c26bba47f0b2496b4d0fb408c5550d"
caseless@~0.12.0:
version "0.12.0"
@ -1677,7 +1677,7 @@ clone@^2.1.1:
co-with-promise@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/co-with-promise/-/co-with-promise-4.6.0.tgz#413e7db6f5893a60b942cf492c4bec93db415ab7"
resolved "http://registry.npmjs.org/co-with-promise/-/co-with-promise-4.6.0.tgz#413e7db6f5893a60b942cf492c4bec93db415ab7"
dependencies:
pinkie-promise "^1.0.0"
@ -1983,7 +1983,7 @@ create-ecdh@^4.0.0:
create-error-class@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6"
resolved "http://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6"
dependencies:
capture-stack-trace "^1.0.0"
@ -2082,21 +2082,21 @@ css-hot-loader@^1.3.5:
normalize-url "^1.9.1"
css-loader@^0.28.7:
version "0.28.7"
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.7.tgz#5f2ee989dd32edd907717f953317656160999c1b"
version "0.28.8"
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.8.tgz#ff36381464dea18fe60f2601a060ba6445886bd5"
dependencies:
babel-code-frame "^6.11.0"
babel-code-frame "^6.26.0"
css-selector-tokenizer "^0.7.0"
cssnano ">=2.6.1 <4"
cssnano "^3.10.0"
icss-utils "^2.1.0"
loader-utils "^1.0.2"
lodash.camelcase "^4.3.0"
object-assign "^4.0.1"
object-assign "^4.1.1"
postcss "^5.0.6"
postcss-modules-extract-imports "^1.0.0"
postcss-modules-local-by-default "^1.0.1"
postcss-modules-scope "^1.0.0"
postcss-modules-values "^1.1.0"
postcss-modules-extract-imports "^1.1.0"
postcss-modules-local-by-default "^1.2.0"
postcss-modules-scope "^1.1.0"
postcss-modules-values "^1.3.0"
postcss-value-parser "^3.3.0"
source-list-map "^2.0.0"
@ -2129,7 +2129,7 @@ cssesc@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4"
"cssnano@>=2.6.1 <4":
cssnano@^3.10.0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-3.10.0.tgz#4f38f6cea2b9b17fa01490f23f1dc68ea65c1c38"
dependencies:
@ -2231,7 +2231,7 @@ debug-log@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f"
debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8:
debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
dependencies:
@ -2372,8 +2372,8 @@ doctrine@1.5.0:
isarray "^1.0.0"
doctrine@^2.0.0, doctrine@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075"
version "2.1.0"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d"
dependencies:
esutils "^2.0.2"
@ -2680,11 +2680,11 @@ eslint-config-standard@^11.0.0-beta.0:
resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-11.0.0-beta.0.tgz#f8afe69803d95c685a4b8392b8793188eb03cbb3"
eslint-import-resolver-node@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz#4422574cde66a9a7b099938ee4d508a199e0e3cc"
version "0.3.2"
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a"
dependencies:
debug "^2.6.8"
resolve "^1.2.0"
debug "^2.6.9"
resolve "^1.5.0"
eslint-module-utils@^2.1.1:
version "2.1.1"
@ -2752,8 +2752,8 @@ eslint-visitor-keys@^1.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
eslint@^4.14.0:
version "4.14.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.14.0.tgz#96609768d1dd23304faba2d94b7fefe5a5447a82"
version "4.15.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.15.0.tgz#89ab38c12713eec3d13afac14e4a89e75ef08145"
dependencies:
ajv "^5.3.0"
babel-code-frame "^6.22.0"
@ -4411,15 +4411,15 @@ latest-version@^3.0.0:
dependencies:
package-json "^4.0.0"
launch-editor-middleware@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/launch-editor-middleware/-/launch-editor-middleware-1.0.0.tgz#1336164fdfdffa5cdaa83612fdbd962af32a726e"
launch-editor-middleware@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/launch-editor-middleware/-/launch-editor-middleware-2.1.0.tgz#31483e203e4fce952c1ea4e8e9e5e643a0fd08d5"
dependencies:
launch-editor "^1.0.0"
launch-editor "^2.0.0"
launch-editor@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/launch-editor/-/launch-editor-1.0.0.tgz#236b5d6891ca946c3544dcf2f82d3d7d7320ba76"
launch-editor@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/launch-editor/-/launch-editor-2.0.0.tgz#24a978139e0e9747fec2b4115f09a684526e2b90"
dependencies:
chalk "^2.3.0"
shell-quote "^1.6.1"
@ -4823,8 +4823,8 @@ mime@^1.3.4, mime@^1.4.1:
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
mime@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/mime/-/mime-2.1.0.tgz#1022a5ada445aa30686e4059abaea83d0b4e8f9c"
version "2.2.0"
resolved "https://registry.yarnpkg.com/mime/-/mime-2.2.0.tgz#161e541965551d3b549fa1114391e3a3d55b923b"
mimic-fn@^1.0.0:
version "1.1.0"
@ -5915,27 +5915,27 @@ postcss-minify-selectors@^2.0.4:
postcss "^5.0.14"
postcss-selector-parser "^2.0.0"
postcss-modules-extract-imports@^1.0.0:
postcss-modules-extract-imports@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.1.0.tgz#b614c9720be6816eaee35fb3a5faa1dba6a05ddb"
dependencies:
postcss "^6.0.1"
postcss-modules-local-by-default@^1.0.1:
postcss-modules-local-by-default@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.2.0.tgz#f7d80c398c5a393fa7964466bd19500a7d61c069"
dependencies:
css-selector-tokenizer "^0.7.0"
postcss "^6.0.1"
postcss-modules-scope@^1.0.0:
postcss-modules-scope@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-1.1.0.tgz#d6ea64994c79f97b62a72b426fbe6056a194bb90"
dependencies:
css-selector-tokenizer "^0.7.0"
postcss "^6.0.1"
postcss-modules-values@^1.1.0:
postcss-modules-values@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-1.3.0.tgz#ecffa9d7e192518389f42ad0e83f72aec456ea20"
dependencies:
@ -6081,8 +6081,8 @@ postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0
supports-color "^3.2.3"
postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.11, postcss@^6.0.13, postcss@^6.0.14, postcss@^6.0.15, postcss@^6.0.5, postcss@^6.0.6, postcss@^6.0.8:
version "6.0.15"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.15.tgz#f460cd6269fede0d1bf6defff0b934a9845d974d"
version "6.0.16"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.16.tgz#112e2fe2a6d2109be0957687243170ea5589e146"
dependencies:
chalk "^2.3.0"
source-map "^0.6.1"
@ -6624,7 +6624,7 @@ resolve-url@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
resolve@^1.1.7, resolve@^1.2.0, resolve@^1.3.3, resolve@^1.4.0:
resolve@^1.1.7, resolve@^1.2.0, resolve@^1.3.3, resolve@^1.4.0, resolve@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36"
dependencies:
@ -6708,6 +6708,13 @@ schema-utils@^0.3.0:
dependencies:
ajv "^5.0.0"
schema-utils@^0.4.2:
version "0.4.3"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.3.tgz#e2a594d3395834d5e15da22b48be13517859458e"
dependencies:
ajv "^5.0.0"
ajv-keywords "^2.1.0"
semver-diff@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36"
@ -7418,9 +7425,9 @@ ua-parser-js@^0.7.9:
version "0.7.17"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.17.tgz#e9ec5f9498b9ec910e7ae3ac626a805c4d09ecac"
uglify-es@3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.2.2.tgz#15c62b7775002c81b7987a1c49ecd3f126cace73"
uglify-es@^3.3.4:
version "3.3.4"
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.4.tgz#2d592678791e5310456bbc95e952139e3b13167a"
dependencies:
commander "~2.12.1"
source-map "~0.6.1"
@ -7454,17 +7461,17 @@ uglifyjs-webpack-plugin@^0.4.6:
webpack-sources "^1.0.1"
uglifyjs-webpack-plugin@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.1.5.tgz#5ec4a16da0fd10c96538f715caed10dbdb180875"
version "1.1.6"
resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.1.6.tgz#f4ba8449edcf17835c18ba6ae99b9d610857fb19"
dependencies:
cacache "^10.0.0"
cacache "^10.0.1"
find-cache-dir "^1.0.0"
schema-utils "^0.3.0"
schema-utils "^0.4.2"
serialize-javascript "^1.4.0"
source-map "^0.6.1"
uglify-es "3.2.2"
webpack-sources "^1.0.1"
worker-farm "^1.4.1"
uglify-es "^3.3.4"
webpack-sources "^1.1.0"
worker-farm "^1.5.2"
uid-number@^0.0.6:
version "0.0.6"
@ -7782,8 +7789,8 @@ webpack-bundle-analyzer@^2.9.0:
ws "^3.3.1"
webpack-dev-middleware@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-2.0.3.tgz#44e15480ec58d275417ac4d93a0126c7b72450bd"
version "2.0.4"
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-2.0.4.tgz#7d8943a609121021bb72772a41636e229346cb41"
dependencies:
loud-rejection "^1.6.0"
memory-fs "~0.4.1"
@ -7815,7 +7822,7 @@ webpack-node-externals@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/webpack-node-externals/-/webpack-node-externals-1.6.0.tgz#232c62ec6092b100635a3d29d83c1747128df9bd"
webpack-sources@^1.0.1:
webpack-sources@^1.0.1, webpack-sources@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.1.0.tgz#a101ebae59d6507354d71d8013950a3a8b7a5a54"
dependencies:
@ -7913,7 +7920,7 @@ wordwrap@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
worker-farm@^1.4.1:
worker-farm@^1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.5.2.tgz#32b312e5dc3d5d45d79ef44acc2587491cd729ae"
dependencies: