Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

21
static/js/ketcher2/node_modules/garnish/LICENSE.md generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Matt DesLauriers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

119
static/js/ketcher2/node_modules/garnish/README.md generated vendored Normal file
View File

@ -0,0 +1,119 @@
# garnish
[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)
Prettifies [ndjson](http://ndjson.org/) or [bole](https://github.com/rvagg/bole) logs from [budo](https://github.com/mattdesl/budo), [wzrd](https://github.com/maxogden/wzrd/) and other tools.
Example with [budo](https://github.com/mattdesl/budo), which uses this under the hood.
<img src="http://i.imgur.com/Pvus8vy.png" width="75%" />
## Install
```sh
npm install garnish [-g|--save-dev]
```
## Usage
### CLI
Pipe a ndjson emitter into `garnish` like so:
```sh
node app.js | garnish [opts]
Options:
--level, -l the minimum debug level, default 'debug'
--name, -n the default app name
```
Where `level` can be `debug`, `info`, `warn`, `error`.
### API
#### `garnish([opt])`
Returns a duplexer that parses input as ndjson, and writes a pretty-printed result. Options:
- `level` (String)
- the minimum log level to print (default `'debug'`)
- the order is as follows: `debug`, `info`, `warn`, `error`
- `name` (String)
- the default name for your logger; a message's `name` field will not be printed when it matches this default name, to reduce redundant/obvious information in the logs.
## format
Typically, you would use [bole](https://github.com/rvagg/bole) or [ndjson](https://www.npmjs.com/package/ndjson) to write the content to garnish. You can also write ndjson to `stdout` like so:
```js
// a log message
console.log({
name: 'myApp',
level: 'warn',
message: 'not found'
})
// a typical server message
console.log({
name: 'myApp',
type: 'generated',
level: 'info',
url: '/foo.png',
statusCode: 200,
contentLength: 12800, // in bytes
elapsed: 120 // in milliseconds
})
```
Currently garnish styles the following:
- `level`
- the log level e.g. `debug`, `info`, `warn`, `error` (default `debug`) - only shown if `message` is present
- `name`
- an optional event or application name. It's recommended to always have a name.
- `message`
- an event message.
- `url`
- a url (stripped to pathname), useful for router logging.
- `statusCode`
- an HTTP statusCode. Codes `>=400` are displayed in red.
- `contentLength`
- the response size; if a `number`, bytes are assumed
- `elapsed`
- time elapsed since the previous related event; if a `number`, milliseconds are assumed
- `type`
- the type of event logged
- `colors`
- an optional color mapping for custom styles
You can use the `colors` field to override any of the default colors with a new [ANSI style](https://github.com/chalk/ansi-styles).
For example, the following will print `elapsed` in yellow if it passes our threshold:
```js
function logTime (msg) {
var now = Date.now()
var time = now - lastTime
lastTime = now
console.log({
name: 'app',
message: msg,
elapsed: time + ' ms',
colors: {
elapsed: time > 1000 ? 'yellow' : 'green'
}
})
}
```
## See Also
- [bistre](https://github.com/hughsk/bistre)
## License
MIT, see [LICENSE.md](http://github.com/mattdesl/garnish/blob/master/LICENSE.md) for details.

15
static/js/ketcher2/node_modules/garnish/bin/cmd.js generated vendored Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env node
var stdout = require('stdout-stream')
var garnish = require('../')
var argv = require('minimist')(process.argv.slice(2), {
alias: {
level: 'l',
name: 'n'
}
})
process.stdin.resume()
process.stdin.setEncoding('utf8')
process.stdin
.pipe(garnish(argv))
.pipe(stdout)

59
static/js/ketcher2/node_modules/garnish/index.js generated vendored Normal file
View File

@ -0,0 +1,59 @@
var split = require('split2')
var eol = require('os').EOL
var renderer = require('./lib/renderer')
var levels = require('./lib/levels')
module.exports = garnish
function garnish (opt) {
opt = opt || {}
var loggerLevel = opt.level || 'debug'
var render = renderer.create(opt.name)
return split(parse)
function parse (line) {
try {
var obj = JSON.parse(line)
if (obj.name === 'http' && obj.message === 'request') return
if (typeof obj.level === 'number') toBunyan(obj)
// check if we need to style it
if (!renderer.isStyleObject(obj)) return line + eol
obj.level = obj.level || 'info'
// allow user to filter to a specific level
if (!levels.valid(loggerLevel, obj.level)) return
// errors should be formatted differently
if (typeof obj.err === 'object') return renderer.renderError(obj) + eol
if (typeof obj.message === 'object') {
return renderer.renderObject(obj) + eol
}
return render(obj) + eol
} catch (e) {
return line + eol
}
}
}
// mutate a bole log to bunyan log
// obj -> null
function toBunyan (obj) {
if (obj.msg && !obj.message) {
obj.message = obj.msg
delete obj.msg
}
if (typeof obj.level === 'number') {
if (obj.level === 20) obj.level = 'debug'
if (obj.level === 30) obj.level = 'info'
if (obj.level === 40) obj.level = 'warn'
if (obj.level === 50) obj.level = 'error'
}
}

34
static/js/ketcher2/node_modules/garnish/lib/levels.js generated vendored Normal file
View File

@ -0,0 +1,34 @@
var padRight = require('pad-right')
var colors = {
debug: 'cyan',
info: 'dim',
warn: 'yellow',
error: 'red'
}
var padLen = Object.keys(colors).reduce(function (prev, a) {
return Math.max(prev, a.length)
}, 0)
var levels = Object.keys(colors)
// whether the message level is valid for the given logger
module.exports.valid = function (logLevel, msgLevel) {
var levelIdx = levels.indexOf(logLevel)
var msgIdx = levels.indexOf(msgLevel)
if (msgIdx === -1 || levelIdx === -1) return true
return msgIdx >= levelIdx
}
// stringify with padding
module.exports.stringify = function (level) {
return padRight(level, padLen, ' ')
}
// get a level's default color
module.exports.color = function (level) {
return colors[level]
}
module.exports.maxLength = padLen

192
static/js/ketcher2/node_modules/garnish/lib/renderer.js generated vendored Normal file
View File

@ -0,0 +1,192 @@
var chalk = require('chalk')
var stripUrl = require('url-trim')
var now = require('right-now')
var levels = require('./levels')
var padLeft = require('pad-left')
var padRight = require('pad-right')
var prettyBytes = require('prettier-bytes')
var prettyMs = require('pretty-ms')
var paddings = {
method: 6,
statusCode: 3,
contentLength: 8,
elapsed: 7
}
var leftAligns = [ 'method' ]
var ansiStyles = Object.keys(chalk.styles)
var keys = [
'time',
'level',
'elapsed',
'contentLength',
'message',
'method',
'statusCode',
'url',
'type',
'name'
]
var startTime = now()
exports.isStyleObject = function (data) {
// skip false/undefined/etc
if (typeof data !== 'object' || !data) {
return false
}
// ensure we have something worth styling
return keys.some(function (key) {
return data.hasOwnProperty(key)
})
}
exports.renderError = function (data) {
var timeOff = String(Math.round((now() - startTime) / 1000) % 10000)
var line = '[' + padLeft(timeOff, 4, '0') + '] '
line += chalk['magenta']('(' + data.name + ')') + '\n'
line += chalk.red(data.err.stack) + '\n'
return line
}
exports.renderObject = function (data) {
var timeOff = String(Math.round((now() - startTime) / 1000) % 10000)
var line = ''
line += '[' + padLeft(timeOff, 4, '0') + '] '
line += levels.stringify(data.level)
line += chalk['magenta']('(' + data.name + ')') + '\n'
line += destructureMessage(data.message)
return line
}
exports.create = function (defaultName) {
return function render (data) {
var level = data.level
var name = data.name
// some default colors
var defaultColors = {
level: levels.color(level) || 'yellow',
name: 'magenta',
time: 'dim',
statusCode: data.statusCode >= 400 ? 'red' : 'green',
contentLength: 'dim',
elapsed: 'dim',
url: 'bold',
method: 'dim',
type: 'dim'
}
// possible user overrides
var colors = data.colors || {}
if (typeof data.message === 'object') {
data.message = destructureMessage(data.message)
}
// clean up the messages a little
if (level) {
data.level = levels.stringify(level)
}
if (name) {
data.name = name === defaultName ? '' : ('(' + name + ')')
}
if (data.url) data.url = stripUrl(data.url)
if (data.type) data.type = '(' + data.type + ')'
var line = []
var timeOff = String(Math.round((now() - startTime) / 1000) % 10000)
data.time = '[' + padLeft(timeOff, 4, '0') + ']'
if (!data.message) {
data.level = level = ''
}
var alignLeft = true
// render each of our valid keys
keys.forEach(function (key) {
var value = data[key]
// skip empty data
if (!value && typeof value !== 'number') {
return
}
// compact formatting
if (key === 'elapsed') value = fixElapsed(value)
if (key === 'contentLength') value = fixSize(value)
// pad to length
if (key in paddings) {
var left = alignLeft || leftAligns.indexOf(key) >= 0
var padFn = left ? padRight : padLeft
value = padFn.call(padFn, value, paddings[key], ' ')
alignLeft = false
}
// colorize chunk
var newColor = getColor(key, colors, defaultColors)
if (newColor) {
value = chalk[newColor](value)
}
line.push(value)
})
return line.join(' ')
}
}
function fixElapsed (time) {
if (typeof time === 'string' && /s$/i.test(time)) {
return time
}
if (/infinity/i.test(time)) return time
var ms = parseInt(time, 10)
return ms > 9999 ? prettyMs(ms) : (ms + 'ms')
}
function fixSize (size) {
if (typeof size === 'string' && /s$/i.test(size)) {
return size
}
if (/infinity/i.test(size)) return size
var bytes = parseInt(size, 10)
return bytes > 9999
? prettyBytes(bytes)
.replace(/ /, '')
: (bytes + 'B')
}
function getColor (key, colors, defaultColors) {
// try to apply user style
var newColor = colors[key]
// use default if style is invalid
if (ansiStyles.indexOf(newColor) === -1) {
newColor = null
}
return newColor || defaultColors[key]
}
// destructure a message onto an object if the message
// is an object.
// obj -> str
function destructureMessage (msg) {
const keys = Object.keys(msg)
var res = ''
for (var i = 0; i < keys.length; i++) {
var key = keys[i]
var val = msg[key]
if (i !== 0) res += '\n'
res += chalk.blue(' "' + key + '"')
res += ': '
res += chalk.green('"' + val + '"')
}
return res
}

View File

@ -0,0 +1,4 @@
'use strict';
module.exports = function () {
return /\u001b\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]/g;
};

View File

@ -0,0 +1,84 @@
{
"_from": "ansi-regex@^0.2.0",
"_id": "ansi-regex@0.2.1",
"_inBundle": false,
"_integrity": "sha1-DY6UaWej2BQ/k+JOKYUl/BsiNfk=",
"_location": "/garnish/ansi-regex",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "ansi-regex@^0.2.0",
"name": "ansi-regex",
"escapedName": "ansi-regex",
"rawSpec": "^0.2.0",
"saveSpec": null,
"fetchSpec": "^0.2.0"
},
"_requiredBy": [
"/garnish/has-ansi",
"/garnish/strip-ansi"
],
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz",
"_shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9",
"_spec": "ansi-regex@^0.2.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/garnish/node_modules/has-ansi",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/ansi-regex/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Regular expression for matching ANSI escape codes",
"devDependencies": {
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/ansi-regex#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern"
],
"license": "MIT",
"name": "ansi-regex",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/ansi-regex.git"
},
"scripts": {
"test": "mocha"
},
"version": "0.2.1"
}

View File

@ -0,0 +1,33 @@
# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex)
> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```sh
$ npm install --save ansi-regex
```
## Usage
```js
var ansiRegex = require('ansi-regex');
ansiRegex().test('\u001b[4mcake\u001b[0m');
//=> true
ansiRegex().test('cake');
//=> false
'\u001b[4mcake\u001b[0m'.match(ansiRegex());
//=> ['\u001b[4m', '\u001b[0m']
```
*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.*
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@ -0,0 +1,40 @@
'use strict';
var styles = module.exports;
var codes = {
reset: [0, 0],
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29],
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39],
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49]
};
Object.keys(codes).forEach(function (key) {
var val = codes[key];
var style = styles[key] = {};
style.open = '\u001b[' + val[0] + 'm';
style.close = '\u001b[' + val[1] + 'm';
});

