This commit is contained in:
2022-07-18 02:50:52 +00:00
parent befd344ab0
commit 06181b34d6
8569 changed files with 818704 additions and 352705 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ const serveStatic = require('serve-static')
const getPort = require('get-port-please')
const { json, end, header } = require('node-res')
const { parseStack } = require('./utils/error')
const { parseStack } = require('./utils')
const SSE = require('./sse')
class LoadingUI {
+4 -1
View File
@@ -13,7 +13,10 @@ class SSE {
status(res, 200)
header(res, 'Content-Type', 'text/event-stream')
header(res, 'Cache-Control', 'no-cache')
header(res, 'Connection', 'keep-alive')
if (req.httpVersion !== '2.0') {
header(res, 'Connection', 'keep-alive')
}
this.subscriptions.add(res)
res.on('close', () => this.subscriptions.delete(res))
+21
View File
@@ -0,0 +1,21 @@
const { sep } = require('path')
// copied from https://github.com/nuxt/consola/blob/master/src/utils/error.js
function parseStack (stack) {
const cwd = process.cwd() + sep
const lines = stack
.split('\n')
.splice(1)
.map(l => l
.trim()
.replace('file://', '')
.replace(cwd, '')
)
return lines
}
module.exports = {
parseStack
}