@tinkoff-react-bui/checkbox-boxed 0.0.1-security → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of @tinkoff-react-bui/checkbox-boxed might be problematic. Click here for more details.

@@ -0,0 +1,202 @@
1
+
2
+ /**
3
+ * This is the common logic for both the Node.js and web browser
4
+ * implementations of `debug()`.
5
+ *
6
+ * Expose `debug()` as the module.
7
+ */
8
+
9
+ exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
10
+ exports.coerce = coerce;
11
+ exports.disable = disable;
12
+ exports.enable = enable;
13
+ exports.enabled = enabled;
14
+ exports.humanize = require('ms');
15
+
16
+ /**
17
+ * The currently active debug mode names, and names to skip.
18
+ */
19
+
20
+ exports.names = [];
21
+ exports.skips = [];
22
+
23
+ /**
24
+ * Map of special "%n" handling functions, for the debug "format" argument.
25
+ *
26
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
27
+ */
28
+
29
+ exports.formatters = {};
30
+
31
+ /**
32
+ * Previous log timestamp.
33
+ */
34
+
35
+ var prevTime;
36
+
37
+ /**
38
+ * Select a color.
39
+ * @param {String} namespace
40
+ * @return {Number}
41
+ * @api private
42
+ */
43
+
44
+ function selectColor(namespace) {
45
+ var hash = 0, i;
46
+
47
+ for (i in namespace) {
48
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
49
+ hash |= 0; // Convert to 32bit integer
50
+ }
51
+
52
+ return exports.colors[Math.abs(hash) % exports.colors.length];
53
+ }
54
+
55
+ /**
56
+ * Create a debugger with the given `namespace`.
57
+ *
58
+ * @param {String} namespace
59
+ * @return {Function}
60
+ * @api public
61
+ */
62
+
63
+ function createDebug(namespace) {
64
+
65
+ function debug() {
66
+ // disabled?
67
+ if (!debug.enabled) return;
68
+
69
+ var self = debug;
70
+
71
+ // set `diff` timestamp
72
+ var curr = +new Date();
73
+ var ms = curr - (prevTime || curr);
74
+ self.diff = ms;
75
+ self.prev = prevTime;
76
+ self.curr = curr;
77
+ prevTime = curr;
78
+
79
+ // turn the `arguments` into a proper Array
80
+ var args = new Array(arguments.length);
81
+ for (var i = 0; i < args.length; i++) {
82
+ args[i] = arguments[i];
83
+ }
84
+
85
+ args[0] = exports.coerce(args[0]);
86
+
87
+ if ('string' !== typeof args[0]) {
88
+ // anything else let's inspect with %O
89
+ args.unshift('%O');
90
+ }
91
+
92
+ // apply any `formatters` transformations
93
+ var index = 0;
94
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
95
+ // if we encounter an escaped % then don't increase the array index
96
+ if (match === '%%') return match;
97
+ index++;
98
+ var formatter = exports.formatters[format];
99
+ if ('function' === typeof formatter) {
100
+ var val = args[index];
101
+ match = formatter.call(self, val);
102
+
103
+ // now we need to remove `args[index]` since it's inlined in the `format`
104
+ args.splice(index, 1);
105
+ index--;
106
+ }
107
+ return match;
108
+ });
109
+
110
+ // apply env-specific formatting (colors, etc.)
111
+ exports.formatArgs.call(self, args);
112
+
113
+ var logFn = debug.log || exports.log || console.log.bind(console);
114
+ logFn.apply(self, args);
115
+ }
116
+
117
+ debug.namespace = namespace;
118
+ debug.enabled = exports.enabled(namespace);
119
+ debug.useColors = exports.useColors();
120
+ debug.color = selectColor(namespace);
121
+
122
+ // env-specific initialization logic for debug instances
123
+ if ('function' === typeof exports.init) {
124
+ exports.init(debug);
125
+ }
126
+
127
+ return debug;
128
+ }
129
+
130
+ /**
131
+ * Enables a debug mode by namespaces. This can include modes
132
+ * separated by a colon and wildcards.
133
+ *
134
+ * @param {String} namespaces
135
+ * @api public
136
+ */
137
+
138
+ function enable(namespaces) {
139
+ exports.save(namespaces);
140
+
141
+ exports.names = [];
142
+ exports.skips = [];
143
+
144
+ var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
145
+ var len = split.length;
146
+
147
+ for (var i = 0; i < len; i++) {
148
+ if (!split[i]) continue; // ignore empty strings
149
+ namespaces = split[i].replace(/\*/g, '.*?');
150
+ if (namespaces[0] === '-') {
151
+ exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
152
+ } else {
153
+ exports.names.push(new RegExp('^' + namespaces + '$'));
154
+ }
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Disable debug output.
160
+ *
161
+ * @api public
162
+ */
163
+
164
+ function disable() {
165
+ exports.enable('');
166
+ }
167
+
168
+ /**
169
+ * Returns true if the given mode name is enabled, false otherwise.
170
+ *
171
+ * @param {String} name
172
+ * @return {Boolean}
173
+ * @api public
174
+ */
175
+
176
+ function enabled(name) {
177
+ var i, len;
178
+ for (i = 0, len = exports.skips.length; i < len; i++) {
179
+ if (exports.skips[i].test(name)) {
180
+ return false;
181
+ }
182
+ }
183
+ for (i = 0, len = exports.names.length; i < len; i++) {
184
+ if (exports.names[i].test(name)) {
185
+ return true;
186
+ }
187
+ }
188
+ return false;
189
+ }
190
+
191
+ /**
192
+ * Coerce `val`.
193
+ *
194
+ * @param {Mixed} val
195
+ * @return {Mixed}
196
+ * @api private
197
+ */
198
+
199
+ function coerce(val) {
200
+ if (val instanceof Error) return val.stack || val.message;
201
+ return val;
202
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Detect Electron renderer process, which is node, but we should
3
+ * treat as a browser.
4
+ */
5
+
6
+ if (typeof process !== 'undefined' && process.type === 'renderer') {
7
+ module.exports = require('./browser.js');
8
+ } else {
9
+ module.exports = require('./node.js');
10
+ }
@@ -0,0 +1,15 @@
1
+ module.exports = inspectorLog;
2
+
3
+ // black hole
4
+ const nullStream = new (require('stream').Writable)();
5
+ nullStream._write = () => {};
6
+
7
+ /**
8
+ * Outputs a `console.log()` to the Node.js Inspector console *only*.
9
+ */
10
+ function inspectorLog() {
11
+ const stdout = console._stdout;
12
+ console._stdout = nullStream;
13
+ console.log.apply(console, arguments);
14
+ console._stdout = stdout;
15
+ }
@@ -0,0 +1,248 @@
1
+ /**
2
+ * Module dependencies.
3
+ */
4
+
5
+ var tty = require('tty');
6
+ var util = require('util');
7
+
8
+ /**
9
+ * This is the Node.js implementation of `debug()`.
10
+ *
11
+ * Expose `debug()` as the module.
12
+ */
13
+
14
+ exports = module.exports = require('./debug');
15
+ exports.init = init;
16
+ exports.log = log;
17
+ exports.formatArgs = formatArgs;
18
+ exports.save = save;
19
+ exports.load = load;
20
+ exports.useColors = useColors;
21
+
22
+ /**
23
+ * Colors.
24
+ */
25
+
26
+ exports.colors = [6, 2, 3, 4, 5, 1];
27
+
28
+ /**
29
+ * Build up the default `inspectOpts` object from the environment variables.
30
+ *
31
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
32
+ */
33
+
34
+ exports.inspectOpts = Object.keys(process.env).filter(function (key) {
35
+ return /^debug_/i.test(key);
36
+ }).reduce(function (obj, key) {
37
+ // camel-case
38
+ var prop = key
39
+ .substring(6)
40
+ .toLowerCase()
41
+ .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
42
+
43
+ // coerce string value into JS value
44
+ var val = process.env[key];
45
+ if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
46
+ else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
47
+ else if (val === 'null') val = null;
48
+ else val = Number(val);
49
+
50
+ obj[prop] = val;
51
+ return obj;
52
+ }, {});
53
+
54
+ /**
55
+ * The file descriptor to write the `debug()` calls to.
56
+ * Set the `DEBUG_FD` env variable to override with another value. i.e.:
57
+ *
58
+ * $ DEBUG_FD=3 node script.js 3>debug.log
59
+ */
60
+
61
+ var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
62
+
63
+ if (1 !== fd && 2 !== fd) {
64
+ util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')()
65
+ }
66
+
67
+ var stream = 1 === fd ? process.stdout :
68
+ 2 === fd ? process.stderr :
69
+ createWritableStdioStream(fd);
70
+
71
+ /**
72
+ * Is stdout a TTY? Colored output is enabled when `true`.
73
+ */
74
+
75
+ function useColors() {
76
+ return 'colors' in exports.inspectOpts
77
+ ? Boolean(exports.inspectOpts.colors)
78
+ : tty.isatty(fd);
79
+ }
80
+
81
+ /**
82
+ * Map %o to `util.inspect()`, all on a single line.
83
+ */
84
+
85
+ exports.formatters.o = function(v) {
86
+ this.inspectOpts.colors = this.useColors;
87
+ return util.inspect(v, this.inspectOpts)
88
+ .split('\n').map(function(str) {
89
+ return str.trim()
90
+ }).join(' ');
91
+ };
92
+
93
+ /**
94
+ * Map %o to `util.inspect()`, allowing multiple lines if needed.
95
+ */
96
+
97
+ exports.formatters.O = function(v) {
98
+ this.inspectOpts.colors = this.useColors;
99
+ return util.inspect(v, this.inspectOpts);
100
+ };
101
+
102
+ /**
103
+ * Adds ANSI color escape codes if enabled.
104
+ *
105
+ * @api public
106
+ */
107
+
108
+ function formatArgs(args) {
109
+ var name = this.namespace;
110
+ var useColors = this.useColors;
111
+
112
+ if (useColors) {
113
+ var c = this.color;
114
+ var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
115
+
116
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
117
+ args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
118
+ } else {
119
+ args[0] = new Date().toUTCString()
120
+ + ' ' + name + ' ' + args[0];
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Invokes `util.format()` with the specified arguments and writes to `stream`.
126
+ */
127
+
128
+ function log() {
129
+ return stream.write(util.format.apply(util, arguments) + '\n');
130
+ }
131
+
132
+ /**
133
+ * Save `namespaces`.
134
+ *
135
+ * @param {String} namespaces
136
+ * @api private
137
+ */
138
+
139
+ function save(namespaces) {
140
+ if (null == namespaces) {
141
+ // If you set a process.env field to null or undefined, it gets cast to the
142
+ // string 'null' or 'undefined'. Just delete instead.
143
+ delete process.env.DEBUG;
144
+ } else {
145
+ process.env.DEBUG = namespaces;
146
+ }
147
+ }
148
+
149
+ /**
150
+ * Load `namespaces`.
151
+ *
152
+ * @return {String} returns the previously persisted debug modes
153
+ * @api private
154
+ */
155
+
156
+ function load() {
157
+ return process.env.DEBUG;
158
+ }
159
+
160
+ /**
161
+ * Copied from `node/src/node.js`.
162
+ *
163
+ * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
164
+ * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
165
+ */
166
+
167
+ function createWritableStdioStream (fd) {
168
+ var stream;
169
+ var tty_wrap = process.binding('tty_wrap');
170
+
171
+ // Note stream._type is used for test-module-load-list.js
172
+
173
+ switch (tty_wrap.guessHandleType(fd)) {
174
+ case 'TTY':
175
+ stream = new tty.WriteStream(fd);
176
+ stream._type = 'tty';
177
+
178
+ // Hack to have stream not keep the event loop alive.
179
+ // See https://github.com/joyent/node/issues/1726
180
+ if (stream._handle && stream._handle.unref) {
181
+ stream._handle.unref();
182
+ }
183
+ break;
184
+
185
+ case 'FILE':
186
+ var fs = require('fs');
187
+ stream = new fs.SyncWriteStream(fd, { autoClose: false });
188
+ stream._type = 'fs';
189
+ break;
190
+
191
+ case 'PIPE':
192
+ case 'TCP':
193
+ var net = require('net');
194
+ stream = new net.Socket({
195
+ fd: fd,
196
+ readable: false,
197
+ writable: true
198
+ });
199
+
200
+ // FIXME Should probably have an option in net.Socket to create a
201
+ // stream from an existing fd which is writable only. But for now
202
+ // we'll just add this hack and set the `readable` member to false.
203
+ // Test: ./node test/fixtures/echo.js < /etc/passwd
204
+ stream.readable = false;
205
+ stream.read = null;
206
+ stream._type = 'pipe';
207
+
208
+ // FIXME Hack to have stream not keep the event loop alive.
209
+ // See https://github.com/joyent/node/issues/1726
210
+ if (stream._handle && stream._handle.unref) {
211
+ stream._handle.unref();
212
+ }
213
+ break;
214
+
215
+ default:
216
+ // Probably an error on in uv_guess_handle()
217
+ throw new Error('Implement me. Unknown stream file type!');
218
+ }
219
+
220
+ // For supporting legacy API we put the FD here.
221
+ stream.fd = fd;
222
+
223
+ stream._isStdio = true;
224
+
225
+ return stream;
226
+ }
227
+
228
+ /**
229
+ * Init logic for `debug` instances.
230
+ *
231
+ * Create a new `inspectOpts` object in case `useColors` is set
232
+ * differently for a particular `debug` instance.
233
+ */
234
+
235
+ function init (debug) {
236
+ debug.inspectOpts = {};
237
+
238
+ var keys = Object.keys(exports.inspectOpts);
239
+ for (var i = 0; i < keys.length; i++) {
240
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Enable namespaces listed in `process.env.DEBUG` initially.
246
+ */
247
+
248
+ exports.enable(load());
package/lib/express.js ADDED
@@ -0,0 +1,116 @@
1
+ /*!
2
+ * express
3
+ * Copyright(c) 2009-2013 TJ Holowaychuk
4
+ * Copyright(c) 2013 Roman Shtylman
5
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
6
+ * MIT Licensed
7
+ */
8
+
9
+ 'use strict';
10
+
11
+ /**
12
+ * Module dependencies.
13
+ */
14
+
15
+ var bodyParser = require('body-parser')
16
+ var EventEmitter = require('events').EventEmitter;
17
+ var mixin = require('merge-descriptors');
18
+ var proto = require('./application');
19
+ var Route = require('./router/route');
20
+ var Router = require('./router');
21
+ var req = require('./request');
22
+ var res = require('./response');
23
+
24
+ /**
25
+ * Expose `createApplication()`.
26
+ */
27
+
28
+ exports = module.exports = createApplication;
29
+
30
+ /**
31
+ * Create an express application.
32
+ *
33
+ * @return {Function}
34
+ * @api public
35
+ */
36
+
37
+ function createApplication() {
38
+ var app = function(req, res, next) {
39
+ app.handle(req, res, next);
40
+ };
41
+
42
+ mixin(app, EventEmitter.prototype, false);
43
+ mixin(app, proto, false);
44
+
45
+ // expose the prototype that will get set on requests
46
+ app.request = Object.create(req, {
47
+ app: { configurable: true, enumerable: true, writable: true, value: app }
48
+ })
49
+
50
+ // expose the prototype that will get set on responses
51
+ app.response = Object.create(res, {
52
+ app: { configurable: true, enumerable: true, writable: true, value: app }
53
+ })
54
+
55
+ app.init();
56
+ return app;
57
+ }
58
+
59
+ /**
60
+ * Expose the prototypes.
61
+ */
62
+
63
+ exports.application = proto;
64
+ exports.request = req;
65
+ exports.response = res;
66
+
67
+ /**
68
+ * Expose constructors.
69
+ */
70
+
71
+ exports.Route = Route;
72
+ exports.Router = Router;
73
+
74
+ /**
75
+ * Expose middleware
76
+ */
77
+
78
+ exports.json = bodyParser.json
79
+ exports.query = require('./middleware/query');
80
+ exports.raw = bodyParser.raw
81
+ exports.static = require('serve-static');
82
+ exports.text = bodyParser.text
83
+ exports.urlencoded = bodyParser.urlencoded
84
+
85
+ /**
86
+ * Replace removed middleware with an appropriate error message.
87
+ */
88
+
89
+ var removedMiddlewares = [
90
+ 'bodyParser',
91
+ 'compress',
92
+ 'cookieSession',
93
+ 'session',
94
+ 'logger',
95
+ 'cookieParser',
96
+ 'favicon',
97
+ 'responseTime',
98
+ 'errorHandler',
99
+ 'timeout',
100
+ 'methodOverride',
101
+ 'vhost',
102
+ 'csrf',
103
+ 'directory',
104
+ 'limit',
105
+ 'multipart',
106
+ 'staticCache'
107
+ ]
108
+
109
+ removedMiddlewares.forEach(function (name) {
110
+ Object.defineProperty(exports, name, {
111
+ get: function () {
112
+ throw new Error('Most middleware (like ' + name + ') is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.');
113
+ },
114
+ configurable: true
115
+ });
116
+ });