View File

@ -0,0 +1,78 @@
{
"_from": "ansi-styles@^1.1.0",
"_id": "ansi-styles@1.1.0",
"_inBundle": false,
"_integrity": "sha1-6uy/Zs1waIJ2Cy9GkVgrj1XXp94=",
"_location": "/garnish/ansi-styles",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "ansi-styles@^1.1.0",
"name": "ansi-styles",
"escapedName": "ansi-styles",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/garnish/chalk"
],
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz",
"_shasum": "eaecbf66cd706882760b2f4691582b8f55d7a7de",
"_spec": "ansi-styles@^1.1.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/garnish/node_modules/chalk",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/ansi-styles/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "ANSI escape codes for styling strings in the terminal",
"devDependencies": {
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/ansi-styles#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"license": "MIT",
"name": "ansi-styles",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/ansi-styles.git"
},
"scripts": {
"test": "mocha"
},
"version": "1.1.0"
}

View File

@ -0,0 +1,70 @@
# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles)
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings.
![screenshot](screenshot.png)
## Install
```sh
$ npm install --save ansi-styles
```
## Usage
```js
var ansi = require('ansi-styles');
console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
```
## API
Each style has an `open` and `close` property.
## Styles
### General
- `reset`
- `bold`
- `dim`
- `italic` *(not widely supported)*
- `underline`
- `inverse`
- `hidden`
- `strikethrough` *(not widely supported)*
### Text colors
- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`
- `gray`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@ -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;
}

View File

@ -0,0 +1,92 @@
{
"_from": "chalk@^0.5.1",
"_id": "chalk@0.5.1",
"_inBundle": false,
"_integrity": "sha1-Zjs6ZItotV0EaQ1JFnqoN4WPIXQ=",
"_location": "/garnish/chalk",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "chalk@^0.5.1",
"name": "chalk",
"escapedName": "chalk",
"rawSpec": "^0.5.1",
"saveSpec": null,
"fetchSpec": "^0.5.1"
},
"_requiredBy": [
"/garnish"
],
"_resolved": "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz",
"_shasum": "663b3a648b68b55d04690d49167aa837858f2174",
"_spec": "chalk@^0.5.1",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/garnish",
"bugs": {
"url": "https://github.com/sindresorhus/chalk/issues"
},
"bundleDependencies": false,
"dependencies": {
"ansi-styles": "^1.1.0",
"escape-string-regexp": "^1.0.0",
"has-ansi": "^0.1.0",
"strip-ansi": "^0.3.0",
"supports-color": "^0.2.0"
},
"deprecated": false,
"description": "Terminal string styling done right. Created because the `colors` module does some really horrible things.",
"devDependencies": {
"matcha": "^0.5.0",
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/chalk#readme",
"keywords": [
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"ansi",
"styles",
"tty",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"license": "MIT",
"maintainers": [
{
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
{
"name": "Joshua Appelman",
"email": "joshua@jbna.nl"
}
],
"name": "chalk",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/chalk.git"
},
"scripts": {
"bench": "matcha benchmark.js",
"test": "mocha"
},
"version": "0.5.1"
}

View File

@ -0,0 +1,175 @@
# <img width="300" src="https://cdn.rawgit.com/sindresorhus/chalk/77ae94f63ab1ac61389b190e5a59866569d1a376/logo.svg" alt="chalk">
> Terminal string styling done right
[![Build Status](https://travis-ci.org/sindresorhus/chalk.svg?branch=master)](https://travis-ci.org/sindresorhus/chalk)
![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg)
[colors.js](https://github.com/Marak/colors.js) is currently the most popular string styling module, but it has serious deficiencies like extending String.prototype which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough.
**Chalk is a clean and focused alternative.**
![screenshot](https://github.com/sindresorhus/ansi-styles/raw/master/screenshot.png)
## Why
- Highly performant
- Doesn't extend String.prototype
- Expressive API
- Ability to nest styles
- Clean and focused
- Auto-detects color support
- Actively maintained
- [Used by 1000+ modules](https://npmjs.org/browse/depended/chalk)
## Install
```sh
$ npm install --save chalk
```
## Usage
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
```js
var chalk = require('chalk');
// style a string
console.log( chalk.blue('Hello world!') );
// combine styled and normal strings
console.log( chalk.blue('Hello'), 'World' + chalk.red('!') );
// compose multiple styles using the chainable API
console.log( chalk.blue.bgRed.bold('Hello world!') );
// pass in multiple arguments
console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') );
// nest styles
console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') );
// nest styles of the same type even (color, underline, background)
console.log( chalk.green('I am a green line ' + chalk.blue('with a blue substring') + ' that becomes green again!') );
```
Easily define your own themes.
```js
var chalk = require('chalk');
var error = chalk.bold.red;
console.log(error('Error!'));
```
Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data).
```js
var name = 'Sindre';
console.log(chalk.green('Hello %s'), name);
//=> Hello Sindre
```
## API
### chalk.`<style>[.<style>...](string, [string...])`
Example: `chalk.red.bold.underline('Hello', 'world');`
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter.
Multiple arguments will be separated by space.
### chalk.enabled
Color support is automatically detected, but you can override it.
### chalk.supportsColor
Detect whether the terminal [supports color](https://github.com/sindresorhus/supports-color).
Can be overridden by the user with the flags `--color` and `--no-color`.
Used internally and handled for you, but exposed for convenience.
### chalk.styles
Exposes the styles as [ANSI escape codes](https://github.com/sindresorhus/ansi-styles).
Generally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with yours.
```js
var chalk = require('chalk');
console.log(chalk.styles.red);
//=> {open: '\u001b[31m', close: '\u001b[39m'}
console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close);
```
### chalk.hasColor(string)
Check whether a string [has color](https://github.com/sindresorhus/has-ansi).
### chalk.stripColor(string)
[Strip color](https://github.com/sindresorhus/strip-ansi) from a string.
Can be useful in combination with `.supportsColor` to strip color on externally styled text when it's not supported.
Example:
```js
var chalk = require('chalk');
var styledString = getText();
if (!chalk.supportsColor) {
styledString = chalk.stripColor(styledString);
}
```
## Styles
### General
- `reset`
- `bold`
- `dim`
- `italic` *(not widely supported)*
- `underline`
- `inverse`
- `hidden`
- `strikethrough` *(not widely supported)*
### Text colors
- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`
- `gray`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@ -0,0 +1,53 @@
#!/usr/bin/env node
'use strict';
var pkg = require('./package.json');
var hasAnsi = require('./');
var input = process.argv[2];
function stdin(cb) {
var ret = '';
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (data) {
ret += data;
});
process.stdin.on('end', function () {
cb(ret);
});
}
function help() {
console.log([
pkg.description,
'',
'Usage',
' $ has-ansi <string>',
' $ echo <string> | has-ansi',
'',
'Exits with code 0 if input has ANSI escape codes and 1 if not'
].join('\n'));
}
function init(data) {
process.exit(hasAnsi(data) ? 0 : 1);
}
if (process.argv.indexOf('--help') !== -1) {
help();
return;
}
if (process.argv.indexOf('--version') !== -1) {
console.log(pkg.version);
return;
}
if (process.stdin.isTTY) {
if (!input) {
help();
return;
}
init(input);
} else {
stdin(init);
}

