Skip to content

Commit f287659

Browse files
author
Shane Osbourne
committed
tweak width
1 parent 2ab7ec3 commit f287659

33 files changed

+393
-121
lines changed

packages/browser-sync/lib/async.js

+19-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ module.exports = {
9090
require("dns").resolve("www.google.com", function(err) {
9191
var online = false;
9292
if (err) {
93-
bs.debug("Could not resolve www.google.com, setting %s", chalk.magenta("online: false"));
93+
bs.debug(
94+
"Could not resolve www.google.com, setting %s",
95+
chalk.magenta("online: false")
96+
);
9497
} else {
9598
bs.debug("Resolved www.google.com, setting %s", chalk.magenta("online: true"));
9699
online = true;
@@ -141,9 +144,15 @@ module.exports = {
141144
done(null, {
142145
options: {
143146
urls: utils.getUrlOptions(bs.options),
144-
snippet: connectUtils.enabled(bs.options) ? connectUtils.scriptTags(bs.options) : false,
147+
snippet: connectUtils.enabled(bs.options)
148+
? connectUtils.scriptTags(bs.options)
149+
: false,
145150
scriptPaths: Immutable.fromJS(connectUtils.clientScript(bs.options, true)),
146-
files: bs.pluginManager.hook("files:watch", bs.options.get("files"), bs.pluginManager.pluginOptions)
151+
files: bs.pluginManager.hook(
152+
"files:watch",
153+
bs.options.get("files"),
154+
bs.pluginManager.pluginOptions
155+
)
147156
}
148157
});
149158
},
@@ -224,7 +233,10 @@ module.exports = {
224233
* @param {Function} done
225234
*/
226235
startSockets: function(bs, done) {
227-
var clientEvents = bs.pluginManager.hook("client:events", bs.options.get("clientEvents").toJS());
236+
var clientEvents = bs.pluginManager.hook(
237+
"client:events",
238+
bs.options.get("clientEvents").toJS()
239+
);
228240

229241
// Start the socket, needs an existing server.
230242
var io = bs.pluginManager.get("socket")(bs.server, clientEvents, bs);
@@ -259,7 +271,9 @@ module.exports = {
259271
return item.name === PLUGIN_NAME;
260272
})
261273
) {
262-
uiOpts = bs.options.get("ui").mergeDeep(Immutable.fromJS(bs.pluginManager.pluginOptions[PLUGIN_NAME]));
274+
uiOpts = bs.options
275+
.get("ui")
276+
.mergeDeep(Immutable.fromJS(bs.pluginManager.pluginOptions[PLUGIN_NAME]));
263277
}
264278

265279
/**

packages/browser-sync/lib/bin.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ function handleNoCommand(argv, input, yargs) {
128128
return process.exit(1);
129129
}
130130

131-
const serveStaticPaths = withoutErrors.filter(item => item.isUrl === false).map(item => item.resolved);
131+
const serveStaticPaths = withoutErrors
132+
.filter(item => item.isUrl === false)
133+
.map(item => item.resolved);
132134

133135
const urls = withoutErrors.filter(item => item.isUrl === true).map(item => item.userInput);
134136

packages/browser-sync/lib/cli/cli-info.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ var info = {
4848
fs.writeFile(path.resolve(cwd, config.userFile), file, function() {
4949
logger.info("Config file created %s", chalk.magenta(config.userFile));
5050
logger.info(
51-
"To use it, in the same directory run: " + chalk.cyan("browser-sync start --config bs-config.js")
51+
"To use it, in the same directory run: " +
52+
chalk.cyan("browser-sync start --config bs-config.js")
5253
);
5354
cb();
5455
});

packages/browser-sync/lib/cli/cli-options.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ export function printErrors(errors: BsErrors) {
128128
`Error Type: ${error.type}`,
129129
`Error Level: ${error.level}`,
130130
error.errors.map(item =>
131-
[`Error Message: ${item.error.message}`, item.meta ? item.meta().join("\n") : ""]
131+
[
132+
`Error Message: ${item.error.message}`,
133+
item.meta ? item.meta().join("\n") : ""
134+
]
132135
.filter(Boolean)
133136
.join("\n")
134137
)

packages/browser-sync/lib/cli/command.recipe.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ module.exports = function(opts) {
2020

2121
var logRecipes = function() {
2222
var dirs = fs.readdirSync(path.join(dir, "recipes"));
23-
logger.info("Install one of the following with %s\n", chalk.cyan("browser-sync recipe <name>"));
23+
logger.info(
24+
"Install one of the following with %s\n",
25+
chalk.cyan("browser-sync recipe <name>")
26+
);
2427
dirs.forEach(function(name) {
2528
console.log(" " + name);
2629
});

packages/browser-sync/lib/cli/transforms/addDefaultIgnorePatterns.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import { List } from "immutable";
22
import { BsTempOptions, TransformResult } from "../cli-options";
33

4-
const defaultIgnorePatterns = [/node_modules/, /bower_components/, ".sass-cache", ".vscode", ".git", ".idea"];
4+
const defaultIgnorePatterns = [
5+
/node_modules/,
6+
/bower_components/,
7+
".sass-cache",
8+
".vscode",
9+
".git",
10+
".idea"
11+
];
512

613
export function addDefaultIgnorePatterns(incoming: BsTempOptions): TransformResult {
714
if (!incoming.get("watch")) {

packages/browser-sync/lib/config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
},
2727
errors: {
2828
"server+proxy": "Invalid config. You cannot specify both server & proxy options.",
29-
"proxy+https": "Invalid config. You set https: true, but your proxy target doesn't reflect this."
29+
"proxy+https":
30+
"Invalid config. You set https: true, but your proxy target doesn't reflect this."
3031
}
3132
};

packages/browser-sync/lib/connect-utils.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ var connectUtils = {
3939
*/
4040
var scriptSrc = (function() {
4141
if (options.get("localOnly")) {
42-
return [options.get("scheme"), "://localhost:", options.get("port"), scriptPath].join("");
42+
return [
43+
options.get("scheme"),
44+
"://localhost:",
45+
options.get("port"),
46+
scriptPath
47+
].join("");
4348
}
4449

4550
/**

packages/browser-sync/lib/default-config.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,15 @@ module.exports = {
512512
*/
513513
timestamps: true,
514514

515-
clientEvents: ["scroll", "scroll:element", "input:text", "input:toggles", "form:submit", "form:reset", "click"],
515+
clientEvents: [
516+
"scroll",
517+
"scroll:element",
518+
"input:text",
519+
"input:toggles",
520+
"form:submit",
521+
"form:reset",
522+
"click"
523+
],
516524

517525
/**
518526
* Alter the script path for complete control over where the Browsersync

packages/browser-sync/lib/file-watcher.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ module.exports.plugin = function(bs) {
4242
if (!_.isFunction(item.fn)) {
4343
item.fn = fn;
4444
}
45-
var watcher = watch(item.match, item.options || defaultWatchOptions, item.fn.bind(bs.publicInstance));
45+
var watcher = watch(
46+
item.match,
47+
item.options || defaultWatchOptions,
48+
item.fn.bind(bs.publicInstance)
49+
);
4650
if (!map[namespace]) {
4751
map[namespace] = {
4852
watchers: [watcher]

packages/browser-sync/lib/http-protocol.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ var queryString = require("qs");
44
var proto = exports;
55
var instanceMethods = ["exit", "notify", "pause", "resume"];
66
var getBody = require("raw-body");
7-
const permittedSocketEvents = ["file:reload", "browser:reload", "browser:notify", "browser:location", "options:set"];
7+
const permittedSocketEvents = [
8+
"file:reload",
9+
"browser:reload",
10+
"browser:notify",
11+
"browser:location",
12+
"options:set"
13+
];
814

915
/**
1016
* Does the requested method expect an instance of BrowserSync
@@ -49,7 +55,9 @@ proto.middleware = function(bs) {
4955
try {
5056
const [name, payload] = JSON.parse(body.toString());
5157
bs.io.sockets.emit(name, payload);
52-
return res.end(`Browsersync HTTP Protocol received: ${name} ${JSON.stringify(payload)}`);
58+
return res.end(
59+
`Browsersync HTTP Protocol received: ${name} ${JSON.stringify(payload)}`
60+
);
5361
} catch (e) {
5462
const output = [`Error: ${e.message}`];
5563
res.writeHead(500, { "Content-Type": "text/plain" });

packages/browser-sync/lib/internal-events.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,20 @@ module.exports = function(bs) {
9292
return x.namespace === "core";
9393
});
9494

95-
var handler = fileHandler.fileChanges(coreNamespacedWatchers, bs.options).subscribe(function(x) {
96-
if (x.type === "reload") {
97-
bs.events.emit("browser:reload", x);
98-
}
99-
if (x.type === "inject") {
100-
x.files.forEach(function(data) {
101-
if (!bs.paused && data.namespace === "core") {
102-
bs.events.emit("file:reload", fileUtils.getFileInfo(data, bs.options));
103-
}
104-
});
105-
}
106-
});
95+
var handler = fileHandler
96+
.fileChanges(coreNamespacedWatchers, bs.options)
97+
.subscribe(function(x) {
98+
if (x.type === "reload") {
99+
bs.events.emit("browser:reload", x);
100+
}
101+
if (x.type === "inject") {
102+
x.files.forEach(function(data) {
103+
if (!bs.paused && data.namespace === "core") {
104+
bs.events.emit("file:reload", fileUtils.getFileInfo(data, bs.options));
105+
}
106+
});
107+
}
108+
});
107109

108110
bs.registerCleanupTask(function() {
109111
handler.dispose();

0 commit comments

Comments
 (0)