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.7.0 to 0.7.1

examples/callback.js

3

example.js

@@ -8,3 +8,4 @@ var browserSync = require("./lib/index");

baseDir: "test/fixtures"
}
},
open: false
};

@@ -11,0 +12,0 @@

"use strict";
var serverModule = require("./server");
var services = require("./services");
var socket = require("./sockets");
var logger = require("./logger");
var config = require("./config");
var utils = require("./utils").utils;
var fileWatcher = require("./file-watcher");
var serverModule = require("./server");
var services = require("./services");
var socket = require("./sockets");
var logger = require("./logger");
var config = require("./config");
var utils = require("./utils").utils;
var fileWatcher = require("./file-watcher");
var bsClient = require("browser-sync-client");
var _ = require("lodash");
var filePath = require("path");
var events = require("events");
var bsControlPanel = require("browser-sync-control-panel");
var bsClient = require("browser-sync-client");
var _ = require("lodash");
var filePath = require("path");
var events = require("events");

@@ -20,3 +21,4 @@ var defaultPlugins = {

"plugin:socket": socket.plugin(),
"plugin:logger": logger.plugin()
"plugin:logger": logger.plugin(),
"plugin:controlpanel": bsControlPanel.plugin()
};

@@ -80,4 +82,3 @@

BrowserSync.prototype.getPlugin = function (name) {
var plugin = this.plugins["plugin:" + name];
return this.plugins["plugin:" + name];
return this.plugins["plugin:" + name] || false;
};

@@ -84,0 +85,0 @@

@@ -22,3 +22,3 @@ "use strict";