View File

@ -0,0 +1,4 @@
'use strict';
var ansiRegex = require('ansi-regex');
var re = new RegExp(ansiRegex().source); // remove the `g` flag
module.exports = re.test.bind(re);

View File

@ -0,0 +1,89 @@
{
"_from": "has-ansi@^0.1.0",
"_id": "has-ansi@0.1.0",
"_inBundle": false,
"_integrity": "sha1-hPJlqujA5qiKEtcCKJS3VoiUxi4=",
"_location": "/garnish/has-ansi",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "has-ansi@^0.1.0",
"name": "has-ansi",
"escapedName": "has-ansi",
"rawSpec": "^0.1.0",
"saveSpec": null,
"fetchSpec": "^0.1.0"
},
"_requiredBy": [
"/garnish/chalk"
],
"_resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz",
"_shasum": "84f265aae8c0e6a88a12d7022894b7568894c62e",
"_spec": "has-ansi@^0.1.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/garnish/node_modules/chalk",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bin": {
"has-ansi": "cli.js"
},
"bugs": {
"url": "https://github.com/sindresorhus/has-ansi/issues"
},
"bundleDependencies": false,
"dependencies": {
"ansi-regex": "^0.2.0"
},
"deprecated": false,
"description": "Check if a string has ANSI escape codes",
"devDependencies": {
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js",
"cli.js"
],
"homepage": "https://github.com/sindresorhus/has-ansi#readme",
"keywords": [
"cli",
"bin",
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"string",
"tty",
"escape",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern",
"has"
],
"license": "MIT",
"name": "has-ansi",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/has-ansi.git"
},
"scripts": {
"test": "mocha"
},
"version": "0.1.0"
}

