Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: node_modules/vulcanize/node_modules/update-notifier/node_modules/chalk/index.js

Issue 800513006: Added vulcanize under third_party/npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: node_modules/vulcanize/node_modules/update-notifier/node_modules/chalk/index.js
diff --git a/node_modules/vulcanize/node_modules/update-notifier/node_modules/chalk/index.js b/node_modules/vulcanize/node_modules/update-notifier/node_modules/chalk/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ac1f16820d1f792f6efd677a88738ee22b0bb3b0
--- /dev/null
+++ b/node_modules/vulcanize/node_modules/update-notifier/node_modules/chalk/index.js
@@ -0,0 +1,95 @@
+'use strict';
+var escapeStringRegexp = require('escape-string-regexp');
+var ansiStyles = require('ansi-styles');
+var stripAnsi = require('strip-ansi');
+var hasAnsi = require('has-ansi');
+var supportsColor = require('supports-color');
+var defineProps = Object.defineProperties;
+var chalk = module.exports;
+
+function build(_styles) {
+ var builder = function builder() {
+ return applyStyle.apply(builder, arguments);
+ };
+ builder._styles = _styles;
+ // __proto__ is used because we must return a function, but there is
+ // no way to create a function with a different prototype.
+ builder.__proto__ = proto;
+ return builder;
+}
+
+var styles = (function () {
+ var ret = {};
+
+ ansiStyles.grey = ansiStyles.gray;
+
+ Object.keys(ansiStyles).forEach(function (key) {
+ ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
+
+ ret[key] = {
+ get: function () {
+ return build(this._styles.concat(key));
+ }
+ };
+ });
+
+ return ret;
+})();
+
+var proto = defineProps(function chalk() {}, styles);
+
+function applyStyle() {
+ // support varags, but simply cast to string in case there's only one arg
+ var args = arguments;
+ var argsLen = args.length;
+ var str = argsLen !== 0 && String(arguments[0]);
+ if (argsLen > 1) {
+ // don't slice `arguments`, it prevents v8 optimizations
+ for (var a = 1; a < argsLen; a++) {
+ str += ' ' + args[a];
+ }
+ }
+
+ if (!chalk.enabled || !str) {
+ return str;
+ }
+
+ /*jshint validthis: true*/
+ var nestedStyles = this._styles;
+
+ for (var i = 0; i < nestedStyles.length; i++) {
+ var code = ansiStyles[nestedStyles[i]];
+ // Replace any instances already present with a re-opening code
+ // otherwise only the part of the string until said closing code
+ // will be colored, and the rest will simply be 'plain'.
+ str = code.open + str.replace(code.closeRe, code.open) + code.close;
+ }
+
+ return str;
+}
+
+function init() {
+ var ret = {};
+
+ Object.keys(styles).forEach(function (name) {
+ ret[name] = {
+ get: function () {
+ return build([name]);
+ }
+ };
+ });
+
+ return ret;
+}
+
+defineProps(chalk, init());
+
+chalk.styles = ansiStyles;
+chalk.hasColor = hasAnsi;
+chalk.stripColor = stripAnsi;
+chalk.supportsColor = supportsColor;
+
+// detect mode if not set manually
+if (chalk.enabled === undefined) {
+ chalk.enabled = chalk.supportsColor;
+}

Powered by Google App Engine
This is Rietveld 408576698