*/
_getDefaultConfigFile: function () {
getDefaultConfigFile: function () {
var defaultPath = process.cwd() + config.configFile;

@@ -25,0 +25,0 @@ return this._getConfigFile(defaultPath);

@@ -60,14 +60,46 @@ "use strict";

/**
* Handle command-line usage with 'start'
* @param args
* @param cb
*/
module.exports.startFromCommandLine = function (args, cb) {
var options = {};
var userConfig;
// First look for provided --config option
if (args.config) {
userConfig = info._getConfigFile(args.config);
} else {
userConfig = info.getDefaultConfigFile();
}
if (userConfig) {
options = _.merge(defaultConfig, userConfig);
options = mergeOptions(defaultConfig, options, allowedOptions);
} else {
options = mergeOptions(defaultConfig, args, allowedOptions);
options.files = cliOptions._mergeFilesOption(args.files, options.exclude);
}
cb(null, {
files: options.files || [],
config: options
});
};
/**
* @param {String} version
* @param {Object} args
* @param {Object} args - optimist object
* @param {Object} argv - process.argv
* @param {Function} cb
*/
module.exports.parse = function (version, args, cb) {
module.exports.parse = function (version, args, argv, cb) {
program
.version(version)
.option("--files", "File paths to watch")
.option("--server", "Run a Local server (uses your cwd as the web root)")
.option("--proxy", "Proxy an existing server")
.option("--files", "File paths to watch")
.option("--no-comments", "Don't add comments to the config file")
.option("--config", "Specify a path to a bs-config.js file")
.option("--host", "Specify a hostname to use");

@@ -85,24 +117,6 @@

.description("Start Browser Sync")
.action(function() {
.action(exports.startFromCommandLine.bind(null, args, cb));
var options;
var userConfig = info._getDefaultConfigFile();
if (userConfig) {
options = _.merge(defaultConfig, userConfig);
options = mergeOptions(defaultConfig, options, allowedOptions);
} else {
options = mergeOptions(defaultConfig, args, allowedOptions);
options.files = cliOptions._mergeFilesOption(args.files, options.exclude);
}
cb(null, {
files: options.files,
config: options
});
});
program.parse(process.argv);
program.parse(argv);
};

@@ -5,3 +5,2 @@ "use strict";

var config = require("./config");
var snippetUtils = require("./snippet").utils;

@@ -13,8 +12,8 @@ var connect = require("connect");

* Launch the server for serving the client JS plus static files
* @param {String} scriptTags
* @param {Object} options
* @param {Function} scripts
* @param {{middleware: Function, baseDir: String}} controlPanel
* @returns {http.Server}
*/
module.exports.launchControlPanel = function (scriptTags, options, scripts) {
module.exports.launchControlPanel = function (options, scripts, controlPanel) {

@@ -26,7 +25,10 @@ var clientScripts = messages.clientScript(options, true);

.use(clientScripts.versioned, scripts)
.use(clientScripts.path, scripts)
.use(snippetUtils.getSnippetMiddleware(scriptTags))
.use(connect.static(config.controlPanel.baseDir));
.use(clientScripts.path, scripts);
if (controlPanel) {
app.use(controlPanel.middleware);
app.use(connect.static(controlPanel.baseDir));
}
return http.createServer(app);
};
};

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

var argv = require("optimist").argv;
var args = require("optimist").argv;
var argv = process.argv;
var _ = require("lodash");

@@ -33,3 +35,3 @@

if (require.main === module) {
init.parse(pjson.version, argv, function (err, data) {
init.parse(pjson.version, args, argv, function (err, data) {
if (err) {

@@ -36,0 +38,0 @@ utils.fail(err, {}, true);

@@ -109,5 +109,7 @@ "use strict";

var template = "<script src='{: socket :}'></script>\n";
template += "<script>{: connector :}</script>\n";
template += "<script src='{: custom :}'></script>\n";
var template = [
"<script src='{: socket :}'></script>",
"<script>{: connector :}</script>",
"<script src='{: custom :}'></script>"
];

@@ -117,4 +119,4 @@ var socket = this._makeUrl(hostIp, ports.socket) + config.socketIoScript;

if (env && env === "controlPanel") {
custom = this._makeUrl(hostIp, ports.controlPanel) + config.controlPanel.jsFile;
if (env === "controlPanel") {
template.pop();
}

@@ -128,3 +130,3 @@

return compile(template, params);
return compile(template.join("\n") + "\n", params);
},

@@ -131,0 +133,0 @@ host: {

@@ -127,3 +127,3 @@ "use strict";

if (res.statusCode === 302) {
res.headers.location = res.headers.location.replace(proxyOptions.host, host + ":" + ports.proxy);
res.headers.location = utils.handleRedirect(res.url, options, host, ports.proxy)
}

@@ -130,0 +130,0 @@ utils.removeHeaders(res.headers, ["content-length", "content-encoding"]);

@@ -7,2 +7,3 @@ "use strict";

var utils = require("./utils").utils;
var snippetUtils = require("./snippet").utils;

@@ -14,3 +15,2 @@ module.exports.init = function (context) {

var servers;
var msg;

@@ -35,5 +35,15 @@ this.io = this.getPlugin("socket")(ports.socket, this.clientEvents, options, this.events);

// Always Launch the control panel
var scriptTags = messages.scriptTags(options.host, ports, options, "controlPanel");
controlPanel.launchControlPanel(scriptTags, options, this.getPlugin("client:script")).listen(ports.controlPanel);
var snippet = messages.scriptTags(options.host, ports, options, "controlPanel");
var cpPlugin = this.getPlugin("controlpanel");
var cp;
if (cpPlugin) {
cp = cpPlugin(options, snippet, this);
}
controlPanel
.launchControlPanel(options, this.getPlugin("client:script"), cp)
.listen(ports.controlPanel);
this.options = options;

@@ -40,0 +50,0 @@

{
"name": "browser-sync",
"description": "Live CSS Reload & Browser Syncing",
"version": "0.7.0",
"version": "0.7.1",
"homepage": "https://github.com/shakyshane/browser-sync",

@@ -45,3 +45,4 @@ "author": {

"browser-sync-client": "0.0.3",
"commander": "~2.1.0"
"commander": "~2.1.0",
"browser-sync-control-panel": "0.0.1"
},

@@ -48,0 +49,0 @@ "devDependencies": {

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