View File

@ -0,0 +1,45 @@
# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi)
> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```sh
$ npm install --save has-ansi
```
## Usage
```js
var hasAnsi = require('has-ansi');
hasAnsi('\u001b[4mcake\u001b[0m');
//=> true
hasAnsi('cake');
//=> false
```
## CLI
```sh
$ npm install --global has-ansi
```
```
$ has-ansi --help
Usage
$ has-ansi <string>
$ echo <string> | has-ansi
Exits with code 0 if input has ANSI escape codes and 1 if not
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@ -0,0 +1,39 @@
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var pkg = require('./package.json');
var strip = require('./');
var input = process.argv[2];
function help() {
console.log([
pkg.description,
'',
'Usage',
' $ strip-ansi <input-file> > <output-file>',
' $ cat <input-file> | strip-ansi > <output-file>',
'',
'Example',
' $ strip-ansi unicorn.txt > unicorn-stripped.txt'
].join('\n'));
}
if (process.argv.indexOf('--help') !== -1) {
help();
return;
}
if (process.argv.indexOf('--version') !== -1) {
console.log(pkg.version);
return;
}
if (input) {
process.stdout.write(strip(fs.readFileSync(input, 'utf8')));
return;
}
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (data) {
process.stdout.write(strip(data));
});

View File

@ -0,0 +1,6 @@
'use strict';
var ansiRegex = require('ansi-regex')();
module.exports = function (str) {
return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
};

View File

@ -0,0 +1,88 @@
{
"_from": "strip-ansi@^0.3.0",
"_id": "strip-ansi@0.3.0",
"_inBundle": false,
"_integrity": "sha1-JfSOoiynkYfzF0pNuHWTR7sSYiA=",
"_location": "/garnish/strip-ansi",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "strip-ansi@^0.3.0",
"name": "strip-ansi",
"escapedName": "strip-ansi",
"rawSpec": "^0.3.0",
"saveSpec": null,
"fetchSpec": "^0.3.0"
},
"_requiredBy": [
"/garnish/chalk"
],
"_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz",
"_shasum": "25f48ea22ca79187f3174a4db8759347bb126220",
"_spec": "strip-ansi@^0.3.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/garnish/node_modules/chalk",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bin": {
"strip-ansi": "cli.js"
},
"bugs": {
"url": "https://github.com/sindresorhus/strip-ansi/issues"
},
"bundleDependencies": false,
"dependencies": {
"ansi-regex": "^0.2.1"
},
"deprecated": false,
"description": "Strip ANSI escape codes",
"devDependencies": {
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js",
"cli.js"
],
"homepage": "https://github.com/sindresorhus/strip-ansi#readme",
"keywords": [
"strip",
"trim",
"remove",
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"license": "MIT",
"name": "strip-ansi",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/strip-ansi.git"
},
"scripts": {
"test": "mocha"
},
"version": "0.3.0"
}

View File

@ -0,0 +1,43 @@
# strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi)
> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```sh
$ npm install --save strip-ansi
```
## Usage
```js
var stripAnsi = require('strip-ansi');
stripAnsi('\x1b[4mcake\x1b[0m');
//=> 'cake'
```
## CLI
```sh
$ npm install --global strip-ansi
```
```sh
$ strip-ansi --help
Usage
$ strip-ansi <input-file> > <output-file>
$ cat <input-file> | strip-ansi > <output-file>
Example
$ strip-ansi unicorn.txt > unicorn-stripped.txt
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@ -0,0 +1,28 @@
#!/usr/bin/env node
'use strict';
var pkg = require('./package.json');
var supportsColor = require('./');
var input = process.argv[2];
function help() {
console.log([
pkg.description,
'',
'Usage',
' $ supports-color',
'',
'Exits with code 0 if color is supported and 1 if not'
].join('\n'));
}
if (!input || process.argv.indexOf('--help') !== -1) {
help();
return;
}
if (process.argv.indexOf('--version') !== -1) {
console.log(pkg.version);
return;
}
process.exit(supportsColor ? 0 : 1);

