Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

拉取更新 #2

Merged
merged 14 commits into from
May 9, 2018
19 changes: 14 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,31 @@
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/src/**/*.js" ],
"outFiles": [
"${workspaceRoot}/out/src/**/*.js"
],
"preLaunchTask": "npm"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/test/**/*.js" ],
"outFiles": [
"${workspaceRoot}/out/test/**/*.js"
],
"preLaunchTask": "npm"
}
]
}
}
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog
| Version | Date | Changelog |
|---|---|---|
|3.2.1|17.02.2018 | &mdash; Re-deployed to vscode marketplace. For some reason few users are facing `command 'extension.liveServer.goOnline' not found` error. <br/> [[#78](https://github.com/ritwickdey/vscode-live-server/issues/78)] [[#80](https://github.com/ritwickdey/vscode-live-server/issues/80)] [[#78#issuecomment](https://github.com/ritwickdey/vscode-live-server/issues/78#issuecomment-365891533)] [[Tweet](https://twitter.com/mohamed_aladdin/status/962608074212200448)] <br/> *(Still the reason of the error is unknown to me.)* <br/><br/> &mdash; Docs Updated
|3.2.0| 09.02.2018 | &mdash; ***[New Feature [[#72](https://github.com/ritwickdey/vscode-live-server/issues/72)]]*** `liveServer.settings.mount` settings added for mounting a directory to a route (see [settings section](https://github.com/ritwickdey/vscode-live-server/blob/master/docs/settings.md) for more details.) *[Thanks [Douglas Chen](https://github.com/cdswyda) for the [PR#73](https://github.com/ritwickdey/vscode-live-server/pull/73)]* <br> |
|3.1.0| 24.01.2018 | &mdash; ***[New feature [#68](https://github.com/ritwickdey/vscode-live-server/issues/68) & [#64](https://github.com/ritwickdey/vscode-live-server/issues/64)]*** CROS Enabled by default. *[Thanks [Elias García](https://github.com/elias-garcia) & [Gabriele Garavini](https://github.com/garaving)]* <br><br> &mdash; ***[New Settings / Enhacement]*** `liveServer.settings.fullReload` settings added for full reload instead of css inject (see [settings section](https://github.com/ritwickdey/vscode-live-server/blob/master/docs/settings.md) for more details.) <br><br> &mdash; ***[New Settings / Enhacement [#49](https://github.com/ritwickdey/vscode-live-server/issues/49)]*** `liveServer.settings.wait` settings added for delay before live reloading (see [settings section](https://github.com/ritwickdey/vscode-live-server/blob/master/docs/settings.md) for more details.) *[Thanks [Allen](https://github.com/justforuse)]*
|3.1.0| 24.01.2018 | &mdash; ***[New feature [#68](https://github.com/ritwickdey/vscode-live-server/issues/68) & [#64](https://github.com/ritwickdey/vscode-live-server/issues/64)]*** CORS Enabled by default. *[Thanks [Elias García](https://github.com/elias-garcia) & [Gabriele Garavini](https://github.com/garaving)]* <br><br> &mdash; ***[New Settings / Enhacement]*** `liveServer.settings.fullReload` settings added for full reload instead of css inject (see [settings section](https://github.com/ritwickdey/vscode-live-server/blob/master/docs/settings.md) for more details.) <br><br> &mdash; ***[New Settings / Enhacement [#49](https://github.com/ritwickdey/vscode-live-server/issues/49)]*** `liveServer.settings.wait` settings added for delay before live reloading (see [settings section](https://github.com/ritwickdey/vscode-live-server/blob/master/docs/settings.md) for more details.) *[Thanks [Allen](https://github.com/justforuse)]*
|3.0.2|19.12.17| &mdash; ***[Enhacement [#38](https://github.com/ritwickdey/vscode-live-server/issues/38) & [#55](https://github.com/ritwickdey/vscode-live-server/issues/55)]*** default keybinding for MAC is changed to `cmd+L O` & `cmd+L C` to open & close server respectively. *[Thanks [Jens Alexander Ewald](https://github.com/jens-a-e), [Tim-Lars Schnehag](https://github.com/tallon1252) & [@nakedtoast](https://github.com/nakedtoast)]* <br> |
|3.0.1|17.12.17| &mdash; ***[Bug Fixed [#31](https://github.com/ritwickdey/vscode-live-server/issues/31)]*** `AdvanceCustomBrowserCmdLine` settings has been fixed. You can specify full path of your favorite custom browser *[Thanks [hdd1013](https://github.com/hdd1013)].* <br><br> &mdash;**[Bug Fixed [#47](https://github.com/ritwickdey/vscode-live-server/issues/47)]** `ChromeDebuggingAttachment` settings has been fixed. *[Thanks [Dr. YSG](https://github.com/DrYSG)].*|
|3.0.0| 23.10.17 | &mdash; ***[Announcement]*** : Live Server is now supports dynamic pages like PHP through *[Live Server Web Extension](https://github.com/ritwickdey/live-server-web-extension)*. <br><br> &mdash; ***[New [#20](https://github.com/ritwickdey/vscode-live-server/issues/20)]*** Support for `https` protocol. *(For more, see the `setting` section)* *[Thanks [Xaqron](https://github.com/Xaqron)].* <br><br> &mdash; ***[New]*** Support for proxy. *(For more, see the `setting` section)* <br><br> &mdash; ***[New]*** Setup settings for *[Live Server Web Extension](https://github.com/ritwickdey/live-server-web-extension)*. *(For more, see the `setting` section)* <br><br> &mdash; ***[Dropped]*** `additionalTagsForLiveReload` setting dropped. *(For more, see the `setting` section)* |
Expand Down
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
***[[I'm sorry! I can't maintain the repo as I'm so busy now days for exams! I need 2-3 maintainers .
If you want to help me to maintain this repo && if you know how to debug, you're welcome - contact with me [email protected]]]***


# Live Server

***Boom! Big Announcement! Live Server is now supported for dynamic pages like PHP. [Check Here for more details](https://github.com/ritwickdey/live-server-web-extension).***

_[If you like the extension, [please leave a review](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer#review-details), it puts a smile on my face.]_
**Boom! Big Announcement! Live Server is now supported for dynamic pages like PHP. [Check Here for more details](https://github.com/ritwickdey/live-server-web-extension).**

***[If you're facing 'command not found error', please follow the steps [#78](https://github.com/ritwickdey/vscode-live-server/issues/78)]***

[![VSCode Marketplace](https://img.shields.io/vscode-marketplace/v/ritwickdey.LiveServer.svg?style=flat-square&label=vscode%20marketplace)](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) [![Total Installs](https://img.shields.io/vscode-marketplace/d/ritwickdey.LiveServer.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) [![Avarage Rating](https://img.shields.io/vscode-marketplace/r/ritwickdey.LiveServer.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer)
[![Travis branch](https://img.shields.io/travis/ritwickdey/vscode-live-server/master.svg?style=flat-square&label=travis%20branch)](https://travis-ci.org/ritwickdey/vscode-live-server) [![Appveyor branch](https://img.shields.io/appveyor/ci/ritwickdey/vscode-live-server.svg?style=flat-square&label=appveyor%20branch)](https://ci.appveyor.com/project/ritwickdey/vscode-live-server) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/ritwickdey/vscode-live-server/)
Expand All @@ -25,7 +30,7 @@ _[If you like the extension, [please leave a review](https://marketplace.visuals
3. Open a HTML file and Right click on the editor and choose the options.
![Edit Menu Option Preview](./images/Screenshot/vscode-live-server-editor-menu-3.jpg)

4. Hit `(alt+L, O)` to Open the Server and `(alt+L, C)` to close the server (You can change the shortcut form keybinding).
4. Hit `(alt+L, O)` to Open the Server and `(alt+L, C)` to close the server (You can change the shortcut form keybinding). *[On MAC, `cmd+L, O` and `cmd+L, C`]*

5. Press `F1` or `ctrl+shift+P` and type `Live Server: Open With Live Server ` to start a server or type `Live Server: Close Live Server` to stop a server.

Expand All @@ -45,10 +50,11 @@ _[If you like the extension, [please leave a review](https://marketplace.visuals
* SVG Support
* `https` Support.
* Support for proxy.
* CORS Enabled
* Support for any file even dynamic pages through *[Live Server Web Extension](https://github.com/ritwickdey/live-server-web-extension)*.

## Installation
Open VSCode Editor and Press `ctrl+P`, type `ext install LiveServer`.
Open VSCode Editor and Press `ctrl+P`, type `ext install ritwickdey.liveserver`.

## Settings
All settings are now listed here [Settings Docs](./docs/settings.md).
Expand All @@ -58,9 +64,16 @@ All settings are now listed here [Settings Docs](./docs/settings.md).

## What's new ?

* ### Version 3.2.0 (09.02.18)
* ***[New Feature [[#72](https://github.com/ritwickdey/vscode-live-server/issues/72)]]*** `liveServer.settings.mount` settings added for mounting a directory to a route (see [settings section](https://github.com/ritwickdey/vscode-live-server/blob/master/docs/settings.md) for more details.) *[Thanks [Douglas Chen](https://github.com/cdswyda) for the [PR#73](https://github.com/ritwickdey/vscode-live-server/pull/73)]*
* ### Version 3.2.1 (17.02.18)
* Re-deployed to vscode marketplace. For some reason few users are facing `command 'extension.liveServer.goOnline' not found` error.
* [#78](https://github.com/ritwickdey/vscode-live-server/issues/78)
* [#80](https://github.com/ritwickdey/vscode-live-server/issues/80)
* [78#issuecomment](https://github.com/ritwickdey/vscode-live-server/issues/78#issuecomment-365891533)
* [Tweet](https://twitter.com/mohamed_aladdin/status/962608074212200448)

*(Still the reason of the error is unknown to me.)*

* Docs Updated

## Changelog
To check full changelog [click here](CHANGELOG.md).
Expand Down
4 changes: 4 additions & 0 deletions docs/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ And note down the `IPv4 Address` (probably it will look like 192.168.xx.xx). Thi

----------

## Are Multi-root workspaces supported?

Currently there is no support for multi-root workspaces. It's automatically the first folder in the workspace choosen.
The current state of this issue you can track [here](https://github.com/ritwickdey/vscode-live-server/issues/43).
4 changes: 2 additions & 2 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* _chrome --incognito --headless --remote-debugging-port=9222_
* _C:\\Program Files\\Firefox Developer Edition\\firefox.exe --private-window_

> Note: Eighter use `AdvanceCustomBrowserCmdLine` or `CustomBrowser`. If you use both, `AdvanceCustomBrowserCmdLine` has higher priority.
> Note: Either use `AdvanceCustomBrowserCmdLine` or `CustomBrowser`. If you use both, `AdvanceCustomBrowserCmdLine` has higher priority.

<hr>

Expand Down Expand Up @@ -158,4 +158,4 @@
}
```

<hr>
<hr>
19 changes: 15 additions & 4 deletions lib/live-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ var fs = require('fs'),
open = require('opn'),
es = require("event-stream"),
os = require('os'),
chokidar = require('chokidar');
chokidar = require('chokidar'),
httpProxy = require('http-proxy');
require('colors');


var INJECTED_CODE = fs.readFileSync(path.join(__dirname, "injected.html"), "utf8");

let useBrowserExtension = false;
let useBrowserExtension = false;
let GET_INJECTED_CODE = () => {
return useBrowserExtension === true ? '' : INJECTED_CODE;
}
Expand Down Expand Up @@ -187,9 +188,9 @@ LiveServer.start = function (options, callback) {
var disableGlobbing = options.disableGlobbing || false;
var onTagMissedCallback = options.onTagMissedCallback || null;
var fullReload = options.fullReload || false;

var staticServerHandler = staticServer(root, onTagMissedCallback);

// Setup a web server
var app = connect();

Expand Down Expand Up @@ -354,6 +355,16 @@ LiveServer.start = function (options, callback) {
// WebSocket
var clients = [];
server.addListener('upgrade', function (request, socket, head) {
if (!request.url.endsWith("/ws")) {
let proxyURL = url.parse(proxy[0][1])
new httpProxy.createProxyServer({
target: {
host: proxyURL.host
},
secure: false
}).ws(request, socket, head);
return;
}
var ws = new WebSocket(request, socket, head);
ws.onopen = function () {
ws.send('connected');
Expand Down
9 changes: 4 additions & 5 deletions lib/live-server/injected.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<script type="text/javascript">
// <![CDATA[ <-- For SVG support
if ('WebSocket' in window) {
(function() {
(function () {
function refreshCSS() {
var sheets = [].slice.call(document.getElementsByTagName("link"));
var head = document.getElementsByTagName("head")[0];
Expand All @@ -20,12 +20,11 @@
var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';
var address = protocol + window.location.host + window.location.pathname + '/ws';
var socket = new WebSocket(address);
socket.onmessage = function(msg) {
socket.onmessage = function (msg) {
if (msg.data == 'reload') window.location.reload();
else if (msg.data == 'refreshcss') refreshCSS();
};
if(sessionStorage && !sessionStorage.getItem('IsThisFirstTime_Log_From_LiveServer'))
{
if (sessionStorage && !sessionStorage.getItem('IsThisFirstTime_Log_From_LiveServer')) {
console.log('Live reload enabled.');
sessionStorage.setItem('IsThisFirstTime_Log_From_LiveServer', true);
}
Expand All @@ -35,4 +34,4 @@
console.error('Upgrade your browser. This Browser is NOT supported WebSocket for Live-Reloading.');
}
// ]]>
</script>
</script>
4 changes: 4 additions & 0 deletions lib/live-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
"node": ">=0.10.0"
},
"eslintConfig": {
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"node": true
},
Expand Down
Loading