@quicktvui/web-cli 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/qt-web-cli-watch.js
CHANGED
|
File without changes
|
package/lib/DevServer.js
CHANGED
|
@@ -36,6 +36,8 @@ const MIME_TYPES = {
|
|
|
36
36
|
'.mp3': 'audio/mpeg',
|
|
37
37
|
'.mp4': 'video/mp4',
|
|
38
38
|
'.wav': 'audio/wav',
|
|
39
|
+
'.ogg': 'audio/ogg',
|
|
40
|
+
'.m4a': 'audio/mp4',
|
|
39
41
|
'.map': 'application/json',
|
|
40
42
|
'.bundle': 'application/javascript; charset=utf-8',
|
|
41
43
|
'.txt': 'text/plain; charset=utf-8',
|
|
@@ -586,7 +588,12 @@ class DevServer {
|
|
|
586
588
|
if (req.headers['if-modified-since']) {
|
|
587
589
|
headers['if-modified-since'] = req.headers['if-modified-since']
|
|
588
590
|
}
|
|
589
|
-
|
|
591
|
+
if (req.headers['content-type']) {
|
|
592
|
+
headers['content-type'] = req.headers['content-type']
|
|
593
|
+
}
|
|
594
|
+
if (req.headers['content-length']) {
|
|
595
|
+
headers['content-length'] = req.headers['content-length']
|
|
596
|
+
}
|
|
590
597
|
headers['x-forwarded-for'] = req.socket.remoteAddress
|
|
591
598
|
headers['x-forwarded-proto'] = protocol
|
|
592
599
|
|
package/lib/HotReloader.js
CHANGED
|
@@ -12,8 +12,7 @@ const signale = require('signale')
|
|
|
12
12
|
class HotReloader {
|
|
13
13
|
constructor() {
|
|
14
14
|
this.clients = new Set()
|
|
15
|
-
this.
|
|
16
|
-
this.lastEventData = null
|
|
15
|
+
this.lastEvent = null
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -31,8 +30,8 @@ class HotReloader {
|
|
|
31
30
|
res.write(`data: ${JSON.stringify({ type: 'connected', timestamp: Date.now() })}\n\n`)
|
|
32
31
|
|
|
33
32
|
// 如果有最近的事件,立即发送
|
|
34
|
-
if (this.
|
|
35
|
-
res.write(`data: ${JSON.stringify(
|
|
33
|
+
if (this.lastEvent) {
|
|
34
|
+
res.write(`data: ${JSON.stringify(this.lastEvent)}\n\n`)
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
this.clients.add(res)
|
|
@@ -58,8 +57,7 @@ class HotReloader {
|
|
|
58
57
|
...data,
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
this.
|
|
62
|
-
this.lastEventData = data
|
|
60
|
+
this.lastEvent = event
|
|
63
61
|
|
|
64
62
|
this._broadcast(event)
|
|
65
63
|
signale.info(`[HotReloader] 通知 ${this.clients.size} 个客户端: bundle-update`)
|
|
@@ -75,8 +73,7 @@ class HotReloader {
|
|
|
75
73
|
reason,
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
this.
|
|
79
|
-
this.lastEventData = { reason }
|
|
76
|
+
this.lastEvent = event
|
|
80
77
|
|
|
81
78
|
this._broadcast(event)
|
|
82
79
|
signale.info(`[HotReloader] 通知 ${this.clients.size} 个客户端: full-reload`)
|
|
@@ -93,8 +90,7 @@ class HotReloader {
|
|
|
93
90
|
timestamp: Date.now(),
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
this.
|
|
97
|
-
this.lastEventData = { status, message }
|
|
93
|
+
this.lastEvent = event
|
|
98
94
|
|
|
99
95
|
this._broadcast(event)
|
|
100
96
|
}
|
|
@@ -104,8 +100,7 @@ class HotReloader {
|
|
|
104
100
|
* 防止 SSE 重连后再次发送旧的 bundle-update 导致无限刷新
|
|
105
101
|
*/
|
|
106
102
|
clearLastEvent() {
|
|
107
|
-
this.
|
|
108
|
-
this.lastEventData = null
|
|
103
|
+
this.lastEvent = null
|
|
109
104
|
}
|
|
110
105
|
|
|
111
106
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quicktvui/web-cli",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "CLI tool for QuickTVUI web development v3 - delegate build & bundle loading",
|
|
5
5
|
"author": "QuickTVUI Team",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,10 +8,6 @@
|
|
|
8
8
|
"qt-web-cli": "./bin/qt-web-cli.js"
|
|
9
9
|
},
|
|
10
10
|
"main": "lib/index.js",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"sync-runtime": "rm -rf runtime/*.js && cp ../web-runtime/dist/web-runtime.*.js runtime/",
|
|
13
|
-
"prepublishOnly": "npm run sync-runtime"
|
|
14
|
-
},
|
|
15
11
|
"files": [
|
|
16
12
|
"bin",
|
|
17
13
|
"lib",
|
|
@@ -86,5 +82,8 @@
|
|
|
86
82
|
},
|
|
87
83
|
"engines": {
|
|
88
84
|
"node": ">=16.0.0"
|
|
85
|
+
},
|
|
86
|
+
"scripts": {
|
|
87
|
+
"sync-runtime": "rm -rf runtime/*.js && cp ../web-runtime/dist/web-runtime.*.js runtime/"
|
|
89
88
|
}
|
|
90
|
-
}
|
|
89
|
+
}
|