Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browser-sync

Package Overview
Dependencies
Maintainers
1
Versions
300
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-sync - npm Package Compare versions

Comparing version 0.3.8 to 0.3.10

32

Gruntfile.js

@@ -25,12 +25,18 @@ 'use strict';

jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
options: {
jshintrc: '.jshintrc'
},
src: 'Gruntfile.js'
},
lib: {
options: {
jshintrc: '.jshintrc'
},
src: ['lib/**/*.js', '!lib/browser-sync-client.min.js']
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/**/*.js']

@@ -75,2 +81,10 @@ }

},
shell: {
github: {
command: 'git push origin master',
options: {
stdout: true
}
}
},
/**

@@ -106,16 +120,16 @@ *

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-jasmine-node');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-shell');
// Default task.
// Tests
grunt.registerTask('default', ['jasmine_node']);
grunt.registerTask('test', ['karma:unit', 'jasmine_node']);
grunt.registerTask('test:server', ['jshint', 'jasmine_node']);
grunt.registerTask('test:client', ['jshint', 'karma:unit']);
grunt.registerTask('test', ['jshint', 'karma:unit', 'jasmine_node']);
grunt.registerTask('release:github', ['jshint', 'karma:unit', 'jasmine_node', 'shell:github']);
};

@@ -139,6 +139,6 @@ 'use strict';

var domData = this.getElems(data.fileExtension);
var elem = this.getMatches(domData.elems, data.assetFileName, domData.attr);
if (typeof elem !== "undefined") {
transformedElem = actions.swapFile(elem, domData.attr);
var elems = this.getMatches(domData.elems, data.assetFileName, domData.attr);
for (var i = 0, n = elems.length; i < n; i += 1) {
transformedElem = actions.swapFile(elems[i], domData.attr);
}

@@ -179,18 +179,18 @@ }

/**
* @param {array} elems - dom nodes
* @param {Array} elems - dom nodes
* @param {string} url
* @param {string} attr
* @returns {HTMLHtmlElement|null}
* @returns {Array}
*/
getMatches: function (elems, url, attr) {
var match;
var matches = [];
for (var i = 0, len = elems.length; i < len; i += 1) {
if (elems[i][attr].indexOf(url) !== -1) {
match = i;
matches.push(elems[i]);
}
}
return elems[match];
return matches;
}

@@ -256,2 +256,30 @@ };

