coc-live-server 0.0.6 → 0.0.8

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.
Files changed (3) hide show
  1. package/README.md +4 -1
  2. package/lib/index.js +16 -0
  3. package/package.json +21 -1
package/README.md CHANGED
@@ -12,7 +12,10 @@ 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.port`: server port, default: 8080
15
+ - `coc-live-server.host`: server host, default: `0.0.0.0`
16
+ - `coc-live-server.port`: server port, default: `8080`
17
+ - `coc-live-server.cors`: cors, default: `false`
18
+ - `coc-live-server.index`: index file, default: `index.html`
16
19
 
17
20
  ## Commands
18
21
 
package/lib/index.js CHANGED
@@ -54,6 +54,10 @@ var statusItem = null;
54
54
  function startLiveServer() {
55
55
  const serverModule = require.resolve("live-server/live-server");
56
56
  const port = getConfigItem("port", 8080);
57
+ const host = getConfigItem("host", "0.0.0.0");
58
+ const cors = getConfigItem("cors");
59
+ const wait = getConfigItem("wait", 100);
60
+ const index = getConfigItem("index", "index.html");
57
61
  const STATUS = `liveServer[:${port}]`;
58
62
  const args = [];
59
63
  if (liveServerProcess) {
@@ -65,6 +69,18 @@ function startLiveServer() {
65
69
  if (port && typeof port === "number") {
66
70
  args.push(" --port=" + port);
67
71
  }
72
+ if (host && typeof host === "string") {
73
+ args.push(" --host=" + host);
74
+ }
75
+ if (cors) {
76
+ args.push(" --cors");
77
+ }
78
+ if (wait && typeof wait === "number") {
79
+ args.push(" --wait=" + wait);
80
+ }
81
+ if (index && typeof index === "string") {
82
+ args.push(" --index=" + index);
83
+ }
68
84
  args.push(` ${import_coc2.workspace.root}`);
69
85
  liveServerProcess = (0, import_child_process.spawn)("node", [serverModule, ...args], { shell: true });
70
86
  if (liveServerProcess) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-live-server",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
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",
@@ -36,10 +36,30 @@
36
36
  "default": true,
37
37
  "description": "Enable coc-live-server extension"
38
38
  },
39
+ "coc-live-server.host": {
40
+ "type": "string",
41
+ "default": "0.0.0.0",
42
+ "description": "Host for the live server"
43
+ },
39
44
  "coc-live-server.port": {
40
45
  "type": "number",
41
46
  "default": 8080,
42
47
  "description": "Port number for the live server"
48
+ },
49
+ "coc-live-server.cors": {
50
+ "type": "boolean",
51
+ "default": false,
52
+ "description": "Enable CORS for the live server"
53
+ },
54
+ "coc-live-server.index": {
55
+ "type": "string",
56
+ "default": "index.html",
57
+ "description": "Default file to serve when accessing the root URL"
58
+ },
59
+ "coc-live-server.wait": {
60
+ "type": "number",
61
+ "default": 100,
62
+ "description": "Wait time in milliseconds before reloading the page after a file change is detected"
43
63
  }
44
64
  }
45
65
  },