This commit is contained in:
darenhsu
2022-07-17 13:16:16 +08:00
parent 84759556ff
commit befd344ab0
28070 changed files with 4008428 additions and 1 deletions
+28
View File
@@ -0,0 +1,28 @@
const url = require('url')
const path = require('path')
const launch = require('launch-editor')
module.exports = (specifiedEditor, srcRoot, onErrorCallback) => {
if (typeof specifiedEditor === 'function') {
onErrorCallback = specifiedEditor
specifiedEditor = undefined
}
if (typeof srcRoot === 'function') {
onErrorCallback = srcRoot
srcRoot = undefined
}
srcRoot = srcRoot || process.cwd()
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 {
launch(path.resolve(srcRoot, file), specifiedEditor, onErrorCallback)
res.end()
}
}
}
+54
View File
@@ -0,0 +1,54 @@
{
"_args": [
[
"launch-editor-middleware@2.2.1",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
]
],
"_from": "launch-editor-middleware@2.2.1",
"_id": "launch-editor-middleware@2.2.1",
"_inBundle": false,
"_integrity": "sha512-s0UO2/gEGiCgei3/2UN3SMuUj1phjQN8lcpnvgLSz26fAzNWPQ6Nf/kF5IFClnfU2ehp6LrmKdMU/beveO+2jg==",
"_location": "/launch-editor-middleware",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "launch-editor-middleware@2.2.1",
"name": "launch-editor-middleware",
"escapedName": "launch-editor-middleware",
"rawSpec": "2.2.1",
"saveSpec": null,
"fetchSpec": "2.2.1"
},
"_requiredBy": [
"/@nuxt/server"
],
"_resolved": "https://registry.npmjs.org/launch-editor-middleware/-/launch-editor-middleware-2.2.1.tgz",
"_spec": "2.2.1",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"author": {
"name": "Evan You"
},
"bugs": {
"url": "https://github.com/yyx990803/launch-editor/issues"
},
"dependencies": {
"launch-editor": "^2.2.1"
},
"description": "express middleware for launching editor",
"homepage": "https://github.com/yyx990803/launch-editor#readme",
"keywords": [
"express",
"middleware",
"editor"
],
"license": "MIT",
"main": "index.js",
"name": "launch-editor-middleware",
"repository": {
"type": "git",
"url": "git+https://github.com/yyx990803/launch-editor.git"
},
"version": "2.2.1"
}