From 3a0d66f07b112b6d2bdc2b57bbf717a89a351ce6 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Wed, 3 Feb 2021 19:17:00 -0500 Subject: New upstream version 8.1.2. --- npm_assets/node_modules/livereload-js/lib/.keepme | 0 .../node_modules/livereload-js/lib/connector.js | 173 ++++++++ .../node_modules/livereload-js/lib/customevents.js | 39 ++ npm_assets/node_modules/livereload-js/lib/less.js | 62 +++ .../node_modules/livereload-js/lib/livereload.js | 207 +++++++++ .../node_modules/livereload-js/lib/options.js | 60 +++ .../node_modules/livereload-js/lib/protocol.js | 95 +++++ .../node_modules/livereload-js/lib/reloader.js | 475 +++++++++++++++++++++ .../node_modules/livereload-js/lib/startup.js | 32 ++ npm_assets/node_modules/livereload-js/lib/timer.js | 42 ++ 10 files changed, 1185 insertions(+) create mode 100644 npm_assets/node_modules/livereload-js/lib/.keepme create mode 100644 npm_assets/node_modules/livereload-js/lib/connector.js create mode 100644 npm_assets/node_modules/livereload-js/lib/customevents.js create mode 100644 npm_assets/node_modules/livereload-js/lib/less.js create mode 100644 npm_assets/node_modules/livereload-js/lib/livereload.js create mode 100644 npm_assets/node_modules/livereload-js/lib/options.js create mode 100644 npm_assets/node_modules/livereload-js/lib/protocol.js create mode 100644 npm_assets/node_modules/livereload-js/lib/reloader.js create mode 100644 npm_assets/node_modules/livereload-js/lib/startup.js create mode 100644 npm_assets/node_modules/livereload-js/lib/timer.js (limited to 'npm_assets/node_modules/livereload-js/lib') diff --git a/npm_assets/node_modules/livereload-js/lib/.keepme b/npm_assets/node_modules/livereload-js/lib/.keepme new file mode 100644 index 0000000..e69de29 diff --git a/npm_assets/node_modules/livereload-js/lib/connector.js b/npm_assets/node_modules/livereload-js/lib/connector.js new file mode 100644 index 0000000..8d84ddd --- /dev/null +++ b/npm_assets/node_modules/livereload-js/lib/connector.js @@ -0,0 +1,173 @@ +(function() { + var Connector, PROTOCOL_6, PROTOCOL_7, Parser, Version, ref; + + ref = require('./protocol'), Parser = ref.Parser, PROTOCOL_6 = ref.PROTOCOL_6, PROTOCOL_7 = ref.PROTOCOL_7; + + Version = process.env.npm_package_version; + + exports.Connector = Connector = (function() { + function Connector(options, WebSocket, Timer, handlers) { + var path; + this.options = options; + this.WebSocket = WebSocket; + this.Timer = Timer; + this.handlers = handlers; + path = this.options.path ? "" + this.options.path : "livereload"; + this._uri = "ws" + (this.options.https ? "s" : "") + "://" + this.options.host + ":" + this.options.port + "/" + path; + this._nextDelay = this.options.mindelay; + this._connectionDesired = false; + this.protocol = 0; + this.protocolParser = new Parser({ + connected: (function(_this) { + return function(protocol) { + _this.protocol = protocol; + _this._handshakeTimeout.stop(); + _this._nextDelay = _this.options.mindelay; + _this._disconnectionReason = 'broken'; + return _this.handlers.connected(_this.protocol); + }; + })(this), + error: (function(_this) { + return function(e) { + _this.handlers.error(e); + return _this._closeOnError(); + }; + })(this), + message: (function(_this) { + return function(message) { + return _this.handlers.message(message); + }; + })(this) + }); + this._handshakeTimeout = new this.Timer((function(_this) { + return function() { + if (!_this._isSocketConnected()) { + return; + } + _this._disconnectionReason = 'handshake-timeout'; + return _this.socket.close(); + }; + })(this)); + this._reconnectTimer = new this.Timer((function(_this) { + return function() { + if (!_this._connectionDesired) { + return; + } + return _this.connect(); + }; + })(this)); + this.connect(); + } + + Connector.prototype._isSocketConnected = function() { + return this.socket && this.socket.readyState === this.WebSocket.OPEN; + }; + + Connector.prototype.connect = function() { + this._connectionDesired = true; + if (this._isSocketConnected()) { + return; + } + this._reconnectTimer.stop(); + this._disconnectionReason = 'cannot-connect'; + this.protocolParser.reset(); + this.handlers.connecting(); + this.socket = new this.WebSocket(this._uri); + this.socket.onopen = (function(_this) { + return function(e) { + return _this._onopen(e); + }; + })(this); + this.socket.onclose = (function(_this) { + return function(e) { + return _this._onclose(e); + }; + })(this); + this.socket.onmessage = (function(_this) { + return function(e) { + return _this._onmessage(e); + }; + })(this); + return this.socket.onerror = (function(_this) { + return function(e) { + return _this._onerror(e); + }; + })(this); + }; + + Connector.prototype.disconnect = function() { + this._connectionDesired = false; + this._reconnectTimer.stop(); + if (!this._isSocketConnected()) { + return; + } + this._disconnectionReason = 'manual'; + return this.socket.close(); + }; + + Connector.prototype._scheduleReconnection = function() { + if (!this._connectionDesired) { + return; + } + if (!this._reconnectTimer.running) { + this._reconnectTimer.start(this._nextDelay); + return this._nextDelay = Math.min(this.options.maxdelay, this._nextDelay * 2); + } + }; + + Connector.prototype.sendCommand = function(command) { + if (this.protocol == null) { + return; + } + return this._sendCommand(command); + }; + + Connector.prototype._sendCommand = function(command) { + return this.socket.send(JSON.stringify(command)); + }; + + Connector.prototype._closeOnError = function() { + this._handshakeTimeout.stop(); + this._disconnectionReason = 'error'; + return this.socket.close(); + }; + + Connector.prototype._onopen = function(e) { + var hello; + this.handlers.socketConnected(); + this._disconnectionReason = 'handshake-failed'; + hello = { + command: 'hello', + protocols: [PROTOCOL_6, PROTOCOL_7] + }; + hello.ver = Version; + if (this.options.ext) { + hello.ext = this.options.ext; + } + if (this.options.extver) { + hello.extver = this.options.extver; + } + if (this.options.snipver) { + hello.snipver = this.options.snipver; + } + this._sendCommand(hello); + return this._handshakeTimeout.start(this.options.handshake_timeout); + }; + + Connector.prototype._onclose = function(e) { + this.protocol = 0; + this.handlers.disconnected(this._disconnectionReason, this._nextDelay); + return this._scheduleReconnection(); + }; + + Connector.prototype._onerror = function(e) {}; + + Connector.prototype._onmessage = function(e) { + return this.protocolParser.process(e.data); + }; + + return Connector; + + })(); + +}).call(this); diff --git a/npm_assets/node_modules/livereload-js/lib/customevents.js b/npm_assets/node_modules/livereload-js/lib/customevents.js new file mode 100644 index 0000000..769ad00 --- /dev/null +++ b/npm_assets/node_modules/livereload-js/lib/customevents.js @@ -0,0 +1,39 @@ +(function() { + var CustomEvents; + + CustomEvents = { + bind: function(element, eventName, handler) { + if (element.addEventListener) { + return element.addEventListener(eventName, handler, false); + } else if (element.attachEvent) { + element[eventName] = 1; + return element.attachEvent('onpropertychange', function(event) { + if (event.propertyName === eventName) { + return handler(); + } + }); + } else { + throw new Error("Attempt to attach custom event " + eventName + " to something which isn't a DOMElement"); + } + }, + fire: function(element, eventName) { + var event; + if (element.addEventListener) { + event = document.createEvent('HTMLEvents'); + event.initEvent(eventName, true, true); + return document.dispatchEvent(event); + } else if (element.attachEvent) { + if (element[eventName]) { + return element[eventName]++; + } + } else { + throw new Error("Attempt to fire custom event " + eventName + " on something which isn't a DOMElement"); + } + } + }; + + exports.bind = CustomEvents.bind; + + exports.fire = CustomEvents.fire; + +}).call(this); diff --git a/npm_assets/node_modules/livereload-js/lib/less.js b/npm_assets/node_modules/livereload-js/lib/less.js new file mode 100644 index 0000000..619c6b8 --- /dev/null +++ b/npm_assets/node_modules/livereload-js/lib/less.js @@ -0,0 +1,62 @@ +(function() { + var LessPlugin; + + module.exports = LessPlugin = (function() { + LessPlugin.identifier = 'less'; + + LessPlugin.version = '1.0'; + + function LessPlugin(window, host) { + this.window = window; + this.host = host; + } + + LessPlugin.prototype.reload = function(path, options) { + if (this.window.less && this.window.less.refresh) { + if (path.match(/\.less$/i)) { + return this.reloadLess(path); + } + if (options.originalPath.match(/\.less$/i)) { + return this.reloadLess(options.originalPath); + } + } + return false; + }; + + LessPlugin.prototype.reloadLess = function(path) { + var i, len, link, links; + links = (function() { + var i, len, ref, results; + ref = document.getElementsByTagName('link'); + results = []; + for (i = 0, len = ref.length; i < len; i++) { + link = ref[i]; + if (link.href && link.rel.match(/^stylesheet\/less$/i) || (link.rel.match(/stylesheet/i) && link.type.match(/^text\/(x-)?less$/i))) { + results.push(link); + } + } + return results; + })(); + if (links.length === 0) { + return false; + } + for (i = 0, len = links.length; i < len; i++) { + link = links[i]; + link.href = this.host.generateCacheBustUrl(link.href); + } + this.host.console.log("LiveReload is asking LESS to recompile all stylesheets"); + this.window.less.refresh(true); + return true; + }; + + LessPlugin.prototype.analyze = function() { + return { + disable: !!(this.window.less && this.window.less.refresh) + }; + }; + + return LessPlugin; + + })(); + +}).call(this); diff --git a/npm_assets/node_modules/livereload-js/lib/livereload.js b/npm_assets/node_modules/livereload-js/lib/livereload.js new file mode 100644 index 0000000..da9b59e --- /dev/null +++ b/npm_assets/node_modules/livereload-js/lib/livereload.js @@ -0,0 +1,207 @@ +(function() { + var Connector, LiveReload, Options, ProtocolError, Reloader, Timer, + hasProp = {}.hasOwnProperty; + + Connector = require('./connector').Connector; + + Timer = require('./timer').Timer; + + Options = require('./options').Options; + + Reloader = require('./reloader').Reloader; + + ProtocolError = require('./protocol').ProtocolError; + + exports.LiveReload = LiveReload = (function() { + function LiveReload(window1) { + var k, ref, v; + this.window = window1; + 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) + } : { + log: function() {}, + error: function() {} + }; + if (!(this.WebSocket = this.window.WebSocket || this.window.MozWebSocket)) { + 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