coc-live-server 0.0.8 → 0.1.0
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/README.md +9 -7
- package/lib/index.js +7 -3
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -12,16 +12,18 @@ Launch a development local Server with live reload feature for static & dynamic
|
|
|
12
12
|
## Configuration options
|
|
13
13
|
|
|
14
14
|
- `coc-live-server.enabled`: Enable coc-live-server extension, default: `true`
|
|
15
|
-
- `coc-live-server.host`: server
|
|
16
|
-
- `coc-live-server.port`: server
|
|
17
|
-
- `coc-live-server.cors`:
|
|
18
|
-
- `coc-live-server.
|
|
15
|
+
- `coc-live-server.host`: Host for the live server, default: `0.0.0.0`
|
|
16
|
+
- `coc-live-server.port`: Port number for the live server, default: `8080`
|
|
17
|
+
- `coc-live-server.cors`: Enable CORS for the live server, default: `false`
|
|
18
|
+
- `coc-live-server.wait`: Wait time in milliseconds before reloading the page after a file change is detected, default: `100`
|
|
19
|
+
- `coc-live-server.spa`: translate requests from /abc to /#/abc (handy for Single Page Apps), default: `false`
|
|
20
|
+
- `coc-live-server.index`: Default file to serve when accessing the root URL, default: `index.html`
|
|
19
21
|
|
|
20
22
|
## Commands
|
|
21
23
|
|
|
22
|
-
- `
|
|
23
|
-
- `
|
|
24
|
-
- `
|
|
24
|
+
- `live-server.toggle`: Toggle Live Server
|
|
25
|
+
- `live-server.start`: Start Live Server
|
|
26
|
+
- `live-server.stop`: Stop Live Server
|
|
25
27
|
|
|
26
28
|
---
|
|
27
29
|
|
package/lib/index.js
CHANGED
|
@@ -57,6 +57,7 @@ function startLiveServer() {
|
|
|
57
57
|
const host = getConfigItem("host", "0.0.0.0");
|
|
58
58
|
const cors = getConfigItem("cors");
|
|
59
59
|
const wait = getConfigItem("wait", 100);
|
|
60
|
+
const spa = getConfigItem("spa");
|
|
60
61
|
const index = getConfigItem("index", "index.html");
|
|
61
62
|
const STATUS = `liveServer[:${port}]`;
|
|
62
63
|
const args = [];
|
|
@@ -75,6 +76,9 @@ function startLiveServer() {
|
|
|
75
76
|
if (cors) {
|
|
76
77
|
args.push(" --cors");
|
|
77
78
|
}
|
|
79
|
+
if (spa) {
|
|
80
|
+
args.push(" --spa");
|
|
81
|
+
}
|
|
78
82
|
if (wait && typeof wait === "number") {
|
|
79
83
|
args.push(" --wait=" + wait);
|
|
80
84
|
}
|
|
@@ -144,13 +148,13 @@ async function activate(context) {
|
|
|
144
148
|
return;
|
|
145
149
|
}
|
|
146
150
|
context.subscriptions.push(
|
|
147
|
-
import_coc3.commands.registerCommand("
|
|
151
|
+
import_coc3.commands.registerCommand("live-server.start", () => {
|
|
148
152
|
startLiveServer();
|
|
149
153
|
}),
|
|
150
|
-
import_coc3.commands.registerCommand("
|
|
154
|
+
import_coc3.commands.registerCommand("live-server.stop", () => {
|
|
151
155
|
stopLiveServer();
|
|
152
156
|
}),
|
|
153
|
-
import_coc3.commands.registerCommand("
|
|
157
|
+
import_coc3.commands.registerCommand("live-server.toggle", () => {
|
|
154
158
|
toggleLiveServer();
|
|
155
159
|
})
|
|
156
160
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coc-live-server",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Launch a development local Server with live reload feature for static & dynamic pages.",
|
|
5
5
|
"author": "cyl <a1008611abcd@126.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,20 +60,25 @@
|
|
|
60
60
|
"type": "number",
|
|
61
61
|
"default": 100,
|
|
62
62
|
"description": "Wait time in milliseconds before reloading the page after a file change is detected"
|
|
63
|
+
},
|
|
64
|
+
"coc-live-server.spa": {
|
|
65
|
+
"type": "boolean",
|
|
66
|
+
"default": false,
|
|
67
|
+
"description": "translate requests from /abc to /#/abc (handy for Single Page Apps)"
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
},
|
|
66
71
|
"commands": [
|
|
67
72
|
{
|
|
68
|
-
"command": "
|
|
73
|
+
"command": "live-server.start",
|
|
69
74
|
"title": "Start Live Server"
|
|
70
75
|
},
|
|
71
76
|
{
|
|
72
|
-
"command": "
|
|
77
|
+
"command": "live-server.stop",
|
|
73
78
|
"title": "Stop Live Server"
|
|
74
79
|
},
|
|
75
80
|
{
|
|
76
|
-
"command": "
|
|
81
|
+
"command": "live-server.toggle",
|
|
77
82
|
"title": "Toggle Live Server"
|
|
78
83
|
}
|
|
79
84
|
]
|