View File

@ -0,0 +1,32 @@
'use strict';
module.exports = (function () {
if (process.argv.indexOf('--no-color') !== -1) {
return false;
}
if (process.argv.indexOf('--color') !== -1) {
return true;
}
if (process.stdout && !process.stdout.isTTY) {
return false;
}
if (process.platform === 'win32') {
return true;
}
if ('COLORTERM' in process.env) {
return true;
}
if (process.env.TERM === 'dumb') {
return false;
}
if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
return true;
}
return false;
})();

View File

@ -0,0 +1,82 @@
{
"_from": "supports-color@^0.2.0",
"_id": "supports-color@0.2.0",
"_inBundle": false,
"_integrity": "sha1-2S3iaU6z9nMjlz1649i1W0wiGQo=",
"_location": "/garnish/supports-color",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "supports-color@^0.2.0",
"name": "supports-color",
"escapedName": "supports-color",
"rawSpec": "^0.2.0",
"saveSpec": null,
"fetchSpec": "^0.2.0"
},
"_requiredBy": [
"/garnish/chalk"
],
"_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz",
"_shasum": "d92de2694eb3f67323973d7ae3d8b55b4c22190a",
"_spec": "supports-color@^0.2.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/garnish/node_modules/chalk",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bin": {
"supports-color": "cli.js"
},
"bugs": {
"url": "https://github.com/sindresorhus/supports-color/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Detect whether a terminal supports color",
"devDependencies": {
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js",
"cli.js"
],
"homepage": "https://github.com/sindresorhus/supports-color#readme",
"keywords": [
"cli",
"bin",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"ansi",
"styles",
"tty",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"support",
"supports",
"capability",
"detect"
],
"license": "MIT",
"name": "supports-color",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/supports-color.git"
},
"scripts": {
"test": "mocha"
},
"version": "0.2.0"
}