/**
* Get percentage of scroll position
* @returns {Array}
*/
getScrollPercentage: function () {
var scrollSpace, scroll, psy, psx;
scrollSpace = ghost.getScrollSpace();
scroll = this.getScroll();
psx = scroll[0] / scrollSpace[0];
psy = scroll[1] / scrollSpace[1];
return [psx, psy];
},
/**
* Get scroll space in pixels
* @returns {Array}
*/
getScrollSpace: function () {
var ssx, ssy, d = document, r = d.documentElement,
b = d.body;
ssx = b.scrollHeight - r.clientWidth;
ssy = b.scrollHeight - r.clientHeight;
return [ssx, ssy];
},
/**
* Get just the Y axis of scroll

@@ -264,2 +292,9 @@ * @returns {Number}

/**
* Get just the percentage of Y axis of scroll
* @returns {Number}
*/
getScrollTopPercentage: function () {
return this.getScrollPercentage()[1];
},
/**
* @param {object} ghostMode

@@ -453,3 +488,3 @@ * @param {number} y

var scrollTop = ghost.getScrollTop(); // Get y position of scroll
var scrollTop = ghost.getScrollTopPercentage(); // Get % of y axis of scroll
var newScroll = new Date().getTime();

@@ -557,6 +592,6 @@

socket.on("scroll:update", function (data) {
if (data.url === window.location.host + window.location.pathname) {
var scrollSpace = ghost.getScrollSpace();
scope.ghostMode.enabled = false;
window.scrollTo(0, data.position);
window.scrollTo(0, scrollSpace[1] * data.position); // proportional scroll
}

@@ -563,0 +598,0 @@ });

@@ -1,1 +0,1 @@

"use strict";!function(a,b){var c,d={ghostMode:{enabled:!0,cache:{}}},e={tagNames:{css:"link",jpg:"img",png:"img",svg:"img",gif:"img",js:"script"},attrs:{link:"href",img:"src",script:"src"}},f={processOptions:function(a,b,c,d){a.options=b,b.ghostMode&&this.initGhostMode(b.ghostMode,c,d),b.notify&&this.createNotifyElem()},createNotifyElem:function(){c=document.createElement("DIV"),c.style.backgroundColor="black",c.style.color="white",c.style.padding="10px",c.style.display="none",c.style.fontFamily="sans-serif",c.style.position="absolute",c.style.zIndex="1000",c.style.right="0px",document.getElementsByTagName("body")[0].appendChild(c)},notify:function(b){c&&(c.innerHTML=b,c.style.top=h.getScrollTop()+"px",c.style.display="block",a.setTimeout(function(){c.style.display="none"},1e3))},initGhostMode:function(a,b,c){if(a.links&&h.initClickEvents(d,b,c.click),a.scroll&&h.initEvents(d,["scroll"],b,c),a.forms)for(var e=h.getInputs(),f=[[e.texts,"keyup","keyup"],[e.radios,"click","forceChange"],[e.radios,"change","radioChange"],[e.checkboxes,"click","forceChange"],[e.checkboxes,"change","checkboxChange"],["textarea","keyup","keyup"],["select","change","selectChange"],["form","submit","formSubmit"],["form","reset","formReset"]],g=0,i=f.length;i>g;g+=1)h.addBrowserEvents(f[g][0],f[g][1],c[f[g][2]],b)},reloadEvent:function(a,b,c){var d;if(b.url&&c.reloadBrowser(!0),b.assetFileName&&b.fileExtension){f.notify("Injected: "+b.assetFileName);var e=this.getElems(b.fileExtension),g=this.getMatches(e.elems,b.assetFileName,e.attr);"undefined"!=typeof g&&(d=c.swapFile(g,e.attr))}return d},getElems:function(a){var b=this.getTagName(a),c=this.getAttr(b);return{elems:document.getElementsByTagName(b),attr:c}},getTagName:function(a){return e.tagNames[a]},getAttr:function(a){return e.attrs[a]},getMatches:function(a,b,c){for(var d,e=0,f=a.length;f>e;e+=1)-1!==a[e][c].indexOf(b)&&(d=e);return a[d]}},g={reloadBrowser:function(a){a&&location.reload()},swapFile:function(a,b){var c=a[b],d=/^[^\?]+(?=\?)/.exec(c);d&&(c=d[0]);var e=(new Date).getTime();return a[b]=c+"?rel="+e,{elem:a,timeStamp:e}}},h={getScroll:function(){if(void 0!==a.pageYOffset)return[a.pageXOffset,a.pageYOffset];var b,c,d=document,e=d.documentElement,f=d.body;return b=e.scrollLeft||f.scrollLeft||0,c=e.scrollTop||f.scrollTop||0,[b,c]},getScrollTop:function(){return this.getScroll()[1]},setScrollTop:function(b,c){b.enabled=!1,a.scrollTo(0,c)},checkCache:function(a,b){var c;return a[b]?a[b].elem:(a.called=a.called?a.called+=1:1,c=document.getElementById(b),c?(a[b]={},a[b].elem=c,c):!1)},initClickEvents:function(a,b,c){for(var d=document.getElementsByTagName("a"),e=0,f=d.length;f>e;e+=1)this.composeElementEvent(d[e],b,"click",c)},initEvents:function(a,b,c,d){for(var e="scroll",f=0,g=b.length;g>f;f+=1)b[f]===e&&this.composeSingleEvent(c,e,d[e])},composeSingleEvent:function(b,c,d){a[b.eventListener](b.prefix+c,d,!1)},composeElementEvent:function(a,b,c,d){a[b.eventListener](b.prefix+"click",d,!1)},emitEvent:function(a,c){b.emit(a,c)},addBrowserEvents:function(a,b,c,d){"string"==typeof a&&(a=document.getElementsByTagName(a));for(var e=0,f=a.length;f>e;e+=1)a[e][d.eventListener](d.prefix+b,c,!1)},getHref:function(a,b){var c,d=a.tagName;return c=b&&b.href?b.href:"A"===d?a.href:this.getParentHref(a,5)},getParentHref:function(a,b){for(var c,d=function(a){return"A"===a.parentNode.tagName?a.parentNode.href:a.parentNode},e=a,f=0;b>f;f+=1){if(c=d(e),"string"==typeof c)return c;e=c}return!1},getInputs:function(){for(var a=document.getElementsByTagName("input"),b=[],c=[],d=[],e=["text","email","url","tel"],f=0,g=a.length;g>f;f+=1){for(var h=a[f].type,i=0,j=e.length;j>i;i+=1)if(h===e[i]){b.push(a[f]);break}"radio"===a[f].type&&c.push(a[f]),"checkbox"===a[f].type&&d.push(a[f])}return{texts:b,radios:c,checkboxes:d}},listeners:{scroll:function(){var b,c=h.getScrollTop(),e=(new Date).getTime();d.ghostMode.lastScroll||(d.ghostMode.scrollTop=c[0],d.ghostMode.lastScroll=(new Date).getTime()),e>d.ghostMode.lastScroll+50&&d.ghostMode.enabled&&(d.ghostMode.lastScroll=e,b=a.location.host+a.location.pathname,h.emitEvent("scroll",{pos:c,url:b})),d.ghostMode.enabled=!0},click:function(a){var b={url:h.getHref(a.target||a.srcElement,this)};h.emitEvent("location",b)},keyup:function(a){var b=a.target||a.srcElement;b.id&&h.emitEvent("input:type",{id:b.id,value:b.value})},forceChange:function(){this.blur(),this.focus()},radioChange:function(a){var b=a.target||a.srcElement;h.emitEvent("input:radio",{id:b.id,value:b.value})},checkboxChange:function(a){var b=a.target||a.srcElement;h.emitEvent("input:checkbox",{id:b.id,checked:b.checked})},selectChange:function(a){var b=a.target||a.srcElement;h.emitEvent("input:select",{id:b.id,value:b.value})},formSubmit:function(a){var b=a.target||a.srcElement;h.emitEvent("form:submit",{id:b.id})},formReset:function(a){var b=a.target||a.srcElement;h.emitEvent("form:reset",{id:b.id})}},utils:{eventListener:a.addEventListener?"addEventListener":"attachEvent",removeEventListener:a.removeEventListener?"removeEventListener":"detachEvent",prefix:a.addEventListener?"":"on"}};a.__karma__&&(a.browserSync=f,a.browserSyncActions=g,a.ghost=h,a.scope=d,b.on=function(){}),b.on("connection",function(a){f.processOptions(d,a,h.utils,h.listeners)}),b.on("reload",function(a){a&&f.reloadEvent(d,a,g)}),b.on("location:update",function(b){b.url&&(a.location=b.url)}),b.on("scroll:update",function(b){b.url===a.location.host+a.location.pathname&&(d.ghostMode.enabled=!1,a.scrollTo(0,b.position))}),b.on("input:update",function(a){d.ghostMode.enabled=!1;var b=h.checkCache(d.ghostMode.cache,a.id);b.value=a.value}),b.on("input:update:radio",function(a){d.ghostMode.enabled=!1;var b=h.checkCache(d.ghostMode.cache,a.id);b.checked=!0}),b.on("input:update:checkbox",function(a){d.ghostMode.enabled=!1;var b=h.checkCache(d.ghostMode.cache,a.id);b.checked=a.checked}),b.on("form:submit",function(a){d.ghostMode.enabled=!1,document.forms[a.id].submit()}),b.on("form:reset",function(a){d.ghostMode.enabled=!1,document.forms[a.id].reset()})}(window,"undefined"==typeof ___socket___?{}:___socket___);
"use strict";!function(a,b){var c,d={ghostMode:{enabled:!0,cache:{}}},e={tagNames:{css:"link",jpg:"img",png:"img",svg:"img",gif:"img",js:"script"},attrs:{link:"href",img:"src",script:"src"}},f={processOptions:function(a,b,c,d){a.options=b,b.ghostMode&&this.initGhostMode(b.ghostMode,c,d),b.notify&&this.createNotifyElem()},createNotifyElem:function(){c=document.createElement("DIV"),c.style.backgroundColor="black",c.style.color="white",c.style.padding="10px",c.style.display="none",c.style.fontFamily="sans-serif",c.style.position="absolute",c.style.zIndex="1000",c.style.right="0px",document.getElementsByTagName("body")[0].appendChild(c)},notify:function(b){c&&(c.innerHTML=b,c.style.top=h.getScrollTop()+"px",c.style.display="block",a.setTimeout(function(){c.style.display="none"},1e3))},initGhostMode:function(a,b,c){if(a.links&&h.initClickEvents(d,b,c.click),a.scroll&&h.initEvents(d,["scroll"],b,c),a.forms)for(var e=h.getInputs(),f=[[e.texts,"keyup","keyup"],[e.radios,"click","forceChange"],[e.radios,"change","radioChange"],[e.checkboxes,"click","forceChange"],[e.checkboxes,"change","checkboxChange"],["textarea","keyup","keyup"],["select","change","selectChange"],["form","submit","formSubmit"],["form","reset","formReset"]],g=0,i=f.length;i>g;g+=1)h.addBrowserEvents(f[g][0],f[g][1],c[f[g][2]],b)},reloadEvent:function(a,b,c){var d;if(b.url&&c.reloadBrowser(!0),b.assetFileName&&b.fileExtension){f.notify("Injected: "+b.assetFileName);for(var e=this.getElems(b.fileExtension),g=this.getMatches(e.elems,b.assetFileName,e.attr),h=0,i=g.length;i>h;h+=1)d=c.swapFile(g[h],e.attr)}return d},getElems:function(a){var b=this.getTagName(a),c=this.getAttr(b);return{elems:document.getElementsByTagName(b),attr:c}},getTagName:function(a){return e.tagNames[a]},getAttr:function(a){return e.attrs[a]},getMatches:function(a,b,c){for(var d=[],e=0,f=a.length;f>e;e+=1)-1!==a[e][c].indexOf(b)&&d.push(a[e]);return d}},g={reloadBrowser:function(a){a&&location.reload()},swapFile:function(a,b){var c=a[b],d=/^[^\?]+(?=\?)/.exec(c);d&&(c=d[0]);var e=(new Date).getTime();return a[b]=c+"?rel="+e,{elem:a,timeStamp:e}}},h={getScroll:function(){if(void 0!==a.pageYOffset)return[a.pageXOffset,a.pageYOffset];var b,c,d=document,e=d.documentElement,f=d.body;return b=e.scrollLeft||f.scrollLeft||0,c=e.scrollTop||f.scrollTop||0,[b,c]},getScrollPercentage:function(){var a,b,c,d;return a=h.getScrollSpace(),b=this.getScroll(),d=b[0]/a[0],c=b[1]/a[1],[d,c]},getScrollSpace:function(){var a,b,c=document,d=c.documentElement,e=c.body;return a=e.scrollHeight-d.clientWidth,b=e.scrollHeight-d.clientHeight,[a,b]},getScrollTop:function(){return this.getScroll()[1]},getScrollTopPercentage:function(){return this.getScrollPercentage()[1]},setScrollTop:function(b,c){b.enabled=!1,a.scrollTo(0,c)},checkCache:function(a,b){var c;return a[b]?a[b].elem:(a.called=a.called?a.called+=1:1,c=document.getElementById(b),c?(a[b]={},a[b].elem=c,c):!1)},initClickEvents:function(a,b,c){for(var d=document.getElementsByTagName("a"),e=0,f=d.length;f>e;e+=1)this.composeElementEvent(d[e],b,"click",c)},initEvents:function(a,b,c,d){for(var e="scroll",f=0,g=b.length;g>f;f+=1)b[f]===e&&this.composeSingleEvent(c,e,d[e])},composeSingleEvent:function(b,c,d){a[b.eventListener](b.prefix+c,d,!1)},composeElementEvent:function(a,b,c,d){a[b.eventListener](b.prefix+"click",d,!1)},emitEvent:function(a,c){b.emit(a,c)},addBrowserEvents:function(a,b,c,d){"string"==typeof a&&(a=document.getElementsByTagName(a));for(var e=0,f=a.length;f>e;e+=1)a[e][d.eventListener](d.prefix+b,c,!1)},getHref:function(a,b){var c,d=a.tagName;return c=b&&b.href?b.href:"A"===d?a.href:this.getParentHref(a,5)},getParentHref:function(a,b){for(var c,d=function(a){return"A"===a.parentNode.tagName?a.parentNode.href:a.parentNode},e=a,f=0;b>f;f+=1){if(c=d(e),"string"==typeof c)return c;e=c}return!1},getInputs:function(){for(var a=document.getElementsByTagName("input"),b=[],c=[],d=[],e=["text","email","url","tel"],f=0,g=a.length;g>f;f+=1){for(var h=a[f].type,i=0,j=e.length;j>i;i+=1)if(h===e[i]){b.push(a[f]);break}"radio"===a[f].type&&c.push(a[f]),"checkbox"===a[f].type&&d.push(a[f])}return{texts:b,radios:c,checkboxes:d}},listeners:{scroll:function(){var b,c=h.getScrollTopPercentage(),e=(new Date).getTime();d.ghostMode.lastScroll||(d.ghostMode.scrollTop=c[0],d.ghostMode.lastScroll=(new Date).getTime()),e>d.ghostMode.lastScroll+50&&d.ghostMode.enabled&&(d.ghostMode.lastScroll=e,b=a.location.host+a.location.pathname,h.emitEvent("scroll",{pos:c,url:b})),d.ghostMode.enabled=!0},click:function(a){var b={url:h.getHref(a.target||a.srcElement,this)};h.emitEvent("location",b)},keyup:function(a){var b=a.target||a.srcElement;b.id&&h.emitEvent("input:type",{id:b.id,value:b.value})},forceChange:function(){this.blur(),this.focus()},radioChange:function(a){var b=a.target||a.srcElement;h.emitEvent("input:radio",{id:b.id,value:b.value})},checkboxChange:function(a){var b=a.target||a.srcElement;h.emitEvent("input:checkbox",{id:b.id,checked:b.checked})},selectChange:function(a){var b=a.target||a.srcElement;h.emitEvent("input:select",{id:b.id,value:b.value})},formSubmit:function(a){var b=a.target||a.srcElement;h.emitEvent("form:submit",{id:b.id})},formReset:function(a){var b=a.target||a.srcElement;h.emitEvent("form:reset",{id:b.id})}},utils:{eventListener:a.addEventListener?"addEventListener":"attachEvent",removeEventListener:a.removeEventListener?"removeEventListener":"detachEvent",prefix:a.addEventListener?"":"on"}};a.__karma__&&(a.browserSync=f,a.browserSyncActions=g,a.ghost=h,a.scope=d,b.on=function(){}),b.on("connection",function(a){f.processOptions(d,a,h.utils,h.listeners)}),b.on("reload",function(a){a&&f.reloadEvent(d,a,g)}),b.on("location:update",function(b){b.url&&(a.location=b.url)}),b.on("scroll:update",function(b){if(b.url===a.location.host+a.location.pathname){var c=h.getScrollSpace();d.ghostMode.enabled=!1,a.scrollTo(0,c[1]*b.position)}}),b.on("input:update",function(a){d.ghostMode.enabled=!1;var b=h.checkCache(d.ghostMode.cache,a.id);b.value=a.value}),b.on("input:update:radio",function(a){d.ghostMode.enabled=!1;var b=h.checkCache(d.ghostMode.cache,a.id);b.checked=!0}),b.on("input:update:checkbox",function(a){d.ghostMode.enabled=!1;var b=h.checkCache(d.ghostMode.cache,a.id);b.checked=a.checked}),b.on("form:submit",function(a){d.ghostMode.enabled=!1,document.forms[a.id].submit()}),b.on("form:reset",function(a){d.ghostMode.enabled=!1,document.forms[a.id].reset()})}(window,"undefined"==typeof ___socket___?{}:___socket___);

@@ -8,14 +8,10 @@ var portScanner = require('portscanner');

var http = require("http");
var devIp = require('dev-ip');
var UAParser = require('ua-parser-js');
var messages = require('./messages');
var loadSnippet = require('./loadSnippet');
var devIp = require('dev-ip');
var createProxy = require('./dev-proxy');
var parser = new UAParser();
var options;
var scriptData = fs.readFileSync(__dirname + messages.clientScript, "UTF-8");
var browserSync = function () {};

@@ -37,3 +33,3 @@

var _this = this, io, handles, server, watcher;
var _this = this, iolocal, handles, server, watcher;

@@ -43,3 +39,3 @@ this.getPorts(3, function (ports) {

// setup Socket.io
io = _this.setupSocket(ports);
iolocal = _this.setupSocket(ports);

@@ -59,7 +55,6 @@ // Set up event callbacks

* Get two available Ports
* @param {number} limit
* @param {function} callback
* @param options
* @param {Number} limit
* @param {Function} callback
*/
getPorts: function (limit, callback, options) {
getPorts: function (limit, callback) {

@@ -108,3 +103,3 @@ var ports = [];

* @param {Array} events
* @param {object} userOptions
* @param {Object} userOptions
* @param {function} handle

@@ -135,5 +130,5 @@ */

* Add a client event & it's callback
* @param {object} client
* @param {string} event
* @param {object} userOptions
* @param {Object} client
* @param {String} event
* @param {Object} userOptions
*/

@@ -153,4 +148,4 @@ handleClientSocketEvent: function (client, event, userOptions, _this) {

* Log a successful client connection
* @param {object} ua
* @param {object} userOptions
* @param {Object} ua
* @param {Object} userOptions
*/

@@ -217,4 +212,4 @@ logConnection: function (ua, userOptions) {

* Defaults to localhost if no network ip's are accessible.
* @param {object} options
* @returns {string} - the IP address
* @param {Object} options
* @returns {String} - the IP address
*/

@@ -238,4 +233,4 @@ getHostIp: function (options) {

* Take the path provided in options & transform into CWD for serving files
* @param {string} baseDir
* @returns {string}
* @param {String} baseDir
* @returns {String}
*/

@@ -271,4 +266,4 @@ getBaseDir: function (baseDir) {

* Log a message to the console
* @param {string} msg
* @param {object} options
* @param {String} msg
* @param {Object} options
* @param {boolean} override

@@ -286,7 +281,7 @@ * @returns {boolean}

/**
* @param {string} path
* @param {String} path
* @param {socket} io
* @param {object} options
* @param {Object} options
* @param _this - context
* @returns {{assetFileName: string}}
* @returns {{assetFileName: String}}
*/

@@ -321,2 +316,19 @@ changeFile: function (path, io, options, _this) {

/**
* Append the socket connector
* @param {String} host
* @param {Number} port
* @returns {Function}
*/
modifySnippet: function (host, port) {
var connector = messages.socketConnector(host, port);
var jsFile = fs.readFileSync(__dirname + messages.clientScript, "UTF-8");
var result = connector + jsFile;
return function (req, res) {
res.setHeader("Content-Type", "text/javascript");
res.end(result);
};
},
/**
* Launch the server for serving the client JS plus static files

@@ -330,12 +342,8 @@ * @param {String} host

var proxy = options.proxy || options.website || null;
var proxy = options.proxy || null;
var server = options.server || null;
var app, modifySnippet = this.modifySnippet(host, ports[0]);
var staticServer, msg;
var modifySnippet = function (req, res) {
res.setHeader("Content-Type", "text/javascript");
res.end(messages.socketConnector(host, ports[0]) + scriptData);
};
var app;
// Server the JS file manually for anything that doesn't use a server.
// Serve the JS file manually for anything that doesn't use a server.
if (!options.server) {

@@ -358,6 +366,6 @@ app = connect().use(messages.clientScript, modifySnippet);

var server = http.createServer(app).listen(ports[1]);
var msg;
// Launch the server
staticServer = http.createServer(app).listen(ports[1]);
if (options.server) {
if (server && !proxy) {
msg = messages.initServer(host, ports[1], this.getBaseDir(options.server.baseDir || "./"));

@@ -367,4 +375,3 @@ this.openBrowser(host, ports[1], options);

if (proxy) {
if (server && !server) {
msg = messages.initProxy(host, ports[2]);

@@ -380,3 +387,3 @@ this.openBrowser(host, ports[2], options);

return server;
return staticServer;
},

@@ -397,4 +404,4 @@ /**

* Proxy for gaze file watching
* @param {Array|string} files
* @param {object} io
* @param {Array|String} files
* @param {Object} io
* @param {function} callback

@@ -401,0 +408,0 @@ * @param options

@@ -1,3 +0,1 @@

var path = require('path');
var url = require('url');
var httpProxy = require('http-proxy');

@@ -4,0 +2,0 @@ var messages = require('./messages');

@@ -182,3 +182,3 @@ #! /usr/bin/env node

if (Array.isArray(filesArg)) {
return filesArg
return filesArg;
}

@@ -185,0 +185,0 @@

@@ -1,3 +0,1 @@

var path = require('path');
var url = require('url');
var messages = require('./messages');

@@ -4,0 +2,0 @@ var write = require('./snippet').write;

@@ -19,3 +19,5 @@ /**

bodyExists: function (body) {
if (!body) return false;
if (!body) {
return false;
}
return (~body.lastIndexOf("</body>"));

@@ -31,3 +33,5 @@ },

var excluded = false;
if (!url) return true;
if (!url) {
return true;
}
this.excludeList.forEach(function(exclude) {

@@ -80,3 +84,3 @@ if (~url.indexOf(exclude)) {

write.call(res, string, encoding);
}
};
};
{
"name": "browser-sync",
"description": "Live CSS Reload & Browser Syncing",
"version": "0.3.8",
"version": "0.3.10",
"homepage": "https://github.com/shakyshane/browser-sync",

@@ -27,3 +27,3 @@ "author": {

"scripts": {
"test": "grunt jasmine_node"
"test": "grunt test"
},

@@ -65,3 +65,4 @@ "dependencies": {

"grunt-contrib-watch": "~0.5.3",
"cli-color": "~0.2.3"
"cli-color": "~0.2.3",
"grunt-shell": "~0.6.1"
},

@@ -68,0 +69,0 @@ "keywords": [

@@ -1,2 +0,2 @@

# browser-sync [![Build Status](https://travis-ci.org/shakyShane/browser-sync.png?branch=master)](https://travis-ci.org/shakyShane/browser-sync)
# browser-sync [![Build Status](https://travis-ci.org/shakyShane/browser-sync.png?branch=master)](https://travis-ci.org/shakyShane/browser-sync) [![NPM version](https://badge.fury.io/js/browser-sync.png)](http://badge.fury.io/js/browser-sync) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)

@@ -17,2 +17,8 @@ > Keep multiple browsers & devices in sync when building websites.

##Support
If you've found Browser-sync useful and would like to contribute to its continued development & support, please feel free to send a donation of any size - it would be greatly appreciated!
[![Support via Gittip](https://rawgithub.com/chris---/Donation-Badges/master/gittip.jpeg)](https://www.gittip.com/shakyshane)
[![Support via PayPal](https://rawgithub.com/chris---/Donation-Badges/master/paypal.jpeg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=shakyshane%40gmail%2ecom&lc=US&item_name=browser%2dsync)
##Using Grunt? There's a [plugin](https://github.com/shakyShane/grunt-browser-sync) for that

@@ -288,3 +294,3 @@

```
grunt karma:unit
grunt test:client
```

@@ -300,3 +306,3 @@ // Run the client-side tests & re-run on every file-change.

```
grunt jasmine_node
grunt test:server
```

@@ -303,0 +309,0 @@ // Run the server-side tests & re-run on every file-change.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc