|
|
@@ -4,7 +4,7 @@ |
|
|
|
|
|
|
|
_ref = require('./protocol'), Parser = _ref.Parser, PROTOCOL_6 = _ref.PROTOCOL_6, PROTOCOL_7 = _ref.PROTOCOL_7; |
|
|
|
|
|
|
|
Version = '2.2.2'; |
|
|
|
Version = '2.2.1'; |
|
|
|
|
|
|
|
exports.Connector = Connector = (function() { |
|
|
|
function Connector(options, WebSocket, Timer, handlers) { |
|
|
@@ -12,7 +12,7 @@ |
|
|
|
this.WebSocket = WebSocket; |
|
|
|
this.Timer = Timer; |
|
|
|
this.handlers = handlers; |
|
|
|
this._uri = "ws" + (this.options.https ? "s" : "") + "://" + this.options.host + ":" + this.options.port + "/livereload"; |
|
|
|
this._uri = "ws://" + this.options.host + ":" + this.options.port + "/livereload"; |
|
|
|
this._nextDelay = this.options.mindelay; |
|
|
|
this._connectionDesired = false; |
|
|
|
this.protocol = 0; |
|
|
@@ -278,8 +278,7 @@ |
|
|
|
|
|
|
|
},{}],4:[function(require,module,exports){ |
|
|
|
(function() { |
|
|
|
var Connector, LiveReload, Options, Reloader, Timer, |
|
|
|
__hasProp = {}.hasOwnProperty; |
|
|
|
var Connector, LiveReload, Options, Reloader, Timer; |
|
|
|
|
|
|
|
Connector = require('./connector').Connector; |
|
|
|
|
|
|
@@ -291,15 +290,11 @@ |
|
|
|
|
|
|
|
exports.LiveReload = LiveReload = (function() { |
|
|
|
function LiveReload(window) { |
|
|
|
var k, v, _ref; |
|
|
|
this.window = window; |
|
|
|
this.listeners = {}; |
|
|
|
this.plugins = []; |
|
|
|
this.pluginIdentifiers = {}; |
|
|
|
this.console = this.window.console && this.window.console.log && this.window.console.error ? this.window.location.href.match(/LR-verbose/) ? this.window.console : { |
|
|
|
log: function() {}, |
|
|
|
error: this.window.console.error.bind(this.window.console) |
|
|
|
} : { |
|
|
|
this.console = this.window.location.href.match(/LR-verbose/) && this.window.console && this.window.console.log && this.window.console.error ? this.window.console : { |
|
|
|
log: function() {}, |
|
|
|
error: function() {} |
|
|
|
}; |
|
|
@@ -307,20 +302,9 @@ |
|
|
|
this.console.error("LiveReload disabled because the browser does not seem to support web sockets"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if ('LiveReloadOptions' in window) { |
|
|
|
this.options = new Options(); |
|
|
|
_ref = window['LiveReloadOptions']; |
|
|
|
for (k in _ref) { |
|
|
|
if (!__hasProp.call(_ref, k)) continue; |
|
|
|
v = _ref[k]; |
|
|
|
this.options.set(k, v); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.options = Options.extract(this.window.document); |
|
|
|
if (!this.options) { |
|
|
|
this.console.error("LiveReload disabled because it could not find its own <SCRIPT> tag"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!(this.options = Options.extract(this.window.document))) { |
|
|
|
this.console.error("LiveReload disabled because it could not find its own <SCRIPT> tag"); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.reloader = new Reloader(this.window, this.console, Timer); |
|
|
|
this.connector = new Connector(this.options, this.WebSocket, Timer, { |
|
|
@@ -342,7 +326,16 @@ |
|
|
|
})(this), |
|
|
|
error: (function(_this) { |
|
|
|
return function(e) { |
|
|
|
return console.log("" + e.message + "."); |
|
|
|
console.log(e); |
|
|
|
// if (e instanceof ProtocolError) { |
|
|
|
// if (typeof console !== "undefined" && console !== null) { |
|
|
|
// return console.log("" + e.message + "."); |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// if (typeof console !== "undefined" && console !== null) { |
|
|
|
// return console.log("LiveReload internal error: " + e.message); |
|
|
|
// } |
|
|
|
// } |
|
|
|
}; |
|
|
|
})(this), |
|
|
|
disconnected: (function(_this) { |
|
|
@@ -380,7 +373,6 @@ |
|
|
|
}; |
|
|
|
})(this) |
|
|
|
}); |
|
|
|
this.initialized = true; |
|
|
|
} |
|
|
|
|
|
|
|
LiveReload.prototype.on = function(eventName, handler) { |
|
|
@@ -409,9 +401,6 @@ |
|
|
|
|
|
|
|
LiveReload.prototype.shutDown = function() { |
|
|
|
var _base; |
|
|
|
if (!this.initialized) { |
|
|
|
return; |
|
|
|
} |
|
|
|
this.connector.disconnect(); |
|
|
|
this.log("LiveReload disconnected."); |
|
|
|
return typeof (_base = this.listeners).shutdown === "function" ? _base.shutdown() : void 0; |
|
|
@@ -423,9 +412,6 @@ |
|
|
|
|
|
|
|
LiveReload.prototype.addPlugin = function(pluginClass) { |
|
|
|
var plugin; |
|
|
|
if (!this.initialized) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.hasPlugin(pluginClass.identifier)) { |
|
|
|
return; |
|
|
|
} |
|
|
@@ -448,9 +434,6 @@ |
|
|
|
|
|
|
|
LiveReload.prototype.analyze = function() { |
|
|
|
var plugin, pluginData, pluginsData, _i, _len, _ref; |
|
|
|
if (!this.initialized) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!(this.connector.protocol >= 7)) { |
|
|
|
return; |
|
|
|
} |
|
|
@@ -480,7 +463,6 @@ |
|
|
|
|
|
|
|
exports.Options = Options = (function() { |
|
|
|
function Options() { |
|
|
|
this.https = false; |
|
|
|
this.host = null; |
|
|
|
this.port = 35729; |
|
|
|
this.snipver = null; |
|
|
@@ -512,7 +494,6 @@ |
|
|
|
element = _ref[_i]; |
|
|
|
if ((src = element.src) && (m = src.match(/^[^:]+:\/\/(.*)\/z?livereload\.js(?:\?(.*))?$/))) { |
|
|
|
options = new Options(); |
|
|
|
options.https = src.indexOf("https") === 0; |
|
|
|
if (mm = m[1].match(/^([^\/:]+)(?::(\d+))?$/)) { |
|
|
|
options.host = mm[1]; |
|
|
|
if (mm[2]) { |
|
|
@@ -561,7 +542,7 @@ |
|
|
|
} |
|
|
|
|
|
|
|
Parser.prototype.reset = function() { |
|
|
|
return this.protocol = 7; |
|
|
|
return this.protocol = null; |
|
|
|
}; |
|
|
|
|
|
|
|
Parser.prototype.process = function(data) { |
|
|
|