View File

@ -0,0 +1,44 @@
# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color)
> Detect whether a terminal supports color
## Install
```sh
$ npm install --save supports-color
```
## Usage
```js
var supportsColor = require('supports-color');
if (supportsColor) {
console.log('Terminal supports color');
}
```
It obeys the `--color` and `--no-color` CLI flags.
## CLI
```sh
$ npm install --global supports-color
```
```sh
$ supports-color --help
Usage
$ supports-color
# Exits with code 0 if color is supported and 1 if not
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

88
static/js/ketcher2/node_modules/garnish/package.json generated vendored Normal file
View File

@ -0,0 +1,88 @@
{
"_from": "garnish@^5.0.0",
"_id": "garnish@5.2.0",
"_inBundle": false,
"_integrity": "sha1-vtQ2WTguSxmOM8eTiXvnxwHmVXc=",
"_location": "/garnish",
"_phantomChildren": {
"escape-string-regexp": "1.0.5"
},
"_requested": {
"type": "range",
"registry": true,
"raw": "garnish@^5.0.0",
"name": "garnish",
"escapedName": "garnish",
"rawSpec": "^5.0.0",
"saveSpec": null,
"fetchSpec": "^5.0.0"
},
"_requiredBy": [
"/budo"
],
"_resolved": "https://registry.npmjs.org/garnish/-/garnish-5.2.0.tgz",
"_shasum": "bed43659382e4b198e33c793897be7c701e65577",
"_spec": "garnish@^5.0.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/budo",
"author": {
"name": "Matt DesLauriers",
"email": "dave.des@gmail.com",
"url": "https://github.com/mattdesl"
},
"bin": {
"garnish": "./bin/cmd.js"
},
"bugs": {
"url": "https://github.com/mattdesl/garnish/issues"
},
"bundleDependencies": false,
"dependencies": {
"chalk": "^0.5.1",
"minimist": "^1.1.0",
"pad-left": "^2.0.0",
"pad-right": "^0.2.2",
"prettier-bytes": "^1.0.3",
"pretty-ms": "^2.1.0",
"right-now": "^1.0.0",
"split2": "^0.2.1",
"stdout-stream": "^1.4.0",
"url-trim": "^1.0.0"
},
"deprecated": false,
"description": "prettifies ndjson from wzrd and similar tools",
"devDependencies": {
"browserify": "^8.1.3",
"standard": "^4.5.4",
"strip-ansi": "^2.0.1",
"tape": "^3.5.0",
"wzrd": "^1.2.1"
},
"homepage": "https://github.com/mattdesl/garnish",
"keywords": [
"prettify",
"pretty",
"print",
"pretty-print",
"ndjson",
"bundle",
"bundler",
"browserify",
"wzrd",
"beefy",
"wizz"
],
"license": "MIT",
"main": "index.js",
"name": "garnish",
"repository": {
"type": "git",
"url": "git://github.com/mattdesl/garnish.git"
},
"scripts": {
"demo": "node test/app.js | ./bin/cmd.js",
"start": "node test/server.js",
"test": "standard && node test/test.js",
"wzrd": "wzrd test/demo.js | ./bin/cmd.js"
},
"version": "5.2.0"
}