browser-sync
Advanced tools
Comparing version
@@ -7,2 +7,3 @@ "use strict"; | ||
var connectUtils = require("./connect-utils"); | ||
var chalk = require("chalk"); | ||
module.exports = { | ||
@@ -21,3 +22,3 @@ /** | ||
} | ||
bs.debug("Found a free port: {magenta:%s", port); | ||
bs.debug("Found a free port: %s", chalk.magenta(port)); | ||
done(null, { | ||
@@ -88,6 +89,6 @@ options: { | ||
if (err) { | ||
bs.debug("Could not resolve www.google.com, setting {magenta:online: false}"); | ||
bs.debug("Could not resolve www.google.com, setting %s", chalk.magenta("online: false")); | ||
} | ||
else { | ||
bs.debug("Resolved www.google.com, setting {magenta:online: true}"); | ||
bs.debug("Resolved www.google.com, setting %s", chalk.magenta("online: true")); | ||
online = true; | ||
@@ -94,0 +95,0 @@ } |
@@ -8,2 +8,3 @@ #!/usr/bin/env node | ||
const recipeOpts = require("../cli-options/opts.recipe.json"); | ||
const chalk = require("chalk"); | ||
const pkg = require("../package.json"); | ||
@@ -14,3 +15,2 @@ const utils = require("./utils"); | ||
const logger_1 = require("./logger"); | ||
const eazy_logger_1 = require("eazy-logger"); | ||
const cli_options_1 = require("./cli/cli-options"); | ||
@@ -57,3 +57,3 @@ var BsErrorLevels; | ||
"To run a proxy, whilst also serving static files", | ||
(0, eazy_logger_1.compile)(" $0 https://example.com htdocs/themes/example") | ||
" $0 https://example.com htdocs/themes/example" | ||
].join("\n")); | ||
@@ -207,5 +207,5 @@ const argv = yargs.argv; | ||
return [ | ||
`Your Input: {yellow:${input}}`, | ||
`CWD: {yellow:${process.cwd()}}`, | ||
`Resolved to: {yellow:${resolved}}` | ||
`Your Input: ${chalk.yellow(input)}`, | ||
`CWD: ${chalk.yellow(process.cwd())}`, | ||
`Resolved to: ${chalk.yellow(resolved)}` | ||
]; | ||
@@ -212,0 +212,0 @@ } |
@@ -8,2 +8,3 @@ "use strict"; | ||
var logger = require("./logger"); | ||
var chalk = require("chalk"); | ||
var eachSeries = utils.eachSeries; | ||
@@ -117,3 +118,3 @@ var _ = require("./lodash.custom"); | ||
return function (item, cb) { | ||
bs.debug("-> {yellow:Starting Step: " + item.step); | ||
bs.debug("-> %s", chalk.yellow("Starting Step: " + item.step)); | ||
/** | ||
@@ -137,3 +138,3 @@ * Execute the current task. | ||
} | ||
bs.debug("+ {green:Step Complete: " + item.step); | ||
bs.debug("+ %s", chalk.green("Step Complete: " + item.step)); | ||
cb(); | ||
@@ -140,0 +141,0 @@ } |
@@ -7,2 +7,3 @@ "use strict"; | ||
var path = require("path"); | ||
var chalk = require("chalk"); | ||
var info = { | ||
@@ -42,5 +43,5 @@ /** | ||
fs.writeFile(path.resolve(cwd, config.userFile), file, function () { | ||
logger.info("Config file created {magenta:%s}", config.userFile); | ||
logger.info("Config file created %s", chalk.magenta(config.userFile)); | ||
logger.info("To use it, in the same directory run: " + | ||
"{cyan:browser-sync start --config bs-config.js}"); | ||
chalk.cyan("browser-sync start --config bs-config.js")); | ||
cb(); | ||
@@ -47,0 +48,0 @@ }); |
"use strict"; | ||
var logger = require("../logger").logger; | ||
var chalk = require("chalk"); | ||
/** | ||
@@ -20,3 +21,3 @@ * $ browser-sync recipe <name> <options> | ||
var dirs = fs.readdirSync(path.join(dir, "recipes")); | ||
logger.info("Install one of the following with {cyan:browser-sync recipe <name>\n"); | ||
logger.info("Install one of the following with %s\n", chalk.cyan('browser-sync recipe <name>')); | ||
dirs.forEach(function (name) { | ||
@@ -50,4 +51,4 @@ console.log(" " + name); | ||
else { | ||
logger.info("Recipe copied into {cyan:%s}", output); | ||
logger.info("Next, inside that folder, run {cyan:npm i && npm start}"); | ||
logger.info("Recipe copied into %s", chalk.cyan(output)); | ||
logger.info("Next, inside that folder, run %s", chalk.cyan("npm i && npm start")); | ||
opts.cb(null); | ||
@@ -58,3 +59,3 @@ } | ||
else { | ||
logger.info("Recipe {cyan:%s} not found. The following are available though", input); | ||
logger.info("Recipe %s not found. The following are available though", chalk.cyan(input)); | ||
logRecipes(); | ||
@@ -61,0 +62,0 @@ opts.cb(); |
@@ -12,4 +12,4 @@ "use strict"; | ||
templates: { | ||
scriptTag: path.join(__dirname, "..", "templates/script-tags.tmpl"), | ||
scriptTagSimple: path.join(__dirname, "..", "templates/script-tags-simple.tmpl"), | ||
scriptTag: path.join(__dirname, "..", "templates/script-tags.html"), | ||
scriptTagSimple: path.join(__dirname, "..", "templates/script-tags-simple.html"), | ||
connector: path.join(__dirname, "..", "templates/connector.tmpl") | ||
@@ -16,0 +16,0 @@ }, |
@@ -10,2 +10,3 @@ #! /usr/bin/env node | ||
var events = require("events"); | ||
var chalk = require("chalk"); | ||
var PassThrough = require("stream").PassThrough; | ||
@@ -226,3 +227,3 @@ var logger = require("eazy-logger").Logger({ | ||
if (instance.length) { | ||
logger.error("{yellow:You tried to start Browsersync twice!} To create multiple instances, use {cyan:browserSync.create().init()"); | ||
logger.error(chalk.yellow("You tried to start Browsersync twice!"), "To create multiple instances, use", chalk.cyan("browserSync.create().init()")); | ||
return instance; | ||
@@ -229,0 +230,0 @@ } |
@@ -5,3 +5,4 @@ "use strict"; | ||
var _ = require("./lodash.custom"); | ||
var template = "[{blue:%s}] "; | ||
var chalk = require("chalk"); | ||
var template = (prefix) => "[" + chalk.blue(prefix) + "] "; | ||
var logger = require("eazy-logger").Logger({ | ||
@@ -17,3 +18,3 @@ useLevelPrefixes: false | ||
return logger.clone(function (config) { | ||
config.prefix = config.prefix + template.replace("%s", name); | ||
config.prefix = config.prefix + template(name); | ||
return config; | ||
@@ -44,5 +45,5 @@ }); | ||
if (data.path[0] === "*") { | ||
return logger.info("{cyan:Reloading files that match: {magenta:%s", data.path); | ||
return logger.info(chalk.cyan("Reloading files that match: %s"), chalk.magenta(data.path)); | ||
} | ||
logger.info("{cyan:File event [" + data.event + "] : {magenta:%s", data.path); | ||
logger.info(chalk.cyan("File event [%s] : %s"), data.event, chalk.magenta(data.path)); | ||
} | ||
@@ -62,5 +63,5 @@ }, | ||
if (data.files && data.files.length > 1) { | ||
return logger.info(`{cyan:Reloading Browsers... (buffered ${data.files.length} events)`); | ||
return logger.info(chalk.cyan(`Reloading Browsers... (buffered %s events)`), data.files.length); | ||
} | ||
logger.info("{cyan:Reloading Browsers..."); | ||
logger.info(chalk.cyan("Reloading Browsers...")); | ||
} | ||
@@ -72,3 +73,4 @@ }, | ||
"browser:error": function () { | ||
logger.error("Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the {cyan:open} option to {cyan:false})"); | ||
logger.error("Couldn't open browser (if you are using BrowserSync in a " + | ||
"headless environment, you might want to set the %s option to %s)", chalk.cyan("open"), chalk.cyan("false")); | ||
}, | ||
@@ -82,3 +84,3 @@ /** | ||
var changed = data.changed; | ||
logger.info("{cyan:%s %s changed} ({magenta:%s})", changed.length, changed.length > 1 ? "files" : "file", changed.join(", ")); | ||
logger.info(chalk.cyan("%s %s changed (%s)"), changed.length, changed.length > 1 ? "files" : "file", chalk.magenta(changed.join(", "))); | ||
} | ||
@@ -93,3 +95,3 @@ }, | ||
var uaString = utils.getUaString(data.ua); | ||
var msg = "{cyan:Browser Connected: {magenta:%s, version: %s}"; | ||
var msg = chalk.cyan("Browser Connected: %s, version: %s"); | ||
var method = "info"; | ||
@@ -99,3 +101,3 @@ if (!bs.options.get("logConnections")) { | ||
} | ||
logger.log(method, msg, uaString.name, uaString.version); | ||
logger.log(method, msg, chalk.magenta(uaString.name), chalk.magenta(uaString.version)); | ||
}, | ||
@@ -129,3 +131,3 @@ /** | ||
if (type === "proxy") { | ||
logger.info("Proxying: {cyan:%s}", bs.options.getIn(["proxy", "target"])); | ||
logger.info("Proxying: %s", chalk.cyan(bs.options.getIn(["proxy", "target"]))); | ||
logUrls(bs.options.get("urls").toJS()); | ||
@@ -135,4 +137,3 @@ } | ||
if (bs.options.get("logSnippet")) { | ||
logger.info("{bold:Copy the following snippet into your website, " + | ||
"just before the closing {cyan:</body>} tag"); | ||
logger.info(chalk.bold(`Copy the following snippet into your website, just before the closing ${chalk.cyan('</body>')} tag`)); | ||
logger.unprefixed("info", messages.scriptTags(bs.options)); | ||
@@ -148,3 +149,3 @@ } | ||
function serveFiles(base) { | ||
logger.info("Serving files from: {magenta:%s}", base); | ||
logger.info("Serving files from: %s", chalk.magenta(base)); | ||
} | ||
@@ -169,3 +170,3 @@ } | ||
else { | ||
logger.setPrefix(template.replace("%s", logPrefix)); | ||
logger.setPrefix(template(logPrefix)); | ||
} | ||
@@ -201,13 +202,13 @@ } | ||
var underlined = false; | ||
logger.info("{bold:Access URLs:"); | ||
logger.unprefixed("info", "{grey: %s", underline); | ||
logger.info(chalk.bold("Access URLs:")); | ||
logger.unprefixed("info", " %s", chalk.grey(underline)); | ||
keys.forEach(function (key, i) { | ||
var keyname = getKeyName(key); | ||
logger.unprefixed("info", " %s: {magenta:%s}", getPadding(key.length, longestName + offset) + keyname, urls[key]); | ||
logger.unprefixed("info", " %s: %s", getPadding(key.length, longestName + offset) + keyname, chalk.magenta(urls[key])); | ||
if (!underlined && names[i + 1] && names[i + 1].indexOf("ui") > -1) { | ||
underlined = true; | ||
logger.unprefixed("info", "{grey: %s}", underline); | ||
logger.unprefixed("info", " %s", chalk.grey(underline)); | ||
} | ||
}); | ||
logger.unprefixed("info", "{grey: %s}", underline); | ||
logger.unprefixed("info", " %s", chalk.grey(underline)); | ||
} | ||
@@ -214,0 +215,0 @@ /** |
@@ -175,3 +175,3 @@ "use strict"; | ||
withErrors.forEach(function (item) { | ||
logger.logger.error("{red:Warning!} %s", item.getIn(["errors", 0, "data", "message"])); | ||
logger.logger.error("%s %s", chalk.red("Warning!"), item.getIn(["errors", 0, "data", "message"])); | ||
}); | ||
@@ -178,0 +178,0 @@ } |
{ | ||
"name": "browser-sync", | ||
"description": "Live CSS Reload & Browser Syncing", | ||
"version": "2.27.10", | ||
"version": "2.28.0", | ||
"homepage": "https://browsersync.io/", | ||
@@ -38,4 +38,4 @@ "author": { | ||
"dependencies": { | ||
"browser-sync-client": "^2.27.10", | ||
"browser-sync-ui": "^2.27.10", | ||
"browser-sync-client": "^2.28.0", | ||
"browser-sync-ui": "^2.28.0", | ||
"bs-recipes": "1.3.4", | ||
@@ -48,3 +48,3 @@ "bs-snippet-injector": "^2.0.1", | ||
"easy-extender": "^2.3.4", | ||
"eazy-logger": "3.1.0", | ||
"eazy-logger": "4.0.0", | ||
"etag": "^1.8.1", | ||
@@ -59,3 +59,3 @@ "fresh": "^0.5.2", | ||
"portscanner": "2.2.0", | ||
"qs": "6.2.3", | ||
"qs": "^6.11.0", | ||
"raw-body": "^2.3.2", | ||
@@ -69,3 +69,3 @@ "resp-modifier": "6.0.2", | ||
"socket.io": "^4.4.1", | ||
"ua-parser-js": "1.0.2", | ||
"ua-parser-js": "1.0.33", | ||
"yargs": "^17.3.1" | ||
@@ -77,7 +77,7 @@ }, | ||
"chai": "^3", | ||
"chalk": "1.1.3", | ||
"chalk": "4.1.2", | ||
"generate-changelog": "^1.7.0", | ||
"graceful-fs": "4.1.9", | ||
"http2": "^3.3.6", | ||
"mocha": "^8.2.0", | ||
"mocha": "^10.2.0", | ||
"prettier": "^1.9.2", | ||
@@ -91,2 +91,3 @@ "q": "1.4.1", | ||
"source-map-support": "^0.5.0", | ||
"strip-ansi": "^6.0.1", | ||
"supertest": "^3", | ||
@@ -102,3 +103,3 @@ "typescript": "^4.6.2", | ||
], | ||
"gitHead": "f6965a67277bdadfaa4943e7b90e4ed6a71e90af" | ||
"gitHead": "52ab250cb52fb431593ab03c9681832274c74607" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
579345
0.37%10416
0.06%20
5.26%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated