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.3 to 0.7.4

17

example.js

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

var browserSync = require("./lib/index");
console.time("init");
var files = ["test/fixtures/assets/*", "test/fixtures/*.html"];

@@ -7,9 +10,17 @@

server: {
baseDir: "test/fixtures",
directory: true
}
baseDir: "test/fixtures"
},
open: false,
minify: true
};
//var clientScript = require("/Users/shakyshane/Sites/browser-sync-modules/browser-sync-client/index");
//
//browserSync.use("client:script", clientScript.middleware, function (err) {
// console.log(err);
//});
browserSync.init(files, options, function (err, bs) {
console.timeEnd("init");
return true;
});

44

lib/cli-init.js

@@ -25,6 +25,5 @@ "use strict";

*/
function methodName(key) {
module.exports.methodName = function (key) {
return "_merge%sOption".replace("%s", ucfirst(key));
}
module.exports.methodName = methodName;
};

@@ -37,9 +36,8 @@ /**

*/
function transformOption(obj, key, args) {
module.exports.transformOption = function (obj, key, args) {
if (args[key] && typeof obj[key] !== "undefined") {
obj[key] = cliOptions[methodName(key)](obj[key], args[key], args);
obj[key] = cliOptions[exports.methodName(key)](obj[key], args[key], args);
}
return obj;
}
module.exports.transformOption = transformOption;
};

@@ -52,9 +50,8 @@ /**

*/
function mergeOptions(defaultConfig, args, allowedOptions) {
module.exports.mergeOptions = function (defaultConfig, args, allowedOptions) {
return allowedOptions
.reduce(function (obj, key) {
return transformOption(obj, key, args);
return exports.transformOption(obj, key, args);
}, defaultConfig);
}
module.exports.mergeOptions = mergeOptions;
};

@@ -80,5 +77,5 @@ /**

options = _.merge(defaultConfig, userConfig);
options = mergeOptions(defaultConfig, options, exports.allowedOptions);
options = exports.mergeOptions(defaultConfig, options, exports.allowedOptions);
} else {
options = mergeOptions(defaultConfig, args, exports.allowedOptions);
options = exports.mergeOptions(defaultConfig, args, exports.allowedOptions);
options.files = cliOptions._mergeFilesOption(args.files, options.exclude);

@@ -103,2 +100,3 @@ }

.version(version)
.usage("<command> [options]")
.option("--files", "File paths to watch")

@@ -112,2 +110,18 @@ .option("--server", "Run a Local server (uses your cwd as the web root)")

program
.on("--help", function(){
console.log(" Server Example:");
console.log(" ---------------");
console.log(" Use current directory as root & watch CSS files");
console.log("");
console.log(" $ browser-sync start --server --files=\"css/*.css\"");
console.log("");
console.log(" Proxy Example:");
console.log(" --------------");
console.log(" Proxy `localhost:8080` & watch CSS files");
console.log("");
console.log(" $ browser-sync start --proxy=\"localhost:8080\" --files=\"css/*.css\"");
console.log("");
});
program
.command("init")

@@ -125,3 +139,7 @@ .description("Creates a default config file")

program.parse(argv);
if (!args._.length) {
program.help();
}
};
module.exports = {
debugInfo: true,
injectFileTypes: ["css", "png", "jpg", "jpeg", "svg", "gif", "webp"],
minify: true,
logConnections: false,
host: null,

@@ -54,4 +56,5 @@ ghostMode: {

"avi",
"swf"
"swf",
"scss"
]
};

@@ -23,4 +23,6 @@ "use strict";

"client:connected": function (options, data) {
var msg = messages.browser.connection(utils.getUaString(data.ua));
utils.log(msg, options, false);
if (options.logConnections) {
var msg = messages.browser.connection(utils.getUaString(data.ua));
utils.log(msg, options, false);
}
},

@@ -27,0 +29,0 @@ "open": function (options, data) {

@@ -116,12 +116,5 @@ "use strict";

* @param base
* @param directory
*/
addDirectory: function (app, base, directory) {
var dirBase = base;
if (directory) {
if (typeof directory === "string") {
dirBase = filePath.resolve(directory);
}
app.use(connect.directory(dirBase, {icons:true}));
}
addDirectory: function (app, base) {
app.use(connect.directory(base, {icons:true}));
}

@@ -172,8 +165,8 @@ };

if (directory) {
utils.addDirectory(app, baseDir, server.directory);
}
utils.addBaseDir(app, baseDir, index);
if (directory) {
utils.addDirectory(app, baseDir);
}

@@ -180,0 +173,0 @@ staticServer = http.createServer(app);

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

controlPanel
.launchControlPanel(options, this.getPlugin("client:script"), cp)
.launchControlPanel(options, this.getPlugin("client:script")(options), cp)
.listen(ports.controlPanel);

@@ -46,0 +46,0 @@

@@ -62,4 +62,8 @@ "use strict";

io.set("log level", 0);
if (options.minify) {
io.set("browser client minification", true);
io.set("browser client gzip", true);
}
exports.socketConnection(events, options, io, emitter);
return io;
};
{
"name": "browser-sync",
"description": "Live CSS Reload & Browser Syncing",
"version": "0.7.3",
"version": "0.7.4",
"homepage": "https://github.com/shakyshane/browser-sync",

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

"resp-modifier": "0.0.4",
"browser-sync-client": "0.0.4",
"browser-sync-client": "0.0.5",
"commander": "~2.1.0",

@@ -47,0 +47,0 @@ "browser-sync-control-panel": "0.0.3"

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