diff --git a/.gitattributes b/.gitattributes index 5748aa10a648fc8e9419ef6c8676497dc2a024b8..9bf0a11d551acaf6e3fe67b1c2644dc81d9fc394 100644 --- a/.gitattributes +++ b/.gitattributes @@ -37,3 +37,5 @@ sample_data/mnist_test.csv filter=lfs diff=lfs merge=lfs -text sample_data/mnist_train_small.csv filter=lfs diff=lfs merge=lfs -text updated_data.csv filter=lfs diff=lfs merge=lfs -text updated_data_train.csv filter=lfs diff=lfs merge=lfs -text +datalab/web/node_modules/dtrace-provider/build/node_gyp_bins/python3 filter=lfs diff=lfs merge=lfs -text +datalab/web/node_modules/node-pty/build/node_gyp_bins/python3 filter=lfs diff=lfs merge=lfs -text diff --git a/datalab/run.sh b/datalab/run.sh new file mode 100644 index 0000000000000000000000000000000000000000..32979a67d86452ab97074a4c7c182b3b474eb944 --- /dev/null +++ b/datalab/run.sh @@ -0,0 +1,75 @@ +#!/bin/bash -e + +# Copyright 2017 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# At least one GPU is considered available iff COLAB_GPU=1. +export COLAB_GPU="$([[ -c /dev/nvidiactl ]] && echo 1)" + +/usr/local/colab/bin/oom_monitor.sh & + +# Start the Colab proxy to the Jupyter kernel manager. +# TODO(b/267667580): Evaluate use of tcmalloc here and possibly other places. +( while true; do + GCE_METADATA_HOST="${VM_GCE_METADATA_HOST}" \ + LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4' \ + /usr/colab/bin/kernel_manager_proxy \ + --listen_port="${KMP_LISTEN_PORT}" \ + --target_port="${KMP_TARGET_PORT}" \ + ${KMP_EXTRA_ARGS} || true + sleep 1 +done & ) + +# Start fresh to isolate user-initiated actions from VM build & startup events. +for f in /var/log/apt/history.log /var/log/pip.log; do + mv "$f" "${f}.bak-run.sh" 2>/dev/null || true # Ignore missing files. +done + +# Warm disk buffers for modules we need for kernel startup. (cf: b/116536906) +if [[ "${COLAB_WARMUP_DEFAULTS}" == "1" ]]; then + python3 -c "import google.colab._kernel" + python3 -c "import matplotlib" + # importing tensorflow on a TPU VM causes the process to acquire the TPU for + # the duration of the import. This makes the TPU effectively unacquirable for + # the duration of the warmup, which can break things like probers. + if [[ "${COLAB_TPU_1VM}" == "1" ]]; then + python3 -c "import tensorflow" + else + python3 -c "import tensorflow" & + fi +fi + +# Start the server to handle /files and /api/contents requests. +/usr/local/bin/colab-fileshim.py ${COLAB_FILESHIM_EXTRA_ARGS} & + +# Link NVidia tools from a read-only volume mount. +for f in $(ls /opt/bin/.nvidia 2>/dev/null); do + ln -st /opt/bin "/opt/bin/.nvidia/${f}" + ln -st /usr/bin "/opt/bin/.nvidia/${f}" +done + +cd / + +# Start the node server. +if [[ "${COLAB_HUMAN_READABLE_NODE_LOGS}" == "1" ]]; then + PIPE=/tmp/.node.out + if ! [[ -p "${PIPE}" ]]; then + mkfifo "${PIPE}" + fi + /datalab/web/node_modules/bunyan/bin/bunyan \ + -l "${COLAB_NODE_LOG_LEVEL:-info}" < "${PIPE}" & + exec >& "${PIPE}" +fi +exec /tools/node/bin/node /datalab/web/app.js + diff --git a/datalab/web/app.js b/datalab/web/app.js new file mode 100644 index 0000000000000000000000000000000000000000..7e721bc920243ab709ab7a4ed039f9577889180c --- /dev/null +++ b/datalab/web/app.js @@ -0,0 +1,78 @@ +"use strict"; +/* + * Copyright 2015 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +var fs = require("fs"); +var path = require("path"); +var appSettings_1 = require("./appSettings"); +var logging = require("./logging"); +var server = require("./server"); +/** + * Loads the configuration settings for the application to use. + * On first run, this generates any dynamic settings and merges them into the + * settings result. + * @return the settings object for the application to use. + */ +function loadAppSettings() { + var settingsPath = path.join(__dirname, 'config', 'settings.json'); + if (!fs.existsSync(settingsPath)) { + var msg = "App settings file \"".concat(settingsPath, "\" not found."); + console.error(msg); + throw new Error(msg); + } + try { + var settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8') || '{}'); + (0, appSettings_1.applyEnvironmentVariables)(settings); + return settings; + } + catch (e) { + console.error(e); + throw new Error("Error parsing settings overrides: ".concat(e)); + } +} +/** + * Load the configuration settings, and then start the server, which + * runs indefinitely, listening to and processing incoming HTTP requests. + */ +var appSettings = loadAppSettings(); +if (appSettings != null) { + logging.initializeLoggers(appSettings); + logging.getLogger().info('app: starting with settings: %s', JSON.stringify(appSettings)); + server.run(appSettings); +} +/** + * Handle shutdown of this process, to also stop the server, which will in turn + * stop the associated Jupyter server process. + */ +function exit() { + logging.getLogger().info('app: exit'); + server.stop(); + logging.getLogger().info('app: exit: stopped'); + process.exit(0); +} +/** + * Handle uncaught exceptions to log them. + */ +function errorHandler(e) { + console.error(e.stack); + logging.getLogger().error(e, 'Unhandled exception'); + process.exit(1); +} +process.on('uncaughtException', errorHandler); +process.on('exit', exit); +process.on('SIGINT', exit); +process.on('SIGTERM', exit); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vdGhpcmRfcGFydHkvY29sYWIvc291cmNlcy9hcHAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7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gIHByb2Nlc3MuZXhpdCgwKTtcbn1cblxuLyoqXG4gKiBIYW5kbGUgdW5jYXVnaHQgZXhjZXB0aW9ucyB0byBsb2cgdGhlbS5cbiAqL1xuZnVuY3Rpb24gZXJyb3JIYW5kbGVyKGU6IEVycm9yKTogdm9pZCB7XG4gIGNvbnNvbGUuZXJyb3IoZS5zdGFjayk7XG5cbiAgbG9nZ2luZy5nZXRMb2dnZXIoKS5lcnJvcihlLCAnVW5oYW5kbGVkIGV4Y2VwdGlvbicpO1xuICBwcm9jZXNzLmV4aXQoMSk7XG59XG5cbnByb2Nlc3Mub24oJ3VuY2F1Z2h0RXhjZXB0aW9uJywgZXJyb3JIYW5kbGVyKTtcbnByb2Nlc3Mub24oJ2V4aXQnLCBleGl0KTtcbnByb2Nlc3Mub24oJ1NJR0lOVCcsIGV4aXQpO1xucHJvY2Vzcy5vbignU0lHVEVSTScsIGV4aXQpO1xuIl19 \ No newline at end of file diff --git a/datalab/web/appSettings.js b/datalab/web/appSettings.js new file mode 100644 index 0000000000000000000000000000000000000000..520284d539de6e128ba8833845710b3fd891048a --- /dev/null +++ b/datalab/web/appSettings.js @@ -0,0 +1,144 @@ +"use strict"; +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.applyEnvironmentVariables = applyEnvironmentVariables; +var environmentVariables = { + 'COLAB_ROOT_REDIRECT': function (settings, value) { + settings.colabRedirect = value; + }, + 'COLAB_SERVER_PORT': function (settings, value) { + settings.serverPort = Number(value); + }, + 'COLAB_LANGUAGE_SERVER_PROXY': function (settings, value) { + settings.languageServerProxy = value; + }, + 'COLAB_SERVER_HOST': function (settings, value) { + settings.serverHost = value; + }, + 'COLAB_NEXT_JUPYTER_PORT': function (settings, value) { + settings.nextJupyterPort = Number(value); + }, + 'COLAB_DEBUG_ADAPTER_MUX_PATH': function (settings, value) { + settings.debugAdapterMultiplexerPath = value; + }, + 'COLAB_DATALAB_ROOT': function (settings, value) { + settings.datalabRoot = value; + }, + 'COLAB_KERNEL_MANAGER_PROXY_PORT': function (settings, value) { + settings.kernelManagerProxyPort = Number(value); + }, + 'COLAB_KERNEL_MANAGER_PROXY_HOST': function (settings, value) { + settings.kernelManagerProxyHost = value; + }, + 'COLAB_LANGUAGE_SERVER_PROXY_LSP_DIRS': function (settings, value) { + settings.languageServerProxyArgs = settings.languageServerProxyArgs || []; + settings.languageServerProxyArgs.push("--lsp_search_dirs=".concat(value)); + }, + 'COLAB_LANGUAGE_SERVER_PROXY_ROOT_URL': function (settings, value) { + settings.languageServerProxyArgs = settings.languageServerProxyArgs || []; + settings.languageServerProxyArgs.push("--language_services_request_root_url=".concat(value)); + }, + 'COLAB_LANGUAGE_SERVER_PROXY_REQUEST_TIMEOUT': function (settings, value) { + settings.languageServerProxyArgs = settings.languageServerProxyArgs || []; + settings.languageServerProxyArgs.push("--language_services_request_timeout=".concat(value)); + }, + 'COLAB_JUPYTER_ALLOW_ORIGIN_PAT': function (settings, value) { + settings.jupyterArgs = settings.jupyterArgs || []; + settings.jupyterArgs.push("--NotebookApp.allow_origin_pat=\"".concat(value, "\"")); + settings.jupyterArgs.push("--NotebookApp.allow_origin="); + settings.jupyterArgs.push("--NotebookApp.allow_credentials=True"); + }, + 'COLAB_JUPYTER_DEBUG': function (settings) { + settings.jupyterArgs = settings.jupyterArgs || []; + settings.jupyterArgs.push("--debug"); + }, + 'COLAB_JUPYTER_TRANSPORT': function (settings, value) { + settings.jupyterArgs = settings.jupyterArgs || []; + settings.jupyterArgs.push("--transport=\"".concat(value, "\"")); + }, + 'COLAB_JUPYTER_IP': function (settings, value) { + settings.jupyterArgs = settings.jupyterArgs || []; + settings.jupyterArgs.push("--ip=".concat(value)); + }, + 'COLAB_GATEWAY_CLIENT_URL': function (settings, value) { + settings.jupyterArgs = settings.jupyterArgs || []; + settings.jupyterArgs.push("--GatewayClient.url=".concat(value)); + }, + 'COLAB_JUPYTER_ALLOW_REMOTE_ACCESS': function (settings, value) { + settings.jupyterArgs = settings.jupyterArgs || []; + settings.jupyterArgs.push("--NotebookApp.allow_remote_access=".concat(value)); + }, + 'COLAB_JUPYTER_TOKEN': function (settings, value) { + settings.jupyterArgs = settings.jupyterArgs || []; + settings.jupyterArgs.push("--NotebookApp.token=".concat(value)); + }, + 'COLAB_JUPYTER_DISABLE_CHECK_XSRF': function (settings, value) { + settings.jupyterArgs = settings.jupyterArgs || []; + settings.jupyterArgs.push("--NotebookApp.disable_check_xsrf=".concat(value)); + }, + 'COLAB_FILE_HANDLER_ADDR': function (settings, value) { + settings.fileHandlerAddr = value; + }, +}; +/** Applies any environment variable overrides. */ +function applyEnvironmentVariables(settings) { + var e_1, _a; + try { + for (var _b = __values(Object.entries(environmentVariables)), _c = _b.next(); !_c.done; _c = _b.next()) { + var _d = __read(_c.value, 2), key = _d[0], apply = _d[1]; + var override = process.env[key]; + if (override !== undefined) { + apply(settings, override); + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwU2V0dGluZ3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi90aGlyZF9wYXJ0eS9jb2xhYi9zb3VyY2VzL2FwcFNldHRpbmdzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7R0FjRzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFzS0gsOERBT0M7QUE5RkQsSUFBTSxvQkFBb0IsR0FBRztJQUMzQixxQkFBcUIsRUFBRSxVQUFDLFFBQXFCLEVBQUUsS0FBYTtRQUMxRCxRQUFRLENBQUMsYUFBYSxHQUFHLEtBQUssQ0FBQztJQUNqQyxDQUFDO0lBQ0QsbUJBQW1CLEVBQUUsVUFBQyxRQUFxQixFQUFFLEtBQWE7UUFDeEQsUUFBUSxDQUFDLFVBQVUsR0FBRyxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUM7SUFDdEMsQ0FBQztJQUNELDZCQUE2QixFQUFFLFVBQUMsUUFBcUIsRUFBRSxLQUFhO1FBQ2xFLFFBQVEsQ0FBQyxtQkFBbUIsR0FBRyxLQUFLLENBQUM7SUFDdkMsQ0FBQztJQUNELG1CQUFtQixFQUFFLFVBQUMsUUFBcUIsRUFBRSxLQUFhO1FBQ3hELFFBQVEsQ0FBQyxVQUFVLEdBQUcsS0FBSyxDQUFDO0lBQzlCLENBQUM7SUFDRCx5QkFBeUIsRUFBRSxVQUFDLFFBQXFCLEVBQUUsS0FBYTtRQUM5RCxRQUFRLENBQUMsZUFBZSxHQUFHLE1BQU0sQ0FBQyxLQUFLLENBQUM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BzZXR0aW5ncy5qdXB5dGVyQXJncy5wdXNoKGAtLU5vdGVib29rQXBwLnRva2VuPSR7dmFsdWV9YCk7XG4gIH0sXG4gICdDT0xBQl9KVVBZVEVSX0RJU0FCTEVfQ0hFQ0tfWFNSRic6XG4gICAgICAoc2V0dGluZ3M6IEFwcFNldHRpbmdzLCB2YWx1ZTogc3RyaW5nKSA9PiB7XG4gICAgICAgIHNldHRpbmdzLmp1cHl0ZXJBcmdzID0gc2V0dGluZ3MuanVweXRlckFyZ3MgfHwgW107XG4gICAgICAgIHNldHRpbmdzLmp1cHl0ZXJBcmdzLnB1c2goYC0tTm90ZWJvb2tBcHAuZGlzYWJsZV9jaGVja194c3JmPSR7dmFsdWV9YCk7XG4gICAgICB9LFxuICAnQ09MQUJfRklMRV9IQU5ETEVSX0FERFInOiAoc2V0dGluZ3M6IEFwcFNldHRpbmdzLCB2YWx1ZTogc3RyaW5nKSA9PiB7XG4gICAgc2V0dGluZ3MuZmlsZUhhbmRsZXJBZGRyID0gdmFsdWU7XG4gIH0sXG59O1xuXG4vKiogQXBwbGllcyBhbnkgZW52aXJvbm1lbnQgdmFyaWFibGUgb3ZlcnJpZGVzLiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGFwcGx5RW52aXJvbm1lbnRWYXJpYWJsZXMoc2V0dGluZ3M6IEFwcFNldHRpbmdzKSB7XG4gIGZvciAoY29uc3QgW2tleSwgYXBwbHldIG9mIE9iamVjdC5lbnRyaWVzKGVudmlyb25tZW50VmFyaWFibGVzKSkge1xuICAgIGNvbnN0IG92ZXJyaWRlID0gcHJvY2Vzcy5lbnZba2V5XTtcbiAgICBpZiAob3ZlcnJpZGUgIT09IHVuZGVmaW5lZCkge1xuICAgICAgYXBwbHkoc2V0dGluZ3MsIG92ZXJyaWRlKTtcbiAgICB9XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/datalab/web/config/basePath.json b/datalab/web/config/basePath.json new file mode 100644 index 0000000000000000000000000000000000000000..3cc762b5501e0d558314aecc7aed03c835319ff9 --- /dev/null +++ b/datalab/web/config/basePath.json @@ -0,0 +1 @@ +"" \ No newline at end of file diff --git a/datalab/web/config/settings.json b/datalab/web/config/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..29f7421b138da15c285a5c3758c3a7f65fd26ba3 --- /dev/null +++ b/datalab/web/config/settings.json @@ -0,0 +1,8 @@ +{ + "contentDir": "/content", + "datalabRoot": "", + "jupyterArgs": ["--debug"], + "nextJupyterPort": 9000, + "serverHost": "", + "serverPort": 8080 +} diff --git a/datalab/web/json_rpc.js b/datalab/web/json_rpc.js new file mode 100644 index 0000000000000000000000000000000000000000..ae512f1cb7943ab0fa7866a9306666cc0946a904 --- /dev/null +++ b/datalab/web/json_rpc.js @@ -0,0 +1,137 @@ +"use strict"; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JsonRpcReader = void 0; +exports.encodeJsonRpc = encodeJsonRpc; +var CR = 13; +var LF = 10; +/** + * JSON RPC reader following the Debug Adapter Protocol message + * format which itself follows Chrome's V8 debugger protocol, originally + * documented at + * https://github.com/buggerjs/bugger-v8-client/blob/master/PROTOCOL.md#v8-debugger-protocol + */ +var JsonRpcReader = /** @class */ (function () { + function JsonRpcReader(callback) { + this.callback = callback; + this.position = 0; + this.allocationSize = 4096; + this.decoder = new TextDecoder(); + this.buffer = new Uint8Array(this.allocationSize); + } + JsonRpcReader.prototype.append = function (data) { + // Grow the buffer if necessary to hold the data. + if (data.byteLength > (this.buffer.byteLength - this.position)) { + var requiredSize = this.position + data.byteLength; + var newSize = Math.ceil(requiredSize / this.allocationSize) * this.allocationSize; + var newBuffer = new Uint8Array(newSize); + newBuffer.set(this.buffer, 0); + this.buffer = newBuffer; + } + // Push new data onto end of the buffer. + this.buffer.set(data, this.position); + this.position += data.byteLength; + var parsedMessages = []; + while (true) { + // Parse all messages out of the buffer. + var message = this.tryReadMessage(); + if (!message) { + break; + } + parsedMessages.push(message); + this.callback(message); + } + return parsedMessages; + }; + JsonRpcReader.prototype.tryReadMessage = function () { + var e_1, _a; + // Loop through looking for \r\n\r\n in the buffer. + for (var i = 0; i < this.position - 4; ++i) { + // First \r\n indicates the end of the headers. + if (this.buffer[i] === CR && this.buffer[i + 1] === LF && + this.buffer[i + 2] === CR && this.buffer[i + 3] === LF) { + // Parse each of the header lines out of the header block. + var headerLength = i + 4; + var headerBytes = this.buffer.subarray(0, headerLength); + var headerString = this.decoder.decode(headerBytes); + var headerLines = headerString.split('\r\n'); + var headers = {}; + try { + for (var headerLines_1 = (e_1 = void 0, __values(headerLines)), headerLines_1_1 = headerLines_1.next(); !headerLines_1_1.done; headerLines_1_1 = headerLines_1.next()) { + var line = headerLines_1_1.value; + if (!line.trim()) { + continue; + } + var pair = line.split(':'); + if (pair.length !== 2) { + throw new Error("Illegal header value: ".concat(line)); + } + headers[pair[0]] = pair[1].trim(); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (headerLines_1_1 && !headerLines_1_1.done && (_a = headerLines_1.return)) _a.call(headerLines_1); + } + finally { if (e_1) throw e_1.error; } + } + var contentLengthString = headers['Content-Length']; + if (!contentLengthString) { + throw new Error('Missing Content-Length header.'); + } + var contentLength = Number(contentLengthString); + if (isNaN(contentLength)) { + throw new Error("Header Content-Length not a number: ".concat(contentLengthString, ".")); + } + var requiredLength = headerLength + contentLength; + if (requiredLength <= this.position) { + // This is just a view onto the current buffer. + var contentBytes = this.buffer.subarray(headerLength, headerLength + contentLength); + var content = this.decoder.decode(contentBytes); + this.buffer.copyWithin(0, headerLength + contentLength, this.position); + this.position = this.position - (headerLength + contentLength); + return { headers: headers, content: content }; + } + } + } + return null; + }; + return JsonRpcReader; +}()); +exports.JsonRpcReader = JsonRpcReader; +/** Encodes the string content to a JSON RPC message. */ +function encodeJsonRpc(content) { + var e_2, _a; + var headers = { + 'Content-Length': String(new TextEncoder().encode(content).byteLength), + }; + var requestString = ''; + try { + for (var _b = __values(Object.keys(headers)), _c = _b.next(); !_c.done; _c = _b.next()) { + var key = _c.value; + requestString += "".concat(key, ": ").concat(headers[key], "\r\n"); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_2) throw e_2.error; } + } + requestString += '\r\n'; + requestString += content; + return requestString; +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianNvbl9ycGMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi90aGlyZF9wYXJ0eS9jb2xhYi9zb3VyY2VzL2pzb25fcnBjLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7O0FBcUdBLHNDQVdDO0FBaEhELElBQU0sRUFBRSxHQUFHLEVBQUUsQ0FBQztBQUNkLElBQU0sRUFBRSxHQUFHLEVBQUUsQ0FBQztBQVFkOzs7OztHQUtHO0FBQ0g7SUFNRSx1QkFBcUIsUUFBMkM7UUFBM0MsYUFBUSxHQUFSLFFBQVEsQ0FBbUM7UUFKeEQsYUFBUSxHQUFXLENBQUMsQ0FBQztRQUNaLG1CQUFjLEdBQUcsSUFBSSxDQUFDO1FBQ3RCLFlBQU8sR0FBRyxJQUFJLFdBQVcsRUFBRSxDQUFDO1FBRzNDLElBQUksQ0FBQyxNQUFNLEdBQUcsSUFBSSxVQUFVLENBQUMsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDO0lBQ3BELENBQUM7SUFFRCw4QkFBTSxHQUFOLFVBQU8sSUFBZ0I7UUFDckIsaURBQWlEO1FBQ2pELElBQ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XJTdHJpbmcuc3BsaXQoJ1xcclxcbicpO1xuICAgICAgICBjb25zdCBoZWFkZXJzOiB7W2tleTogc3RyaW5nXTogc3RyaW5nfSA9IHt9O1xuICAgICAgICBmb3IgKGNvbnN0IGxpbmUgb2YgaGVhZGVyTGluZXMpIHtcbiAgICAgICAgICBpZiAoIWxpbmUudHJpbSgpKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgY29uc3QgcGFpciA9IGxpbmUuc3BsaXQoJzonKTtcbiAgICAgICAgICBpZiAocGFpci5sZW5ndGggIT09IDIpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgSWxsZWdhbCBoZWFkZXIgdmFsdWU6ICR7bGluZX1gKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaGVhZGVyc1twYWlyWzBdXSA9IHBhaXJbMV0udHJpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IGNvbnRlbnRMZW5ndGhTdHJpbmcgPSBoZWFkZXJzWydDb250ZW50LUxlbmd0aCddO1xuICAgICAgICBpZiAoIWNvbnRlbnRMZW5ndGhTdHJpbmcpIHtcbiAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ01pc3NpbmcgQ29udGVudC1MZW5ndGggaGVhZGVyLicpO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IGNvbnRlbnRMZW5ndGggPSBOdW1iZXIoY29udGVudExlbmd0aFN0cmluZyk7XG4gICAgICAgIGlmIChpc05hTihjb250ZW50TGVuZ3RoKSkge1xuICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcbiAgICAgICAgICAgICAgYEhlYWRlciBDb250ZW50LUxlbmd0aCBub3QgYSBudW1iZXI6ICR7Y29udGVudExlbmd0aFN0cmluZ30uYCk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgcmVxdWlyZWRMZW5ndGggPSBoZWFkZXJMZW5ndGggKyBjb250ZW50TGVuZ3RoO1xuICAgICAg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dC5rZXlzKGhlYWRlcnMpKSB7XG4gICAgcmVxdWVzdFN0cmluZyArPSBgJHtrZXl9OiAke2hlYWRlcnNba2V5XX1cXHJcXG5gO1xuICB9XG4gIHJlcXVlc3RTdHJpbmcgKz0gJ1xcclxcbic7XG4gIHJlcXVlc3RTdHJpbmcgKz0gY29udGVudDtcbiAgcmV0dXJuIHJlcXVlc3RTdHJpbmc7XG59XG4iXX0= \ No newline at end of file diff --git a/datalab/web/jupyter.js b/datalab/web/jupyter.js new file mode 100644 index 0000000000000000000000000000000000000000..d6ad31a6727c23828ef5debc5ae32bf6a4402484 --- /dev/null +++ b/datalab/web/jupyter.js @@ -0,0 +1,213 @@ +"use strict"; +/* + * Copyright 2015 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.init = init; +exports.close = close; +exports.handleSocket = handleSocket; +exports.handleRequest = handleRequest; +var childProcess = require("child_process"); +var httpProxy = require("http-proxy"); +var path = require("path"); +var logging = require("./logging"); +/** + * Singleton tracking the jupyter server instance we manage. + */ +var jupyterServer = null; +/** + * The maximum number of times we'll restart jupyter; we set a limit to avoid + * users being stuck with a slow-crash-looping server. + */ +var remainingJupyterServerRestarts = 20; +/** + * The application settings instance. + */ +var appSettings; +/* + * This list of levels should match the ones used by Python: + * https://docs.python.org/3/library/logging.html#logging-levels + */ +var LogLevels; +(function (LogLevels) { + LogLevels["CRITICAL"] = "CRITICAL"; + LogLevels["ERROR"] = "ERROR"; + LogLevels["WARNING"] = "WARNING"; + LogLevels["INFO"] = "INFO"; + LogLevels["DEBUG"] = "DEBUG"; + LogLevels["NOTSET"] = "NOTSET"; +})(LogLevels || (LogLevels = {})); +function pipeOutput(stream) { + stream.setEncoding('utf8'); + // The format we parse here corresponds to the log format we set in our + // jupyter configuration. + var logger = logging.getJupyterLogger(); + stream.on('data', function (data) { + var e_1, _a; + try { + for (var _b = __values(data.split('\n')), _c = _b.next(); !_c.done; _c = _b.next()) { + var line = _c.value; + if (line.trim().length === 0) { + continue; + } + var parts = line.split('|', 3); + if (parts.length !== 3) { + // Non-logging messages (eg tracebacks) get logged as warnings. + logger.warn(line); + continue; + } + var level = parts[1]; + var message = parts[2]; + // We need to map Python's log levels to those used by bunyan. + if (level === LogLevels.CRITICAL || level === LogLevels.ERROR) { + logger.error(message); + } + else if (level === LogLevels.WARNING) { + logger.warn(message); + } + else if (level === LogLevels.INFO) { + logger.info(message); + } + else { + // We map DEBUG, NOTSET, and any unknown log levels to debug. + logger.debug(message); + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + }); +} +function createJupyterServer() { + var e_2, _a; + if (!remainingJupyterServerRestarts) { + logging.getLogger().error('No jupyter restart attempts remaining.'); + return; + } + remainingJupyterServerRestarts -= 1; + var port = appSettings.nextJupyterPort; + logging.getLogger().info('Launching Jupyter server at %d', port); + var jupyterArgs = appSettings.jupyterArgs || []; + function exitHandler(code, signal) { + if (jupyterServer) { + logging.getLogger().error('Jupyter process %d exited due to signal: %s', jupyterServer.childProcess.pid, signal); + } + else { + logging.getLogger().error('Jupyter process exit before server creation finished due to signal: %s', signal); + } + // We want to restart jupyter whenever it terminates. + createJupyterServer(); + } + var contentDir = path.join(appSettings.datalabRoot, appSettings.contentDir); + var processArgs = ['notebook'].concat(jupyterArgs || []).concat([ + "--port=".concat(port), + "--FileContentsManager.root_dir=".concat(appSettings.datalabRoot, "/"), + // TODO: b/136659627 - Delete this line. + "--MappingKernelManager.root_dir=".concat(contentDir), + ]); + var jupyterServerAddr = 'localhost'; + try { + for (var jupyterArgs_1 = __values(jupyterArgs), jupyterArgs_1_1 = jupyterArgs_1.next(); !jupyterArgs_1_1.done; jupyterArgs_1_1 = jupyterArgs_1.next()) { + var flag = jupyterArgs_1_1.value; + // Extracts a string like '1.2.3.4' from the string '--ip=1.2.3.4' + var match = flag.match(/--ip=([^ ]+)/); + if (match) { + jupyterServerAddr = match[1]; + break; + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (jupyterArgs_1_1 && !jupyterArgs_1_1.done && (_a = jupyterArgs_1.return)) _a.call(jupyterArgs_1); + } + finally { if (e_2) throw e_2.error; } + } + logging.getLogger().info('Using jupyter server address %s', jupyterServerAddr); + var processOptions = { + detached: false, + env: process.env, + }; + var serverProcess = childProcess.spawn('jupyter', processArgs, processOptions); + serverProcess.on('exit', exitHandler); + logging.getLogger().info('Jupyter process started with pid %d and args %j', serverProcess.pid, processArgs); + // Capture the output, so it can be piped for logging. + pipeOutput(serverProcess.stdout); + pipeOutput(serverProcess.stderr); + // Create the proxy. + var proxyTargetHost = appSettings.kernelManagerProxyHost || jupyterServerAddr; + var proxyTargetPort = appSettings.kernelManagerProxyPort || port; + var proxy = httpProxy.createProxyServer({ target: "http://".concat(proxyTargetHost, ":").concat(proxyTargetPort) }); + proxy.on('error', errorHandler); + jupyterServer = { port: port, proxy: proxy, childProcess: serverProcess }; +} +/** + * Initializes the Jupyter server manager. + */ +function init(settings) { + appSettings = settings; + createJupyterServer(); +} +/** + * Closes the Jupyter server manager. + */ +function close() { + if (!jupyterServer) { + return; + } + var pid = jupyterServer.childProcess.pid; + logging.getLogger().info("jupyter close: PID: ".concat(pid)); + jupyterServer.childProcess.kill('SIGHUP'); +} +/** Proxy this socket request to jupyter. */ +function handleSocket(request, socket, head) { + if (!jupyterServer) { + logging.getLogger().error('Jupyter server is not running.'); + return; + } + jupyterServer.proxy.ws(request, socket, head); +} +/** Proxy this HTTP request to jupyter. */ +function handleRequest(request, response) { + if (!jupyterServer) { + response.statusCode = 500; + response.end(); + return; + } + jupyterServer.proxy.web(request, response, null); +} +function errorHandler(error, request, response) { + logging.getLogger().error(error, 'Jupyter server returned error.'); + response.writeHead(500, 'Internal Server Error'); + response.end(); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianVweXRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3RoaXJkX3BhcnR5L2NvbGFiL3NvdXJjZXMvanVweXRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7Ozs7O0dBY0c7Ozs7Ozs7Ozs7Ozs7QUEySkgsb0JBR0M7QUFLRCxzQkFRQztBQUdELG9DQU9DO0FBR0Qsc0NBU0M7QUEvTEQsNENBQThDO0FBRTlDLHNDQUF3QztBQUV4QywyQkFBNkI7QUFHN0IsbUNBQXFDO0FBUXJDOztHQUVHO0FBQ0gsSUFBSSxhQUFhLEdBQXVCLElBQUksQ0FBQztBQUU3Qzs7O0dBR0c7QUFDSCxJQUFJLDhCQUE4QixHQUFXLEVBQUUsQ0FBQztBQUVoRDs7R0FFRztBQUNILElBQUksV0FBd0IsQ0FBQztBQUU3Qjs7O0dBR0c7QUFDSCxJQUFLLFNBT0o7QUFQRCxXQUFLLFNBQVM7SUFDWixrQ0FBcUIsQ0FBQTtJQUNyQiw0QkFBZSxDQUFBO0lBQ2YsZ0NBQW1CLENBQUE7SUFDbkIsMEJBQWEsQ0FBQTtJQUNiLDRCQUFlLENBQUE7SUFDZiw4QkFBaUI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SB0aGlzIEhUVFAgcmVxdWVzdCB0byBqdXB5dGVyLiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGhhbmRsZVJlcXVlc3QoXG4gICAgcmVxdWVzdDogaHR0cC5JbmNvbWluZ01lc3NhZ2UsIHJlc3BvbnNlOiBodHRwLlNlcnZlclJlc3BvbnNlKSB7XG4gIGlmICghanVweXRlclNlcnZlcikge1xuICAgIHJlc3BvbnNlLnN0YXR1c0NvZGUgPSA1MDA7XG4gICAgcmVzcG9uc2UuZW5kKCk7XG4gICAgcmV0dXJuO1xuICB9XG5cbiAganVweXRlclNlcnZlci5wcm94eS53ZWIocmVxdWVzdCwgcmVzcG9uc2UsIG51bGwpO1xufVxuXG5mdW5jdGlvbiBlcnJvckhhbmRsZXIoXG4gICAgZXJyb3I6IEVycm9yLCByZXF1ZXN0OiBodHRwLkluY29taW5nTWVzc2FnZSxcbiAgICByZXNwb25zZTogaHR0cC5TZXJ2ZXJSZXNwb25zZSkge1xuICBsb2dnaW5nLmdldExvZ2dlcigpLmVycm9yKGVycm9yLCAnSnVweXRlciBzZXJ2ZXIgcmV0dXJuZWQgZXJyb3IuJyk7XG5cbiAgcmVzcG9uc2Uud3JpdGVIZWFkKDUwMCwgJ0ludGVybmFsIFNlcnZlciBFcnJvcicpO1xuICByZXNwb25zZS5lbmQoKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/datalab/web/logging.js b/datalab/web/logging.js new file mode 100644 index 0000000000000000000000000000000000000000..2cb18fe3a7e89a960710dcea983aa6ba92ad46ad --- /dev/null +++ b/datalab/web/logging.js @@ -0,0 +1,129 @@ +"use strict"; +/* + * Copyright 2015 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getLogger = getLogger; +exports.getJupyterLogger = getJupyterLogger; +exports.logRequest = logRequest; +exports.initializeLoggers = initializeLoggers; +var bunyan = require("bunyan"); +var path = require("path"); +// We import the bunyan-rotating-file-stream package, which exports a +// constructor as a single object; we use lint disables here to make the usage +// below look reasonable. +// +// tslint:disable-next-line:no-require-imports variable-name enforce-name-casing +var RotatingFileStream = require('bunyan-rotating-file-stream'); +var logger = null; +var requestLogger = null; +var jupyterLogger = null; +/** + * Gets the logger for generating debug logs. + * @returns the logger configured for debugging logging. + */ +function getLogger() { + return logger; +} +/** + * Gets the logger for generating Jupyter logs. + * @returns the logger configured for Jupyter logging. + */ +function getJupyterLogger() { + return jupyterLogger; +} +/** + * Logs a request and the corresponding response. + * @param request the request to be logged. + * @param response the response to be logged. + */ +function logRequest(request, response) { + requestLogger.debug({ url: request.url, method: request.method }, 'Received a new request'); + response.on('finish', function () { + requestLogger.debug({ + url: request.url, + method: request.method, + status: response.statusCode + }); + }); +} +/** + * Initializes loggers used within the application. + */ +function initializeLoggers(settings) { + var e_1, _a; + // We configure our loggers as follows: + // * our base logger tags all log records with `"name":"app"`, and sends logs + // to stderr (including logs of all children) + // * one child logger adds `"type":"request"`, and records method/URL for all + // HTTP requests to the app, and method/URL/response code for all responses + // * one child logger adds `"type":"jupyter"`, and records all messages from + // the jupyter notebook server. These logs are also sent to a file on disk + // (to assist user debugging). + // + // For more about bunyan, see: + // https://github.com/trentm/node-bunyan/tree/f21007d46c0e64072617380b70d3f542368318a8 + var jupyterLogPath = path.join(settings.datalabRoot, '/var/colab/app.log'); + logger = bunyan.createLogger({ + name: 'app', + streams: [ + { level: 'debug', type: 'stream', stream: process.stderr }, + ] + }); + requestLogger = logger.child({ type: 'request' }); + jupyterLogger = logger.child({ + type: 'jupyter', + streams: [{ + level: 'info', + type: 'stream', + stream: new RotatingFileStream({ + path: jupyterLogPath, + rotateExisting: false, + threshold: '2m', + totalSize: '20m' + }), + }] + }); + // Omit superfluous fields, unless using the bunyan CLI to make logs human + // readable, because the CLI requires them. + if (process.env['COLAB_HUMAN_READABLE_NODE_LOGS'] !== '1') { + try { + for (var _b = __values([logger, jupyterLogger, requestLogger]), _c = _b.next(); !_c.done; _c = _b.next()) { + var logs = _c.value; + delete logs.fields['hostname']; + delete logs.fields['name']; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + } +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2luZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3RoaXJkX3BhcnR5L2NvbGFiL3NvdXJjZXMvbG9nZ2luZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7Ozs7O0dBY0c7Ozs7Ozs7Ozs7Ozs7QUF1QkgsOEJBRUM7QUFNRCw0Q0FFQztBQU9ELGdDQVdDO0FBS0QsOENBeUNDO0FBL0ZELCtCQUFpQztBQUVqQywyQkFBNkI7QUFJN0IscUVBQXFFO0FBQ3JFLDhFQUE4RTtBQUM5RSx5QkFBeUI7QUFDekIsRUFBRTtBQUNGLGdGQUFnRjtBQUNoRixJQUFNLGtCQUFrQixHQUFHLE9BQU8sQ0FBQyw2QkFBNkIsQ0FBQyxDQUFDO0FBRWxFLElBQUksTUFBTSxHQUF3QixJQUFJLENBQUM7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RzWyduYW1lJ107XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/datalab/web/lsp/capabilities_node.js b/datalab/web/lsp/capabilities_node.js new file mode 100644 index 0000000000000000000000000000000000000000..8ee1a490fe959147c74cb97d57a1f9dc8cb5d30c --- /dev/null +++ b/datalab/web/lsp/capabilities_node.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FwYWJpbGl0aWVzX25vZGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9nZW5maWxlcy90aGlyZF9wYXJ0eS9jb2xhYi9zb3VyY2VzL2xzcC9jYXBhYmlsaXRpZXNfbm9kZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgcHJvdG9jb2wgZnJvbSAnLi9wcm90b2NvbF9ub2RlJztcbmltcG9ydCAqIGFzIHRleHREb2N1bWVudCBmcm9tICcuL3RleHRfZG9jdW1lbnRfbm9kZSc7XG5pbXBvcnQgKiBhcyB3b3Jrc3BhY2UgZnJvbSAnLi93b3Jrc3BhY2Vfbm9kZSc7XG5cbmRlY2xhcmUgaW50ZXJmYWNlIENsaWVudENhcGFiaWxpdGllcyB7XG4gIC8qKlxuICAgKiBXb3Jrc3BhY2Ugc3BlY2lmaWMgY2xpZW50IGNhcGFiaWxpdGllcy5cbiAgICovXG4gIHdvcmtzcGFjZT86IHtcbiAgICAvKipcbiAgICAgKiBUaGUgY2xpZW50IHN1cHBvcnRzIGFwcGx5aW5nIGJhdGNoIGVkaXRzXG4gICAgICogdG8gdGhlIHdvcmtzcGFjZSBieSBzdXBwb3J0aW5nIHRoZSByZXF1ZXN0XG4gICAgICogJ3dvcmtzcGFjZS9hcHBseUVkaXQnXG4gICAgICovX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xuXG4gIC8qKlxuICAgKiBUaGUgaW5pdGlhbCB0cmFjZSBzZXR0aW5nLiBJZiBvbWl0dGVkIHRyYWNlIGlzIGRpc2FibGVkICgnb2ZmJykuXG4gICAqL1xuICB0cmFjZT86ICdvZmYnfCdtZXNzYWdlcyd8J3ZlcmJvc2UnO1xuXG4gIC8qKlxuICAgKiBUaGUgd29ya3NwYWNlIGZvbGRlcnMgY29uZmlndXJlZCBpbiB0aGUgY2xpZW50IHdoZW4gdGhlIHNlcnZlciBzdGFydHMuXG4gICAqIFRoaXMgcHJvcGVydHkgaXMgb25seSBhdmFpbGFibGUgaWYgdGhlIGNsaWVudCBzdXBwb3J0cyB3b3Jrc3BhY2UgZm9sZGVycy5cbiAgICogSXQgY2FuIGJlIGBudWxsYCBpZiB0aGUgY2xpZW50IHN1cHBvcnRzIHdvcmtzcGFjZSBmb2xkZXJzIGJ1dCBub25lIGFyZVxuICAgKiBjb25maWd1cmVkLlxuICAgKlxuICAgKiBAc2luY2UgMy42LjBcbiAgICovXG4gIHdvcmtzcGFjZUZvbGRlcnM/OiB3b3Jrc3BhY2UuV29ya3NwYWNlRm9sZGVyW118bnVsbDtcbn1cbiJdfQ== \ No newline at end of file diff --git a/datalab/web/lsp/extensions_node.js b/datalab/web/lsp/extensions_node.js new file mode 100644 index 0000000000000000000000000000000000000000..f74a1abb1c70d66720a5fa03c1f90dec11a85e53 --- /dev/null +++ b/datalab/web/lsp/extensions_node.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExecutionStatus = void 0; +/** The status of a cell's execution. */ +var ExecutionStatus; +(function (ExecutionStatus) { + /** The default value for an execution status. */ + ExecutionStatus[ExecutionStatus["UNKNOWN"] = 0] = "UNKNOWN"; + /** Execution is up to date. */ + ExecutionStatus[ExecutionStatus["FRESH"] = 1] = "FRESH"; + /** Execution is out of date. */ + ExecutionStatus[ExecutionStatus["STALE"] = 2] = "STALE"; +})(ExecutionStatus || (exports.Ex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NlIENlbGxHcmFwaCB7XG4gIC8qKlxuICAgKiBUaGUgaW5kaWNlcyBvZiBjZWxscyBpbiBhIFB5dGhvbiBub3RlYm9vay5cbiAgICovXG4gIGNlbGxzPzogQ2VsbFtdO1xuXG4gIC8qKlxuICAgKiBUaGUgcmVmZXJlbmNlIGdyYXBoIHdoaWNoIGVzdGFibGlzaGVzIGRlcGVuZGVuY2llcyBiZXR3ZWVuIHRoZSBjZWxscy5cbiAgICovXG4gIHJlZnM/OiBDZWxsUmVmW107XG59XG5cbi8qKlxuICogRGVwZW5kZW50Q2VsbHNSZXNwb25zZSByZXByZXNlbnRzIGEgcmVzcG9uc2UgZnJvbSBlaXRoZXIgcHJlcmVxdWlzaXRlIG9yXG4gKiBkZXBlbmRlbnQgY2VsbHMuIEl0IGNvbnRhaW5zIGEgZ3JhcGggdGhhdCByZXByZXNlbnRzIGNlbGxzIGFuZCB0aGVpclxuICogcmVmZXJlbmNlcyB0aGF0IGVzdGFibGlzaGVzIHRoZSBkZXBlbmRlbmNpZXMgYmV0d2VlbiB0aGVtLlxuICovXG5leHBvcnQgaW50ZXJmYWNlIERlcGVuZGVudENlbGxzUmVzcG9uc2UgZXh0ZW5kcyBDZWxsR3JhcGgge1xuICAvKipcbiAgICogTWFnaWNzIHRoYXQgYXJlIG5vdCBzdXBwb3J0ZWQgYnkgcHJlcmVxIGNlbGxzLCBhbmQgbWF5IGxlYWQgdG8gaW5jb3JyZWN0XG4gICAqIHJlc3VsdHMuXG4gICAqL1xuICB1bnN1cHBvcnRlZE1hZ2ljcz86IHN0cmluZ1tdO1xufVxuIl19 \ No newline at end of file diff --git a/datalab/web/lsp/protocol_node.js b/datalab/web/lsp/protocol_node.js new file mode 100644 index 0000000000000000000000000000000000000000..8859c6da42e5c2a7c3417d5dbc764d1422e02d2a --- /dev/null +++ b/datalab/web/lsp/protocol_node.js @@ -0,0 +1,191 @@ +"use strict"; +// tslint:disable:enforce-name-casing +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SymbolTag = exports.SymbolKind = exports.DiagnosticSeverity = exports.DiagnosticTag = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.ErrorCode = exports.Method = void 0; +/** + * JSON-RPC Methods. + */ +var Method; +(function (Method) { + Method["CancelRequest"] = "$/cancelRequest"; + Method["ClientRegisterCapability"] = "client/registerCapability"; + Method["ColabPipLogChanged"] = "colab/pipLogChanged"; + Method["CompletionItemResolve"] = "completionItem/resolve"; + Method["Initialize"] = "initialize"; + Method["Initialized"] = "initialized"; + Method["TextDocumentAutoExecuteCheck"] = "textDocument/autoExecuteCheck"; + Method["TextDocumentCodeAction"] = "textDocument/codeAction"; + Method["TextDocumentCompletion"] = "textDocument/completion"; + Method["TextDocumentDefinition"] = "textDocument/definition"; + Method["TextDocumentDidChange"] = "textDocument/didChange"; + Method["TextDocumentDidClose"] = "textDocument/didClose"; + Method["TextDocumentDidOpen"] = "textDocument/didOpen"; + Method["TextDocumentEchoDocument"] = "textDocument/echoDocument"; + Method["TextDocumentHover"] = "textDocument/hover"; + Method["TextDocumentCellDependents"] = "textDocument/cellDependents"; + Method["TextDocumentCellPrerequisites"] = "textDocument/cellPrerequisites"; + Method["TextDocumentInlayHint"] = "textDocument/inlayHint"; + Method["TextDocumentPublishDiagnostics"] = "textDocument/publishDiagnostics"; + Method["TextDocumentPrepareRename"] = "textDocument/prepareRename"; + Method["TextDocumentRename"] = "textDocument/rename"; + Method["TextDocumentRepair"] = "textDocument/repair"; + Method["TextDocumentSignatureHelp"] = "textDocument/signatureHelp"; + Method["WindowLogMessage"] = "window/logMessage"; + Method["WorkspaceConfiguration"] = "workspace/configuration"; + Method["WorkspaceDidChangeConfiguration"] = "workspace/didChangeConfiguration"; + Method["WorkspaceDidChangeWatchedFiles"] = "workspace/didChangeWatchedFiles"; +})(Method || (exports.Method = Method = {})); +/** + * https://microsoft.github.io/language-server-protocol/specifications/specification-current/#responseMessage + */ +var ErrorCode; +(function (ErrorCode) { + // Defined by JSON RPC + ErrorCode[ErrorCode["ParseError"] = -32700] = "ParseError"; + ErrorCode[ErrorCode["InvalidRequest"] = -32600] = "InvalidRequest"; + ErrorCode[ErrorCode["MethodNotFound"] = -32601] = "MethodNotFound"; + ErrorCode[ErrorCode["InvalidParams"] = -32602] = "InvalidParams"; + ErrorCode[ErrorCode["InternalError"] = -32603] = "InternalError"; + ErrorCode[ErrorCode["ServerErrorStart"] = -32099] = "ServerErrorStart"; + ErrorCode[ErrorCode["ServerErrorEnd"] = -32000] = "ServerErrorEnd"; + ErrorCode[ErrorCode["ServerNotInitialized"] = -32002] = "ServerNotInitialized"; + ErrorCode[ErrorCode["UnknownErrorCode"] = -32001] = "UnknownErrorCode"; + // Defined by the protocol. + ErrorCode[ErrorCode["RequestCancelled"] = -32800] = "RequestCancelled"; + ErrorCode[ErrorCode["ContentModified"] = -32801] = "ContentModified"; +})(ErrorCode || (exports.ErrorCode = ErrorCode = {})); +/** + * The kind of resource operations supported by the client. + */ +var ResourceOperationKind; +(function (ResourceOperationKind) { + /** + * Supports creating new files and folders. + */ + ResourceOperationKind["CREATE"] = "create"; + /** + * Supports renaming existing files and folders. + */ + ResourceOperationKind["RENAME"] = "rename"; + /** + * Supports deleting existing files and folders. + */ + ResourceOperationKind["DELETE"] = "delete"; +})(ResourceOperationKind || (exports.ResourceOperationKind = ResourceOperationKind = {})); +/** + * https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspaceEditClientCapabilities + */ +var FailureHandlingKind; +(function (FailureHandlingKind) { + /** + * Applying the workspace change is simply aborted if one of the changes + * provided fails. + * All operations executed before the failing operation stay executed. + */ + FailureHandlingKind["Abort"] = "abort"; + /** + * All operations are executed transactional. That means they either all + * succeed or no changes at all are applied to the workspace. + */ + FailureHandlingKind["Transactional"] = "transactional"; + /** + * If the workspace edit contains only textual file changes, they are + * executed transactionally. + * If resource changes (create, rename or delete file) are part of the + * change, the failure handling strategy is abort. + */ + FailureHandlingKind["TextOnlyTransactional"] = "textOnlyTransactional"; + /** + * The client tries to undo the operations already executed. But there is no + * guarantee that this is succeeding. + */ + FailureHandlingKind["Undo"] = "undo"; +})(FailureHandlingKind || (exports.FailureHandlingKind = FailureHandlingKind = {})); +/** + * The diagnostic tags. + * + * @since 3.15.0 + */ +var DiagnosticTag; +(function (DiagnosticTag) { + /** + * Unused or unnecessary code. + * + * Clients are allowed to render diagnostics with this tag faded out + * instead of having an error squiggle. + */ + DiagnosticTag[DiagnosticTag["Unnecessary"] = 1] = "Unnecessary"; + /** + * Deprecated or obsolete code. + * + * Clients are allowed to rendered diagnostics with this tag strike through. + */ + DiagnosticTag[DiagnosticTag["Deprecated"] = 2] = "Deprecated"; +})(DiagnosticTag || (exports.DiagnosticTag = DiagnosticTag = {})); +/** + * https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic + */ +var DiagnosticSeverity; +(function (DiagnosticSeverity) { + /** + * Reports an error. + */ + DiagnosticSeverity[DiagnosticSeverity["Error"] = 1] = "Error"; + /** + * Reports a warning. + */ + DiagnosticSeverity[DiagnosticSeverity["Warning"] = 2] = "Warning"; + /** + * Reports an information. + */ + DiagnosticSeverity[DiagnosticSeverity["Information"] = 3] = "Information"; + /** + * Reports a hint. + */ + DiagnosticSeverity[DiagnosticSeverity["Hint"] = 4] = "Hint"; +})(DiagnosticSeverity || (exports.DiagnosticSeverity = DiagnosticSeverity = {})); +/** + * A symbol kind. + */ +var SymbolKind; +(function (SymbolKind) { + SymbolKind[SymbolKind["File"] = 1] = "File"; + SymbolKind[SymbolKind["Module"] = 2] = "Module"; + SymbolKind[SymbolKind["Namespace"] = 3] = "Namespace"; + SymbolKind[SymbolKind["Package"] = 4] = "Package"; + SymbolKind[SymbolKind["Class"] = 5] = "Class"; + SymbolKind[SymbolKind["Method"] = 6] = "Method"; + SymbolKind[SymbolKind["Property"] = 7] = "Property"; + SymbolKind[SymbolKind["Field"] = 8] = "Field"; + SymbolKind[SymbolKind["Constructor"] = 9] = "Constructor"; + SymbolKind[SymbolKind["Enum"] = 10] = "Enum"; + SymbolKind[SymbolKind["Interface"] = 11] = "Interface"; + SymbolKind[SymbolKind["Function"] = 12] = "Function"; + SymbolKind[SymbolKind["Variable"] = 13] = "Variable"; + SymbolKind[SymbolKind["Constant"] = 14] = "Constant"; + SymbolKind[SymbolKind["String"] = 15] = "String"; + SymbolKind[SymbolKind["Number"] = 16] = "Number"; + SymbolKind[SymbolKind["Boolean"] = 17] = "Boolean"; + SymbolKind[SymbolKind["Array"] = 18] = "Array"; + SymbolKind[SymbolKind["Object"] = 19] = "Object"; + SymbolKind[SymbolKind["Key"] = 20] = "Key"; + SymbolKind[SymbolKind["Null"] = 21] = "Null"; + SymbolKind[SymbolKind["EnumMember"] = 22] = "EnumMember"; + SymbolKind[SymbolKind["Struct"] = 23] = "Struct"; + SymbolKind[SymbolKind["Event"] = 24] = "Event"; + SymbolKind[SymbolKind["Operator"] = 25] = "Operator"; + SymbolKind[SymbolKind["TypeParameter"] = 26] = "TypeParameter"; +})(SymbolKind || (exports.SymbolKind = SymbolKind = {})); +/** + * Symbol tags are extra annotations that tweak the rendering of a symbol. + * + * @since 3.16 + */ +var SymbolTag; +(function (SymbolTag) { + /** + * Render a symbol as obsolete, usually using a strike-out. + */ + SymbolTag[SymbolTag["Deprecated"] = 1] = "Deprecated"; +})(SymbolTag || (exports.SymbolTag = SymbolTag = {})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdG9jb2xfbm9kZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL2dlbmZpbGVzL3RoaXJkX3BhcnR5L2NvbGFiL3NvdXJjZXMvbHNwL3Byb3RvY29sX25vZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHFDQUFxQzs7O0FBRXJDOztHQUVHO0FBQ0gsSUFBWSxNQTRCWDtBQTVCRCxXQUFZLE1BQU07SUFDaEIsMkNBQWlDLEN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mljYXRpb25zL3NwZWNpZmljYXRpb24tY3VycmVudC8jY2xpZW50X3JlZ2lzdGVyQ2FwYWJpbGl0eVxuICovXG5leHBvcnQgaW50ZXJmYWNlIFJlZ2lzdHJhdGlvblBhcmFtcyB7XG4gIHJlZ2lzdHJhdGlvbnM6IFJlZ2lzdHJhdGlvbltdO1xufVxuIl19 \ No newline at end of file diff --git a/datalab/web/lsp/settings_node.js b/datalab/web/lsp/settings_node.js new file mode 100644 index 0000000000000000000000000000000000000000..ae63ed1333cd13554cd4277013b2c4f0de614003 --- /dev/null +++ b/datalab/web/lsp/settings_node.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.all = void 0; +/** + * Settings which may be used by the Python language server. + * These are from the default preferences from a VSCode client, culled + * to the LSP-related values. + * + * The difficulty here is that LSP only defines a mechanism to provide + * generic settings and the server expects the client to send all necessary + * settings. VSCode sends all Python settings to every Python language server. + * Furthermore the language server may request specific settings later. + * + * See: + * https://github.com/microsoft/pyright/blob/9d4e58d06643dccbfe0f450070334675b6b64724/docs/settings.md + */ +exports.all = { + 'python': { + 'analysis': { + 'diagnosticPublishDelay': 1000, + 'errors': [], + 'warnings': [], + 'information': [], + 'disabled': [], + 'typeshedPaths': [], + 'cacheFolderPath': '', + 'memory': { 'keepLibraryAst': false }, + 'logLevel': 'Warning', + 'symbolsHierarchyDepthLimit': 10, + 'completeFunctionParens': false, + 'autoImportCompletions': true, + 'autoSearchPaths': true, + 'stubPath': 'typings', + 'diagnosticMode': 'openFilesOnly', + 'extraPaths': [], + 'useLibraryCodeForTypes': true, + 'typeCheckingMode': 'basic', + // See diagnostics explanation at: + // https://github.com/microsoft/pyright/blob/main/docs/configuration.md + 'diagnosticSeverityOverrides': {}, + }, + }, +}; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0dGluZ3Nfbm9kZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIj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fSxcbiAgICAgICdsb2dMZXZlbCc6ICdXYXJuaW5nJyxcbiAgICAgICdzeW1ib2xzSGllcmFyY2h5RGVwdGhMaW1pdCc6IDEwLFxuICAgICAgJ2NvbXBsZXRlRnVuY3Rpb25QYXJlbnMnOiBmYWxzZSxcbiAgICAgICdhdXRvSW1wb3J0Q29tcGxldGlvbnMnOiB0cnVlLFxuICAgICAgJ2F1dG9TZWFyY2hQYXRocyc6IHRydWUsXG4gICAgICAnc3R1YlBhdGgnOiAndHlwaW5ncycsXG4gICAgICAnZGlhZ25vc3RpY01vZGUnOiAnb3BlbkZpbGVzT25seScsXG4gICAgICAnZXh0cmFQYXRocyc6IFtdLFxuICAgICAgJ3VzZUxpYnJhcnlDb2RlRm9yVHlwZXMnOiB0cnVlLFxuICAgICAgJ3R5cGVDaGVja2luZ01vZGUnOiAnYmFzaWMnLFxuICAgICAgLy8gU2VlIGRpYWdub3N0aWNzIGV4cGxhbmF0aW9uIGF0OlxuICAgICAgLy8gaHR0cHM6Ly9naXRodWIuY29tL21pY3Jvc29mdC9weXJpZ2h0L2Jsb2IvbWFpbi9kb2NzL2NvbmZpZ3VyYXRpb24ubWRcbiAgICAgICdkaWFnbm9zdGljU2V2ZXJpdHlPdmVycmlkZXMnOiB7fSxcbiAgICB9LFxuICB9LFxufTtcbiJdfQ== \ No newline at end of file diff --git a/datalab/web/lsp/text_document_node.js b/datalab/web/lsp/text_document_node.js new file mode 100644 index 0000000000000000000000000000000000000000..7538ac889355105f4fde77e23555376e1aa30b93 --- /dev/null +++ b/datalab/web/lsp/text_document_node.js @@ -0,0 +1,330 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.InlayHintKind = exports.SignatureHelpTriggerKind = exports.InsertTextMode = exports.InsertTextFormat = exports.CodeActionKind = exports.TextDocumentSyncKind = exports.CompletionTriggerKind = exports.LanguageIdentifier = exports.CompletionItemKind = exports.CompletionItemTag = exports.MarkupKind = void 0; +/** + * Describes the content type that a client supports in various + * result literals like `Hover`, `ParameterInfo` or `CompletionItem`. + * + * Please note that `MarkupKinds` must not start with a `$`. This kinds + * are reserved for internal usage. + */ +var MarkupKind; +(function (MarkupKind) { + /** + * Plain text is supported as a content format + */ + MarkupKind["PlainText"] = "plaintext"; + /** + * Markdown is supported as a content format + */ + MarkupKind["Markdown"] = "markdown"; +})(MarkupKind || (exports.MarkupKind = MarkupKind = {})); +/** + * Completion item tags are extra annotations that tweak the rendering of + * a completion item. + * + * @since 3.15.0 + */ +var CompletionItemTag; +(function (CompletionItemTag) { + /** + * Render a completion as obsolete, usually using a strike-out. + */ + CompletionItemTag[CompletionItemTag["Deprecated"] = 1] = "Deprecated"; +})(CompletionItemTag || (exports.CompletionItemTag = CompletionItemTag = {})); +/** + * The kind of a completion entry. + */ +var CompletionItemKind; +(function (CompletionItemKind) { + CompletionItemKind[CompletionItemKind["Text"] = 1] = "Text"; + CompletionItemKind[CompletionItemKind["Method"] = 2] = "Method"; + CompletionItemKind[CompletionItemKind["Function"] = 3] = "Function"; + CompletionItemKind[CompletionItemKind["Constructor"] = 4] = "Constructor"; + CompletionItemKind[CompletionItemKind["Field"] = 5] = "Field"; + CompletionItemKind[CompletionItemKind["Variable"] = 6] = "Variable"; + CompletionItemKind[CompletionItemKind["Class"] = 7] = "Class"; + CompletionItemKind[CompletionItemKind["Interface"] = 8] = "Interface"; + CompletionItemKind[CompletionItemKind["Module"] = 9] = "Module"; + CompletionItemKind[CompletionItemKind["Property"] = 10] = "Property"; + CompletionItemKind[CompletionItemKind["Unit"] = 11] = "Unit"; + CompletionItemKind[CompletionItemKind["Value"] = 12] = "Value"; + CompletionItemKind[CompletionItemKind["Enum"] = 13] = "Enum"; + CompletionItemKind[CompletionItemKind["Keyword"] = 14] = "Keyword"; + CompletionItemKind[CompletionItemKind["Snippet"] = 15] = "Snippet"; + CompletionItemKind[CompletionItemKind["Color"] = 16] = "Color"; + CompletionItemKind[CompletionItemKind["File"] = 17] = "File"; + CompletionItemKind[CompletionItemKind["Reference"] = 18] = "Reference"; + CompletionItemKind[CompletionItemKind["Folder"] = 19] = "Folder"; + CompletionItemKind[CompletionItemKind["EnumMember"] = 20] = "EnumMember"; + CompletionItemKind[CompletionItemKind["Constant"] = 21] = "Constant"; + CompletionItemKind[CompletionItemKind["Struct"] = 22] = "Struct"; + CompletionItemKind[CompletionItemKind["Event"] = 23] = "Event"; + CompletionItemKind[CompletionItemKind["Operator"] = 24] = "Operator"; + CompletionItemKind[CompletionItemKind["TypeParameter"] = 25] = "TypeParameter"; +})(CompletionItemKind || (exports.CompletionItemKind = CompletionItemKind = {})); +/** + * Known language identifiers. + * https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentItem + */ +var LanguageIdentifier; +(function (LanguageIdentifier) { + LanguageIdentifier["ABAP"] = "abap"; + LanguageIdentifier["WindowsBat"] = "bat"; + LanguageIdentifier["BibTeX"] = "bibtex"; + LanguageIdentifier["Clojure"] = "clojure"; + LanguageIdentifier["Coffeescript"] = "coffeescript"; + LanguageIdentifier["C"] = "c"; + LanguageIdentifier["CPlusPlus"] = "cpp"; + LanguageIdentifier["CSharp"] = "csharp"; + LanguageIdentifier["CSS"] = "css"; + LanguageIdentifier["Diff"] = "diff"; + LanguageIdentifier["Dart"] = "dart"; + LanguageIdentifier["Dockerfile"] = "dockerfile"; + LanguageIdentifier["Elixir"] = "elixir"; + LanguageIdentifier["Erlang"] = "erlang"; + LanguageIdentifier["FSharp"] = "fsharp"; + LanguageIdentifier["GitCommit"] = "git-commit"; + LanguageIdentifier["GitRebase"] = "git-rebase"; + LanguageIdentifier["Go"] = "go"; + LanguageIdentifier["Groovy"] = "groovy"; + LanguageIdentifier["Handlebars"] = "handlebars"; + LanguageIdentifier["HTML"] = "html"; + LanguageIdentifier["Ini"] = "ini"; + LanguageIdentifier["Java"] = "java"; + LanguageIdentifier["JavaScript"] = "javascript"; + LanguageIdentifier["JavaScriptReact"] = "javascriptreact"; + LanguageIdentifier["JSON"] = "json"; + LanguageIdentifier["LaTeX"] = "latex"; + LanguageIdentifier["Less"] = "less"; + LanguageIdentifier["Lua"] = "lua"; + LanguageIdentifier["Makefile"] = "makefile"; + LanguageIdentifier["Markdown"] = "markdown"; + LanguageIdentifier["ObjectiveC"] = "c"; + LanguageIdentifier["ObjectiveCPlusPlus"] = "cpp"; + LanguageIdentifier["Perl"] = "perl"; + LanguageIdentifier["Perl6"] = "perl6"; + LanguageIdentifier["PHP"] = "php"; + LanguageIdentifier["Powershell"] = "powershell"; + LanguageIdentifier["Pug"] = "jade"; + LanguageIdentifier["Python"] = "python"; + LanguageIdentifier["R"] = "r"; + LanguageIdentifier["Razor"] = "razor"; + LanguageIdentifier["Ruby"] = "ruby"; + LanguageIdentifier["Rust"] = "rust"; + LanguageIdentifier["SCSS"] = "scss"; + LanguageIdentifier["Sass"] = "syntax"; + LanguageIdentifier["Scala"] = "scala"; + LanguageIdentifier["ShaderLab"] = "shaderlab"; + LanguageIdentifier["Shell"] = "shellscript"; + LanguageIdentifier["SQL"] = "sql"; + LanguageIdentifier["Swift"] = "swift"; + LanguageIdentifier["TypeScript"] = "typescript"; + LanguageIdentifier["TypeScriptReact"] = "typescriptreact"; + LanguageIdentifier["TeX"] = "tex"; + LanguageIdentifier["VisualBasic"] = "vb"; + LanguageIdentifier["XML"] = "xml"; + LanguageIdentifier["XSL"] = "xsl"; + LanguageIdentifier["YAML"] = "yaml"; +})(LanguageIdentifier || (exports.LanguageIdentifier = LanguageIdentifier = {})); +/** + * How a completion was triggered + * https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion + */ +var CompletionTriggerKind; +(function (CompletionTriggerKind) { + /** + * Completion was triggered by typing an identifier (24x7 code + * complete), manual invocation (e.g Ctrl+Space) or via API. + */ + CompletionTriggerKind[CompletionTriggerKind["Invoked"] = 1] = "Invoked"; + /** + * Completion was triggered by a trigger character specified by + * the `triggerCharacters` properties of the + * `CompletionRegistrationOptions`. + */ + CompletionTriggerKind[CompletionTriggerKind["TriggerCharacter"] = 2] = "TriggerCharacter"; + /** + * Completion was re-triggered as the current completion list is incomplete. + */ + CompletionTriggerKind[CompletionTriggerKind["TriggerForIncompleteCompletions"] = 3] = "TriggerForIncompleteCompletions"; +})(CompletionTriggerKind || (exports.CompletionTriggerKind = CompletionTriggerKind = {})); +/** + * Defines how the host (editor) should sync document changes + * to the language server. + */ +var TextDocumentSyncKind; +(function (TextDocumentSyncKind) { + /** + * Documents should not be synced at all. + */ + TextDocumentSyncKind[TextDocumentSyncKind["None"] = 0] = "None"; + /** + * Documents are synced by always sending the full content + * of the document. + */ + TextDocumentSyncKind[TextDocumentSyncKind["Full"] = 1] = "Full"; + /** + * Documents are synced by sending the full content on open. + * After that only incremental updates to the document are + * send. + */ + TextDocumentSyncKind[TextDocumentSyncKind["Incremental"] = 2] = "Incremental"; +})(TextDocumentSyncKind || (exports.TextDocumentSyncKind = TextDocumentSyncKind = {})); +/** + * The kind of a code action. + * + * Kinds are a hierarchical list of identifiers separated by `.`, + * e.g. `"refactor.extract.function"`. + * + * The set of kinds is open and the client needs to announce the kinds it + * supports to the server during initialization. + */ +var CodeActionKind; +(function (CodeActionKind) { + /** + * Empty kind. + */ + CodeActionKind["Empty"] = ""; + /** + * Base kind for quickfix actions: 'quickfix'. + */ + CodeActionKind["QuickFix"] = "quickfix"; + /** + * Base kind for refactoring actions: 'refactor'. + */ + CodeActionKind["Refactor"] = "refactor"; + /** + * Base kind for refactoring extraction actions: 'refactor.extract'. + * + * Example extract actions: + * + * - Extract method + * - Extract function + * - Extract variable + * - Extract interface from class + * - ... + */ + CodeActionKind["RefactorExtract"] = "refactor.extract"; + /** + * Base kind for refactoring inline actions: 'refactor.inline'. + * + * Example inline actions: + * + * - Inline function + * - Inline variable + * - Inline constant + * - ... + */ + CodeActionKind["RefactorInline"] = "refactor.inline"; + /** + * Base kind for refactoring rewrite actions: 'refactor.rewrite'. + * + * Example rewrite actions: + * + * - Convert JavaScript function to class + * - Add or remove parameter + * - Encapsulate field + * - Make method static + * - Move method to base class + * - ... + */ + CodeActionKind["RefactorRewrite"] = "refactor.rewrite"; + /** + * Base kind for source actions: `source`. + * + * Source code actions apply to the entire file. + */ + CodeActionKind["Source"] = "source"; + /** + * Base kind for an organize imports source action `source.organizeImports`. + */ + CodeActionKind["SourceOrganizeImports"] = "source.organizeImports"; +})(CodeActionKind || (exports.CodeActionKind = CodeActionKind = {})); +/** + * Defines whether the insert text in a completion item should be interpreted as + * plain text or a snippet. + */ +var InsertTextFormat; +(function (InsertTextFormat) { + /** + * The primary text to be inserted is treated as a plain string. + */ + InsertTextFormat[InsertTextFormat["PlainText"] = 1] = "PlainText"; + /** + * The primary text to be inserted is treated as a snippet. + * + * A snippet can define tab stops and placeholders with `$1`, `$2` + * and `${3:foo}`. `$0` defines the final tab stop, it defaults to + * the end of the snippet. Placeholders with equal identifiers are linked, + * that is typing in one will update others too. + */ + InsertTextFormat[InsertTextFormat["Snippet"] = 2] = "Snippet"; +})(InsertTextFormat || (exports.InsertTextFormat = InsertTextFormat = {})); +/** + * How whitespace and indentation is handled during completion + * item insertion. + * + * @since 3.16.0 + */ +var InsertTextMode; +(function (InsertTextMode) { + /** + * The insertion or replace strings is taken as it is. If the + * value is multi line the lines below the cursor will be + * inserted using the indentation defined in the string value. + * The client will not apply any kind of adjustments to the + * string. + */ + InsertTextMode[InsertTextMode["asIs"] = 1] = "asIs"; + /** + * The editor adjusts leading whitespace of new lines so that + * they match the indentation up to the cursor of the line for + * which the item is accepted. + * + * Consider a line like this: <2tabs><3tabs>foo. Accepting a + * multi line completion item is indented using 2 tabs and all + * following lines inserted will be indented using 2 tabs as well. + */ + InsertTextMode[InsertTextMode["adjustIndentation"] = 2] = "adjustIndentation"; +})(InsertTextMode || (exports.InsertTextMode = InsertTextMode = {})); +/** + * How a signature help was triggered. + * + * @since 3.15.0 + */ +var SignatureHelpTriggerKind; +(function (SignatureHelpTriggerKind) { + /** + * Signature help was invoked manually by the user or by a command. + */ + SignatureHelpTriggerKind[SignatureHelpTriggerKind["Invoked"] = 1] = "Invoked"; + /** + * Signature help was triggered by a trigger character. + */ + SignatureHelpTriggerKind[SignatureHelpTriggerKind["TriggerCharacter"] = 2] = "TriggerCharacter"; + /** + * Signature help was triggered by the cursor moving or by the document + * content changing. + */ + SignatureHelpTriggerKind[SignatureHelpTriggerKind["ContentChange"] = 3] = "ContentChange"; +})(SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = SignatureHelpTriggerKind = {})); +/** + * Inlay hint kinds. + * + * @since 3.17.0 + */ +var InlayHintKind; +(function (InlayHintKind) { + InlayHintKind[InlayHintKind["Empty"] = 0] = "Empty"; + /** + * An inlay hint that for a type annotation. + */ + InlayHintKind[InlayHintKind["Type"] = 1] = "Type"; + /** + * An inlay hint that is for a parameter. + */ + InlayHintKind[InlayHintKind["Parameter"] = 2] = "Parameter"; +})(InlayHintKind || (exports.InlayHintKind = InlayHintKind = {})); +// tslint:enable:enforce-name-casing +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGV4dF9kb2N1bWVudF9ub2RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vZ2VuZmlsZXMvdGhpcmRfcGFydHkvY29sYWIvc291cmNlcy9sc3AvdGV4dF9kb2N1bWVudF9ub2RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQThOQTs7Ozs7O0dBTUc7QUFDSCxJQUFZLFVBVVg7QUFWRCxXQUFZLFVBQVU7SUFDcEI7O09BRUc7SUFDSCxxQ0FBdUIsQ0FBQTtJQUV2Qjs7T0FFRztJQUNILG1DQUFxQixDQUFBO0FBQ3ZCLENBQUMsRUFWVyxVQUFVLDBCQUFWLFVBQVUsUUFVckI7QUFrQkQ7Ozs7O0dBS0c7QUFDSCxJQUFZLGlCQUtYO0FBTEQsV0FBWSxpQkFBaUI7SUFDM0I7O09BRUc7SUFDSCxxRUFBYyxDQU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CBpdHNlbGYuIFRoYXQgbWVhbnMgcGFkZGluZyBjYW4gYmUgdXNlZFxuICAgKiB0byB2aXN1YWxseSBhbGlnbi9zZXBhcmF0ZSBhbiBpbmxheSBoaW50LlxuICAgKi9cbiAgcGFkZGluZ0xlZnQ/OiBib29sZWFuO1xuXG4gIC8qKlxuICAgKiBSZW5kZXIgcGFkZGluZyBhZnRlciB0aGUgaGludC5cbiAgICpcbiAgICogTm90ZTogUGFkZGluZyBzaG91bGQgdXNlIHRoZSBlZGl0b3IncyBiYWNrZ3JvdW5kIGNvbG9yLCBub3QgdGhlXG4gICAqIGJhY2tncm91bmQgY29sb3Igb2YgdGhlIGhpbnQgaXRzZWxmLiBUaGF0IG1lYW5zIHBhZGRpbmcgY2FuIGJlIHVzZWRcbiAgICogdG8gdmlzdWFsbHkgYWxpZ24vc2VwYXJhdGUgYW4gaW5sYXkgaGludC5cbiAgICovXG4gIHBhZGRpbmdSaWdodD86IGJvb2xlYW47XG5cblxuICAvKipcbiAgICogQSBkYXRhIGVudHJ5IGZpZWxkIHRoYXQgaXMgcHJlc2VydmVkIG9uIGFuIGlubGF5IGhpbnQgYmV0d2VlblxuICAgKiBhIGB0ZXh0RG9jdW1lbnQvaW5sYXlIaW50YCBhbmQgYSBgaW5sYXlIaW50L3Jlc29sdmVgIHJlcXVlc3QuXG4gICAqL1xuICBkYXRhPzogdW5rbm93bjtcbn1cbi8vIHRzbGludDplbmFibGU6ZW5mb3JjZS1uYW1lLWNhc2luZ1xuIl19 \ No newline at end of file diff --git a/datalab/web/lsp/window_node.js b/datalab/web/lsp/window_node.js new file mode 100644 index 0000000000000000000000000000000000000000..e0c77ec23d9ab36dc83caf59cec7602e318c075b --- /dev/null +++ b/datalab/web/lsp/window_node.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MessageType = void 0; +/** Log message type. */ +var MessageType; +(function (MessageType) { + /** + * An error message. + */ + MessageType[MessageType["Error"] = 1] = "Error"; + /** + * A warning message. + */ + MessageType[MessageType["Warning"] = 2] = "Warning"; + /** + * An information message. + */ + MessageType[MessageType["Info"] = 3] = "Info"; + /** + * A log message. + */ + MessageType[MessageType["Log"] = 4] = "Log"; +})(MessageType || (exports.MessageType = MessageType = {})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2luZG93X25vZGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9nZW5maWxlcy90aGlyZF9wYXJ0eS9jb2xhYi9zb3VyY2VzL2xzcC93aW5kb3dfbm9kZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUErQkEsd0JBQXdCO0FBQ3hCLElBQVksV0FpQlg7QUFqQkQsV0FBWSxXQUFXO0lBQ3JCOztPQUVHO0lBQ0gsK0NBQVMsQ0FBQTtJQUNUOztPQUVHO0lBQ0gsbURBQVcsQ0FBQTtJQUNYOztPQUVHO0lBQ0gsNkNBQVEsQ0FBQTtJQUNSOztPQUVHO0lBQ0gsMkNBQU8sQ0FBQTtBQUNULENBQUMsRUFqQlcsV0FBVywyQkFBWCxXQUFXLFFBaUJ0QiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIHByb3RvY29sIGZyb20gJy4vcHJvdG9jb2xfbm9kZSc7XG5cbi8vIHRzbGludDpkaXNhYmxlOmVuZm9yY2UtbmFtZS1jYXNpbmdcblxuLyoqXG4gKiBUaGUgbG9nIG1lc3NhZ2Ugbm90aWZpY2F0aW9uIGlzIHNlbnQgZnJvbSB0aGUgc2VydmVyIHRvIHRoZSBjbGllbnQgdG8gYXNrIHRoZVxuICogY2xpZW50IHRvIGxvZyBhIHBhcnRpY3VsYXIgbWVzc2FnZS5cbiAqIGh0dHBzOi8vbWljcm9zb2Z0LmdpdGh1Yi5pby9sYW5ndWFnZS1zZXJ2ZXItcHJvdG9jb2wvc3BlY2lmaWNhdG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IEFuIGluZm9ybWF0aW9uIG1lc3NhZ2UuXG4gICAqL1xuICBJbmZvID0gMyxcbiAgLyoqXG4gICAqIEEgbG9nIG1lc3NhZ2UuXG4gICAqL1xuICBMb2cgPSA0LFxufVxuIl19 \ No newline at end of file diff --git a/datalab/web/lsp/workspace_node.js b/datalab/web/lsp/workspace_node.js new file mode 100644 index 0000000000000000000000000000000000000000..1911a73b01e85d4800f87714e155a39176e2105e --- /dev/null +++ b/datalab/web/lsp/workspace_node.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FileChangeType = exports.WatchKind = void 0; +/** + * See: + * https://microsoft.github.io/language-server-protocol/specification#workspace_didChangeWatchedFiles + */ +var WatchKind; +(function (WatchKind) { + /** + * Interested in create events. + */ + WatchKind[WatchKind["Create"] = 1] = "Create"; + /** + * Interested in change events + */ + WatchKind[WatchKind["Change"] = 2] = "Change"; + /** + * Interested in delete events + */ + WatchKind[WatchKind["Delete"] = 4] = "Delete"; +})(WatchKind || (exports.WatchKind = WatchKind = {})); +/** + * The file event type. + */ +var FileChangeType; +(function (FileChangeType) { + /** + * The file got created. + */ + FileChangeType[FileChangeType["Created"] = 1] = "Created"; + /** + * The file got changed. + */ + FileChangeType[FileChangeType["Changed"] = 2] = "Changed"; + /** + * The file got deleted. + */ + FileChangeType[FileChangeType["Deleted"] = 3] = "Deleted"; +})(FileChangeType || (exports.FileChangeType = FileChangeType = {})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya3NwYWNlX25vZGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9nZW5maWxlcy90aGlyZF9wYXJ0eS9jb2xhYi9zb3VyY2VzL2xzcC93b3Jrc3BhY2Vfbm9kZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFpVEE7OztHQUdHO0FBQ0gsSUFB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UaGUgY2hhbmdlIHR5cGUuXG4gICAqL1xuICB0eXBlOiBGaWxlQ2hhbmdlVHlwZTtcbn1cblxuLyoqXG4gKiBUaGUgZmlsZSBldmVudCB0eXBlLlxuICovXG5leHBvcnQgZW51bSBGaWxlQ2hhbmdlVHlwZSB7XG4gIC8qKlxuICAgKiBUaGUgZmlsZSBnb3QgY3JlYXRlZC5cbiAgICovXG4gIENyZWF0ZWQgPSAxLFxuICAvKipcbiAgICogVGhlIGZpbGUgZ290IGNoYW5nZWQuXG4gICAqL1xuICBDaGFuZ2VkID0gMixcbiAgLyoqXG4gICAqIFRoZSBmaWxlIGdvdCBkZWxldGVkLlxuICAgKi9cbiAgRGVsZXRlZCA9IDMsXG59XG4iXX0= \ No newline at end of file diff --git a/datalab/web/node_modules/.bin/bunyan b/datalab/web/node_modules/.bin/bunyan new file mode 100644 index 0000000000000000000000000000000000000000..62b8f7f0d3753ec8f262d3fcdb2dd8ba68b37fdc --- /dev/null +++ b/datalab/web/node_modules/.bin/bunyan @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb97ac3eee1e35dfbaa2025aa5bb391bbe5adcbe7305a32d6f6e6cdbe1879ac9 +size 56829 diff --git a/datalab/web/node_modules/.bin/mkdirp b/datalab/web/node_modules/.bin/mkdirp new file mode 100644 index 0000000000000000000000000000000000000000..0abafe5cad113e8935f3e4072f8917ff6362fc16 --- /dev/null +++ b/datalab/web/node_modules/.bin/mkdirp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24b028bccb1773f02cf0d0fb3dca5468f1b5d22a06cbc5cbf351e1eb3accefb1 +size 731 diff --git a/datalab/web/node_modules/.bin/ncp b/datalab/web/node_modules/.bin/ncp new file mode 100644 index 0000000000000000000000000000000000000000..ed4b7089c2d4e07de9a3d9a6c19fab9e105a8601 --- /dev/null +++ b/datalab/web/node_modules/.bin/ncp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7ca0417a675931d7d4f549009af66f25b47ea5a07e6ddcd85efb712afba3178 +size 1084 diff --git a/datalab/web/node_modules/.bin/rimraf b/datalab/web/node_modules/.bin/rimraf new file mode 100644 index 0000000000000000000000000000000000000000..fe6473b34628ce19ef2aea5a31039ad1bee0bb3f --- /dev/null +++ b/datalab/web/node_modules/.bin/rimraf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a1557fb195dd6ba967235a93927f74e0452b913425c713bcabdeaee9f62d189 +size 838 diff --git a/datalab/web/node_modules/.bin/semver b/datalab/web/node_modules/.bin/semver new file mode 100644 index 0000000000000000000000000000000000000000..322dac5e210a7e79a8f1f1012f792e7d94fbe6cb --- /dev/null +++ b/datalab/web/node_modules/.bin/semver @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5c53c713df57d8bdfd03f00e758b5b6a3f51e91a44eb888065394c0deb0da51 +size 4784 diff --git a/datalab/web/node_modules/.package-lock.json b/datalab/web/node_modules/.package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..b4432f4af9b6595625bf2713447ba2509dbec6d1 --- /dev/null +++ b/datalab/web/node_modules/.package-lock.json @@ -0,0 +1,634 @@ +{ + "name": "ipy-rev-proxy", + "lockfileVersion": 2, + "requires": true, + "packages": { + "node_modules/accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "dependencies": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" + }, + "node_modules/arraybuffer.slice": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" + }, + "node_modules/async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + }, + "node_modules/async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "node_modules/backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" + }, + "node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "optional": true + }, + "node_modules/base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/base64id": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", + "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "dependencies": { + "callsite": "1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/blob": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", + "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "optional": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/bunyan": { + "version": "1.8.12", + "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.12.tgz", + "integrity": "sha1-8VDw9nSKvdcq6uhPBEA74u8RN5c=", + "engines": [ + "node >=0.10.0" + ], + "bin": { + "bunyan": "bin/bunyan" + }, + "optionalDependencies": { + "dtrace-provider": "~0.8", + "moment": "^2.10.6", + "mv": "~2", + "safe-json-stringify": "~1" + } + }, + "node_modules/bunyan-rotating-file-stream": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/bunyan-rotating-file-stream/-/bunyan-rotating-file-stream-1.6.3.tgz", + "integrity": "sha512-pJFBvosqXjYXsOtDr72SDhZr3d+1ADDBO8TiU0ju0DbNBS4+vjI3GatczzB7LCcBWqWevQ91j1HYsl8cgnI+HQ==", + "engines": [ + "node >=0.10.0" + ], + "dependencies": { + "async": "^1.5.2", + "lodash": "^4.2.1", + "semver": "^5.1.0", + "strftime": "^0.9.2" + } + }, + "node_modules/callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", + "engines": { + "node": "*" + } + }, + "node_modules/component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" + }, + "node_modules/component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, + "node_modules/component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "optional": true + }, + "node_modules/cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/dtrace-provider": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.7.tgz", + "integrity": "sha1-3JObTT4GIM/gwc2APQ0tftBP/QQ=", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "nan": "^2.10.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/engine.io": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.2.0.tgz", + "integrity": "sha512-mRbgmAtQ4GAlKwuPnnAvXXwdPhEx+jkc0OBCLrXuD/CRvwNK3AxRSnqK4FSqmAMRRHryVJP8TopOvmEaA64fKw==", + "dependencies": { + "accepts": "~1.3.4", + "base64id": "1.0.0", + "cookie": "0.3.1", + "debug": "~3.1.0", + "engine.io-parser": "~2.1.0", + "ws": "~3.3.1" + } + }, + "node_modules/engine.io-client": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.2.1.tgz", + "integrity": "sha512-y5AbkytWeM4jQr7m/koQLc5AxpRKC1hEVUb/s1FUAWEJq5AzJJ4NLvzuKPuxtDi5Mq755WuDvZ6Iv2rXj4PTzw==", + "dependencies": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "~3.1.0", + "engine.io-parser": "~2.1.1", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "~3.3.1", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + } + }, + "node_modules/engine.io-client/node_modules/ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "dependencies": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "node_modules/engine.io-parser": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.1.2.tgz", + "integrity": "sha512-dInLFzr80RijZ1rGpx1+56/uFoH7/7InhH3kZt+Ms6hT8tNx3NGW/WNSA/f8As1WkOfkuyb3tnRyuXGxusclMw==", + "dependencies": { + "after": "0.8.2", + "arraybuffer.slice": "~0.0.7", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.4", + "has-binary2": "~1.0.2" + } + }, + "node_modules/engine.io/node_modules/ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "dependencies": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "node_modules/eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" + }, + "node_modules/follow-redirects": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.1.tgz", + "integrity": "sha512-v9GI1hpaqq1ZZR6pBD1+kI7O24PhDvNGNodjS3MdcEqyrahCp8zbtpv+2B/krUnSmUH80lbAS7MrdeK5IylgKg==", + "dependencies": { + "debug": "^3.1.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/glob": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "deprecated": "Glob versions prior to v9 are no longer supported", + "optional": true, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/has-binary2": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "dependencies": { + "isarray": "2.0.1" + } + }, + "node_modules/has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" + }, + "node_modules/http-proxy": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", + "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", + "dependencies": { + "eventemitter3": "^3.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "optional": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "optional": true + }, + "node_modules/isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + }, + "node_modules/lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + }, + "node_modules/mime-db": { + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "dependencies": { + "mime-db": "~1.35.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "optional": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "optional": true + }, + "node_modules/mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "optional": true, + "dependencies": { + "minimist": "0.0.8" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/moment": { + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=", + "optional": true, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/mv": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/mv/-/mv-2.1.1.tgz", + "integrity": "sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI=", + "optional": true, + "dependencies": { + "mkdirp": "~0.5.1", + "ncp": "~2.0.0", + "rimraf": "~2.4.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "optional": true + }, + "node_modules/ncp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", + "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", + "optional": true, + "bin": { + "ncp": "bin/ncp" + } + }, + "node_modules/negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-pty": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.9.0.tgz", + "integrity": "sha512-MBnCQl83FTYOu7B4xWw10AW77AAh7ThCE1VXEv+JeWj8mSpGo+0bwgsV+b23ljBFwEM9OmsOv3kM27iUPPm84g==", + "hasInstallScript": true, + "dependencies": { + "nan": "^2.14.0" + } + }, + "node_modules/node-pty/node_modules/nan": { + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==" + }, + "node_modules/object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "optional": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/options": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", + "integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "dependencies": { + "better-assert": "~1.0.0" + } + }, + "node_modules/parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "dependencies": { + "better-assert": "~1.0.0" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + }, + "node_modules/rimraf": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", + "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "optional": true, + "dependencies": { + "glob": "^6.0.1" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/safe-json-stringify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz", + "integrity": "sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==", + "optional": true + }, + "node_modules/semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/socket.io": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.1.1.tgz", + "integrity": "sha512-rORqq9c+7W0DAK3cleWNSyfv/qKXV99hV4tZe+gGLfBECw3XEhBy7x85F3wypA9688LKjtwO9pX9L33/xQI8yA==", + "dependencies": { + "debug": "~3.1.0", + "engine.io": "~3.2.0", + "has-binary2": "~1.0.2", + "socket.io-adapter": "~1.1.0", + "socket.io-client": "2.1.1", + "socket.io-parser": "~3.2.0" + } + }, + "node_modules/socket.io-adapter": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz", + "integrity": "sha1-KoBeihTWNyEk3ZFZrUUC+MsH8Gs=" + }, + "node_modules/socket.io-client": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.1.1.tgz", + "integrity": "sha512-jxnFyhAuFxYfjqIgduQlhzqTcOEQSn+OHKVfAxWaNWa7ecP7xSNk2Dx/3UEsDcY7NcFafxvNvKPmmO7HTwTxGQ==", + "dependencies": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "engine.io-client": "~3.2.0", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.2.0", + "to-array": "0.1.4" + } + }, + "node_modules/socket.io-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.2.0.tgz", + "integrity": "sha512-FYiBx7rc/KORMJlgsXysflWx/RIvtqZbyGLlHZvjfmPTPeuD/I8MaW7cfFrj5tRltICJdgwflhfZ3NVVbVLFQA==", + "dependencies": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "isarray": "2.0.1" + } + }, + "node_modules/strftime": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/strftime/-/strftime-0.9.2.tgz", + "integrity": "sha1-vMooYfKUVtNyqvaheBHIvG859YM=", + "engines": { + "node": ">=0.2.0" + } + }, + "node_modules/to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" + }, + "node_modules/ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "optional": true + }, + "node_modules/ws": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-1.1.4.tgz", + "integrity": "sha1-V/QNA2gy5fUFVmKjl8Tedu1mv2E=", + "dependencies": { + "options": ">=0.0.5", + "ultron": "1.0.x" + } + }, + "node_modules/ws/node_modules/ultron": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz", + "integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po=" + }, + "node_modules/xmlhttprequest-ssl": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" + } + } +} diff --git a/datalab/web/node_modules/accepts/HISTORY.md b/datalab/web/node_modules/accepts/HISTORY.md new file mode 100644 index 0000000000000000000000000000000000000000..f16c17a569a22adf1ca7732c1f93c208726e27bb --- /dev/null +++ b/datalab/web/node_modules/accepts/HISTORY.md @@ -0,0 +1,224 @@ +1.3.5 / 2018-02-28 +================== + + * deps: mime-types@~2.1.18 + - deps: mime-db@~1.33.0 + +1.3.4 / 2017-08-22 +================== + + * deps: mime-types@~2.1.16 + - deps: mime-db@~1.29.0 + +1.3.3 / 2016-05-02 +================== + + * deps: mime-types@~2.1.11 + - deps: mime-db@~1.23.0 + * deps: negotiator@0.6.1 + - perf: improve `Accept` parsing speed + - perf: improve `Accept-Charset` parsing speed + - perf: improve `Accept-Encoding` parsing speed + - perf: improve `Accept-Language` parsing speed + +1.3.2 / 2016-03-08 +================== + + * deps: mime-types@~2.1.10 + - Fix extension of `application/dash+xml` + - Update primary extension for `audio/mp4` + - deps: mime-db@~1.22.0 + +1.3.1 / 2016-01-19 +================== + + * deps: mime-types@~2.1.9 + - deps: mime-db@~1.21.0 + +1.3.0 / 2015-09-29 +================== + + * deps: mime-types@~2.1.7 + - deps: mime-db@~1.19.0 + * deps: negotiator@0.6.0 + - Fix including type extensions in parameters in `Accept` parsing + - Fix parsing `Accept` parameters with quoted equals + - Fix parsing `Accept` parameters with quoted semicolons + - Lazy-load modules from main entry point + - perf: delay type concatenation until needed + - perf: enable strict mode + - perf: hoist regular expressions + - perf: remove closures getting spec properties + - perf: remove a closure from media type parsing + - perf: remove property delete from media type parsing + +1.2.13 / 2015-09-06 +=================== + + * deps: mime-types@~2.1.6 + - deps: mime-db@~1.18.0 + +1.2.12 / 2015-07-30 +=================== + + * deps: mime-types@~2.1.4 + - deps: mime-db@~1.16.0 + +1.2.11 / 2015-07-16 +=================== + + * deps: mime-types@~2.1.3 + - deps: mime-db@~1.15.0 + +1.2.10 / 2015-07-01 +=================== + + * deps: mime-types@~2.1.2 + - deps: mime-db@~1.14.0 + +1.2.9 / 2015-06-08 +================== + + * deps: mime-types@~2.1.1 + - perf: fix deopt during mapping + +1.2.8 / 2015-06-07 +================== + + * deps: mime-types@~2.1.0 + - deps: mime-db@~1.13.0 + * perf: avoid argument reassignment & argument slice + * perf: avoid negotiator recursive construction + * perf: enable strict mode + * perf: remove unnecessary bitwise operator + +1.2.7 / 2015-05-10 +================== + + * deps: negotiator@0.5.3 + - Fix media type parameter matching to be case-insensitive + +1.2.6 / 2015-05-07 +================== + + * deps: mime-types@~2.0.11 + - deps: mime-db@~1.9.1 + * deps: negotiator@0.5.2 + - Fix comparing media types with quoted values + - Fix splitting media types with quoted commas + +1.2.5 / 2015-03-13 +================== + + * deps: mime-types@~2.0.10 + - deps: mime-db@~1.8.0 + +1.2.4 / 2015-02-14 +================== + + * Support Node.js 0.6 + * deps: mime-types@~2.0.9 + - deps: mime-db@~1.7.0 + * deps: negotiator@0.5.1 + - Fix preference sorting to be stable for long acceptable lists + +1.2.3 / 2015-01-31 +================== + + * deps: mime-types@~2.0.8 + - deps: mime-db@~1.6.0 + +1.2.2 / 2014-12-30 +================== + + * deps: mime-types@~2.0.7 + - deps: mime-db@~1.5.0 + +1.2.1 / 2014-12-30 +================== + + * deps: mime-types@~2.0.5 + - deps: mime-db@~1.3.1 + +1.2.0 / 2014-12-19 +================== + + * deps: negotiator@0.5.0 + - Fix list return order when large accepted list + - Fix missing identity encoding when q=0 exists + - Remove dynamic building of Negotiator class + +1.1.4 / 2014-12-10 +================== + + * deps: mime-types@~2.0.4 + - deps: mime-db@~1.3.0 + +1.1.3 / 2014-11-09 +================== + + * deps: mime-types@~2.0.3 + - deps: mime-db@~1.2.0 + +1.1.2 / 2014-10-14 +================== + + * deps: negotiator@0.4.9 + - Fix error when media type has invalid parameter + +1.1.1 / 2014-09-28 +================== + + * deps: mime-types@~2.0.2 + - deps: mime-db@~1.1.0 + * deps: negotiator@0.4.8 + - Fix all negotiations to be case-insensitive + - Stable sort preferences of same quality according to client order + +1.1.0 / 2014-09-02 +================== + + * update `mime-types` + +1.0.7 / 2014-07-04 +================== + + * Fix wrong type returned from `type` when match after unknown extension + +1.0.6 / 2014-06-24 +================== + + * deps: negotiator@0.4.7 + +1.0.5 / 2014-06-20 +================== + + * fix crash when unknown extension given + +1.0.4 / 2014-06-19 +================== + + * use `mime-types` + +1.0.3 / 2014-06-11 +================== + + * deps: negotiator@0.4.6 + - Order by specificity when quality is the same + +1.0.2 / 2014-05-29 +================== + + * Fix interpretation when header not in request + * deps: pin negotiator@0.4.5 + +1.0.1 / 2014-01-18 +================== + + * Identity encoding isn't always acceptable + * deps: negotiator@~0.4.0 + +1.0.0 / 2013-12-27 +================== + + * Genesis diff --git a/datalab/web/node_modules/accepts/LICENSE b/datalab/web/node_modules/accepts/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..06166077be4d1f620d89b9eb33c76d89e75857da --- /dev/null +++ b/datalab/web/node_modules/accepts/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2015 Douglas Christopher Wilson + +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. diff --git a/datalab/web/node_modules/accepts/README.md b/datalab/web/node_modules/accepts/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6a2749a1a817dc31f701a762f3b5e4db838f0bb7 --- /dev/null +++ b/datalab/web/node_modules/accepts/README.md @@ -0,0 +1,143 @@ +# accepts + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). +Extracted from [koa](https://www.npmjs.com/package/koa) for general use. + +In addition to negotiator, it allows: + +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` + as well as `('text/html', 'application/json')`. +- Allows type shorthands such as `json`. +- Returns `false` when no types match +- Treats non-existent headers as `*` + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install accepts +``` + +## API + + + +```js +var accepts = require('accepts') +``` + +### accepts(req) + +Create a new `Accepts` object for the given `req`. + +#### .charset(charsets) + +Return the first accepted charset. If nothing in `charsets` is accepted, +then `false` is returned. + +#### .charsets() + +Return the charsets that the request accepts, in the order of the client's +preference (most preferred first). + +#### .encoding(encodings) + +Return the first accepted encoding. If nothing in `encodings` is accepted, +then `false` is returned. + +#### .encodings() + +Return the encodings that the request accepts, in the order of the client's +preference (most preferred first). + +#### .language(languages) + +Return the first accepted language. If nothing in `languages` is accepted, +then `false` is returned. + +#### .languages() + +Return the languages that the request accepts, in the order of the client's +preference (most preferred first). + +#### .type(types) + +Return the first accepted type (and it is returned as the same text as what +appears in the `types` array). If nothing in `types` is accepted, then `false` +is returned. + +The `types` array can contain full MIME types or file extensions. Any value +that is not a full MIME types is passed to `require('mime-types').lookup`. + +#### .types() + +Return the types that the request accepts, in the order of the client's +preference (most preferred first). + +## Examples + +### Simple type negotiation + +This simple example shows how to use `accepts` to return a different typed +respond body based on what the client wants to accept. The server lists it's +preferences in order and will get back the best match between the client and +server. + +```js +var accepts = require('accepts') +var http = require('http') + +function app (req, res) { + var accept = accepts(req) + + // the order of this list is significant; should be server preferred order + switch (accept.type(['json', 'html'])) { + case 'json': + res.setHeader('Content-Type', 'application/json') + res.write('{"hello":"world!"}') + break + case 'html': + res.setHeader('Content-Type', 'text/html') + res.write('hello, world!') + break + default: + // the fallback is text/plain, so no need to specify it above + res.setHeader('Content-Type', 'text/plain') + res.write('hello, world!') + break + } + + res.end() +} + +http.createServer(app).listen(3000) +``` + +You can test this out with the cURL program: +```sh +curl -I -H'Accept: text/html' http://localhost:3000/ +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/accepts.svg +[npm-url]: https://npmjs.org/package/accepts +[node-version-image]: https://img.shields.io/node/v/accepts.svg +[node-version-url]: https://nodejs.org/en/download/ +[travis-image]: https://img.shields.io/travis/jshttp/accepts/master.svg +[travis-url]: https://travis-ci.org/jshttp/accepts +[coveralls-image]: https://img.shields.io/coveralls/jshttp/accepts/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/accepts +[downloads-image]: https://img.shields.io/npm/dm/accepts.svg +[downloads-url]: https://npmjs.org/package/accepts diff --git a/datalab/web/node_modules/accepts/index.js b/datalab/web/node_modules/accepts/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e9b2f63fb16f8ecdeb16c8eced302612794ccf65 --- /dev/null +++ b/datalab/web/node_modules/accepts/index.js @@ -0,0 +1,238 @@ +/*! + * accepts + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var Negotiator = require('negotiator') +var mime = require('mime-types') + +/** + * Module exports. + * @public + */ + +module.exports = Accepts + +/** + * Create a new Accepts object for the given req. + * + * @param {object} req + * @public + */ + +function Accepts (req) { + if (!(this instanceof Accepts)) { + return new Accepts(req) + } + + this.headers = req.headers + this.negotiator = new Negotiator(req) +} + +/** + * Check if the given `type(s)` is acceptable, returning + * the best match when true, otherwise `undefined`, in which + * case you should respond with 406 "Not Acceptable". + * + * The `type` value may be a single mime type string + * such as "application/json", the extension name + * such as "json" or an array `["json", "html", "text/plain"]`. When a list + * or array is given the _best_ match, if any is returned. + * + * Examples: + * + * // Accept: text/html + * this.types('html'); + * // => "html" + * + * // Accept: text/*, application/json + * this.types('html'); + * // => "html" + * this.types('text/html'); + * // => "text/html" + * this.types('json', 'text'); + * // => "json" + * this.types('application/json'); + * // => "application/json" + * + * // Accept: text/*, application/json + * this.types('image/png'); + * this.types('png'); + * // => undefined + * + * // Accept: text/*;q=.5, application/json + * this.types(['html', 'json']); + * this.types('html', 'json'); + * // => "json" + * + * @param {String|Array} types... + * @return {String|Array|Boolean} + * @public + */ + +Accepts.prototype.type = +Accepts.prototype.types = function (types_) { + var types = types_ + + // support flattened arguments + if (types && !Array.isArray(types)) { + types = new Array(arguments.length) + for (var i = 0; i < types.length; i++) { + types[i] = arguments[i] + } + } + + // no types, return all requested types + if (!types || types.length === 0) { + return this.negotiator.mediaTypes() + } + + // no accept header, return first given type + if (!this.headers.accept) { + return types[0] + } + + var mimes = types.map(extToMime) + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime)) + var first = accepts[0] + + return first + ? types[mimes.indexOf(first)] + : false +} + +/** + * Return accepted encodings or best fit based on `encodings`. + * + * Given `Accept-Encoding: gzip, deflate` + * an array sorted by quality is returned: + * + * ['gzip', 'deflate'] + * + * @param {String|Array} encodings... + * @return {String|Array} + * @public + */ + +Accepts.prototype.encoding = +Accepts.prototype.encodings = function (encodings_) { + var encodings = encodings_ + + // support flattened arguments + if (encodings && !Array.isArray(encodings)) { + encodings = new Array(arguments.length) + for (var i = 0; i < encodings.length; i++) { + encodings[i] = arguments[i] + } + } + + // no encodings, return all requested encodings + if (!encodings || encodings.length === 0) { + return this.negotiator.encodings() + } + + return this.negotiator.encodings(encodings)[0] || false +} + +/** + * Return accepted charsets or best fit based on `charsets`. + * + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5` + * an array sorted by quality is returned: + * + * ['utf-8', 'utf-7', 'iso-8859-1'] + * + * @param {String|Array} charsets... + * @return {String|Array} + * @public + */ + +Accepts.prototype.charset = +Accepts.prototype.charsets = function (charsets_) { + var charsets = charsets_ + + // support flattened arguments + if (charsets && !Array.isArray(charsets)) { + charsets = new Array(arguments.length) + for (var i = 0; i < charsets.length; i++) { + charsets[i] = arguments[i] + } + } + + // no charsets, return all requested charsets + if (!charsets || charsets.length === 0) { + return this.negotiator.charsets() + } + + return this.negotiator.charsets(charsets)[0] || false +} + +/** + * Return accepted languages or best fit based on `langs`. + * + * Given `Accept-Language: en;q=0.8, es, pt` + * an array sorted by quality is returned: + * + * ['es', 'pt', 'en'] + * + * @param {String|Array} langs... + * @return {Array|String} + * @public + */ + +Accepts.prototype.lang = +Accepts.prototype.langs = +Accepts.prototype.language = +Accepts.prototype.languages = function (languages_) { + var languages = languages_ + + // support flattened arguments + if (languages && !Array.isArray(languages)) { + languages = new Array(arguments.length) + for (var i = 0; i < languages.length; i++) { + languages[i] = arguments[i] + } + } + + // no languages, return all requested languages + if (!languages || languages.length === 0) { + return this.negotiator.languages() + } + + return this.negotiator.languages(languages)[0] || false +} + +/** + * Convert extnames to mime. + * + * @param {String} type + * @return {String} + * @private + */ + +function extToMime (type) { + return type.indexOf('/') === -1 + ? mime.lookup(type) + : type +} + +/** + * Check if mime is valid. + * + * @param {String} type + * @return {String} + * @private + */ + +function validMime (type) { + return typeof type === 'string' +} diff --git a/datalab/web/node_modules/accepts/package.json b/datalab/web/node_modules/accepts/package.json new file mode 100644 index 0000000000000000000000000000000000000000..517a162dc691ce47308f7ba772b55ab467182eea --- /dev/null +++ b/datalab/web/node_modules/accepts/package.json @@ -0,0 +1,46 @@ +{ + "name": "accepts", + "description": "Higher-level content negotiation", + "version": "1.3.5", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "repository": "jshttp/accepts", + "dependencies": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + }, + "devDependencies": { + "eslint": "4.18.1", + "eslint-config-standard": "11.0.0", + "eslint-plugin-import": "2.9.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "6.0.1", + "eslint-plugin-promise": "3.6.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "~1.21.5" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + }, + "keywords": [ + "content", + "negotiation", + "accept", + "accepts" + ] +} diff --git a/datalab/web/node_modules/after/.npmignore b/datalab/web/node_modules/after/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..6c7860241ddb048c41d4697a0b69e1fe6f8a4af1 --- /dev/null +++ b/datalab/web/node_modules/after/.npmignore @@ -0,0 +1,2 @@ +node_modules +.monitor diff --git a/datalab/web/node_modules/after/.travis.yml b/datalab/web/node_modules/after/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..afd72d0e5805e1c57d06b610288e70b5f1cdc399 --- /dev/null +++ b/datalab/web/node_modules/after/.travis.yml @@ -0,0 +1,12 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - 0.9 + - 0.10 + - 0.12 + - 4.2.4 + - 5.4.1 + - iojs-1 + - iojs-2 + - iojs-3 diff --git a/datalab/web/node_modules/after/LICENCE b/datalab/web/node_modules/after/LICENCE new file mode 100644 index 0000000000000000000000000000000000000000..7c351306835c316f71dd15d5845d8a4349dca5d9 --- /dev/null +++ b/datalab/web/node_modules/after/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2011 Raynos. + +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. \ No newline at end of file diff --git a/datalab/web/node_modules/after/README.md b/datalab/web/node_modules/after/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fc69096476c18aa29e78bb9d6dfd77c9be2e190d --- /dev/null +++ b/datalab/web/node_modules/after/README.md @@ -0,0 +1,115 @@ +# After [![Build Status][1]][2] + +Invoke callback after n calls + +## Status: production ready + +## Example + +```js +var after = require("after") +var db = require("./db") // some db. + +var updateUser = function (req, res) { + // use after to run two tasks in parallel, + // namely get request body and get session + // then run updateUser with the results + var next = after(2, updateUser) + var results = {} + + getJSONBody(req, res, function (err, body) { + if (err) return next(err) + + results.body = body + next(null, results) + }) + + getSessionUser(req, res, function (err, user) { + if (err) return next(err) + + results.user = user + next(null, results) + }) + + // now do the thing! + function updateUser(err, result) { + if (err) { + res.statusCode = 500 + return res.end("Unexpected Error") + } + + if (!result.user || result.user.role !== "admin") { + res.statusCode = 403 + return res.end("Permission Denied") + } + + db.put("users:" + req.params.userId, result.body, function (err) { + if (err) { + res.statusCode = 500 + return res.end("Unexpected Error") + } + + res.statusCode = 200 + res.end("Ok") + }) + } +} +``` + +## Naive Example + +```js +var after = require("after") + , next = after(3, logItWorks) + +next() +next() +next() // it works + +function logItWorks() { + console.log("it works!") +} +``` + +## Example with error handling + +```js +var after = require("after") + , next = after(3, logError) + +next() +next(new Error("oops")) // logs oops +next() // does nothing + +// This callback is only called once. +// If there is an error the callback gets called immediately +// this avoids the situation where errors get lost. +function logError(err) { + console.log(err) +} +``` + +## Installation + +`npm install after` + +## Tests + +`npm test` + +## Contributors + + - Raynos + - defunctzombie + +## MIT Licenced + + [1]: https://secure.travis-ci.org/Raynos/after.png + [2]: http://travis-ci.org/Raynos/after + [3]: http://raynos.org/blog/2/Flow-control-in-node.js + [4]: http://stackoverflow.com/questions/6852059/determining-the-end-of-asynchronous-operations-javascript/6852307#6852307 + [5]: http://stackoverflow.com/questions/6869872/in-javascript-what-are-best-practices-for-executing-multiple-asynchronous-functi/6870031#6870031 + [6]: http://stackoverflow.com/questions/6864397/javascript-performance-long-running-tasks/6889419#6889419 + [7]: http://stackoverflow.com/questions/6597493/synchronous-database-queries-with-node-js/6620091#6620091 + [8]: http://github.com/Raynos/iterators + [9]: http://github.com/Raynos/composite diff --git a/datalab/web/node_modules/after/index.js b/datalab/web/node_modules/after/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ec24879744f965746846317f84f2834a82297c85 --- /dev/null +++ b/datalab/web/node_modules/after/index.js @@ -0,0 +1,28 @@ +module.exports = after + +function after(count, callback, err_cb) { + var bail = false + err_cb = err_cb || noop + proxy.count = count + + return (count === 0) ? callback() : proxy + + function proxy(err, result) { + if (proxy.count <= 0) { + throw new Error('after called too many times') + } + --proxy.count + + // after first error, rest are passed to err_cb + if (err) { + bail = true + callback(err) + // future error callbacks will go to error handler + callback = err_cb + } else if (proxy.count === 0 && !bail) { + callback(null, result) + } + } +} + +function noop() {} diff --git a/datalab/web/node_modules/after/package.json b/datalab/web/node_modules/after/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b79796f777445f879522f5dfde599f56fb320c92 --- /dev/null +++ b/datalab/web/node_modules/after/package.json @@ -0,0 +1,28 @@ +{ + "name": "after", + "description": "after - tiny flow control", + "version": "0.8.2", + "author": "Raynos ", + "contributors": [ + { + "name": "Raynos", + "email": "raynos2@gmail.com", + "url": "http://raynos.org" + } + ], + "scripts": { + "test": "mocha --ui tdd --reporter spec test/*.js" + }, + "devDependencies": { + "mocha": "~1.8.1" + }, + "keywords": [ + "flowcontrol", + "after", + "flow", + "control", + "arch" + ], + "license": "MIT", + "repository": "git://github.com/Raynos/after.git" +} diff --git a/datalab/web/node_modules/after/test/after-test.js b/datalab/web/node_modules/after/test/after-test.js new file mode 100644 index 0000000000000000000000000000000000000000..0d63f4c24636cf7c3410714b6a512d375c1ca05f --- /dev/null +++ b/datalab/web/node_modules/after/test/after-test.js @@ -0,0 +1,120 @@ +/*global suite, test*/ + +var assert = require("assert") + , after = require("../") + +test("exists", function () { + assert(typeof after === "function", "after is not a function") +}) + +test("after when called with 0 invokes", function (done) { + after(0, done) +}); + +test("after 1", function (done) { + var next = after(1, done) + next() +}) + +test("after 5", function (done) { + var next = after(5, done) + , i = 5 + + while (i--) { + next() + } +}) + +test("manipulate count", function (done) { + var next = after(1, done) + , i = 5 + + next.count = i + while (i--) { + next() + } +}) + +test("after terminates on error", function (done) { + var next = after(2, function(err) { + assert.equal(err.message, 'test'); + done(); + }) + next(new Error('test')) + next(new Error('test2')) +}) + +test('gee', function(done) { + done = after(2, done) + + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + assert.equal(err.message, 2) + done() + }); + + next() + next(new Error(1)) + next(new Error(2)) +}) + +test('eee', function(done) { + done = after(3, done) + + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + assert.equal(err.message, 2) + done() + }); + + next(new Error(1)) + next(new Error(2)) + next(new Error(2)) +}) + +test('gge', function(done) { + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + // should not happen + assert.ok(false); + }); + + next() + next() + next(new Error(1)) +}) + +test('egg', function(done) { + function cb(err) { + assert.equal(err.message, 1); + done() + } + + var next = after(3, cb, function(err) { + // should not happen + assert.ok(false); + }); + + next(new Error(1)) + next() + next() +}) + +test('throws on too many calls', function(done) { + var next = after(1, done); + next() + assert.throws(next, /after called too many times/); +}); + diff --git a/datalab/web/node_modules/arraybuffer.slice/.npmignore b/datalab/web/node_modules/arraybuffer.slice/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..cfbee8d8bdcb2e512928c3132c010816ecaa9b97 --- /dev/null +++ b/datalab/web/node_modules/arraybuffer.slice/.npmignore @@ -0,0 +1,17 @@ +lib-cov +lcov.info +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results +build +.grunt + +node_modules diff --git a/datalab/web/node_modules/arraybuffer.slice/LICENCE b/datalab/web/node_modules/arraybuffer.slice/LICENCE new file mode 100644 index 0000000000000000000000000000000000000000..35fa37590d20542b2e7220e7340ffd686c5596a9 --- /dev/null +++ b/datalab/web/node_modules/arraybuffer.slice/LICENCE @@ -0,0 +1,18 @@ +Copyright (C) 2013 Rase- + +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. diff --git a/datalab/web/node_modules/arraybuffer.slice/Makefile b/datalab/web/node_modules/arraybuffer.slice/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..849887f7fafa87e356e644f284781a040009f4b9 --- /dev/null +++ b/datalab/web/node_modules/arraybuffer.slice/Makefile @@ -0,0 +1,8 @@ + +REPORTER = dot + +test: + @./node_modules/.bin/mocha \ + --reporter $(REPORTER) + +.PHONY: test diff --git a/datalab/web/node_modules/arraybuffer.slice/README.md b/datalab/web/node_modules/arraybuffer.slice/README.md new file mode 100644 index 0000000000000000000000000000000000000000..15e465efca541cd721a9311b94cb60340ca4c28f --- /dev/null +++ b/datalab/web/node_modules/arraybuffer.slice/README.md @@ -0,0 +1,17 @@ +# How to +```javascript +var sliceBuffer = require('arraybuffer.slice'); +var ab = (new Int8Array(5)).buffer; +var sliced = sliceBuffer(ab, 1, 3); +sliced = sliceBuffer(ab, 1); +``` + +# Licence (MIT) +Copyright (C) 2013 Rase- + + +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. diff --git a/datalab/web/node_modules/arraybuffer.slice/index.js b/datalab/web/node_modules/arraybuffer.slice/index.js new file mode 100644 index 0000000000000000000000000000000000000000..11ac556e9ac8eaadad19bf053cc9bf0f813042da --- /dev/null +++ b/datalab/web/node_modules/arraybuffer.slice/index.js @@ -0,0 +1,29 @@ +/** + * An abstraction for slicing an arraybuffer even when + * ArrayBuffer.prototype.slice is not supported + * + * @api public + */ + +module.exports = function(arraybuffer, start, end) { + var bytes = arraybuffer.byteLength; + start = start || 0; + end = end || bytes; + + if (arraybuffer.slice) { return arraybuffer.slice(start, end); } + + if (start < 0) { start += bytes; } + if (end < 0) { end += bytes; } + if (end > bytes) { end = bytes; } + + if (start >= bytes || start >= end || bytes === 0) { + return new ArrayBuffer(0); + } + + var abv = new Uint8Array(arraybuffer); + var result = new Uint8Array(end - start); + for (var i = start, ii = 0; i < end; i++, ii++) { + result[ii] = abv[i]; + } + return result.buffer; +}; diff --git a/datalab/web/node_modules/arraybuffer.slice/package.json b/datalab/web/node_modules/arraybuffer.slice/package.json new file mode 100644 index 0000000000000000000000000000000000000000..294b54e6e5c9eacb83d8762913de66e2d744d233 --- /dev/null +++ b/datalab/web/node_modules/arraybuffer.slice/package.json @@ -0,0 +1,16 @@ +{ + "name": "arraybuffer.slice", + "description": "Exports a function for slicing ArrayBuffers (no polyfilling)", + "version": "0.0.7", + "license": "MIT", + "homepage": "https://github.com/rase-/arraybuffer.slice", + "dependencies": {}, + "devDependencies": { + "mocha": "1.17.1", + "expect.js": "0.2.0" + }, + "repository": { + "type": "git", + "url": "git@github.com:rase-/arraybuffer.slice.git" + } +} diff --git a/datalab/web/node_modules/arraybuffer.slice/test/slice-buffer.js b/datalab/web/node_modules/arraybuffer.slice/test/slice-buffer.js new file mode 100644 index 0000000000000000000000000000000000000000..4778da67dac2b21ee90c4f2fab0505ac8148b48e --- /dev/null +++ b/datalab/web/node_modules/arraybuffer.slice/test/slice-buffer.js @@ -0,0 +1,227 @@ +/* + * Test dependencies + */ + +var sliceBuffer = require('../index.js'); +var expect = require('expect.js'); + +/** + * Tests + */ + +describe('sliceBuffer', function() { + describe('using standard slice', function() { + it('should slice correctly with only start provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 3); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with start and end provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 3, 8); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < 8; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 0, -3); + var sabv = new Uint8Array(sliced); + for (var i = 0, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, -6, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 6, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with equal start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 1, 1); + expect(sliced.byteLength).to.equal(0); + }); + + it('should slice correctly when end larger than buffer', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 0, 100); + expect(new Uint8Array(sliced)).to.eql(abv); + }); + + it('shoud slice correctly when start larger than end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + + var sliced = sliceBuffer(abv.buffer, 6, 5); + expect(sliced.byteLength).to.equal(0); + }); + }); + + describe('using fallback', function() { + it('should slice correctly with only start provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 3); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with start and end provided', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + + var sliced = sliceBuffer(ab, 3, 8); + var sabv = new Uint8Array(sliced); + for (var i = 3, ii = 0; i < 8; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + + var sliced = sliceBuffer(ab, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 3, ii = 0; i < abv.length; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 0, -3); + var sabv = new Uint8Array(sliced); + for (var i = 0, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with negative start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, -6, -3); + var sabv = new Uint8Array(sliced); + for (var i = abv.length - 6, ii = 0; i < abv.length - 3; i++, ii++) { + expect(abv[i]).to.equal(sabv[ii]); + } + }); + + it('should slice correctly with equal start and end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 1, 1); + expect(sliced.byteLength).to.equal(0); + }); + + it('should slice correctly when end larger than buffer', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 0, 100); + var sabv = new Uint8Array(sliced); + for (var i = 0; i < abv.length; i++) { + expect(abv[i]).to.equal(sabv[i]); + } + }); + + it('shoud slice correctly when start larger than end', function() { + var abv = new Uint8Array(10); + for (var i = 0; i < abv.length; i++) { + abv[i] = i; + } + var ab = abv.buffer; + ab.slice = undefined; + + var sliced = sliceBuffer(ab, 6, 5); + expect(sliced.byteLength).to.equal(0); + }); + }); +}); diff --git a/datalab/web/node_modules/async-limiter/.travis.yml b/datalab/web/node_modules/async-limiter/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..6cf4a7ad0b7c6317691d092c261498868ab22b53 --- /dev/null +++ b/datalab/web/node_modules/async-limiter/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "6" + - "node" +script: npm run travis +cache: + yarn: true diff --git a/datalab/web/node_modules/async-limiter/LICENSE b/datalab/web/node_modules/async-limiter/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9c91fb26803ab91013ece7c825691b3c29d3abb6 --- /dev/null +++ b/datalab/web/node_modules/async-limiter/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2017 Samuel Reed + +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. diff --git a/datalab/web/node_modules/async-limiter/coverage/coverage.json b/datalab/web/node_modules/async-limiter/coverage/coverage.json new file mode 100644 index 0000000000000000000000000000000000000000..5b4a358483e011ff99119eccd56cf4fd48f2e56a --- /dev/null +++ b/datalab/web/node_modules/async-limiter/coverage/coverage.json @@ -0,0 +1 @@ +{"/Users/samuelreed/git/forks/async-throttle/index.js":{"path":"/Users/samuelreed/git/forks/async-throttle/index.js","s":{"1":1,"2":7,"3":1,"4":6,"5":6,"6":6,"7":6,"8":6,"9":6,"10":1,"11":1,"12":3,"13":13,"14":13,"15":13,"16":1,"17":19,"18":1,"19":45,"20":6,"21":39,"22":13,"23":13,"24":13,"25":13,"26":39,"27":18,"28":6,"29":6,"30":1,"31":6,"32":6,"33":6,"34":1,"35":13,"36":13,"37":1},"b":{"1":[1,6],"2":[6,5],"3":[6,5],"4":[6,39],"5":[13,26],"6":[18,21],"7":[6,0]},"f":{"1":7,"2":3,"3":13,"4":19,"5":45,"6":6,"7":13},"fnMap":{"1":{"name":"Queue","line":3,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":24}}},"2":{"name":"(anonymous_2)","line":22,"loc":{"start":{"line":22,"column":24},"end":{"line":22,"column":41}}},"3":{"name":"(anonymous_3)","line":23,"loc":{"start":{"line":23,"column":28},"end":{"line":23,"column":39}}},"4":{"name":"(anonymous_4)","line":31,"loc":{"start":{"line":31,"column":7},"end":{"line":31,"column":18}}},"5":{"name":"(anonymous_5)","line":36,"loc":{"start":{"line":36,"column":23},"end":{"line":36,"column":34}}},"6":{"name":"(anonymous_6)","line":55,"loc":{"start":{"line":55,"column":25},"end":{"line":55,"column":38}}},"7":{"name":"done","line":62,"loc":{"start":{"line":62,"column":0},"end":{"line":62,"column":16}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":14,"column":1}},"2":{"start":{"line":4,"column":2},"end":{"line":6,"column":3}},"3":{"start":{"line":5,"column":4},"end":{"line":5,"column":30}},"4":{"start":{"line":8,"column":2},"end":{"line":8,"column":26}},"5":{"start":{"line":9,"column":2},"end":{"line":9,"column":53}},"6":{"start":{"line":10,"column":2},"end":{"line":10,"column":19}},"7":{"start":{"line":11,"column":2},"end":{"line":11,"column":17}},"8":{"start":{"line":12,"column":2},"end":{"line":12,"column":16}},"9":{"start":{"line":13,"column":2},"end":{"line":13,"column":31}},"10":{"start":{"line":16,"column":0},"end":{"line":20,"column":2}},"11":{"start":{"line":22,"column":0},"end":{"line":28,"column":3}},"12":{"start":{"line":23,"column":2},"end":{"line":27,"column":4}},"13":{"start":{"line":24,"column":4},"end":{"line":24,"column":75}},"14":{"start":{"line":25,"column":4},"end":{"line":25,"column":16}},"15":{"start":{"line":26,"column":4},"end":{"line":26,"column":24}},"16":{"start":{"line":30,"column":0},"end":{"line":34,"column":3}},"17":{"start":{"line":32,"column":4},"end":{"line":32,"column":43}},"18":{"start":{"line":36,"column":0},"end":{"line":53,"column":2}},"19":{"start":{"line":37,"column":2},"end":{"line":39,"column":3}},"20":{"start":{"line":38,"column":4},"end":{"line":38,"column":11}},"21":{"start":{"line":40,"column":2},"end":{"line":45,"column":3}},"22":{"start":{"line":41,"column":4},"end":{"line":41,"column":32}},"23":{"start":{"line":42,"column":4},"end":{"line":42,"column":19}},"24":{"start":{"line":43,"column":4},"end":{"line":43,"column":20}},"25":{"start":{"line":44,"column":4},"end":{"line":44,"column":16}},"26":{"start":{"line":47,"column":2},"end":{"line":52,"column":3}},"27":{"start":{"line":48,"column":4},"end":{"line":51,"column":5}},"28":{"start":{"line":49,"column":6},"end":{"line":49,"column":30}},"29":{"start":{"line":50,"column":6},"end":{"line":50,"column":27}},"30":{"start":{"line":55,"column":0},"end":{"line":60,"column":2}},"31":{"start":{"line":56,"column":2},"end":{"line":59,"column":3}},"32":{"start":{"line":57,"column":4},"end":{"line":57,"column":22}},"33":{"start":{"line":58,"column":4},"end":{"line":58,"column":16}},"34":{"start":{"line":62,"column":0},"end":{"line":65,"column":1}},"35":{"start":{"line":63,"column":2},"end":{"line":63,"column":17}},"36":{"start":{"line":64,"column":2},"end":{"line":64,"column":14}},"37":{"start":{"line":67,"column":0},"end":{"line":67,"column":23}}},"branchMap":{"1":{"line":4,"type":"if","locations":[{"start":{"line":4,"column":2},"end":{"line":4,"column":2}},{"start":{"line":4,"column":2},"end":{"line":4,"column":2}}]},"2":{"line":8,"type":"binary-expr","locations":[{"start":{"line":8,"column":12},"end":{"line":8,"column":19}},{"start":{"line":8,"column":23},"end":{"line":8,"column":25}}]},"3":{"line":9,"type":"binary-expr","locations":[{"start":{"line":9,"column":21},"end":{"line":9,"column":40}},{"start":{"line":9,"column":44},"end":{"line":9,"column":52}}]},"4":{"line":37,"type":"if","locations":[{"start":{"line":37,"column":2},"end":{"line":37,"column":2}},{"start":{"line":37,"column":2},"end":{"line":37,"column":2}}]},"5":{"line":40,"type":"if","locations":[{"start":{"line":40,"column":2},"end":{"line":40,"column":2}},{"start":{"line":40,"column":2},"end":{"line":40,"column":2}}]},"6":{"line":47,"type":"if","locations":[{"start":{"line":47,"column":2},"end":{"line":47,"column":2}},{"start":{"line":47,"column":2},"end":{"line":47,"column":2}}]},"7":{"line":56,"type":"if","locations":[{"start":{"line":56,"column":2},"end":{"line":56,"column":2}},{"start":{"line":56,"column":2},"end":{"line":56,"column":2}}]}}}} \ No newline at end of file diff --git a/datalab/web/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html b/datalab/web/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html new file mode 100644 index 0000000000000000000000000000000000000000..198882b4b1185be9e2062cc932e325dcad1e5df7 --- /dev/null +++ b/datalab/web/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html @@ -0,0 +1,73 @@ + + + + Code coverage report for async-throttle/ + + + + + + +
+

Code coverage report for async-throttle/

+

+ Statements: 100% (37 / 37)      + Branches: 92.86% (13 / 14)      + Functions: 100% (7 / 7)      + Lines: 100% (37 / 37)      + Ignored: none      +

+
All files » async-throttle/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
index.js100%(37 / 37)92.86%(13 / 14)100%(7 / 7)100%(37 / 37)
+
+
+ + + + + + diff --git a/datalab/web/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html b/datalab/web/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html new file mode 100644 index 0000000000000000000000000000000000000000..adc030fda975915569d2aa614db5d107dfa3aa06 --- /dev/null +++ b/datalab/web/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html @@ -0,0 +1,246 @@ + + + + Code coverage report for async-throttle/index.js + + + + + + +
+

Code coverage report for async-throttle/index.js

+

+ Statements: 100% (37 / 37)      + Branches: 92.86% (13 / 14)      + Functions: 100% (7 / 7)      + Lines: 100% (37 / 37)      + Ignored: none      +

+
All files » async-throttle/ » index.js
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68  +  +1 +7 +1 +  +  +6 +6 +6 +6 +6 +6 +  +  +1 +  +  +  +  +  +1 +3 +13 +13 +13 +  +  +  +1 +  +19 +  +  +  +1 +45 +6 +  +39 +13 +13 +13 +13 +  +  +39 +18 +6 +6 +  +  +  +  +1 +6 +6 +6 +  +  +  +1 +13 +13 +  +  +1 + 
'use strict';
+ 
+function Queue(options) {
+  if (!(this instanceof Queue)) {
+    return new Queue(options);
+  }
+ 
+  options = options || {};
+  this.concurrency = options.concurrency || Infinity;
+  this.pending = 0;
+  this.jobs = [];
+  this.cbs = [];
+  this._done = done.bind(this);
+}
+ 
+var arrayAddMethods = [
+  'push',
+  'unshift',
+  'splice'
+];
+ 
+arrayAddMethods.forEach(function(method) {
+  Queue.prototype[method] = function() {
+    var methodResult = Array.prototype[method].apply(this.jobs, arguments);
+    this._run();
+    return methodResult;
+  };
+});
+ 
+Object.defineProperty(Queue.prototype, 'length', {
+  get: function() {
+    return this.pending + this.jobs.length;
+  }
+});
+ 
+Queue.prototype._run = function() {
+  if (this.pending === this.concurrency) {
+    return;
+  }
+  if (this.jobs.length) {
+    var job = this.jobs.shift();
+    this.pending++;
+    job(this._done);
+    this._run();
+  }
+ 
+  if (this.pending === 0) {
+    while (this.cbs.length !== 0) {
+      var cb = this.cbs.pop();
+      process.nextTick(cb);
+    }
+  }
+};
+ 
+Queue.prototype.onDone = function(cb) {
+  Eif (typeof cb === 'function') {
+    this.cbs.push(cb);
+    this._run();
+  }
+};
+ 
+function done() {
+  this.pending--;
+  this._run();
+}
+ 
+module.exports = Queue;
+ 
+ +
+ + + + + + diff --git a/datalab/web/node_modules/async-limiter/coverage/lcov-report/base.css b/datalab/web/node_modules/async-limiter/coverage/lcov-report/base.css new file mode 100644 index 0000000000000000000000000000000000000000..a6a2f3284d0221eee83373df7f9ba792601efe51 --- /dev/null +++ b/datalab/web/node_modules/async-limiter/coverage/lcov-report/base.css @@ -0,0 +1,182 @@ +body, html { + margin:0; padding: 0; +} +body { + font-family: Helvetica Neue, Helvetica,Arial; + font-size: 10pt; +} +div.header, div.footer { + background: #eee; + padding: 1em; +} +div.header { + z-index: 100; + position: fixed; + top: 0; + border-bottom: 1px solid #666; + width: 100%; +} +div.footer { + border-top: 1px solid #666; +} +div.body { + margin-top: 10em; +} +div.meta { + font-size: 90%; + text-align: center; +} +h1, h2, h3 { + font-weight: normal; +} +h1 { + font-size: 12pt; +} +h2 { + font-size: 10pt; +} +pre { + font-family: Consolas, Menlo, Monaco, monospace; + margin: 0; + padding: 0; + line-height: 1.3; + font-size: 14px; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; +} + +div.path { font-size: 110%; } +div.path a:link, div.path a:visited { color: #000; } +table.coverage { border-collapse: collapse; margin:0; padding: 0 } + +table.coverage td { + margin: 0; + padding: 0; + color: #111; + vertical-align: top; +} +table.coverage td.line-count { + width: 50px; + text-align: right; + padding-right: 5px; +} +table.coverage td.line-coverage { + color: #777 !important; + text-align: right; + border-left: 1px solid #666; + border-right: 1px solid #666; +} + +table.coverage td.text { +} + +table.coverage td span.cline-any { + display: inline-block; + padding: 0 5px; + width: 40px; +} +table.coverage td span.cline-neutral { + background: #eee; +} +table.coverage td span.cline-yes { + background: #b5d592; + color: #999; +} +table.coverage td span.cline-no { + background: #fc8c84; +} + +.cstat-yes { color: #111; } +.cstat-no { background: #fc8c84; color: #111; } +.fstat-no { background: #ffc520; color: #111 !important; } +.cbranch-no { background: yellow !important; color: #111; } + +.cstat-skip { background: #ddd; color: #111; } +.fstat-skip { background: #ddd; color: #111 !important; } +.cbranch-skip { background: #ddd !important; color: #111; } + +.missing-if-branch { + display: inline-block; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: black; + color: yellow; +} + +.skip-if-branch { + display: none; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: #ccc; + color: white; +} + +.missing-if-branch .typ, .skip-if-branch .typ { + color: inherit !important; +} + +.entity, .metric { font-weight: bold; } +.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } +.metric small { font-size: 80%; font-weight: normal; color: #666; } + +div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } +div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } +div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } +div.coverage-summary th.file { border-right: none !important; } +div.coverage-summary th.pic { border-left: none !important; text-align: right; } +div.coverage-summary th.pct { border-right: none !important; } +div.coverage-summary th.abs { border-left: none !important; text-align: right; } +div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } +div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } +div.coverage-summary td.file { border-left: 1px solid #666; white-space: nowrap; } +div.coverage-summary td.pic { min-width: 120px !important; } +div.coverage-summary a:link { text-decoration: none; color: #000; } +div.coverage-summary a:visited { text-decoration: none; color: #777; } +div.coverage-summary a:hover { text-decoration: underline; } +div.coverage-summary tfoot td { border-top: 1px solid #666; } + +div.coverage-summary .sorter { + height: 10px; + width: 7px; + display: inline-block; + margin-left: 0.5em; + background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; +} +div.coverage-summary .sorted .sorter { + background-position: 0 -20px; +} +div.coverage-summary .sorted-desc .sorter { + background-position: 0 -10px; +} + +.high { background: #b5d592 !important; } +.medium { background: #ffe87c !important; } +.low { background: #fc8c84 !important; } + +span.cover-fill, span.cover-empty { + display:inline-block; + border:1px solid #444; + background: white; + height: 12px; +} +span.cover-fill { + background: #ccc; + border-right: 1px solid #444; +} +span.cover-empty { + background: white; + border-left: none; +} +span.cover-full { + border-right: none !important; +} +pre.prettyprint { + border: none !important; + padding: 0 !important; + margin: 0 !important; +} +.com { color: #999 !important; } +.ignore-none { color: #999; font-weight: normal; } diff --git a/datalab/web/node_modules/async-limiter/coverage/lcov-report/index.html b/datalab/web/node_modules/async-limiter/coverage/lcov-report/index.html new file mode 100644 index 0000000000000000000000000000000000000000..782a1cff1190b0c243a453b25316d42a8e0cb63b --- /dev/null +++ b/datalab/web/node_modules/async-limiter/coverage/lcov-report/index.html @@ -0,0 +1,73 @@ + + + + Code coverage report for All files + + + + + + +
+

Code coverage report for All files

+

+ Statements: 100% (37 / 37)      + Branches: 92.86% (13 / 14)      + Functions: 100% (7 / 7)      + Lines: 100% (37 / 37)      + Ignored: none      +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
async-throttle/100%(37 / 37)92.86%(13 / 14)100%(7 / 7)100%(37 / 37)
+
+
+ + + + + + diff --git a/datalab/web/node_modules/async-limiter/coverage/lcov-report/prettify.css b/datalab/web/node_modules/async-limiter/coverage/lcov-report/prettify.css new file mode 100644 index 0000000000000000000000000000000000000000..b317a7cda31a440fbd47540297ee3c68d51f343e --- /dev/null +++ b/datalab/web/node_modules/async-limiter/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/datalab/web/node_modules/async-limiter/coverage/lcov-report/prettify.js b/datalab/web/node_modules/async-limiter/coverage/lcov-report/prettify.js new file mode 100644 index 0000000000000000000000000000000000000000..ef51e03866898f709d2bed6f55ed10bfb9840e6f --- /dev/null +++ b/datalab/web/node_modules/async-limiter/coverage/lcov-report/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/datalab/web/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png b/datalab/web/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..03f704a609c6fd0dbfdac63466a7d7c958b5cbf3 Binary files /dev/null and b/datalab/web/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png differ diff --git a/datalab/web/node_modules/async-limiter/coverage/lcov-report/sorter.js b/datalab/web/node_modules/async-limiter/coverage/lcov-report/sorter.js new file mode 100644 index 0000000000000000000000000000000000000000..6afb736c39fb15da83c56b083ab88b505c247a38 --- /dev/null +++ b/datalab/web/node_modules/async-limiter/coverage/lcov-report/sorter.js @@ -0,0 +1,156 @@ +var addSorting = (function () { + "use strict"; + var cols, + currentSort = { + index: 0, + desc: false + }; + + // returns the summary table element + function getTable() { return document.querySelector('.coverage-summary table'); } + // returns the thead element of the summary table + function getTableHeader() { return getTable().querySelector('thead tr'); } + // returns the tbody element of the summary table + function getTableBody() { return getTable().querySelector('tbody'); } + // returns the th element for nth column + function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } + + // loads all columns + function loadColumns() { + var colNodes = getTableHeader().querySelectorAll('th'), + colNode, + cols = [], + col, + i; + + for (i = 0; i < colNodes.length; i += 1) { + colNode = colNodes[i]; + col = { + key: colNode.getAttribute('data-col'), + sortable: !colNode.getAttribute('data-nosort'), + type: colNode.getAttribute('data-type') || 'string' + }; + cols.push(col); + if (col.sortable) { + col.defaultDescSort = col.type === 'number'; + colNode.innerHTML = colNode.innerHTML + ''; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function (a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function (a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function () { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i =0 ; i < cols.length; i += 1) { + if (cols[i].sortable) { + el = getNthColumn(i).querySelector('.sorter'); + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function () { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(cols); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/datalab/web/node_modules/async-limiter/coverage/lcov.info b/datalab/web/node_modules/async-limiter/coverage/lcov.info new file mode 100644 index 0000000000000000000000000000000000000000..fbf36aab035770e2b116084456e1367e9506b090 --- /dev/null +++ b/datalab/web/node_modules/async-limiter/coverage/lcov.info @@ -0,0 +1,74 @@ +TN: +SF:/Users/samuelreed/git/forks/async-throttle/index.js +FN:3,Queue +FN:22,(anonymous_2) +FN:23,(anonymous_3) +FN:31,(anonymous_4) +FN:36,(anonymous_5) +FN:55,(anonymous_6) +FN:62,done +FNF:7 +FNH:7 +FNDA:7,Queue +FNDA:3,(anonymous_2) +FNDA:13,(anonymous_3) +FNDA:19,(anonymous_4) +FNDA:45,(anonymous_5) +FNDA:6,(anonymous_6) +FNDA:13,done +DA:3,1 +DA:4,7 +DA:5,1 +DA:8,6 +DA:9,6 +DA:10,6 +DA:11,6 +DA:12,6 +DA:13,6 +DA:16,1 +DA:22,1 +DA:23,3 +DA:24,13 +DA:25,13 +DA:26,13 +DA:30,1 +DA:32,19 +DA:36,1 +DA:37,45 +DA:38,6 +DA:40,39 +DA:41,13 +DA:42,13 +DA:43,13 +DA:44,13 +DA:47,39 +DA:48,18 +DA:49,6 +DA:50,6 +DA:55,1 +DA:56,6 +DA:57,6 +DA:58,6 +DA:62,1 +DA:63,13 +DA:64,13 +DA:67,1 +LF:37 +LH:37 +BRDA:4,1,0,1 +BRDA:4,1,1,6 +BRDA:8,2,0,6 +BRDA:8,2,1,5 +BRDA:9,3,0,6 +BRDA:9,3,1,5 +BRDA:37,4,0,6 +BRDA:37,4,1,39 +BRDA:40,5,0,13 +BRDA:40,5,1,26 +BRDA:47,6,0,18 +BRDA:47,6,1,21 +BRDA:56,7,0,6 +BRDA:56,7,1,0 +BRF:14 +BRH:13 +end_of_record diff --git a/datalab/web/node_modules/async-limiter/index.js b/datalab/web/node_modules/async-limiter/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c9bd2f9778213d8adbab4c8a17d13e32aa3fc25b --- /dev/null +++ b/datalab/web/node_modules/async-limiter/index.js @@ -0,0 +1,67 @@ +'use strict'; + +function Queue(options) { + if (!(this instanceof Queue)) { + return new Queue(options); + } + + options = options || {}; + this.concurrency = options.concurrency || Infinity; + this.pending = 0; + this.jobs = []; + this.cbs = []; + this._done = done.bind(this); +} + +var arrayAddMethods = [ + 'push', + 'unshift', + 'splice' +]; + +arrayAddMethods.forEach(function(method) { + Queue.prototype[method] = function() { + var methodResult = Array.prototype[method].apply(this.jobs, arguments); + this._run(); + return methodResult; + }; +}); + +Object.defineProperty(Queue.prototype, 'length', { + get: function() { + return this.pending + this.jobs.length; + } +}); + +Queue.prototype._run = function() { + if (this.pending === this.concurrency) { + return; + } + if (this.jobs.length) { + var job = this.jobs.shift(); + this.pending++; + job(this._done); + this._run(); + } + + if (this.pending === 0) { + while (this.cbs.length !== 0) { + var cb = this.cbs.pop(); + process.nextTick(cb); + } + } +}; + +Queue.prototype.onDone = function(cb) { + if (typeof cb === 'function') { + this.cbs.push(cb); + this._run(); + } +}; + +function done() { + this.pending--; + this._run(); +} + +module.exports = Queue; diff --git a/datalab/web/node_modules/async-limiter/package.json b/datalab/web/node_modules/async-limiter/package.json new file mode 100644 index 0000000000000000000000000000000000000000..fa36061c0e0a992c8ec61702fb43ab0aa8d7ee13 --- /dev/null +++ b/datalab/web/node_modules/async-limiter/package.json @@ -0,0 +1,35 @@ +{ + "name": "async-limiter", + "version": "1.0.0", + "description": "asynchronous function queue with adjustable concurrency", + "keywords": [ + "throttle", + "async", + "limiter", + "asynchronous", + "job", + "task", + "concurrency", + "concurrent" + ], + "dependencies": {}, + "devDependencies": { + "coveralls": "^2.11.2", + "eslint": "^4.6.1", + "eslint-plugin-mocha": "^4.11.0", + "intelli-espower-loader": "^1.0.1", + "istanbul": "^0.3.2", + "mocha": "^3.5.2", + "power-assert": "^1.4.4" + }, + "scripts": { + "test": "mocha --R intelli-espower-loader test/", + "travis": "npm run lint && npm run coverage", + "coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls", + "example": "node example", + "lint": "eslint ." + }, + "repository": "https://github.com/strml/async-limiter.git", + "author": "Samuel Reed [(StackOverflow)](http://stackoverflow.com/questions/tagged/async.js) +### Synchronous iteration functions + +If you get an error like `RangeError: Maximum call stack size exceeded.` or other stack overflow issues when using async, you are likely using a synchronous iterator. By *synchronous* we mean a function that calls its callback on the same tick in the javascript event loop, without doing any I/O or using any timers. Calling many callbacks iteratively will quickly overflow the stack. If you run into this issue, just defer your callback with `async.setImmediate` to start a new call stack on the next tick of the event loop. + +This can also arise by accident if you callback early in certain cases: + +```js +async.eachSeries(hugeArray, function iterator(item, callback) { + if (inCache(item)) { + callback(null, cache[item]); // if many items are cached, you'll overflow + } else { + doSomeIO(item, callback); + } +}, function done() { + //... +}); +``` + +Just change it to: + +```js +async.eachSeries(hugeArray, function iterator(item, callback) { + if (inCache(item)) { + async.setImmediate(function () { + callback(null, cache[item]); + }); + } else { + doSomeIO(item, callback); + //... +``` + +Async guards against synchronous functions in some, but not all, cases. If you are still running into stack overflows, you can defer as suggested above, or wrap functions with [`async.ensureAsync`](#ensureAsync) Functions that are asynchronous by their nature do not have this problem and don't need the extra callback deferral. + +If JavaScript's event loop is still a bit nebulous, check out [this article](http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/) or [this talk](http://2014.jsconf.eu/speakers/philip-roberts-what-the-heck-is-the-event-loop-anyway.html) for more detailed information about how it works. + + +### Multiple callbacks + +Make sure to always `return` when calling a callback early, otherwise you will cause multiple callbacks and unpredictable behavior in many cases. + +```js +async.waterfall([ + function (callback) { + getSomething(options, function (err, result) { + if (err) { + callback(new Error("failed getting something:" + err.message)); + // we should return here + } + // since we did not return, this callback still will be called and + // `processData` will be called twice + callback(null, result); + }); + }, + processData +], done) +``` + +It is always good practice to `return callback(err, result)` whenever a callback call is not the last statement of a function. + + +### Binding a context to an iterator + +This section is really about `bind`, not about `async`. If you are wondering how to +make `async` execute your iterators in a given context, or are confused as to why +a method of another library isn't working as an iterator, study this example: + +```js +// Here is a simple object with an (unnecessarily roundabout) squaring method +var AsyncSquaringLibrary = { + squareExponent: 2, + square: function(number, callback){ + var result = Math.pow(number, this.squareExponent); + setTimeout(function(){ + callback(null, result); + }, 200); + } +}; + +async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){ + // result is [NaN, NaN, NaN] + // This fails because the `this.squareExponent` expression in the square + // function is not evaluated in the context of AsyncSquaringLibrary, and is + // therefore undefined. +}); + +async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){ + // result is [1, 4, 9] + // With the help of bind we can attach a context to the iterator before + // passing it to async. Now the square function will be executed in its + // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent` + // will be as expected. +}); +``` + +## Download + +The source is available for download from +[GitHub](https://github.com/caolan/async/blob/master/lib/async.js). +Alternatively, you can install using Node Package Manager (`npm`): + + npm install async + +As well as using Bower: + + bower install async + +__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed + +## In the Browser + +So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. + +Usage: + +```html + + +``` + +## Documentation + +Some functions are also available in the following forms: +* `Series` - the same as `` but runs only a single async operation at a time +* `Limit` - the same as `` but runs a maximum of `limit` async operations at a time + +### Collections + +* [`each`](#each), `eachSeries`, `eachLimit` +* [`forEachOf`](#forEachOf), `forEachOfSeries`, `forEachOfLimit` +* [`map`](#map), `mapSeries`, `mapLimit` +* [`filter`](#filter), `filterSeries`, `filterLimit` +* [`reject`](#reject), `rejectSeries`, `rejectLimit` +* [`reduce`](#reduce), [`reduceRight`](#reduceRight) +* [`detect`](#detect), `detectSeries`, `detectLimit` +* [`sortBy`](#sortBy) +* [`some`](#some), `someLimit` +* [`every`](#every), `everyLimit` +* [`concat`](#concat), `concatSeries` + +### Control Flow + +* [`series`](#seriestasks-callback) +* [`parallel`](#parallel), `parallelLimit` +* [`whilst`](#whilst), [`doWhilst`](#doWhilst) +* [`until`](#until), [`doUntil`](#doUntil) +* [`during`](#during), [`doDuring`](#doDuring) +* [`forever`](#forever) +* [`waterfall`](#waterfall) +* [`compose`](#compose) +* [`seq`](#seq) +* [`applyEach`](#applyEach), `applyEachSeries` +* [`queue`](#queue), [`priorityQueue`](#priorityQueue) +* [`cargo`](#cargo) +* [`auto`](#auto) +* [`retry`](#retry) +* [`iterator`](#iterator) +* [`times`](#times), `timesSeries`, `timesLimit` + +### Utils + +* [`apply`](#apply) +* [`nextTick`](#nextTick) +* [`memoize`](#memoize) +* [`unmemoize`](#unmemoize) +* [`ensureAsync`](#ensureAsync) +* [`constant`](#constant) +* [`asyncify`](#asyncify) +* [`wrapSync`](#wrapSync) +* [`log`](#log) +* [`dir`](#dir) +* [`noConflict`](#noConflict) + +## Collections + + + +### each(arr, iterator, [callback]) + +Applies the function `iterator` to each item in `arr`, in parallel. +The `iterator` is called with an item from the list, and a callback for when it +has finished. If the `iterator` passes an error to its `callback`, the main +`callback` (for the `each` function) is immediately called with the error. + +Note, that since this function applies `iterator` to each item in parallel, +there is no guarantee that the iterator functions will complete in order. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A function to apply to each item in `arr`. + The iterator is passed a `callback(err)` which must be called once it has + completed. If no error has occurred, the `callback` should be run without + arguments or with an explicit `null` argument. The array index is not passed + to the iterator. If you need the index, use [`forEachOf`](#forEachOf). +* `callback(err)` - *Optional* A callback which is called when all `iterator` functions + have finished, or an error occurs. + +__Examples__ + + +```js +// assuming openFiles is an array of file names and saveFile is a function +// to save the modified contents of that file: + +async.each(openFiles, saveFile, function(err){ + // if any of the saves produced an error, err would equal that error +}); +``` + +```js +// assuming openFiles is an array of file names + +async.each(openFiles, function(file, callback) { + + // Perform operation on file here. + console.log('Processing file ' + file); + + if( file.length > 32 ) { + console.log('This file name is too long'); + callback('File name too long'); + } else { + // Do work to process file here + console.log('File processed'); + callback(); + } +}, function(err){ + // if any of the file processing produced an error, err would equal that error + if( err ) { + // One of the iterations produced an error. + // All processing will now stop. + console.log('A file failed to process'); + } else { + console.log('All files have been processed successfully'); + } +}); +``` + +__Related__ + +* eachSeries(arr, iterator, [callback]) +* eachLimit(arr, limit, iterator, [callback]) + +--------------------------------------- + + + + +### forEachOf(obj, iterator, [callback]) + +Like `each`, except that it iterates over objects, and passes the key as the second argument to the iterator. + +__Arguments__ + +* `obj` - An object or array to iterate over. +* `iterator(item, key, callback)` - A function to apply to each item in `obj`. +The `key` is the item's key, or index in the case of an array. The iterator is +passed a `callback(err)` which must be called once it has completed. If no +error has occurred, the callback should be run without arguments or with an +explicit `null` argument. +* `callback(err)` - *Optional* A callback which is called when all `iterator` functions have finished, or an error occurs. + +__Example__ + +```js +var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; +var configs = {}; + +async.forEachOf(obj, function (value, key, callback) { + fs.readFile(__dirname + value, "utf8", function (err, data) { + if (err) return callback(err); + try { + configs[key] = JSON.parse(data); + } catch (e) { + return callback(e); + } + callback(); + }) +}, function (err) { + if (err) console.error(err.message); + // configs is now a map of JSON data + doSomethingWith(configs); +}) +``` + +__Related__ + +* forEachOfSeries(obj, iterator, [callback]) +* forEachOfLimit(obj, limit, iterator, [callback]) + +--------------------------------------- + + +### map(arr, iterator, [callback]) + +Produces a new array of values by mapping each value in `arr` through +the `iterator` function. The `iterator` is called with an item from `arr` and a +callback for when it has finished processing. Each of these callback takes 2 arguments: +an `error`, and the transformed item from `arr`. If `iterator` passes an error to its +callback, the main `callback` (for the `map` function) is immediately called with the error. + +Note, that since this function applies the `iterator` to each item in parallel, +there is no guarantee that the `iterator` functions will complete in order. +However, the results array will be in the same order as the original `arr`. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A function to apply to each item in `arr`. + The iterator is passed a `callback(err, transformed)` which must be called once + it has completed with an error (which can be `null`) and a transformed item. +* `callback(err, results)` - *Optional* A callback which is called when all `iterator` + functions have finished, or an error occurs. Results is an array of the + transformed items from the `arr`. + +__Example__ + +```js +async.map(['file1','file2','file3'], fs.stat, function(err, results){ + // results is now an array of stats for each file +}); +``` + +__Related__ +* mapSeries(arr, iterator, [callback]) +* mapLimit(arr, limit, iterator, [callback]) + +--------------------------------------- + + + +### filter(arr, iterator, [callback]) + +__Alias:__ `select` + +Returns a new array of all the values in `arr` which pass an async truth test. +_The callback for each `iterator` call only accepts a single argument of `true` or +`false`; it does not accept an error argument first!_ This is in-line with the +way node libraries work with truth tests like `fs.exists`. This operation is +performed in parallel, but the results array will be in the same order as the +original. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A truth test to apply to each item in `arr`. + The `iterator` is passed a `callback(truthValue)`, which must be called with a + boolean argument once it has completed. +* `callback(results)` - *Optional* A callback which is called after all the `iterator` + functions have finished. + +__Example__ + +```js +async.filter(['file1','file2','file3'], fs.exists, function(results){ + // results now equals an array of the existing files +}); +``` + +__Related__ + +* filterSeries(arr, iterator, [callback]) +* filterLimit(arr, limit, iterator, [callback]) + +--------------------------------------- + + +### reject(arr, iterator, [callback]) + +The opposite of [`filter`](#filter). Removes values that pass an `async` truth test. + +__Related__ + +* rejectSeries(arr, iterator, [callback]) +* rejectLimit(arr, limit, iterator, [callback]) + +--------------------------------------- + + +### reduce(arr, memo, iterator, [callback]) + +__Aliases:__ `inject`, `foldl` + +Reduces `arr` into a single value using an async `iterator` to return +each successive step. `memo` is the initial state of the reduction. +This function only operates in series. + +For performance reasons, it may make sense to split a call to this function into +a parallel map, and then use the normal `Array.prototype.reduce` on the results. +This function is for situations where each step in the reduction needs to be async; +if you can get the data before reducing it, then it's probably a good idea to do so. + +__Arguments__ + +* `arr` - An array to iterate over. +* `memo` - The initial state of the reduction. +* `iterator(memo, item, callback)` - A function applied to each item in the + array to produce the next step in the reduction. The `iterator` is passed a + `callback(err, reduction)` which accepts an optional error as its first + argument, and the state of the reduction as the second. If an error is + passed to the callback, the reduction is stopped and the main `callback` is + immediately called with the error. +* `callback(err, result)` - *Optional* A callback which is called after all the `iterator` + functions have finished. Result is the reduced value. + +__Example__ + +```js +async.reduce([1,2,3], 0, function(memo, item, callback){ + // pointless async: + process.nextTick(function(){ + callback(null, memo + item) + }); +}, function(err, result){ + // result is now equal to the last value of memo, which is 6 +}); +``` + +--------------------------------------- + + +### reduceRight(arr, memo, iterator, [callback]) + +__Alias:__ `foldr` + +Same as [`reduce`](#reduce), only operates on `arr` in reverse order. + + +--------------------------------------- + + +### detect(arr, iterator, [callback]) + +Returns the first value in `arr` that passes an async truth test. The +`iterator` is applied in parallel, meaning the first iterator to return `true` will +fire the detect `callback` with that result. That means the result might not be +the first item in the original `arr` (in terms of order) that passes the test. + +If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries). + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A truth test to apply to each item in `arr`. + The iterator is passed a `callback(truthValue)` which must be called with a + boolean argument once it has completed. **Note: this callback does not take an error as its first argument.** +* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns + `true`, or after all the `iterator` functions have finished. Result will be + the first item in the array that passes the truth test (iterator) or the + value `undefined` if none passed. **Note: this callback does not take an error as its first argument.** + +__Example__ + +```js +async.detect(['file1','file2','file3'], fs.exists, function(result){ + // result now equals the first file in the list that exists +}); +``` + +__Related__ + +* detectSeries(arr, iterator, [callback]) +* detectLimit(arr, limit, iterator, [callback]) + +--------------------------------------- + + +### sortBy(arr, iterator, [callback]) + +Sorts a list by the results of running each `arr` value through an async `iterator`. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A function to apply to each item in `arr`. + The iterator is passed a `callback(err, sortValue)` which must be called once it + has completed with an error (which can be `null`) and a value to use as the sort + criteria. +* `callback(err, results)` - *Optional* A callback which is called after all the `iterator` + functions have finished, or an error occurs. Results is the items from + the original `arr` sorted by the values returned by the `iterator` calls. + +__Example__ + +```js +async.sortBy(['file1','file2','file3'], function(file, callback){ + fs.stat(file, function(err, stats){ + callback(err, stats.mtime); + }); +}, function(err, results){ + // results is now the original array of files sorted by + // modified date +}); +``` + +__Sort Order__ + +By modifying the callback parameter the sorting order can be influenced: + +```js +//ascending order +async.sortBy([1,9,3,5], function(x, callback){ + callback(null, x); +}, function(err,result){ + //result callback +} ); + +//descending order +async.sortBy([1,9,3,5], function(x, callback){ + callback(null, x*-1); //<- x*-1 instead of x, turns the order around +}, function(err,result){ + //result callback +} ); +``` + +--------------------------------------- + + +### some(arr, iterator, [callback]) + +__Alias:__ `any` + +Returns `true` if at least one element in the `arr` satisfies an async test. +_The callback for each iterator call only accepts a single argument of `true` or +`false`; it does not accept an error argument first!_ This is in-line with the +way node libraries work with truth tests like `fs.exists`. Once any iterator +call returns `true`, the main `callback` is immediately called. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A truth test to apply to each item in the array + in parallel. The iterator is passed a `callback(truthValue)`` which must be + called with a boolean argument once it has completed. +* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns + `true`, or after all the iterator functions have finished. Result will be + either `true` or `false` depending on the values of the async tests. + + **Note: the callbacks do not take an error as their first argument.** +__Example__ + +```js +async.some(['file1','file2','file3'], fs.exists, function(result){ + // if result is true then at least one of the files exists +}); +``` + +__Related__ + +* someLimit(arr, limit, iterator, callback) + +--------------------------------------- + + +### every(arr, iterator, [callback]) + +__Alias:__ `all` + +Returns `true` if every element in `arr` satisfies an async test. +_The callback for each `iterator` call only accepts a single argument of `true` or +`false`; it does not accept an error argument first!_ This is in-line with the +way node libraries work with truth tests like `fs.exists`. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A truth test to apply to each item in the array + in parallel. The iterator is passed a `callback(truthValue)` which must be + called with a boolean argument once it has completed. +* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns + `false`, or after all the iterator functions have finished. Result will be + either `true` or `false` depending on the values of the async tests. + + **Note: the callbacks do not take an error as their first argument.** + +__Example__ + +```js +async.every(['file1','file2','file3'], fs.exists, function(result){ + // if result is true then every file exists +}); +``` + +__Related__ + +* everyLimit(arr, limit, iterator, callback) + +--------------------------------------- + + +### concat(arr, iterator, [callback]) + +Applies `iterator` to each item in `arr`, concatenating the results. Returns the +concatenated list. The `iterator`s are called in parallel, and the results are +concatenated as they return. There is no guarantee that the results array will +be returned in the original order of `arr` passed to the `iterator` function. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A function to apply to each item in `arr`. + The iterator is passed a `callback(err, results)` which must be called once it + has completed with an error (which can be `null`) and an array of results. +* `callback(err, results)` - *Optional* A callback which is called after all the `iterator` + functions have finished, or an error occurs. Results is an array containing + the concatenated results of the `iterator` function. + +__Example__ + +```js +async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ + // files is now a list of filenames that exist in the 3 directories +}); +``` + +__Related__ + +* concatSeries(arr, iterator, [callback]) + + +## Control Flow + + +### series(tasks, [callback]) + +Run the functions in the `tasks` array in series, each one running once the previous +function has completed. If any functions in the series pass an error to its +callback, no more functions are run, and `callback` is immediately called with the value of the error. +Otherwise, `callback` receives an array of results when `tasks` have completed. + +It is also possible to use an object instead of an array. Each property will be +run as a function, and the results will be passed to the final `callback` as an object +instead of an array. This can be a more readable way of handling results from +[`series`](#series). + +**Note** that while many implementations preserve the order of object properties, the +[ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) +explicitly states that + +> The mechanics and order of enumerating the properties is not specified. + +So if you rely on the order in which your series of functions are executed, and want +this to work on all platforms, consider using an array. + +__Arguments__ + +* `tasks` - An array or object containing functions to run, each function is passed + a `callback(err, result)` it must call on completion with an error `err` (which can + be `null`) and an optional `result` value. +* `callback(err, results)` - An optional callback to run once all the functions + have completed. This function gets a results array (or object) containing all + the result arguments passed to the `task` callbacks. + +__Example__ + +```js +async.series([ + function(callback){ + // do some stuff ... + callback(null, 'one'); + }, + function(callback){ + // do some more stuff ... + callback(null, 'two'); + } +], +// optional callback +function(err, results){ + // results is now equal to ['one', 'two'] +}); + + +// an example using an object instead of an array +async.series({ + one: function(callback){ + setTimeout(function(){ + callback(null, 1); + }, 200); + }, + two: function(callback){ + setTimeout(function(){ + callback(null, 2); + }, 100); + } +}, +function(err, results) { + // results is now equal to: {one: 1, two: 2} +}); +``` + +--------------------------------------- + + +### parallel(tasks, [callback]) + +Run the `tasks` array of functions in parallel, without waiting until the previous +function has completed. If any of the functions pass an error to its +callback, the main `callback` is immediately called with the value of the error. +Once the `tasks` have completed, the results are passed to the final `callback` as an +array. + +**Note:** `parallel` is about kicking-off I/O tasks in parallel, not about parallel execution of code. If your tasks do not use any timers or perform any I/O, they will actually be executed in series. Any synchronous setup sections for each task will happen one after the other. JavaScript remains single-threaded. + +It is also possible to use an object instead of an array. Each property will be +run as a function and the results will be passed to the final `callback` as an object +instead of an array. This can be a more readable way of handling results from +[`parallel`](#parallel). + + +__Arguments__ + +* `tasks` - An array or object containing functions to run. Each function is passed + a `callback(err, result)` which it must call on completion with an error `err` + (which can be `null`) and an optional `result` value. +* `callback(err, results)` - An optional callback to run once all the functions + have completed successfully. This function gets a results array (or object) containing all + the result arguments passed to the task callbacks. + +__Example__ + +```js +async.parallel([ + function(callback){ + setTimeout(function(){ + callback(null, 'one'); + }, 200); + }, + function(callback){ + setTimeout(function(){ + callback(null, 'two'); + }, 100); + } +], +// optional callback +function(err, results){ + // the results array will equal ['one','two'] even though + // the second function had a shorter timeout. +}); + + +// an example using an object instead of an array +async.parallel({ + one: function(callback){ + setTimeout(function(){ + callback(null, 1); + }, 200); + }, + two: function(callback){ + setTimeout(function(){ + callback(null, 2); + }, 100); + } +}, +function(err, results) { + // results is now equals to: {one: 1, two: 2} +}); +``` + +__Related__ + +* parallelLimit(tasks, limit, [callback]) + +--------------------------------------- + + +### whilst(test, fn, callback) + +Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped, +or an error occurs. + +__Arguments__ + +* `test()` - synchronous truth test to perform before each execution of `fn`. +* `fn(callback)` - A function which is called each time `test` passes. The function is + passed a `callback(err)`, which must be called once it has completed with an + optional `err` argument. +* `callback(err, [results])` - A callback which is called after the test + function has failed and repeated execution of `fn` has stopped. `callback` + will be passed an error and any arguments passed to the final `fn`'s callback. + +__Example__ + +```js +var count = 0; + +async.whilst( + function () { return count < 5; }, + function (callback) { + count++; + setTimeout(function () { + callback(null, count); + }, 1000); + }, + function (err, n) { + // 5 seconds have passed, n = 5 + } +); +``` + +--------------------------------------- + + +### doWhilst(fn, test, callback) + +The post-check version of [`whilst`](#whilst). To reflect the difference in +the order of operations, the arguments `test` and `fn` are switched. + +`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. + +--------------------------------------- + + +### until(test, fn, callback) + +Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped, +or an error occurs. `callback` will be passed an error and any arguments passed +to the final `fn`'s callback. + +The inverse of [`whilst`](#whilst). + +--------------------------------------- + + +### doUntil(fn, test, callback) + +Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`. + +--------------------------------------- + + +### during(test, fn, callback) + +Like [`whilst`](#whilst), except the `test` is an asynchronous function that is passed a callback in the form of `function (err, truth)`. If error is passed to `test` or `fn`, the main callback is immediately called with the value of the error. + +__Example__ + +```js +var count = 0; + +async.during( + function (callback) { + return callback(null, count < 5); + }, + function (callback) { + count++; + setTimeout(callback, 1000); + }, + function (err) { + // 5 seconds have passed + } +); +``` + +--------------------------------------- + + +### doDuring(fn, test, callback) + +The post-check version of [`during`](#during). To reflect the difference in +the order of operations, the arguments `test` and `fn` are switched. + +Also a version of [`doWhilst`](#doWhilst) with asynchronous `test` function. + +--------------------------------------- + + +### forever(fn, [errback]) + +Calls the asynchronous function `fn` with a callback parameter that allows it to +call itself again, in series, indefinitely. + +If an error is passed to the callback then `errback` is called with the +error, and execution stops, otherwise it will never be called. + +```js +async.forever( + function(next) { + // next is suitable for passing to things that need a callback(err [, whatever]); + // it will result in this function being called again. + }, + function(err) { + // if next is called with a value in its first parameter, it will appear + // in here as 'err', and execution will stop. + } +); +``` + +--------------------------------------- + + +### waterfall(tasks, [callback]) + +Runs the `tasks` array of functions in series, each passing their results to the next in +the array. However, if any of the `tasks` pass an error to their own callback, the +next function is not executed, and the main `callback` is immediately called with +the error. + +__Arguments__ + +* `tasks` - An array of functions to run, each function is passed a + `callback(err, result1, result2, ...)` it must call on completion. The first + argument is an error (which can be `null`) and any further arguments will be + passed as arguments in order to the next task. +* `callback(err, [results])` - An optional callback to run once all the functions + have completed. This will be passed the results of the last task's callback. + + + +__Example__ + +```js +async.waterfall([ + function(callback) { + callback(null, 'one', 'two'); + }, + function(arg1, arg2, callback) { + // arg1 now equals 'one' and arg2 now equals 'two' + callback(null, 'three'); + }, + function(arg1, callback) { + // arg1 now equals 'three' + callback(null, 'done'); + } +], function (err, result) { + // result now equals 'done' +}); +``` +Or, with named functions: + +```js +async.waterfall([ + myFirstFunction, + mySecondFunction, + myLastFunction, +], function (err, result) { + // result now equals 'done' +}); +function myFirstFunction(callback) { + callback(null, 'one', 'two'); +} +function mySecondFunction(arg1, arg2, callback) { + // arg1 now equals 'one' and arg2 now equals 'two' + callback(null, 'three'); +} +function myLastFunction(arg1, callback) { + // arg1 now equals 'three' + callback(null, 'done'); +} +``` + +Or, if you need to pass any argument to the first function: + +```js +async.waterfall([ + async.apply(myFirstFunction, 'zero'), + mySecondFunction, + myLastFunction, +], function (err, result) { + // result now equals 'done' +}); +function myFirstFunction(arg1, callback) { + // arg1 now equals 'zero' + callback(null, 'one', 'two'); +} +function mySecondFunction(arg1, arg2, callback) { + // arg1 now equals 'one' and arg2 now equals 'two' + callback(null, 'three'); +} +function myLastFunction(arg1, callback) { + // arg1 now equals 'three' + callback(null, 'done'); +} +``` + +--------------------------------------- + +### compose(fn1, fn2...) + +Creates a function which is a composition of the passed asynchronous +functions. Each function consumes the return value of the function that +follows. Composing functions `f()`, `g()`, and `h()` would produce the result of +`f(g(h()))`, only this version uses callbacks to obtain the return values. + +Each function is executed with the `this` binding of the composed function. + +__Arguments__ + +* `functions...` - the asynchronous functions to compose + + +__Example__ + +```js +function add1(n, callback) { + setTimeout(function () { + callback(null, n + 1); + }, 10); +} + +function mul3(n, callback) { + setTimeout(function () { + callback(null, n * 3); + }, 10); +} + +var add1mul3 = async.compose(mul3, add1); + +add1mul3(4, function (err, result) { + // result now equals 15 +}); +``` + +--------------------------------------- + +### seq(fn1, fn2...) + +Version of the compose function that is more natural to read. +Each function consumes the return value of the previous function. +It is the equivalent of [`compose`](#compose) with the arguments reversed. + +Each function is executed with the `this` binding of the composed function. + +__Arguments__ + +* `functions...` - the asynchronous functions to compose + + +__Example__ + +```js +// Requires lodash (or underscore), express3 and dresende's orm2. +// Part of an app, that fetches cats of the logged user. +// This example uses `seq` function to avoid overnesting and error +// handling clutter. +app.get('/cats', function(request, response) { + var User = request.models.User; + async.seq( + _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) + function(user, fn) { + user.getCats(fn); // 'getCats' has signature (callback(err, data)) + } + )(req.session.user_id, function (err, cats) { + if (err) { + console.error(err); + response.json({ status: 'error', message: err.message }); + } else { + response.json({ status: 'ok', message: 'Cats found', data: cats }); + } + }); +}); +``` + +--------------------------------------- + +### applyEach(fns, args..., callback) + +Applies the provided arguments to each function in the array, calling +`callback` after all functions have completed. If you only provide the first +argument, then it will return a function which lets you pass in the +arguments as if it were a single function call. + +__Arguments__ + +* `fns` - the asynchronous functions to all call with the same arguments +* `args...` - any number of separate arguments to pass to the function +* `callback` - the final argument should be the callback, called when all + functions have completed processing + + +__Example__ + +```js +async.applyEach([enableSearch, updateSchema], 'bucket', callback); + +// partial application example: +async.each( + buckets, + async.applyEach([enableSearch, updateSchema]), + callback +); +``` + +__Related__ + +* applyEachSeries(tasks, args..., [callback]) + +--------------------------------------- + + +### queue(worker, [concurrency]) + +Creates a `queue` object with the specified `concurrency`. Tasks added to the +`queue` are processed in parallel (up to the `concurrency` limit). If all +`worker`s are in progress, the task is queued until one becomes available. +Once a `worker` completes a `task`, that `task`'s callback is called. + +__Arguments__ + +* `worker(task, callback)` - An asynchronous function for processing a queued + task, which must call its `callback(err)` argument when finished, with an + optional `error` as an argument. If you want to handle errors from an individual task, pass a callback to `q.push()`. +* `concurrency` - An `integer` for determining how many `worker` functions should be + run in parallel. If omitted, the concurrency defaults to `1`. If the concurrency is `0`, an error is thrown. + +__Queue objects__ + +The `queue` object returned by this function has the following properties and +methods: + +* `length()` - a function returning the number of items waiting to be processed. +* `started` - a function returning whether or not any items have been pushed and processed by the queue +* `running()` - a function returning the number of items currently being processed. +* `workersList()` - a function returning the array of items currently being processed. +* `idle()` - a function returning false if there are items waiting or being processed, or true if not. +* `concurrency` - an integer for determining how many `worker` functions should be + run in parallel. This property can be changed after a `queue` is created to + alter the concurrency on-the-fly. +* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once + the `worker` has finished processing the task. Instead of a single task, a `tasks` array + can be submitted. The respective callback is used for every task in the list. +* `unshift(task, [callback])` - add a new task to the front of the `queue`. +* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit, + and further tasks will be queued. +* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`. +* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`. +* `paused` - a boolean for determining whether the queue is in a paused state +* `pause()` - a function that pauses the processing of tasks until `resume()` is called. +* `resume()` - a function that resumes the processing of queued tasks when the queue is paused. +* `kill()` - a function that removes the `drain` callback and empties remaining tasks from the queue forcing it to go idle. + +__Example__ + +```js +// create a queue object with concurrency 2 + +var q = async.queue(function (task, callback) { + console.log('hello ' + task.name); + callback(); +}, 2); + + +// assign a callback +q.drain = function() { + console.log('all items have been processed'); +} + +// add some items to the queue + +q.push({name: 'foo'}, function (err) { + console.log('finished processing foo'); +}); +q.push({name: 'bar'}, function (err) { + console.log('finished processing bar'); +}); + +// add some items to the queue (batch-wise) + +q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { + console.log('finished processing item'); +}); + +// add some items to the front of the queue + +q.unshift({name: 'bar'}, function (err) { + console.log('finished processing bar'); +}); +``` + + +--------------------------------------- + + +### priorityQueue(worker, concurrency) + +The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects: + +* `push(task, priority, [callback])` - `priority` should be a number. If an array of + `tasks` is given, all tasks will be assigned the same priority. +* The `unshift` method was removed. + +--------------------------------------- + + +### cargo(worker, [payload]) + +Creates a `cargo` object with the specified payload. Tasks added to the +cargo will be processed altogether (up to the `payload` limit). If the +`worker` is in progress, the task is queued until it becomes available. Once +the `worker` has completed some tasks, each callback of those tasks is called. +Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) for how `cargo` and `queue` work. + +While [queue](#queue) passes only one task to one of a group of workers +at a time, cargo passes an array of tasks to a single worker, repeating +when the worker is finished. + +__Arguments__ + +* `worker(tasks, callback)` - An asynchronous function for processing an array of + queued tasks, which must call its `callback(err)` argument when finished, with + an optional `err` argument. +* `payload` - An optional `integer` for determining how many tasks should be + processed per round; if omitted, the default is unlimited. + +__Cargo objects__ + +The `cargo` object returned by this function has the following properties and +methods: + +* `length()` - A function returning the number of items waiting to be processed. +* `payload` - An `integer` for determining how many tasks should be + process per round. This property can be changed after a `cargo` is created to + alter the payload on-the-fly. +* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called + once the `worker` has finished processing the task. Instead of a single task, an array of `tasks` + can be submitted. The respective callback is used for every task in the list. +* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued. +* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`. +* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`. +* `idle()`, `pause()`, `resume()`, `kill()` - cargo inherits all of the same methods and event calbacks as [`queue`](#queue) + +__Example__ + +```js +// create a cargo object with payload 2 + +var cargo = async.cargo(function (tasks, callback) { + for(var i=0; i +### auto(tasks, [concurrency], [callback]) + +Determines the best order for running the functions in `tasks`, based on their requirements. Each function can optionally depend on other functions being completed first, and each function is run as soon as its requirements are satisfied. + +If any of the functions pass an error to their callback, the `auto` sequence will stop. Further tasks will not execute (so any other functions depending on it will not run), and the main `callback` is immediately called with the error. Functions also receive an object containing the results of functions which have completed so far. + +Note, all functions are called with a `results` object as a second argument, +so it is unsafe to pass functions in the `tasks` object which cannot handle the +extra argument. + +For example, this snippet of code: + +```js +async.auto({ + readData: async.apply(fs.readFile, 'data.txt', 'utf-8') +}, callback); +``` + +will have the effect of calling `readFile` with the results object as the last +argument, which will fail: + +```js +fs.readFile('data.txt', 'utf-8', cb, {}); +``` + +Instead, wrap the call to `readFile` in a function which does not forward the +`results` object: + +```js +async.auto({ + readData: function(cb, results){ + fs.readFile('data.txt', 'utf-8', cb); + } +}, callback); +``` + +__Arguments__ + +* `tasks` - An object. Each of its properties is either a function or an array of + requirements, with the function itself the last item in the array. The object's key + of a property serves as the name of the task defined by that property, + i.e. can be used when specifying requirements for other tasks. + The function receives two arguments: (1) a `callback(err, result)` which must be + called when finished, passing an `error` (which can be `null`) and the result of + the function's execution, and (2) a `results` object, containing the results of + the previously executed functions. +* `concurrency` - An optional `integer` for determining the maximum number of tasks that can be run in parallel. By default, as many as possible. +* `callback(err, results)` - An optional callback which is called when all the + tasks have been completed. It receives the `err` argument if any `tasks` + pass an error to their callback. Results are always returned; however, if + an error occurs, no further `tasks` will be performed, and the results + object will only contain partial results. + + +__Example__ + +```js +async.auto({ + get_data: function(callback){ + console.log('in get_data'); + // async code to get some data + callback(null, 'data', 'converted to array'); + }, + make_folder: function(callback){ + console.log('in make_folder'); + // async code to create a directory to store a file in + // this is run at the same time as getting the data + callback(null, 'folder'); + }, + write_file: ['get_data', 'make_folder', function(callback, results){ + console.log('in write_file', JSON.stringify(results)); + // once there is some data and the directory exists, + // write the data to a file in the directory + callback(null, 'filename'); + }], + email_link: ['write_file', function(callback, results){ + console.log('in email_link', JSON.stringify(results)); + // once the file is written let's email a link to it... + // results.write_file contains the filename returned by write_file. + callback(null, {'file':results.write_file, 'email':'user@example.com'}); + }] +}, function(err, results) { + console.log('err = ', err); + console.log('results = ', results); +}); +``` + +This is a fairly trivial example, but to do this using the basic parallel and +series functions would look like this: + +```js +async.parallel([ + function(callback){ + console.log('in get_data'); + // async code to get some data + callback(null, 'data', 'converted to array'); + }, + function(callback){ + console.log('in make_folder'); + // async code to create a directory to store a file in + // this is run at the same time as getting the data + callback(null, 'folder'); + } +], +function(err, results){ + async.series([ + function(callback){ + console.log('in write_file', JSON.stringify(results)); + // once there is some data and the directory exists, + // write the data to a file in the directory + results.push('filename'); + callback(null); + }, + function(callback){ + console.log('in email_link', JSON.stringify(results)); + // once the file is written let's email a link to it... + callback(null, {'file':results.pop(), 'email':'user@example.com'}); + } + ]); +}); +``` + +For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding +new tasks much easier (and the code more readable). + + +--------------------------------------- + + +### retry([opts = {times: 5, interval: 0}| 5], task, [callback]) + +Attempts to get a successful response from `task` no more than `times` times before +returning an error. If the task is successful, the `callback` will be passed the result +of the successful task. If all attempts fail, the callback will be passed the error and +result (if any) of the final attempt. + +__Arguments__ + +* `opts` - Can be either an object with `times` and `interval` or a number. + * `times` - The number of attempts to make before giving up. The default is `5`. + * `interval` - The time to wait between retries, in milliseconds. The default is `0`. + * If `opts` is a number, the number specifies the number of times to retry, with the default interval of `0`. +* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)` + which must be called when finished, passing `err` (which can be `null`) and the `result` of + the function's execution, and (2) a `results` object, containing the results of + the previously executed functions (if nested inside another control flow). +* `callback(err, results)` - An optional callback which is called when the + task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`. + +The [`retry`](#retry) function can be used as a stand-alone control flow by passing a callback, as shown below: + +```js +// try calling apiMethod 3 times +async.retry(3, apiMethod, function(err, result) { + // do something with the result +}); +``` + +```js +// try calling apiMethod 3 times, waiting 200 ms between each retry +async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { + // do something with the result +}); +``` + +```js +// try calling apiMethod the default 5 times no delay between each retry +async.retry(apiMethod, function(err, result) { + // do something with the result +}); +``` + +It can also be embedded within other control flow functions to retry individual methods +that are not as reliable, like this: + +```js +async.auto({ + users: api.getUsers.bind(api), + payments: async.retry(3, api.getPayments.bind(api)) +}, function(err, results) { + // do something with the results +}); +``` + + +--------------------------------------- + + +### iterator(tasks) + +Creates an iterator function which calls the next function in the `tasks` array, +returning a continuation to call the next one after that. It's also possible to +“peek” at the next iterator with `iterator.next()`. + +This function is used internally by the `async` module, but can be useful when +you want to manually control the flow of functions in series. + +__Arguments__ + +* `tasks` - An array of functions to run. + +__Example__ + +```js +var iterator = async.iterator([ + function(){ sys.p('one'); }, + function(){ sys.p('two'); }, + function(){ sys.p('three'); } +]); + +node> var iterator2 = iterator(); +'one' +node> var iterator3 = iterator2(); +'two' +node> iterator3(); +'three' +node> var nextfn = iterator2.next(); +node> nextfn(); +'three' +``` + +--------------------------------------- + + +### apply(function, arguments..) + +Creates a continuation function with some arguments already applied. + +Useful as a shorthand when combined with other control flow functions. Any arguments +passed to the returned function are added to the arguments originally passed +to apply. + +__Arguments__ + +* `function` - The function you want to eventually apply all arguments to. +* `arguments...` - Any number of arguments to automatically apply when the + continuation is called. + +__Example__ + +```js +// using apply + +async.parallel([ + async.apply(fs.writeFile, 'testfile1', 'test1'), + async.apply(fs.writeFile, 'testfile2', 'test2'), +]); + + +// the same process without using apply + +async.parallel([ + function(callback){ + fs.writeFile('testfile1', 'test1', callback); + }, + function(callback){ + fs.writeFile('testfile2', 'test2', callback); + } +]); +``` + +It's possible to pass any number of additional arguments when calling the +continuation: + +```js +node> var fn = async.apply(sys.puts, 'one'); +node> fn('two', 'three'); +one +two +three +``` + +--------------------------------------- + + +### nextTick(callback), setImmediate(callback) + +Calls `callback` on a later loop around the event loop. In Node.js this just +calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)` +if available, otherwise `setTimeout(callback, 0)`, which means other higher priority +events may precede the execution of `callback`. + +This is used internally for browser-compatibility purposes. + +__Arguments__ + +* `callback` - The function to call on a later loop around the event loop. + +__Example__ + +```js +var call_order = []; +async.nextTick(function(){ + call_order.push('two'); + // call_order now equals ['one','two'] +}); +call_order.push('one') +``` + + +### times(n, iterator, [callback]) + +Calls the `iterator` function `n` times, and accumulates results in the same manner +you would use with [`map`](#map). + +__Arguments__ + +* `n` - The number of times to run the function. +* `iterator` - The function to call `n` times. +* `callback` - see [`map`](#map) + +__Example__ + +```js +// Pretend this is some complicated async factory +var createUser = function(id, callback) { + callback(null, { + id: 'user' + id + }) +} +// generate 5 users +async.times(5, function(n, next){ + createUser(n, function(err, user) { + next(err, user) + }) +}, function(err, users) { + // we should now have 5 users +}); +``` + +__Related__ + +* timesSeries(n, iterator, [callback]) +* timesLimit(n, limit, iterator, [callback]) + + +## Utils + + +### memoize(fn, [hasher]) + +Caches the results of an `async` function. When creating a hash to store function +results against, the callback is omitted from the hash and an optional hash +function can be used. + +If no hash function is specified, the first argument is used as a hash key, which may work reasonably if it is a string or a data type that converts to a distinct string. Note that objects and arrays will not behave reasonably. Neither will cases where the other arguments are significant. In such cases, specify your own hash function. + +The cache of results is exposed as the `memo` property of the function returned +by `memoize`. + +__Arguments__ + +* `fn` - The function to proxy and cache results from. +* `hasher` - An optional function for generating a custom hash for storing + results. It has all the arguments applied to it apart from the callback, and + must be synchronous. + +__Example__ + +```js +var slow_fn = function (name, callback) { + // do something + callback(null, result); +}; +var fn = async.memoize(slow_fn); + +// fn can now be used as if it were slow_fn +fn('some name', function () { + // callback +}); +``` + + +### unmemoize(fn) + +Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized +form. Handy for testing. + +__Arguments__ + +* `fn` - the memoized function + +--------------------------------------- + + +### ensureAsync(fn) + +Wrap an async function and ensure it calls its callback on a later tick of the event loop. If the function already calls its callback on a next tick, no extra deferral is added. This is useful for preventing stack overflows (`RangeError: Maximum call stack size exceeded`) and generally keeping [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) contained. + +__Arguments__ + +* `fn` - an async function, one that expects a node-style callback as its last argument + +Returns a wrapped function with the exact same call signature as the function passed in. + +__Example__ + +```js +function sometimesAsync(arg, callback) { + if (cache[arg]) { + return callback(null, cache[arg]); // this would be synchronous!! + } else { + doSomeIO(arg, callback); // this IO would be asynchronous + } +} + +// this has a risk of stack overflows if many results are cached in a row +async.mapSeries(args, sometimesAsync, done); + +// this will defer sometimesAsync's callback if necessary, +// preventing stack overflows +async.mapSeries(args, async.ensureAsync(sometimesAsync), done); + +``` + +--------------------------------------- + + +### constant(values...) + +Returns a function that when called, calls-back with the values provided. Useful as the first function in a `waterfall`, or for plugging values in to `auto`. + +__Example__ + +```js +async.waterfall([ + async.constant(42), + function (value, next) { + // value === 42 + }, + //... +], callback); + +async.waterfall([ + async.constant(filename, "utf8"), + fs.readFile, + function (fileData, next) { + //... + } + //... +], callback); + +async.auto({ + hostname: async.constant("https://server.net/"), + port: findFreePort, + launchServer: ["hostname", "port", function (cb, options) { + startServer(options, cb); + }], + //... +}, callback); + +``` + +--------------------------------------- + + + +### asyncify(func) + +__Alias:__ `wrapSync` + +Take a sync function and make it async, passing its return value to a callback. This is useful for plugging sync functions into a waterfall, series, or other async functions. Any arguments passed to the generated function will be passed to the wrapped function (except for the final callback argument). Errors thrown will be passed to the callback. + +__Example__ + +```js +async.waterfall([ + async.apply(fs.readFile, filename, "utf8"), + async.asyncify(JSON.parse), + function (data, next) { + // data is the result of parsing the text. + // If there was a parsing error, it would have been caught. + } +], callback) +``` + +If the function passed to `asyncify` returns a Promise, that promises's resolved/rejected state will be used to call the callback, rather than simply the synchronous return value. Example: + +```js +async.waterfall([ + async.apply(fs.readFile, filename, "utf8"), + async.asyncify(function (contents) { + return db.model.create(contents); + }), + function (model, next) { + // `model` is the instantiated model object. + // If there was an error, this function would be skipped. + } +], callback) +``` + +This also means you can asyncify ES2016 `async` functions. + +```js +var q = async.queue(async.asyncify(async function (file) { + var intermediateStep = await processFile(file); + return await somePromise(intermediateStep) +})); + +q.push(files); +``` + +--------------------------------------- + + +### log(function, arguments) + +Logs the result of an `async` function to the `console`. Only works in Node.js or +in browsers that support `console.log` and `console.error` (such as FF and Chrome). +If multiple arguments are returned from the async function, `console.log` is +called on each argument in order. + +__Arguments__ + +* `function` - The function you want to eventually apply all arguments to. +* `arguments...` - Any number of arguments to apply to the function. + +__Example__ + +```js +var hello = function(name, callback){ + setTimeout(function(){ + callback(null, 'hello ' + name); + }, 1000); +}; +``` +```js +node> async.log(hello, 'world'); +'hello world' +``` + +--------------------------------------- + + +### dir(function, arguments) + +Logs the result of an `async` function to the `console` using `console.dir` to +display the properties of the resulting object. Only works in Node.js or +in browsers that support `console.dir` and `console.error` (such as FF and Chrome). +If multiple arguments are returned from the async function, `console.dir` is +called on each argument in order. + +__Arguments__ + +* `function` - The function you want to eventually apply all arguments to. +* `arguments...` - Any number of arguments to apply to the function. + +__Example__ + +```js +var hello = function(name, callback){ + setTimeout(function(){ + callback(null, {hello: name}); + }, 1000); +}; +``` +```js +node> async.dir(hello, 'world'); +{hello: 'world'} +``` + +--------------------------------------- + + +### noConflict() + +Changes the value of `async` back to its original value, returning a reference to the +`async` object. diff --git a/datalab/web/node_modules/async/dist/async.js b/datalab/web/node_modules/async/dist/async.js new file mode 100644 index 0000000000000000000000000000000000000000..31e7620fb6ffb3a9db48740e3f18921cb3d07c1f --- /dev/null +++ b/datalab/web/node_modules/async/dist/async.js @@ -0,0 +1,1265 @@ +/*! + * async + * https://github.com/caolan/async + * + * Copyright 2010-2014 Caolan McMahon + * Released under the MIT license + */ +(function () { + + var async = {}; + function noop() {} + function identity(v) { + return v; + } + function toBool(v) { + return !!v; + } + function notId(v) { + return !v; + } + + // global on the server, window in the browser + var previous_async; + + // Establish the root object, `window` (`self`) in the browser, `global` + // on the server, or `this` in some virtual machines. We use `self` + // instead of `window` for `WebWorker` support. + var root = typeof self === 'object' && self.self === self && self || + typeof global === 'object' && global.global === global && global || + this; + + if (root != null) { + previous_async = root.async; + } + + async.noConflict = function () { + root.async = previous_async; + return async; + }; + + function only_once(fn) { + return function() { + if (fn === null) throw new Error("Callback was already called."); + fn.apply(this, arguments); + fn = null; + }; + } + + function _once(fn) { + return function() { + if (fn === null) return; + fn.apply(this, arguments); + fn = null; + }; + } + + //// cross-browser compatiblity functions //// + + var _toString = Object.prototype.toString; + + var _isArray = Array.isArray || function (obj) { + return _toString.call(obj) === '[object Array]'; + }; + + // Ported from underscore.js isObject + var _isObject = function(obj) { + var type = typeof obj; + return type === 'function' || type === 'object' && !!obj; + }; + + function _isArrayLike(arr) { + return _isArray(arr) || ( + // has a positive integer length property + typeof arr.length === "number" && + arr.length >= 0 && + arr.length % 1 === 0 + ); + } + + function _arrayEach(arr, iterator) { + var index = -1, + length = arr.length; + + while (++index < length) { + iterator(arr[index], index, arr); + } + } + + function _map(arr, iterator) { + var index = -1, + length = arr.length, + result = Array(length); + + while (++index < length) { + result[index] = iterator(arr[index], index, arr); + } + return result; + } + + function _range(count) { + return _map(Array(count), function (v, i) { return i; }); + } + + function _reduce(arr, iterator, memo) { + _arrayEach(arr, function (x, i, a) { + memo = iterator(memo, x, i, a); + }); + return memo; + } + + function _forEachOf(object, iterator) { + _arrayEach(_keys(object), function (key) { + iterator(object[key], key); + }); + } + + function _indexOf(arr, item) { + for (var i = 0; i < arr.length; i++) { + if (arr[i] === item) return i; + } + return -1; + } + + var _keys = Object.keys || function (obj) { + var keys = []; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + keys.push(k); + } + } + return keys; + }; + + function _keyIterator(coll) { + var i = -1; + var len; + var keys; + if (_isArrayLike(coll)) { + len = coll.length; + return function next() { + i++; + return i < len ? i : null; + }; + } else { + keys = _keys(coll); + len = keys.length; + return function next() { + i++; + return i < len ? keys[i] : null; + }; + } + } + + // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html) + // This accumulates the arguments passed into an array, after a given index. + // From underscore.js (https://github.com/jashkenas/underscore/pull/2140). + function _restParam(func, startIndex) { + startIndex = startIndex == null ? func.length - 1 : +startIndex; + return function() { + var length = Math.max(arguments.length - startIndex, 0); + var rest = Array(length); + for (var index = 0; index < length; index++) { + rest[index] = arguments[index + startIndex]; + } + switch (startIndex) { + case 0: return func.call(this, rest); + case 1: return func.call(this, arguments[0], rest); + } + // Currently unused but handle cases outside of the switch statement: + // var args = Array(startIndex + 1); + // for (index = 0; index < startIndex; index++) { + // args[index] = arguments[index]; + // } + // args[startIndex] = rest; + // return func.apply(this, args); + }; + } + + function _withoutIndex(iterator) { + return function (value, index, callback) { + return iterator(value, callback); + }; + } + + //// exported async module functions //// + + //// nextTick implementation with browser-compatible fallback //// + + // capture the global reference to guard against fakeTimer mocks + var _setImmediate = typeof setImmediate === 'function' && setImmediate; + + var _delay = _setImmediate ? function(fn) { + // not a direct alias for IE10 compatibility + _setImmediate(fn); + } : function(fn) { + setTimeout(fn, 0); + }; + + if (typeof process === 'object' && typeof process.nextTick === 'function') { + async.nextTick = process.nextTick; + } else { + async.nextTick = _delay; + } + async.setImmediate = _setImmediate ? _delay : async.nextTick; + + + async.forEach = + async.each = function (arr, iterator, callback) { + return async.eachOf(arr, _withoutIndex(iterator), callback); + }; + + async.forEachSeries = + async.eachSeries = function (arr, iterator, callback) { + return async.eachOfSeries(arr, _withoutIndex(iterator), callback); + }; + + + async.forEachLimit = + async.eachLimit = function (arr, limit, iterator, callback) { + return _eachOfLimit(limit)(arr, _withoutIndex(iterator), callback); + }; + + async.forEachOf = + async.eachOf = function (object, iterator, callback) { + callback = _once(callback || noop); + object = object || []; + + var iter = _keyIterator(object); + var key, completed = 0; + + while ((key = iter()) != null) { + completed += 1; + iterator(object[key], key, only_once(done)); + } + + if (completed === 0) callback(null); + + function done(err) { + completed--; + if (err) { + callback(err); + } + // Check key is null in case iterator isn't exhausted + // and done resolved synchronously. + else if (key === null && completed <= 0) { + callback(null); + } + } + }; + + async.forEachOfSeries = + async.eachOfSeries = function (obj, iterator, callback) { + callback = _once(callback || noop); + obj = obj || []; + var nextKey = _keyIterator(obj); + var key = nextKey(); + function iterate() { + var sync = true; + if (key === null) { + return callback(null); + } + iterator(obj[key], key, only_once(function (err) { + if (err) { + callback(err); + } + else { + key = nextKey(); + if (key === null) { + return callback(null); + } else { + if (sync) { + async.setImmediate(iterate); + } else { + iterate(); + } + } + } + })); + sync = false; + } + iterate(); + }; + + + + async.forEachOfLimit = + async.eachOfLimit = function (obj, limit, iterator, callback) { + _eachOfLimit(limit)(obj, iterator, callback); + }; + + function _eachOfLimit(limit) { + + return function (obj, iterator, callback) { + callback = _once(callback || noop); + obj = obj || []; + var nextKey = _keyIterator(obj); + if (limit <= 0) { + return callback(null); + } + var done = false; + var running = 0; + var errored = false; + + (function replenish () { + if (done && running <= 0) { + return callback(null); + } + + while (running < limit && !errored) { + var key = nextKey(); + if (key === null) { + done = true; + if (running <= 0) { + callback(null); + } + return; + } + running += 1; + iterator(obj[key], key, only_once(function (err) { + running -= 1; + if (err) { + callback(err); + errored = true; + } + else { + replenish(); + } + })); + } + })(); + }; + } + + + function doParallel(fn) { + return function (obj, iterator, callback) { + return fn(async.eachOf, obj, iterator, callback); + }; + } + function doParallelLimit(fn) { + return function (obj, limit, iterator, callback) { + return fn(_eachOfLimit(limit), obj, iterator, callback); + }; + } + function doSeries(fn) { + return function (obj, iterator, callback) { + return fn(async.eachOfSeries, obj, iterator, callback); + }; + } + + function _asyncMap(eachfn, arr, iterator, callback) { + callback = _once(callback || noop); + arr = arr || []; + var results = _isArrayLike(arr) ? [] : {}; + eachfn(arr, function (value, index, callback) { + iterator(value, function (err, v) { + results[index] = v; + callback(err); + }); + }, function (err) { + callback(err, results); + }); + } + + async.map = doParallel(_asyncMap); + async.mapSeries = doSeries(_asyncMap); + async.mapLimit = doParallelLimit(_asyncMap); + + // reduce only has a series version, as doing reduce in parallel won't + // work in many situations. + async.inject = + async.foldl = + async.reduce = function (arr, memo, iterator, callback) { + async.eachOfSeries(arr, function (x, i, callback) { + iterator(memo, x, function (err, v) { + memo = v; + callback(err); + }); + }, function (err) { + callback(err, memo); + }); + }; + + async.foldr = + async.reduceRight = function (arr, memo, iterator, callback) { + var reversed = _map(arr, identity).reverse(); + async.reduce(reversed, memo, iterator, callback); + }; + + async.transform = function (arr, memo, iterator, callback) { + if (arguments.length === 3) { + callback = iterator; + iterator = memo; + memo = _isArray(arr) ? [] : {}; + } + + async.eachOf(arr, function(v, k, cb) { + iterator(memo, v, k, cb); + }, function(err) { + callback(err, memo); + }); + }; + + function _filter(eachfn, arr, iterator, callback) { + var results = []; + eachfn(arr, function (x, index, callback) { + iterator(x, function (v) { + if (v) { + results.push({index: index, value: x}); + } + callback(); + }); + }, function () { + callback(_map(results.sort(function (a, b) { + return a.index - b.index; + }), function (x) { + return x.value; + })); + }); + } + + async.select = + async.filter = doParallel(_filter); + + async.selectLimit = + async.filterLimit = doParallelLimit(_filter); + + async.selectSeries = + async.filterSeries = doSeries(_filter); + + function _reject(eachfn, arr, iterator, callback) { + _filter(eachfn, arr, function(value, cb) { + iterator(value, function(v) { + cb(!v); + }); + }, callback); + } + async.reject = doParallel(_reject); + async.rejectLimit = doParallelLimit(_reject); + async.rejectSeries = doSeries(_reject); + + function _createTester(eachfn, check, getResult) { + return function(arr, limit, iterator, cb) { + function done() { + if (cb) cb(getResult(false, void 0)); + } + function iteratee(x, _, callback) { + if (!cb) return callback(); + iterator(x, function (v) { + if (cb && check(v)) { + cb(getResult(true, x)); + cb = iterator = false; + } + callback(); + }); + } + if (arguments.length > 3) { + eachfn(arr, limit, iteratee, done); + } else { + cb = iterator; + iterator = limit; + eachfn(arr, iteratee, done); + } + }; + } + + async.any = + async.some = _createTester(async.eachOf, toBool, identity); + + async.someLimit = _createTester(async.eachOfLimit, toBool, identity); + + async.all = + async.every = _createTester(async.eachOf, notId, notId); + + async.everyLimit = _createTester(async.eachOfLimit, notId, notId); + + function _findGetResult(v, x) { + return x; + } + async.detect = _createTester(async.eachOf, identity, _findGetResult); + async.detectSeries = _createTester(async.eachOfSeries, identity, _findGetResult); + async.detectLimit = _createTester(async.eachOfLimit, identity, _findGetResult); + + async.sortBy = function (arr, iterator, callback) { + async.map(arr, function (x, callback) { + iterator(x, function (err, criteria) { + if (err) { + callback(err); + } + else { + callback(null, {value: x, criteria: criteria}); + } + }); + }, function (err, results) { + if (err) { + return callback(err); + } + else { + callback(null, _map(results.sort(comparator), function (x) { + return x.value; + })); + } + + }); + + function comparator(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + } + }; + + async.auto = function (tasks, concurrency, callback) { + if (typeof arguments[1] === 'function') { + // concurrency is optional, shift the args. + callback = concurrency; + concurrency = null; + } + callback = _once(callback || noop); + var keys = _keys(tasks); + var remainingTasks = keys.length; + if (!remainingTasks) { + return callback(null); + } + if (!concurrency) { + concurrency = remainingTasks; + } + + var results = {}; + var runningTasks = 0; + + var hasError = false; + + var listeners = []; + function addListener(fn) { + listeners.unshift(fn); + } + function removeListener(fn) { + var idx = _indexOf(listeners, fn); + if (idx >= 0) listeners.splice(idx, 1); + } + function taskComplete() { + remainingTasks--; + _arrayEach(listeners.slice(0), function (fn) { + fn(); + }); + } + + addListener(function () { + if (!remainingTasks) { + callback(null, results); + } + }); + + _arrayEach(keys, function (k) { + if (hasError) return; + var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]]; + var taskCallback = _restParam(function(err, args) { + runningTasks--; + if (args.length <= 1) { + args = args[0]; + } + if (err) { + var safeResults = {}; + _forEachOf(results, function(val, rkey) { + safeResults[rkey] = val; + }); + safeResults[k] = args; + hasError = true; + + callback(err, safeResults); + } + else { + results[k] = args; + async.setImmediate(taskComplete); + } + }); + var requires = task.slice(0, task.length - 1); + // prevent dead-locks + var len = requires.length; + var dep; + while (len--) { + if (!(dep = tasks[requires[len]])) { + throw new Error('Has nonexistent dependency in ' + requires.join(', ')); + } + if (_isArray(dep) && _indexOf(dep, k) >= 0) { + throw new Error('Has cyclic dependencies'); + } + } + function ready() { + return runningTasks < concurrency && _reduce(requires, function (a, x) { + return (a && results.hasOwnProperty(x)); + }, true) && !results.hasOwnProperty(k); + } + if (ready()) { + runningTasks++; + task[task.length - 1](taskCallback, results); + } + else { + addListener(listener); + } + function listener() { + if (ready()) { + runningTasks++; + removeListener(listener); + task[task.length - 1](taskCallback, results); + } + } + }); + }; + + + + async.retry = function(times, task, callback) { + var DEFAULT_TIMES = 5; + var DEFAULT_INTERVAL = 0; + + var attempts = []; + + var opts = { + times: DEFAULT_TIMES, + interval: DEFAULT_INTERVAL + }; + + function parseTimes(acc, t){ + if(typeof t === 'number'){ + acc.times = parseInt(t, 10) || DEFAULT_TIMES; + } else if(typeof t === 'object'){ + acc.times = parseInt(t.times, 10) || DEFAULT_TIMES; + acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL; + } else { + throw new Error('Unsupported argument type for \'times\': ' + typeof t); + } + } + + var length = arguments.length; + if (length < 1 || length > 3) { + throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)'); + } else if (length <= 2 && typeof times === 'function') { + callback = task; + task = times; + } + if (typeof times !== 'function') { + parseTimes(opts, times); + } + opts.callback = callback; + opts.task = task; + + function wrappedTask(wrappedCallback, wrappedResults) { + function retryAttempt(task, finalAttempt) { + return function(seriesCallback) { + task(function(err, result){ + seriesCallback(!err || finalAttempt, {err: err, result: result}); + }, wrappedResults); + }; + } + + function retryInterval(interval){ + return function(seriesCallback){ + setTimeout(function(){ + seriesCallback(null); + }, interval); + }; + } + + while (opts.times) { + + var finalAttempt = !(opts.times-=1); + attempts.push(retryAttempt(opts.task, finalAttempt)); + if(!finalAttempt && opts.interval > 0){ + attempts.push(retryInterval(opts.interval)); + } + } + + async.series(attempts, function(done, data){ + data = data[data.length - 1]; + (wrappedCallback || opts.callback)(data.err, data.result); + }); + } + + // If a callback is passed, run this as a controll flow + return opts.callback ? wrappedTask() : wrappedTask; + }; + + async.waterfall = function (tasks, callback) { + callback = _once(callback || noop); + if (!_isArray(tasks)) { + var err = new Error('First argument to waterfall must be an array of functions'); + return callback(err); + } + if (!tasks.length) { + return callback(); + } + function wrapIterator(iterator) { + return _restParam(function (err, args) { + if (err) { + callback.apply(null, [err].concat(args)); + } + else { + var next = iterator.next(); + if (next) { + args.push(wrapIterator(next)); + } + else { + args.push(callback); + } + ensureAsync(iterator).apply(null, args); + } + }); + } + wrapIterator(async.iterator(tasks))(); + }; + + function _parallel(eachfn, tasks, callback) { + callback = callback || noop; + var results = _isArrayLike(tasks) ? [] : {}; + + eachfn(tasks, function (task, key, callback) { + task(_restParam(function (err, args) { + if (args.length <= 1) { + args = args[0]; + } + results[key] = args; + callback(err); + })); + }, function (err) { + callback(err, results); + }); + } + + async.parallel = function (tasks, callback) { + _parallel(async.eachOf, tasks, callback); + }; + + async.parallelLimit = function(tasks, limit, callback) { + _parallel(_eachOfLimit(limit), tasks, callback); + }; + + async.series = function(tasks, callback) { + _parallel(async.eachOfSeries, tasks, callback); + }; + + async.iterator = function (tasks) { + function makeCallback(index) { + function fn() { + if (tasks.length) { + tasks[index].apply(null, arguments); + } + return fn.next(); + } + fn.next = function () { + return (index < tasks.length - 1) ? makeCallback(index + 1): null; + }; + return fn; + } + return makeCallback(0); + }; + + async.apply = _restParam(function (fn, args) { + return _restParam(function (callArgs) { + return fn.apply( + null, args.concat(callArgs) + ); + }); + }); + + function _concat(eachfn, arr, fn, callback) { + var result = []; + eachfn(arr, function (x, index, cb) { + fn(x, function (err, y) { + result = result.concat(y || []); + cb(err); + }); + }, function (err) { + callback(err, result); + }); + } + async.concat = doParallel(_concat); + async.concatSeries = doSeries(_concat); + + async.whilst = function (test, iterator, callback) { + callback = callback || noop; + if (test()) { + var next = _restParam(function(err, args) { + if (err) { + callback(err); + } else if (test.apply(this, args)) { + iterator(next); + } else { + callback.apply(null, [null].concat(args)); + } + }); + iterator(next); + } else { + callback(null); + } + }; + + async.doWhilst = function (iterator, test, callback) { + var calls = 0; + return async.whilst(function() { + return ++calls <= 1 || test.apply(this, arguments); + }, iterator, callback); + }; + + async.until = function (test, iterator, callback) { + return async.whilst(function() { + return !test.apply(this, arguments); + }, iterator, callback); + }; + + async.doUntil = function (iterator, test, callback) { + return async.doWhilst(iterator, function() { + return !test.apply(this, arguments); + }, callback); + }; + + async.during = function (test, iterator, callback) { + callback = callback || noop; + + var next = _restParam(function(err, args) { + if (err) { + callback(err); + } else { + args.push(check); + test.apply(this, args); + } + }); + + var check = function(err, truth) { + if (err) { + callback(err); + } else if (truth) { + iterator(next); + } else { + callback(null); + } + }; + + test(check); + }; + + async.doDuring = function (iterator, test, callback) { + var calls = 0; + async.during(function(next) { + if (calls++ < 1) { + next(null, true); + } else { + test.apply(this, arguments); + } + }, iterator, callback); + }; + + function _queue(worker, concurrency, payload) { + if (concurrency == null) { + concurrency = 1; + } + else if(concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } + function _insert(q, data, pos, callback) { + if (callback != null && typeof callback !== "function") { + throw new Error("task callback must be a function"); + } + q.started = true; + if (!_isArray(data)) { + data = [data]; + } + if(data.length === 0 && q.idle()) { + // call drain immediately if there are no tasks + return async.setImmediate(function() { + q.drain(); + }); + } + _arrayEach(data, function(task) { + var item = { + data: task, + callback: callback || noop + }; + + if (pos) { + q.tasks.unshift(item); + } else { + q.tasks.push(item); + } + + if (q.tasks.length === q.concurrency) { + q.saturated(); + } + }); + async.setImmediate(q.process); + } + function _next(q, tasks) { + return function(){ + workers -= 1; + + var removed = false; + var args = arguments; + _arrayEach(tasks, function (task) { + _arrayEach(workersList, function (worker, index) { + if (worker === task && !removed) { + workersList.splice(index, 1); + removed = true; + } + }); + + task.callback.apply(task, args); + }); + if (q.tasks.length + workers === 0) { + q.drain(); + } + q.process(); + }; + } + + var workers = 0; + var workersList = []; + var q = { + tasks: [], + concurrency: concurrency, + payload: payload, + saturated: noop, + empty: noop, + drain: noop, + started: false, + paused: false, + push: function (data, callback) { + _insert(q, data, false, callback); + }, + kill: function () { + q.drain = noop; + q.tasks = []; + }, + unshift: function (data, callback) { + _insert(q, data, true, callback); + }, + process: function () { + while(!q.paused && workers < q.concurrency && q.tasks.length){ + + var tasks = q.payload ? + q.tasks.splice(0, q.payload) : + q.tasks.splice(0, q.tasks.length); + + var data = _map(tasks, function (task) { + return task.data; + }); + + if (q.tasks.length === 0) { + q.empty(); + } + workers += 1; + workersList.push(tasks[0]); + var cb = only_once(_next(q, tasks)); + worker(data, cb); + } + }, + length: function () { + return q.tasks.length; + }, + running: function () { + return workers; + }, + workersList: function () { + return workersList; + }, + idle: function() { + return q.tasks.length + workers === 0; + }, + pause: function () { + q.paused = true; + }, + resume: function () { + if (q.paused === false) { return; } + q.paused = false; + var resumeCount = Math.min(q.concurrency, q.tasks.length); + // Need to call q.process once per concurrent + // worker to preserve full concurrency after pause + for (var w = 1; w <= resumeCount; w++) { + async.setImmediate(q.process); + } + } + }; + return q; + } + + async.queue = function (worker, concurrency) { + var q = _queue(function (items, cb) { + worker(items[0], cb); + }, concurrency, 1); + + return q; + }; + + async.priorityQueue = function (worker, concurrency) { + + function _compareTasks(a, b){ + return a.priority - b.priority; + } + + function _binarySearch(sequence, item, compare) { + var beg = -1, + end = sequence.length - 1; + while (beg < end) { + var mid = beg + ((end - beg + 1) >>> 1); + if (compare(item, sequence[mid]) >= 0) { + beg = mid; + } else { + end = mid - 1; + } + } + return beg; + } + + function _insert(q, data, priority, callback) { + if (callback != null && typeof callback !== "function") { + throw new Error("task callback must be a function"); + } + q.started = true; + if (!_isArray(data)) { + data = [data]; + } + if(data.length === 0) { + // call drain immediately if there are no tasks + return async.setImmediate(function() { + q.drain(); + }); + } + _arrayEach(data, function(task) { + var item = { + data: task, + priority: priority, + callback: typeof callback === 'function' ? callback : noop + }; + + q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); + + if (q.tasks.length === q.concurrency) { + q.saturated(); + } + async.setImmediate(q.process); + }); + } + + // Start with a normal queue + var q = async.queue(worker, concurrency); + + // Override push to accept second parameter representing priority + q.push = function (data, priority, callback) { + _insert(q, data, priority, callback); + }; + + // Remove unshift function + delete q.unshift; + + return q; + }; + + async.cargo = function (worker, payload) { + return _queue(worker, 1, payload); + }; + + function _console_fn(name) { + return _restParam(function (fn, args) { + fn.apply(null, args.concat([_restParam(function (err, args) { + if (typeof console === 'object') { + if (err) { + if (console.error) { + console.error(err); + } + } + else if (console[name]) { + _arrayEach(args, function (x) { + console[name](x); + }); + } + } + })])); + }); + } + async.log = _console_fn('log'); + async.dir = _console_fn('dir'); + /*async.info = _console_fn('info'); + async.warn = _console_fn('warn'); + async.error = _console_fn('error');*/ + + async.memoize = function (fn, hasher) { + var memo = {}; + var queues = {}; + var has = Object.prototype.hasOwnProperty; + hasher = hasher || identity; + var memoized = _restParam(function memoized(args) { + var callback = args.pop(); + var key = hasher.apply(null, args); + if (has.call(memo, key)) { + async.setImmediate(function () { + callback.apply(null, memo[key]); + }); + } + else if (has.call(queues, key)) { + queues[key].push(callback); + } + else { + queues[key] = [callback]; + fn.apply(null, args.concat([_restParam(function (args) { + memo[key] = args; + var q = queues[key]; + delete queues[key]; + for (var i = 0, l = q.length; i < l; i++) { + q[i].apply(null, args); + } + })])); + } + }); + memoized.memo = memo; + memoized.unmemoized = fn; + return memoized; + }; + + async.unmemoize = function (fn) { + return function () { + return (fn.unmemoized || fn).apply(null, arguments); + }; + }; + + function _times(mapper) { + return function (count, iterator, callback) { + mapper(_range(count), iterator, callback); + }; + } + + async.times = _times(async.map); + async.timesSeries = _times(async.mapSeries); + async.timesLimit = function (count, limit, iterator, callback) { + return async.mapLimit(_range(count), limit, iterator, callback); + }; + + async.seq = function (/* functions... */) { + var fns = arguments; + return _restParam(function (args) { + var that = this; + + var callback = args[args.length - 1]; + if (typeof callback == 'function') { + args.pop(); + } else { + callback = noop; + } + + async.reduce(fns, args, function (newargs, fn, cb) { + fn.apply(that, newargs.concat([_restParam(function (err, nextargs) { + cb(err, nextargs); + })])); + }, + function (err, results) { + callback.apply(that, [err].concat(results)); + }); + }); + }; + + async.compose = function (/* functions... */) { + return async.seq.apply(null, Array.prototype.reverse.call(arguments)); + }; + + + function _applyEach(eachfn) { + return _restParam(function(fns, args) { + var go = _restParam(function(args) { + var that = this; + var callback = args.pop(); + return eachfn(fns, function (fn, _, cb) { + fn.apply(that, args.concat([cb])); + }, + callback); + }); + if (args.length) { + return go.apply(this, args); + } + else { + return go; + } + }); + } + + async.applyEach = _applyEach(async.eachOf); + async.applyEachSeries = _applyEach(async.eachOfSeries); + + + async.forever = function (fn, callback) { + var done = only_once(callback || noop); + var task = ensureAsync(fn); + function next(err) { + if (err) { + return done(err); + } + task(next); + } + next(); + }; + + function ensureAsync(fn) { + return _restParam(function (args) { + var callback = args.pop(); + args.push(function () { + var innerArgs = arguments; + if (sync) { + async.setImmediate(function () { + callback.apply(null, innerArgs); + }); + } else { + callback.apply(null, innerArgs); + } + }); + var sync = true; + fn.apply(this, args); + sync = false; + }); + } + + async.ensureAsync = ensureAsync; + + async.constant = _restParam(function(values) { + var args = [null].concat(values); + return function (callback) { + return callback.apply(this, args); + }; + }); + + async.wrapSync = + async.asyncify = function asyncify(func) { + return _restParam(function (args) { + var callback = args.pop(); + var result; + try { + result = func.apply(this, args); + } catch (e) { + return callback(e); + } + // if result is Promise object + if (_isObject(result) && typeof result.then === "function") { + result.then(function(value) { + callback(null, value); + })["catch"](function(err) { + callback(err.message ? err : new Error(err)); + }); + } else { + callback(null, result); + } + }); + }; + + // Node.js + if (typeof module === 'object' && module.exports) { + module.exports = async; + } + // AMD / RequireJS + else if (typeof define === 'function' && define.amd) { + define([], function () { + return async; + }); + } + // included directly via +``` + +As of version 1.1.0, node-bunyan supports being run via Browserify. The +default [stream](#streams) when running in the browser is one that emits +raw log records to `console.log/info/warn/error`. + +Here is a quick example showing you how you can get this working for your +script. + +1. Get browserify and bunyan installed in your module: + + ```sh + $ npm install browserify bunyan + ``` + +2. An example script using Bunyan, "play.js": + + ```js + var bunyan = require('bunyan'); + var log = bunyan.createLogger({name: 'play', level: 'debug'}); + log.trace('this one does not emit'); + log.debug('hi on debug'); // console.log + log.info('hi on info'); // console.info + log.warn('hi on warn'); // console.warn + log.error('hi on error'); // console.error + ``` + +3. Build this into a bundle to run in the browser, "play.browser.js": + + ```sh + $ ./node_modules/.bin/browserify play.js -o play.browser.js + ``` + +4. Put that into an HTML file, "play.html": + + ```html + + + + + + + +
hi
+ + + ``` + +5. Open that in your browser and open your browser console: + + ```sh + $ open play.html + ``` + +Here is what it looks like in Firefox's console: ![Bunyan + Browserify in the +Firefox console](./docs/img/bunyan.browserify.png) + +For some, the raw log records might not be desired. To have a rendered log line +you'll want to add your own stream, starting with something like this: + +```js +var bunyan = require('./lib/bunyan'); + +function MyRawStream() {} +MyRawStream.prototype.write = function (rec) { + console.log('[%s] %s: %s', + rec.time.toISOString(), + bunyan.nameFromLevel[rec.level], + rec.msg); +} + +var log = bunyan.createLogger({ + name: 'play', + streams: [ + { + level: 'info', + stream: new MyRawStream(), + type: 'raw' + } + ] +}); + +log.info('hi on info'); +``` + +## Webpack +Webpack can work with the same example Browserify above. To do this, we need to make webpack ignore optional files: +Create "empty_shim.js": +```javascript +// This is an empty shim for things that should be not be included in webpack +``` +Now tell webpack to use this file for +[optional dependencies](https://webpack.github.io/docs/configuration.html#resolve-alias) +in your "webpack.config.js": +``` +resolve: { + // These shims are needed for bunyan + alias: { + 'dtrace-provider': '/path/to/shim/empty_shim.js', + fs: '/path/to/shim/empty_shim.js', + 'safe-json-stringify': '/path/to/shim/empty_shim.js', + mv: '/path/to/shim/empty_shim.js', + 'source-map-support': '/path/to/shim/empty_shim.js' + } +} +``` +Now webpack builds, ignoring these optional dependencies via shimming in an empty JS file! + +# Versioning + +All versions are `..` which will be incremented for +breaking backward compat and major reworks, new features without breaking +change, and bug fixes, respectively. tl;dr: [Semantic +versioning](http://semver.org/). + +# License + +[MIT](./LICENSE.txt). + +# See Also + +See the [user-maintained list of Bunyan-related software in the Bunyan +wiki](https://github.com/trentm/node-bunyan/wiki/Awesome-Bunyan). diff --git a/datalab/web/node_modules/bunyan/TODO.md b/datalab/web/node_modules/bunyan/TODO.md new file mode 100644 index 0000000000000000000000000000000000000000..814f6ed05704f83beabf90a90371bd83c0f385b2 --- /dev/null +++ b/datalab/web/node_modules/bunyan/TODO.md @@ -0,0 +1,137 @@ +# higher prio + +- `bunyan` (without redir) ^C should stop, doesn't since recent change +- man page for the bunyan CLI (refer to it in the readme) + - perhaps wait for a bunyan new version with deps, and use dashdash + with a (vapour) man page generator + +# v2 + +- ^C fix +- node-exeunt +- `createLogger(, )` changes (#460) + - see section below +- the dtrace-provider thing (#487) + TODO: answer Cody email +- use package.json version for VERSION +- use deps + - dashdash + - assert-plus? + - verror? +- break out to multiple files + - want to work through PRs before that, so don't just break them all +- TODO: a quick pass through tickets and pulls for other things to include +- get ticket refs for the above, if any +- formatters: read up again on `glp master..1.x` +- support for customer formatters + - for the CLI as well? How? ~/.bunyanrc? + + +# changes to ctor and log.child to separate fields from config + + + +Current: + + createLogger() + log.child(, ) + +Could be: + + createLogger(, ) + log.child(, ) + # Still support: log.child(, ) + +Pros: Compat issues are minimal: a change is only required if there is a +collision with used field and a new config var name. +Cons: A *slight* con is that my guess is the common usage of child is +`log.child()`, so the more future-proof common usage becomes: + + log.child(null, ) + +That's not too bad. It is clearer at least than: + + log.child(, true) + +TODO: + +- is there a ticket for this work already? +- make the change +- do a migration guide? i.e. provide the grep commands to find all + possible calls to inspect. E.g. if don't have `rg logUndefined` in your + code, then you are fine. And one time future-proofing via changing + to fields in the *second* arg. +- list of issues/pulls that wanted to add new config fields + + + +# docs + +- document log.addStream() and log.addSerializers() + + +# someday/maybe + +- 2.0 (?) with `v: 1` in log records. Fwd/bwd compat in `bunyan` CLI +- `tail -f`-like support +- full-on docs +- better examples/ +- better coloring +- look at pino (bunyan style, perf benefits) +- would be exciting to have bunyan support in http://lnav.org/ if that + made sense +- "template" support for 'rotating-file' stream to get dated rolled files +- "all" or "off" levels? log4j? logging.py? + logging.py has NOTSET === 0. I think that is only needed/used for + multi-level hierarchical effective level. +- buffered writes to increase speed: + - I'd start with a tools/timeoutput.js for some numbers to compare + before/after. Sustained high output to a file. + - perhaps this would be a "buffered: true" option on the stream object + - then wrap the "stream" with a local class that handles the buffering + - to finish this, need the 'log.close' and `process.on('exit', ...)` + work that Trent has started. +- "canWrite" handling for full streams. Need to buffer a la log4js +- test file log with logadm rotation: does it handle that? +- test suite: + - test for a cloned logger double-`stream.end()` causing problems. + Perhaps the "closeOnExit" for existing streams should be false for + clones. + - test that a `log.clone(...)` adding a new field matching a serializer + works *and* that an existing field in the parent is not *re-serialized*. +- split out `bunyan` cli to a "bunyan" or "bunyan-reader" or "node-bunyan-reader" + as the basis for tools to consume bunyan logs. It can grow indep of node-bunyan + for generating the logs. + It would take a Bunyan log record object and be expected to emit it. + + node-bunyan-reader + .createReadStream(path, [options]) ? + +- coloring bug: in less the indented extra info lines only have the first + line colored. Do we need the ANSI char on *each* line? That'll be + slower. +- document "well-known" keys from bunyan CLI p.o.v.. Add "client_req". +- More `bunyan` output formats and filtering features. +- Think about a bunyan dashboard that supports organizing and viewing logs + from multiple hosts and services. +- doc the restify RequestCaptureStream usage of RingBuffer. Great example. +- A vim plugin (a la http://vim.cybermirror.org/runtime/autoload/zip.vim ?) to + allow browsing (read-only) a bunyan log in rendered form. +- Some speed comparisons with others to get a feel for Bunyan's speed. +- what about promoting 'latency' field and making that easier? +- `log.close` to close streams and shutdown and `this.closed` + process.on('exit', log.close) + -> 'end' for the name +- bunyan cli: more layouts (http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/EnhancedPatternLayout.html) + Custom log formats (in config file? in '-f' arg) using printf or hogan.js + or whatever. Dap wants field width control for lining up. Hogan.js is + probably overkill for this. +- loggly example using raw streams, hook.io?, whatever. +- serializer support: + - restify-server.js example -> restifyReq ? or have `req` detect that. + That is nicer for the "use all standard ones". *Does* restify req + have anything special? + - differential HTTP *client* req/res with *server* req/res. +- statsd stream? http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/ + Think about it. +- web ui. Ideas: http://googlecloudplatform.blogspot.ca/2014/04/a-new-logs-viewer-for-google-cloud.html diff --git a/datalab/web/node_modules/bunyan/bin/bunyan b/datalab/web/node_modules/bunyan/bin/bunyan new file mode 100644 index 0000000000000000000000000000000000000000..7c928191ba6936fa646633e9873c7d6b91505c53 --- /dev/null +++ b/datalab/web/node_modules/bunyan/bin/bunyan @@ -0,0 +1,1708 @@ +#!/usr/bin/env node +/** + * Copyright 2017 Trent Mick + * Copyright 2017 Joyent Inc. + * + * bunyan -- filter and pretty-print Bunyan log files (line-delimited JSON) + * + * See . + * + * -*- mode: js -*- + * vim: expandtab:ts=4:sw=4 + */ + +var VERSION = '1.8.12'; + +var p = console.log; +var util = require('util'); +var pathlib = require('path'); +var vm = require('vm'); +var http = require('http'); +var fs = require('fs'); +var warn = console.warn; +var child_process = require('child_process'), + spawn = child_process.spawn, + exec = child_process.exec, + execFile = child_process.execFile; +var assert = require('assert'); + +try { + var moment = require('moment'); +} catch (e) { + moment = null; +} + + +//---- globals and constants + +var nodeVer = process.versions.node.split('.').map(Number); +var nodeSpawnSupportsStdio = (nodeVer[0] > 0 || nodeVer[1] >= 8); + +// Internal debug logging via `console.warn`. +var _DEBUG = false; + +// Output modes. +var OM_LONG = 1; +var OM_JSON = 2; +var OM_INSPECT = 3; +var OM_SIMPLE = 4; +var OM_SHORT = 5; +var OM_BUNYAN = 6; +var OM_FROM_NAME = { + 'long': OM_LONG, + 'paul': OM_LONG, /* backward compat */ + 'json': OM_JSON, + 'inspect': OM_INSPECT, + 'simple': OM_SIMPLE, + 'short': OM_SHORT, + 'bunyan': OM_BUNYAN +}; + + +// Levels +var TRACE = 10; +var DEBUG = 20; +var INFO = 30; +var WARN = 40; +var ERROR = 50; +var FATAL = 60; + +var levelFromName = { + 'trace': TRACE, + 'debug': DEBUG, + 'info': INFO, + 'warn': WARN, + 'error': ERROR, + 'fatal': FATAL +}; +var nameFromLevel = {}; +var upperNameFromLevel = {}; +var upperPaddedNameFromLevel = {}; +Object.keys(levelFromName).forEach(function (name) { + var lvl = levelFromName[name]; + nameFromLevel[lvl] = name; + upperNameFromLevel[lvl] = name.toUpperCase(); + upperPaddedNameFromLevel[lvl] = ( + name.length === 4 ? ' ' : '') + name.toUpperCase(); +}); + + +// Display time formats. +var TIME_UTC = 1; // the default, bunyan's native format +var TIME_LOCAL = 2; + +// Timezone formats: output format -> momentjs format string +var TIMEZONE_UTC_FORMATS = { + long: '[[]YYYY-MM-DD[T]HH:mm:ss.SSS[Z][]]', + short: 'HH:mm:ss.SSS[Z]' +}; +var TIMEZONE_LOCAL_FORMATS = { + long: '[[]YYYY-MM-DD[T]HH:mm:ss.SSSZ[]]', + short: 'HH:mm:ss.SSS' +}; + + +// The current raw input line being processed. Used for `uncaughtException`. +var currLine = null; + +// Child dtrace process, if any. Used for signal-handling. +var child = null; + +// Whether ANSI codes are being used. Used for signal-handling. +var usingAnsiCodes = false; + +// Used to tell the 'uncaughtException' handler that '-c CODE' is being used. +var gUsingConditionOpts = false; + +// Pager child process, and output stream to which to write. +var pager = null; +var stdout = process.stdout; + + + +//---- support functions + +function getVersion() { + return VERSION; +} + + +var format = util.format; +if (!format) { + /* BEGIN JSSTYLED */ + // If not node 0.6, then use its `util.format`: + // : + var inspect = util.inspect; + var formatRegExp = /%[sdj%]/g; + format = function format(f) { + if (typeof f !== 'string') { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function (x) { + if (i >= len) + return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': return JSON.stringify(args[i++]); + case '%%': return '%'; + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (x === null || typeof x !== 'object') { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; + }; + /* END JSSTYLED */ +} + +function indent(s) { + return ' ' + s.split(/\r?\n/).join('\n '); +} + +function objCopy(obj) { + if (obj === null) { + return null; + } else if (Array.isArray(obj)) { + return obj.slice(); + } else { + var copy = {}; + Object.keys(obj).forEach(function (k) { + copy[k] = obj[k]; + }); + return copy; + } +} + +function printHelp() { + /* BEGIN JSSTYLED */ + p('Usage:'); + p(' bunyan [OPTIONS] [FILE ...]'); + p(' ... | bunyan [OPTIONS]'); + p(' bunyan [OPTIONS] -p PID'); + p(''); + p('Filter and pretty-print Bunyan log file content.'); + p(''); + p('General options:'); + p(' -h, --help print this help info and exit'); + p(' --version print version of this command and exit'); + p(''); + p('Runtime log snooping (via DTrace, only on supported platforms):'); + p(' -p PID Process bunyan:log-* probes from the process'); + p(' with the given PID. Can be used multiple times,'); + p(' or specify all processes with "*", or a set of'); + p(' processes whose command & args match a pattern'); + p(' with "-p NAME".'); + p(''); + p('Filtering options:'); + p(' -l, --level LEVEL'); + p(' Only show messages at or above the specified level.'); + p(' You can specify level *names* or the internal numeric'); + p(' values.'); + p(' -c, --condition CONDITION'); + p(' Run each log message through the condition and'); + p(' only show those that return truish. E.g.:'); + p(' -c \'this.pid == 123\''); + p(' -c \'this.level == DEBUG\''); + p(' -c \'this.msg.indexOf("boom") != -1\''); + p(' "CONDITION" must be legal JS code. `this` holds'); + p(' the log record. The TRACE, DEBUG, ... FATAL values'); + p(' are defined to help with comparing `this.level`.'); + p(' --strict Suppress all but legal Bunyan JSON log lines. By default'); + p(' non-JSON, and non-Bunyan lines are passed through.'); + p(''); + p('Output options:'); + p(' --pager Pipe output into `less` (or $PAGER if set), if'); + p(' stdout is a TTY. This overrides $BUNYAN_NO_PAGER.'); + p(' Note: Paging is only supported on node >=0.8.'); + p(' --no-pager Do not pipe output into a pager.'); + p(' --color Colorize output. Defaults to try if output'); + p(' stream is a TTY.'); + p(' --no-color Force no coloring (e.g. terminal doesn\'t support it)'); + p(' -o, --output MODE'); + p(' Specify an output mode/format. One of'); + p(' long: (the default) pretty'); + p(' json: JSON output, 2-space indent'); + p(' json-N: JSON output, N-space indent, e.g. "json-4"'); + p(' bunyan: 0 indented JSON, bunyan\'s native format'); + p(' inspect: node.js `util.inspect` output'); + p(' short: like "long", but more concise'); + p(' simple: level, followed by "-" and then the message'); + p(' -j shortcut for `-o json`'); + p(' -0 shortcut for `-o bunyan`'); + p(' -L, --time local'); + p(' Display time field in local time, rather than UTC.'); + p(''); + p('Environment Variables:'); + p(' BUNYAN_NO_COLOR Set to a non-empty value to force no output '); + p(' coloring. See "--no-color".'); + p(' BUNYAN_NO_PAGER Disable piping output to a pager. '); + p(' See "--no-pager".'); + p(''); + p('See for more complete docs.'); + p('Please report bugs to .'); + /* END JSSTYLED */ +} + +/* + * If the user specifies multiple input sources, we want to print out records + * from all sources in a single, chronologically ordered stream. To do this + * efficiently, we first assume that all records within each source are ordered + * already, so we need only keep track of the next record in each source and + * the time of the last record emitted. To avoid excess memory usage, we + * pause() streams that are ahead of others. + * + * 'streams' is an object indexed by source name (file name) which specifies: + * + * stream Actual stream object, so that we can pause and resume it. + * + * records Array of log records we've read, but not yet emitted. Each + * record includes 'line' (the raw line), 'rec' (the JSON + * record), and 'time' (the parsed time value). + * + * done Whether the stream has any more records to emit. + */ +var streams = {}; + +function gotRecord(file, line, rec, opts, stylize) +{ + var time = new Date(rec.time); + + streams[file]['records'].push({ line: line, rec: rec, time: time }); + emitNextRecord(opts, stylize); +} + +function filterRecord(rec, opts) +{ + if (opts.level && rec.level < opts.level) { + return false; + } + + if (opts.condFuncs) { + var recCopy = objCopy(rec); + for (var i = 0; i < opts.condFuncs.length; i++) { + var pass = opts.condFuncs[i].call(recCopy); + if (!pass) + return false; + } + } else if (opts.condVm) { + for (var i = 0; i < opts.condVm.length; i++) { + var pass = opts.condVm[i].runInNewContext(rec); + if (!pass) + return false; + } + } + + return true; +} + +function emitNextRecord(opts, stylize) +{ + var ofile, ready, minfile, rec; + + for (;;) { + /* + * Take a first pass through the input streams to see if we have a + * record from all of them. If not, we'll pause any streams for + * which we do already have a record (to avoid consuming excess + * memory) and then wait until we have records from the others + * before emitting the next record. + * + * As part of the same pass, we look for the earliest record + * we have not yet emitted. + */ + minfile = undefined; + ready = true; + for (ofile in streams) { + + if (streams[ofile].stream === null || + (!streams[ofile].done && streams[ofile].records.length === 0)) { + ready = false; + break; + } + + if (streams[ofile].records.length > 0 && + (minfile === undefined || + streams[minfile].records[0].time > + streams[ofile].records[0].time)) { + minfile = ofile; + } + } + + if (!ready || minfile === undefined) { + for (ofile in streams) { + if (!streams[ofile].stream || streams[ofile].done) + continue; + + if (streams[ofile].records.length > 0) { + if (!streams[ofile].paused) { + streams[ofile].paused = true; + streams[ofile].stream.pause(); + } + } else if (streams[ofile].paused) { + streams[ofile].paused = false; + streams[ofile].stream.resume(); + } + } + + return; + } + + /* + * Emit the next record for 'minfile', and invoke ourselves again to + * make sure we emit as many records as we can right now. + */ + rec = streams[minfile].records.shift(); + emitRecord(rec.rec, rec.line, opts, stylize); + } +} + +/** + * Return a function for the given JS code that returns. + * + * If no 'return' in the given javascript snippet, then assume we are a single + * statement and wrap in 'return (...)'. This is for convenience for short + * '-c ...' snippets. + */ +function funcWithReturnFromSnippet(js) { + // auto-"return" + if (js.indexOf('return') === -1) { + if (js.substring(js.length - 1) === ';') { + js = js.substring(0, js.length - 1); + } + js = 'return (' + js + ')'; + } + + // Expose level definitions to condition func context + var varDefs = []; + Object.keys(upperNameFromLevel).forEach(function (lvl) { + varDefs.push(format('var %s = %d;', + upperNameFromLevel[lvl], lvl)); + }); + varDefs = varDefs.join('\n') + '\n'; + + return (new Function(varDefs + js)); +} + +/** + * Parse the command-line options and arguments into an object. + * + * { + * 'args': [...] // arguments + * 'help': true, // true if '-h' option given + * // etc. + * } + * + * @return {Object} The parsed options. `.args` is the argument list. + * @throws {Error} If there is an error parsing argv. + */ +function parseArgv(argv) { + var parsed = { + args: [], + help: false, + color: null, + paginate: null, + outputMode: OM_LONG, + jsonIndent: 2, + level: null, + strict: false, + pids: null, + pidsType: null, + timeFormat: TIME_UTC // one of the TIME_ constants + }; + + // Turn '-iH' into '-i -H', except for argument-accepting options. + var args = argv.slice(2); // drop ['node', 'scriptname'] + var newArgs = []; + var optTakesArg = {'d': true, 'o': true, 'c': true, 'l': true, 'p': true}; + for (var i = 0; i < args.length; i++) { + if (args[i].charAt(0) === '-' && args[i].charAt(1) !== '-' && + args[i].length > 2) + { + var splitOpts = args[i].slice(1).split(''); + for (var j = 0; j < splitOpts.length; j++) { + newArgs.push('-' + splitOpts[j]); + if (optTakesArg[splitOpts[j]]) { + var optArg = splitOpts.slice(j+1).join(''); + if (optArg.length) { + newArgs.push(optArg); + } + break; + } + } + } else { + newArgs.push(args[i]); + } + } + args = newArgs; + + // Expose level definitions to condition vm context + var condDefines = []; + Object.keys(upperNameFromLevel).forEach(function (lvl) { + condDefines.push( + format('Object.prototype.%s = %s;', upperNameFromLevel[lvl], lvl)); + }); + condDefines = condDefines.join('\n') + '\n'; + + var endOfOptions = false; + while (args.length > 0) { + var arg = args.shift(); + switch (arg) { + case '--': + endOfOptions = true; + break; + case '-h': // display help and exit + case '--help': + parsed.help = true; + break; + case '--version': + parsed.version = true; + break; + case '--strict': + parsed.strict = true; + break; + case '--color': + parsed.color = true; + break; + case '--no-color': + parsed.color = false; + break; + case '--pager': + parsed.paginate = true; + break; + case '--no-pager': + parsed.paginate = false; + break; + case '-o': + case '--output': + var name = args.shift(); + var idx = name.lastIndexOf('-'); + if (idx !== -1) { + var indentation = Number(name.slice(idx+1)); + if (! isNaN(indentation)) { + parsed.jsonIndent = indentation; + name = name.slice(0, idx); + } + } + parsed.outputMode = OM_FROM_NAME[name]; + if (parsed.outputMode === undefined) { + throw new Error('unknown output mode: "'+name+'"'); + } + break; + case '-j': // output with JSON.stringify + parsed.outputMode = OM_JSON; + break; + case '-0': + parsed.outputMode = OM_BUNYAN; + break; + case '-L': + parsed.timeFormat = TIME_LOCAL; + if (!moment) { + throw new Error( + 'could not find moment package required for "-L"'); + } + break; + case '--time': + var timeArg = args.shift(); + switch (timeArg) { + case 'utc': + parsed.timeFormat = TIME_UTC; + break + case 'local': + parsed.timeFormat = TIME_LOCAL; + if (!moment) { + throw new Error('could not find moment package ' + + 'required for "--time=local"'); + } + break + case undefined: + throw new Error('missing argument to "--time"'); + default: + throw new Error(format('invalid time format: "%s"', + timeArg)); + } + break; + case '-p': + if (!parsed.pids) { + parsed.pids = []; + } + var pidArg = args.shift(); + var pid = +(pidArg); + if (!isNaN(pid) || pidArg === '*') { + if (parsed.pidsType && parsed.pidsType !== 'num') { + throw new Error(format('cannot mix PID name and ' + + 'number arguments: "%s"', pidArg)); + } + parsed.pidsType = 'num'; + if (!parsed.pids) { + parsed.pids = []; + } + parsed.pids.push(isNaN(pid) ? pidArg : pid); + } else { + if (parsed.pidsType && parsed.pidsType !== 'name') { + throw new Error(format('cannot mix PID name and ' + + 'number arguments: "%s"', pidArg)); + } + parsed.pidsType = 'name'; + parsed.pids = pidArg; + } + break; + case '-l': + case '--level': + var levelArg = args.shift(); + var level = +(levelArg); + if (isNaN(level)) { + level = +levelFromName[levelArg.toLowerCase()]; + } + if (isNaN(level)) { + throw new Error('unknown level value: "'+levelArg+'"'); + } + parsed.level = level; + break; + case '-c': + case '--condition': + gUsingConditionOpts = true; + var condition = args.shift(); + if (Boolean(process.env.BUNYAN_EXEC && + process.env.BUNYAN_EXEC === 'vm')) + { + parsed.condVm = parsed.condVm || []; + var scriptName = 'bunyan-condition-'+parsed.condVm.length; + var code = condDefines + condition; + var script; + try { + script = vm.createScript(code, scriptName); + } catch (complErr) { + throw new Error(format('illegal CONDITION code: %s\n' + + ' CONDITION script:\n' + + '%s\n' + + ' Error:\n' + + '%s', + complErr, indent(code), indent(complErr.stack))); + } + + // Ensure this is a reasonably safe CONDITION. + try { + script.runInNewContext(minValidRecord); + } catch (condErr) { + throw new Error(format( + /* JSSTYLED */ + 'CONDITION code cannot safely filter a minimal Bunyan log record\n' + + ' CONDITION script:\n' + + '%s\n' + + ' Minimal Bunyan log record:\n' + + '%s\n' + + ' Filter error:\n' + + '%s', + indent(code), + indent(JSON.stringify(minValidRecord, null, 2)), + indent(condErr.stack) + )); + } + parsed.condVm.push(script); + } else { + parsed.condFuncs = parsed.condFuncs || []; + parsed.condFuncs.push(funcWithReturnFromSnippet(condition)); + } + break; + default: // arguments + if (!endOfOptions && arg.length > 0 && arg[0] === '-') { + throw new Error('unknown option "'+arg+'"'); + } + parsed.args.push(arg); + break; + } + } + //TODO: '--' handling and error on a first arg that looks like an option. + + return parsed; +} + + +function isInteger(s) { + return (s.search(/^-?[0-9]+$/) == 0); +} + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +// Suggested colors (some are unreadable in common cases): +// - Good: cyan, yellow (limited use), bold, green, magenta, red +// - Bad: blue (not visible on cmd.exe), grey (same color as background on +// Solarized Dark theme from , see +// issue #160) +var colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +function stylizeWithColor(str, color) { + if (!str) + return ''; + var codes = colors[color]; + if (codes) { + return '\033[' + codes[0] + 'm' + str + + '\033[' + codes[1] + 'm'; + } else { + return str; + } +} + +function stylizeWithoutColor(str, color) { + return str; +} + + +/** + * Is this a valid Bunyan log record. + */ +function isValidRecord(rec) { + if (rec.v == null || + rec.level == null || + rec.name == null || + rec.hostname == null || + rec.pid == null || + rec.time == null || + rec.msg == null) { + // Not valid Bunyan log. + return false; + } else { + return true; + } +} +var minValidRecord = { + v: 0, //TODO: get this from bunyan.LOG_VERSION + level: INFO, + name: 'name', + hostname: 'hostname', + pid: 123, + time: Date.now(), + msg: 'msg' +}; + + +/** + * Parses the given log line and either emits it right away (for invalid + * records) or enqueues it for emitting later when it's the next line to show. + */ +function handleLogLine(file, line, opts, stylize) { + currLine = line; // intentionally global + + // Emit non-JSON lines immediately. + var rec; + if (!line) { + if (!opts.strict) emit(line + '\n'); + return; + } else if (line[0] !== '{') { + if (!opts.strict) emit(line + '\n'); // not JSON + return; + } else { + try { + rec = JSON.parse(line); + } catch (e) { + if (!opts.strict) emit(line + '\n'); + return; + } + } + + if (!isValidRecord(rec)) { + if (!opts.strict) emit(line + '\n'); + return; + } + + if (!filterRecord(rec, opts)) + return; + + if (file === null) + return emitRecord(rec, line, opts, stylize); + + return gotRecord(file, line, rec, opts, stylize); +} + +/** + * Print out a single result, considering input options. + */ +function emitRecord(rec, line, opts, stylize) { + var short = false; + + switch (opts.outputMode) { + case OM_SHORT: + short = true; + /* jsl:fall-thru */ + + case OM_LONG: + // [time] LEVEL: name[/comp]/pid on hostname (src): msg* (extras...) + // msg* + // -- + // long and multi-line extras + // ... + // If 'msg' is single-line, then it goes in the top line. + // If 'req', show the request. + // If 'res', show the response. + // If 'err' and 'err.stack' then show that. + if (!isValidRecord(rec)) { + return emit(line + '\n'); + } + + delete rec.v; + + // Time. + var time; + if (!short && opts.timeFormat === TIME_UTC) { + // Fast default path: We assume the raw `rec.time` is a UTC time + // in ISO 8601 format (per spec). + time = '[' + rec.time + ']'; + } else if (!moment && opts.timeFormat === TIME_UTC) { + // Don't require momentjs install, as long as not using TIME_LOCAL. + time = rec.time.substr(11); + } else { + var tzFormat; + var moTime = moment(rec.time); + switch (opts.timeFormat) { + case TIME_UTC: + tzFormat = TIMEZONE_UTC_FORMATS[short ? 'short' : 'long']; + moTime.utc(); + break; + case TIME_LOCAL: + tzFormat = TIMEZONE_LOCAL_FORMATS[short ? 'short' : 'long']; + break; + default: + throw new Error('unexpected timeFormat: ' + opts.timeFormat); + }; + time = moTime.format(tzFormat); + } + time = stylize(time, 'none'); + delete rec.time; + + var nameStr = rec.name; + delete rec.name; + + if (rec.component) { + nameStr += '/' + rec.component; + } + delete rec.component; + + if (!short) + nameStr += '/' + rec.pid; + delete rec.pid; + + var level = (upperPaddedNameFromLevel[rec.level] || 'LVL' + rec.level); + if (opts.color) { + var colorFromLevel = { + 10: 'white', // TRACE + 20: 'yellow', // DEBUG + 30: 'cyan', // INFO + 40: 'magenta', // WARN + 50: 'red', // ERROR + 60: 'inverse', // FATAL + }; + level = stylize(level, colorFromLevel[rec.level]); + } + delete rec.level; + + var src = ''; + if (rec.src && rec.src.file) { + var s = rec.src; + if (s.func) { + src = format(' (%s:%d in %s)', s.file, s.line, s.func); + } else { + src = format(' (%s:%d)', s.file, s.line); + } + src = stylize(src, 'green'); + } + delete rec.src; + + var hostname = rec.hostname; + delete rec.hostname; + + var extras = []; + var details = []; + + if (rec.req_id) { + extras.push('req_id=' + rec.req_id); + } + delete rec.req_id; + + var onelineMsg; + if (rec.msg.indexOf('\n') !== -1) { + onelineMsg = ''; + details.push(indent(stylize(rec.msg, 'cyan'))); + } else { + onelineMsg = ' ' + stylize(rec.msg, 'cyan'); + } + delete rec.msg; + + if (rec.req && typeof (rec.req) === 'object') { + var req = rec.req; + delete rec.req; + var headers = req.headers; + if (!headers) { + headers = ''; + } else if (typeof (headers) === 'string') { + headers = '\n' + headers; + } else if (typeof (headers) === 'object') { + headers = '\n' + Object.keys(headers).map(function (h) { + return h + ': ' + headers[h]; + }).join('\n'); + } + var s = format('%s %s HTTP/%s%s', req.method, + req.url, + req.httpVersion || '1.1', + headers + ); + delete req.url; + delete req.method; + delete req.httpVersion; + delete req.headers; + if (req.body) { + s += '\n\n' + (typeof (req.body) === 'object' + ? JSON.stringify(req.body, null, 2) : req.body); + delete req.body; + } + if (req.trailers && Object.keys(req.trailers) > 0) { + s += '\n' + Object.keys(req.trailers).map(function (t) { + return t + ': ' + req.trailers[t]; + }).join('\n'); + } + delete req.trailers; + details.push(indent(s)); + // E.g. for extra 'foo' field on 'req', add 'req.foo' at + // top-level. This *does* have the potential to stomp on a + // literal 'req.foo' key. + Object.keys(req).forEach(function (k) { + rec['req.' + k] = req[k]; + }) + } + + /* + * `client_req` is the typical field name for an *HTTP client request + * object* serialized by the restify-clients library. Render the + * client request somewhat like `curl` debug output shows it. + */ + if (rec.client_req && typeof (rec.client_req) === 'object') { + var client_req = rec.client_req; + delete rec.client_req; + + var headers = client_req.headers; + delete client_req.headers; + + /* + * `client_req.address`, and `client_req.port`, provide values for + * a *likely* "Host" header that wasn't included in the serialized + * headers. Node.js will often add this "Host" header in its + * `http.ClientRequest`, e.g. for node v6.10.3: + * // JSSTYLED + * https://github.com/nodejs/node/blob/v6.10.3/lib/_http_client.js#L88-L105 + * + * If `client_req.port` exists and is 80 or 443, we *assume* that + * is the default protocol port, and elide it per the `defaultPort` + * handling in the node.js link above. + * + * Note: This added Host header is a *guess*. Bunyan shouldn't be + * doing this "favour" for users because it can be wrong and + * misleading. Bunyan 2.x will drop adding this. See issue #504 + * for details. + */ + var hostHeaderLine = ''; + if (!headers || !( + Object.hasOwnProperty.call(headers, 'host') || + Object.hasOwnProperty.call(headers, 'Host') || + Object.hasOwnProperty.call(headers, 'HOST') + ) + ) { + if (Object.hasOwnProperty.call(client_req, 'address')) { + hostHeaderLine = '\nHost: ' + client_req.address; + if (Object.hasOwnProperty.call(client_req, 'port')) { + // XXX + var port = +client_req.port; + if (port !== 80 && port !== 443) { + hostHeaderLine += ':' + client_req.port; + } + delete client_req.port; + } + delete client_req.address; + } + } + + var s = format('%s %s HTTP/%s%s%s', client_req.method, + client_req.url, + client_req.httpVersion || '1.1', + hostHeaderLine, + (headers ? + '\n' + Object.keys(headers).map( + function (h) { + return h + ': ' + headers[h]; + }).join('\n') : + '')); + delete client_req.method; + delete client_req.url; + delete client_req.httpVersion; + + if (client_req.body) { + s += '\n\n' + (typeof (client_req.body) === 'object' ? + JSON.stringify(client_req.body, null, 2) : + client_req.body); + delete client_req.body; + } + // E.g. for extra 'foo' field on 'client_req', add + // 'client_req.foo' at top-level. This *does* have the potential + // to stomp on a literal 'client_req.foo' key. + Object.keys(client_req).forEach(function (k) { + rec['client_req.' + k] = client_req[k]; + }) + details.push(indent(s)); + } + + function _res(res) { + var s = ''; + + /* + * Handle `res.header` or `res.headers` as either a string or + * an object of header key/value pairs. Prefer `res.header` if set, + * because that's what Bunyan's own `res` serializer specifies, + * because that's the value in Node.js's core HTTP server response + * implementation that has all the implicit headers. + * + * Note: `res.header` (string) typically includes the 'HTTP/1.1 ...' + * status line. + */ + var headerTypes = {string: true, object: true}; + var headers; + var headersStr = ''; + var headersHaveStatusLine = false; + if (res.header && headerTypes[typeof (res.header)]) { + headers = res.header; + delete res.header; + } else if (res.headers && headerTypes[typeof (res.headers)]) { + headers = res.headers; + delete res.headers; + } + if (headers === undefined) { + /* pass through */ + } else if (typeof (headers) === 'string') { + headersStr = headers.trimRight(); // Trim the CRLF. + if (headersStr.slice(0, 5) === 'HTTP/') { + headersHaveStatusLine = true; + } + } else { + headersStr += Object.keys(headers).map( + function (h) { return h + ': ' + headers[h]; }).join('\n'); + } + + /* + * Add a 'HTTP/1.1 ...' status line if the headers didn't already + * include it. + */ + if (!headersHaveStatusLine && res.statusCode !== undefined) { + s += format('HTTP/1.1 %s %s\n', res.statusCode, + http.STATUS_CODES[res.statusCode]); + } + delete res.statusCode; + s += headersStr; + + if (res.body !== undefined) { + var body = (typeof (res.body) === 'object' + ? JSON.stringify(res.body, null, 2) : res.body); + if (body.length > 0) { s += '\n\n' + body }; + delete res.body; + } else { + s = s.trimRight(); + } + if (res.trailer) { + s += '\n' + res.trailer; + } + delete res.trailer; + if (s) { + details.push(indent(s)); + } + // E.g. for extra 'foo' field on 'res', add 'res.foo' at + // top-level. This *does* have the potential to stomp on a + // literal 'res.foo' key. + Object.keys(res).forEach(function (k) { + rec['res.' + k] = res[k]; + }); + } + + if (rec.res && typeof (rec.res) === 'object') { + _res(rec.res); + delete rec.res; + } + if (rec.client_res && typeof (rec.client_res) === 'object') { + _res(rec.client_res); + delete rec.client_res; + } + + if (rec.err && rec.err.stack) { + var err = rec.err + if (typeof (err.stack) !== 'string') { + details.push(indent(err.stack.toString())); + } else { + details.push(indent(err.stack)); + } + delete err.message; + delete err.name; + delete err.stack; + // E.g. for extra 'foo' field on 'err', add 'err.foo' at + // top-level. This *does* have the potential to stomp on a + // literal 'err.foo' key. + Object.keys(err).forEach(function (k) { + rec['err.' + k] = err[k]; + }) + delete rec.err; + } + + var leftover = Object.keys(rec); + for (var i = 0; i < leftover.length; i++) { + var key = leftover[i]; + var value = rec[key]; + var stringified = false; + if (typeof (value) !== 'string') { + value = JSON.stringify(value, null, 2); + stringified = true; + } + if (value.indexOf('\n') !== -1 || value.length > 50) { + details.push(indent(key + ': ' + value)); + } else if (!stringified && (value.indexOf(' ') != -1 || + value.length === 0)) + { + extras.push(key + '=' + JSON.stringify(value)); + } else { + extras.push(key + '=' + value); + } + } + + extras = stylize( + (extras.length ? ' (' + extras.join(', ') + ')' : ''), 'none'); + details = stylize( + (details.length ? details.join('\n --\n') + '\n' : ''), 'none'); + if (!short) + emit(format('%s %s: %s on %s%s:%s%s\n%s', + time, + level, + nameStr, + hostname || '', + src, + onelineMsg, + extras, + details)); + else + emit(format('%s %s %s:%s%s\n%s', + time, + level, + nameStr, + onelineMsg, + extras, + details)); + break; + + case OM_INSPECT: + emit(util.inspect(rec, false, Infinity, true) + '\n'); + break; + + case OM_BUNYAN: + emit(JSON.stringify(rec, null, 0) + '\n'); + break; + + case OM_JSON: + emit(JSON.stringify(rec, null, opts.jsonIndent) + '\n'); + break; + + case OM_SIMPLE: + /* JSSTYLED */ + // + if (!isValidRecord(rec)) { + return emit(line + '\n'); + } + emit(format('%s - %s\n', + upperNameFromLevel[rec.level] || 'LVL' + rec.level, + rec.msg)); + break; + default: + throw new Error('unknown output mode: '+opts.outputMode); + } +} + + +var stdoutFlushed = true; +function emit(s) { + try { + stdoutFlushed = stdout.write(s); + } catch (e) { + // Handle any exceptions in stdout writing in `stdout.on('error', ...)`. + } +} + + +/** + * A hacked up version of 'process.exit' that will first drain stdout + * before exiting. *WARNING: This doesn't stop event processing.* IOW, + * callers have to be careful that code following this call isn't + * accidentally executed. + * + * In node v0.6 "process.stdout and process.stderr are blocking when they + * refer to regular files or TTY file descriptors." However, this hack might + * still be necessary in a shell pipeline. + */ +function drainStdoutAndExit(code) { + if (_DEBUG) warn('(drainStdoutAndExit(%d))', code); + stdout.on('drain', function () { + cleanupAndExit(code); + }); + if (stdoutFlushed) { + cleanupAndExit(code); + } +} + + +/** + * Process all input from stdin. + * + * @params opts {Object} Bunyan options object. + * @param stylize {Function} Output stylize function to use. + * @param callback {Function} `function ()` + */ +function processStdin(opts, stylize, callback) { + var leftover = ''; // Left-over partial line from last chunk. + var stdin = process.stdin; + stdin.resume(); + stdin.setEncoding('utf8'); + stdin.on('data', function (chunk) { + var lines = chunk.split(/\r\n|\n/); + var length = lines.length; + if (length === 1) { + leftover += lines[0]; + return; + } + + if (length > 1) { + handleLogLine(null, leftover + lines[0], opts, stylize); + } + leftover = lines.pop(); + length -= 1; + for (var i = 1; i < length; i++) { + handleLogLine(null, lines[i], opts, stylize); + } + }); + stdin.on('end', function () { + if (leftover) { + handleLogLine(null, leftover, opts, stylize); + leftover = ''; + } + callback(); + }); +} + + +/** + * Process bunyan:log-* probes from the given pid. + * + * @params opts {Object} Bunyan options object. + * @param stylize {Function} Output stylize function to use. + * @param callback {Function} `function (code)` + */ +function processPids(opts, stylize, callback) { + var leftover = ''; // Left-over partial line from last chunk. + + /** + * Get the PIDs to dtrace. + * + * @param cb {Function} `function (errCode, pids)` + */ + function getPids(cb) { + if (opts.pidsType === 'num') { + return cb(null, opts.pids); + } + if (process.platform === 'sunos') { + execFile('/bin/pgrep', ['-lf', opts.pids], + function (pidsErr, stdout, stderr) { + if (pidsErr) { + warn('bunyan: error getting PIDs for "%s": %s\n%s\n%s', + opts.pids, pidsErr.message, stdout, stderr); + return cb(1); + } + var pids = stdout.trim().split('\n') + .map(function (line) { + return line.trim().split(/\s+/)[0] + }) + .filter(function (pid) { + return Number(pid) !== process.pid + }); + if (pids.length === 0) { + warn('bunyan: error: no matching PIDs found for "%s"', + opts.pids); + return cb(2); + } + cb(null, pids); + } + ); + } else { + var regex = opts.pids; + if (regex && /[a-zA-Z0-9_]/.test(regex[0])) { + // 'foo' -> '[f]oo' trick to exclude the 'grep' PID from its + // own search. + regex = '[' + regex[0] + ']' + regex.slice(1); + } + exec(format('ps -A -o pid,command | grep \'%s\'', regex), + function (pidsErr, stdout, stderr) { + if (pidsErr) { + warn('bunyan: error getting PIDs for "%s": %s\n%s\n%s', + opts.pids, pidsErr.message, stdout, stderr); + return cb(1); + } + var pids = stdout.trim().split('\n') + .map(function (line) { + return line.trim().split(/\s+/)[0]; + }) + .filter(function (pid) { + return Number(pid) !== process.pid; + }); + if (pids.length === 0) { + warn('bunyan: error: no matching PIDs found for "%s"', + opts.pids); + return cb(2); + } + cb(null, pids); + } + ); + } + } + + getPids(function (errCode, pids) { + if (errCode) { + return callback(errCode); + } + + var probes = pids.map(function (pid) { + if (!opts.level) + return format('bunyan%s:::log-*', pid); + + var rval = [], l; + + for (l in levelFromName) { + if (levelFromName[l] >= opts.level) + rval.push(format('bunyan%s:::log-%s', pid, l)); + } + + if (rval.length != 0) + return rval.join(','); + + warn('bunyan: error: level (%d) exceeds maximum logging level', + opts.level); + return drainStdoutAndExit(1); + }).join(','); + var argv = ['dtrace', '-Z', '-x', 'strsize=4k', + '-x', 'switchrate=10hz', '-qn', + format('%s{printf("%s", copyinstr(arg0))}', probes)]; + //console.log('dtrace argv: %s', argv); + var dtrace = spawn(argv[0], argv.slice(1), + // Share the stderr handle to have error output come + // straight through. Only supported in v0.8+. + {stdio: ['pipe', 'pipe', process.stderr]}); + dtrace.on('error', function (e) { + if (e.syscall === 'spawn' && e.errno === 'ENOENT') { + console.error('bunyan: error: could not spawn "dtrace" ' + + '("bunyan -p" is only supported on platforms with dtrace)'); + } else { + console.error('bunyan: error: unexpected dtrace error: %s', e); + } + callback(1); + }) + child = dtrace; // intentionally global + + function finish(code) { + if (leftover) { + handleLogLine(null, leftover, opts, stylize); + leftover = ''; + } + callback(code); + } + + dtrace.stdout.setEncoding('utf8'); + dtrace.stdout.on('data', function (chunk) { + var lines = chunk.split(/\r\n|\n/); + var length = lines.length; + if (length === 1) { + leftover += lines[0]; + return; + } + if (length > 1) { + handleLogLine(null, leftover + lines[0], opts, stylize); + } + leftover = lines.pop(); + length -= 1; + for (var i = 1; i < length; i++) { + handleLogLine(null, lines[i], opts, stylize); + } + }); + + if (nodeSpawnSupportsStdio) { + dtrace.on('exit', finish); + } else { + // Fallback (for < v0.8) to pipe the dtrace process' stderr to + // this stderr. Wait for all of (1) process 'exit', (2) stderr + // 'end', and (2) stdout 'end' before returning to ensure all + // stderr is flushed (issue #54). + var returnCode = null; + var eventsRemaining = 3; + function countdownToFinish(code) { + returnCode = code; + eventsRemaining--; + if (eventsRemaining == 0) { + finish(returnCode); + } + } + dtrace.stderr.pipe(process.stderr); + dtrace.stderr.on('end', countdownToFinish); + dtrace.stderr.on('end', countdownToFinish); + dtrace.on('exit', countdownToFinish); + } + }); +} + + +/** + * Process all input from the given log file. + * + * @param file {String} Log file path to process. + * @params opts {Object} Bunyan options object. + * @param stylize {Function} Output stylize function to use. + * @param callback {Function} `function ()` + */ +function processFile(file, opts, stylize, callback) { + var stream = fs.createReadStream(file); + if (/\.gz$/.test(file)) { + stream = stream.pipe(require('zlib').createGunzip()); + } + // Manually decode streams - lazy load here as per node/lib/fs.js + var decoder = new (require('string_decoder').StringDecoder)('utf8'); + + streams[file].stream = stream; + + stream.on('error', function (err) { + streams[file].done = true; + callback(err); + }); + + var leftover = ''; // Left-over partial line from last chunk. + stream.on('data', function (data) { + var chunk = decoder.write(data); + if (!chunk.length) { + return; + } + var lines = chunk.split(/\r\n|\n/); + var length = lines.length; + if (length === 1) { + leftover += lines[0]; + return; + } + + if (length > 1) { + handleLogLine(file, leftover + lines[0], opts, stylize); + } + leftover = lines.pop(); + length -= 1; + for (var i = 1; i < length; i++) { + handleLogLine(file, lines[i], opts, stylize); + } + }); + + stream.on('end', function () { + streams[file].done = true; + if (leftover) { + handleLogLine(file, leftover, opts, stylize); + leftover = ''; + } else { + emitNextRecord(opts, stylize); + } + callback(); + }); +} + + +/** + * From node async module. + */ +/* BEGIN JSSTYLED */ +function asyncForEach(arr, iterator, callback) { + callback = callback || function () {}; + if (!arr.length) { + return callback(); + } + var completed = 0; + arr.forEach(function (x) { + iterator(x, function (err) { + if (err) { + callback(err); + callback = function () {}; + } + else { + completed += 1; + if (completed === arr.length) { + callback(); + } + } + }); + }); +}; +/* END JSSTYLED */ + + + +/** + * Cleanup and exit properly. + * + * Warning: this doesn't stop processing, i.e. process exit might be delayed. + * It is up to the caller to ensure that no subsequent bunyan processing + * is done after calling this. + * + * @param code {Number} exit code. + * @param signal {String} Optional signal name, if this was exitting because + * of a signal. + */ +var cleanedUp = false; +function cleanupAndExit(code, signal) { + // Guard one call. + if (cleanedUp) { + return; + } + cleanedUp = true; + if (_DEBUG) warn('(bunyan: cleanupAndExit)'); + + // Clear possibly interrupted ANSI code (issue #59). + if (usingAnsiCodes) { + stdout.write('\033[0m'); + } + + // Kill possible dtrace child. + if (child) { + child.kill(signal); + } + + if (pager) { + // Let pager know that output is done, then wait for pager to exit. + stdout.end(); + pager.on('exit', function (pagerCode) { + if (_DEBUG) + warn('(bunyan: pager exit -> process.exit(%s))', + pagerCode || code); + process.exit(pagerCode || code); + }); + } else { + if (_DEBUG) warn('(bunyan: process.exit(%s))', code); + process.exit(code); + } +} + + + +//---- mainline + +process.on('SIGINT', function () { cleanupAndExit(1, 'SIGINT'); }); +process.on('SIGQUIT', function () { cleanupAndExit(1, 'SIGQUIT'); }); +process.on('SIGTERM', function () { cleanupAndExit(1, 'SIGTERM'); }); +process.on('SIGHUP', function () { cleanupAndExit(1, 'SIGHUP'); }); + +process.on('uncaughtException', function (err) { + function _indent(s) { + var lines = s.split(/\r?\n/); + for (var i = 0; i < lines.length; i++) { + lines[i] = '* ' + lines[i]; + } + return lines.join('\n'); + } + + var title = encodeURIComponent(format( + 'Bunyan %s crashed: %s', getVersion(), String(err))); + var e = console.error; + e('```'); + e('* The Bunyan CLI crashed!'); + e('*'); + if (err.name === 'ReferenceError' && gUsingConditionOpts) { + /* BEGIN JSSTYLED */ + e('* This crash was due to a "ReferenceError", which is often the result of given'); + e('* `-c CONDITION` code that doesn\'t guard against undefined values. If that is'); + /* END JSSTYLED */ + e('* not the problem:'); + e('*'); + } + e('* Please report this issue and include the details below:'); + e('*'); + e('* https://github.com/trentm/node-bunyan/issues/new?title=%s', title); + e('*'); + e('* * *'); + e('* platform:', process.platform); + e('* node version:', process.version); + e('* bunyan version:', getVersion()); + e('* argv: %j', process.argv); + e('* log line: %j', currLine); + e('* stack:'); + e(_indent(err.stack)); + e('```'); + process.exit(1); +}); + + +function main(argv) { + try { + var opts = parseArgv(argv); + } catch (e) { + warn('bunyan: error: %s', e.message); + return drainStdoutAndExit(1); + } + if (opts.help) { + printHelp(); + return; + } + if (opts.version) { + console.log('bunyan ' + getVersion()); + return; + } + if (opts.pids && opts.args.length > 0) { + warn('bunyan: error: can\'t use both "-p PID" (%s) and file (%s) args', + opts.pids, opts.args.join(' ')); + return drainStdoutAndExit(1); + } + if (opts.color === null) { + if (process.env.BUNYAN_NO_COLOR && + process.env.BUNYAN_NO_COLOR.length > 0) { + opts.color = false; + } else { + opts.color = process.stdout.isTTY; + } + } + usingAnsiCodes = opts.color; // intentionally global + var stylize = (opts.color ? stylizeWithColor : stylizeWithoutColor); + + // Pager. + var paginate = ( + process.stdout.isTTY && + process.stdin.isTTY && + !opts.pids && // Don't page if following process output. + opts.args.length > 0 && // Don't page if no file args to process. + process.platform !== 'win32' && + (nodeVer[0] > 0 || nodeVer[1] >= 8) && + (opts.paginate === true || + (opts.paginate !== false && + (!process.env.BUNYAN_NO_PAGER || + process.env.BUNYAN_NO_PAGER.length === 0)))); + if (paginate) { + var pagerCmd = process.env.PAGER || 'less'; + /* JSSTYLED */ + assert.ok(pagerCmd.indexOf('"') === -1 && pagerCmd.indexOf("'") === -1, + 'cannot parse PAGER quotes yet'); + var argv = pagerCmd.split(/\s+/g); + var env = objCopy(process.env); + if (env.LESS === undefined) { + // git's default is LESS=FRSX. I don't like the 'S' here because + // lines are *typically* wide with bunyan output and scrolling + // horizontally is a royal pain. Note a bug in Mac's `less -F`, + // such that SIGWINCH can kill it. If that rears too much then + // I'll remove 'F' from here. + env.LESS = 'FRX'; + } + if (_DEBUG) warn('(pager: argv=%j, env.LESS=%j)', argv, env.LESS); + // `pager` and `stdout` intentionally global. + pager = spawn(argv[0], argv.slice(1), + // Share the stderr handle to have error output come + // straight through. Only supported in v0.8+. + {env: env, stdio: ['pipe', 1, 2]}); + stdout = pager.stdin; + + // Early termination of the pager: just stop. + pager.on('exit', function (pagerCode) { + if (_DEBUG) warn('(bunyan: pager exit)'); + pager = null; + stdout.end() + stdout = process.stdout; + cleanupAndExit(pagerCode); + }); + } + + // Stdout error handling. (Couldn't setup until `stdout` was determined.) + stdout.on('error', function (err) { + if (_DEBUG) warn('(stdout error event: %s)', err); + if (err.code === 'EPIPE') { + drainStdoutAndExit(0); + } else if (err.toString() === 'Error: This socket is closed.') { + // Could get this if the pager closes its stdin, but hasn't + // exited yet. + drainStdoutAndExit(1); + } else { + warn(err); + drainStdoutAndExit(1); + } + }); + + var retval = 0; + if (opts.pids) { + processPids(opts, stylize, function (code) { + cleanupAndExit(code); + }); + } else if (opts.args.length > 0) { + var files = opts.args; + files.forEach(function (file) { + streams[file] = { stream: null, records: [], done: false } + }); + asyncForEach(files, + function (file, next) { + processFile(file, opts, stylize, function (err) { + if (err) { + warn('bunyan: %s', err.message); + retval += 1; + } + next(); + }); + }, + function (err) { + if (err) { + warn('bunyan: unexpected error: %s', err.stack || err); + return drainStdoutAndExit(1); + } + cleanupAndExit(retval); + } + ); + } else { + processStdin(opts, stylize, function () { + cleanupAndExit(retval); + }); + } +} + +if (require.main === module) { + // HACK guard for . + // We override the `process.stdout.end` guard that core node.js puts in + // place. The real fix is that `.end()` shouldn't be called on stdout + // in node core. Node v0.6.9 fixes that. Only guard for v0.6.0..v0.6.8. + if ([0, 6, 0] <= nodeVer && nodeVer <= [0, 6, 8]) { + var stdout = process.stdout; + stdout.end = stdout.destroy = stdout.destroySoon = function () { + /* pass */ + }; + } + + main(process.argv); +} diff --git a/datalab/web/node_modules/bunyan/docs/bunyan.1 b/datalab/web/node_modules/bunyan/docs/bunyan.1 new file mode 100644 index 0000000000000000000000000000000000000000..41d3769551af1c28742d9821cae89972261756f3 --- /dev/null +++ b/datalab/web/node_modules/bunyan/docs/bunyan.1 @@ -0,0 +1,235 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "BUNYAN" "1" "January 2015" "" "bunyan manual" +. +.SH "NAME" +\fBbunyan\fR \- filter and pretty\-print Bunyan log file content +. +.SH "SYNOPSIS" +\fBbunyan\fR [OPTIONS] +. +.P +\&\.\.\. | \fBbunyan\fR [OPTIONS] +. +.P +\fBbunyan\fR [OPTIONS] \-p PID +. +.SH "DESCRIPTION" +"Bunyan" is \fBa simple and fast a JSON logging library\fR for node\.js services, a one\-JSON\-object\-per\-line log format, and \fBa \fBbunyan\fR CLI tool\fR for nicely viewing those logs\. This man page describes the latter\. +. +.SS "Pretty\-printing" +A bunyan log file is a stream of JSON objects, optionally interspersed with non\-JSON log lines\. The primary usage of bunyan(1) is to pretty print, for example: +. +.IP "" 4 +. +.nf + +$ bunyan foo\.log # or `cat foo\.log | bunyan +[2012\-02\-08T22:56:52\.856Z] INFO: myservice/123 on example\.com: My message + extra: multi + line +[2012\-02\-08T22:56:54\.856Z] ERROR: myservice/123 on example\.com: My message +\.\.\. +. +.fi +. +.IP "" 0 +. +.P +By default the "long" output format is used\. Use the \fB\-o FORMAT\fR option to emit other formats\. E\.g\.: +. +.IP "" 4 +. +.nf + +$ bunyan foo\.log \-o short +22:56:52\.856Z INFO myservice: My message + extra: multi + line +22:56:54\.856Z ERROR myservice: My message +\.\.\. +. +.fi +. +.IP "" 0 +. +.P +These will color the output if supported in your terminal\. See "OUTPUT FORMATS" below\. +. +.SS "Filtering" +The \fBbunyan\fR CLI can also be used to filter a bunyan log\. Use \fB\-l LEVEL\fR to filter by level: +. +.IP "" 4 +. +.nf + +$ bunyan foo\.log \-l error # show only \'error\' level records +[2012\-02\-08T22:56:54\.856Z] ERROR: myservice/123 on example\.com: My message +. +.fi +. +.IP "" 0 +. +.P +Use \fB\-c COND\fR to filter on a JavaScript expression returning true on the record data\. In the COND code, \fBthis\fR refers to the record object: +. +.IP "" 4 +. +.nf + +$ bunyan foo\.log \-c `this\.three` # show records with the \'extra\' field +[2012\-02\-08T22:56:52\.856Z] INFO: myservice/123 on example\.com: My message + extra: multi + line +. +.fi +. +.IP "" 0 +. +.SH "OPTIONS" +. +.TP +\fB\-h\fR, \fB\-\-help\fR +Print this help info and exit\. +. +.TP +\fB\-\-version\fR +Print version of this command and exit\. +. +.TP +\fB\-q\fR, \fB\-\-quiet\fR +Don\'t warn if input isn\'t valid JSON\. +. +.P +Dtrace options (only on dtrace\-supporting platforms): +. +.TP +\fB\-p PID\fR, \fB\-p NAME\fR +Process bunyan:log\-* probes from the process with the given PID\. Can be used multiple times, or specify all processes with \'*\', or a set of processes whose command & args match a pattern with \'\-p NAME\'\. +. +.P +Filtering options: +. +.TP +\fB\-l\fR, \fB\-\-level LEVEL\fR +Only show messages at or above the specified level\. You can specify level \fInames\fR or numeric values\. (See \'Log Levels\' below\.) +. +.TP +\fB\-c COND\fR, \fB\-\-condition COND\fR +Run each log message through the condition and only show those that resolve to a truish value\. E\.g\. \fB\-c \'this\.pid == 123\'\fR\. +. +.TP +\fB\-\-strict\fR +Suppress all but legal Bunyan JSON log lines\. By default non\-JSON, and non\-Bunyan lines are passed through\. +. +.P +Output options: +. +.TP +\fB\-\-color\fR +Colorize output\. Defaults to try if output stream is a TTY\. +. +.TP +\fB\-\-no\-color\fR +Force no coloring (e\.g\. terminal doesn\'t support it) +. +.TP +\fB\-o FORMAT\fR, \fB\-\-output FORMAT\fR +Specify an output format\. One of \fBlong\fR (the default), \fBshort\fR, \fBjson\fR, \fBjson\-N\fR, \fBbunyan\fR (the native bunyan 0\-indent JSON output) or \fBinspect\fR\. +. +.TP +\fB\-j\fR +Shortcut for \fB\-o json\fR\. +. +.TP +\fB\-L\fR, \fB\-\-time local\fR +Display the time field in \fIlocal\fR time, rather than the default UTC time\. +. +.SH "LOG LEVELS" +In Bunyan log records, then \fBlevel\fR field is a number\. For the \fB\-l|\-\-level\fR argument the level \fBnames\fR are supported as shortcuts\. In \fB\-c|\-\-condition\fR scripts, uppercase symbols like "DEBUG" are defined for convenience\. +. +.IP "" 4 +. +.nf + +Level Name Level Number Symbol in COND Scripts +trace 10 TRACE +debug 20 DEBUG +info 30 INFO +warn 40 WARN +error 50 ERROR +fatal 60 FATAL +. +.fi +. +.IP "" 0 +. +.SH "OUTPUT FORMATS" +. +.nf + +FORMAT NAME DESCRIPTION +long (default) The default output\. Long form\. Colored and "pretty"\. + \'req\' and \'res\' and \'err\' fields are rendered specially + as an HTTP request, HTTP response and exception + stack trace, respectively\. For backward compat, the + name "paul" also works for this\. +short Like the default output, but more concise\. Some + typically redundant fields are ellided\. +json JSON output, 2\-space indentation\. +json\-N JSON output, N\-space indentation, e\.g\. "json\-4" +bunyan Alias for "json\-0", the Bunyan "native" format\. +inspect Node\.js `util\.inspect` output\. +. +.fi +. +.SH "DTRACE SUPPORT" +On systems that support DTrace (e\.g\., MacOS, FreeBSD, illumos derivatives like SmartOS and OmniOS), Bunyan will create a DTrace provider (\fBbunyan\fR) that makes available the following probes: +. +.IP "" 4 +. +.nf + +log\-trace +log\-debug +log\-info +log\-warn +log\-error +log\-fatal +. +.fi +. +.IP "" 0 +. +.P +Each of these probes has a single argument: the string that would be written to the log\. Note that when a probe is enabled, it will fire whenever the corresponding function is called, even if the level of the log message is less than that of any stream\. +. +.P +See \fIhttps://github\.com/trentm/node\-bunyan#dtrace\-support\fR for more details and the \'\-p PID\' option above for convenience usage\. +. +.SH "ENVIRONMENT" +. +.TP +\fBBUNYAN_NO_COLOR\fR +Set to a non\-empty value to force no output coloring\. See \'\-\-no\-color\'\. +. +.SH "PROJECT & BUGS" +\fBbunyan\fR is written in JavaScript and requires node\.js (\fBnode\fR)\. The project lives at \fIhttps://github\.com/trentm/node\-bunyan\fR and is published to npm as "bunyan"\. +. +.IP "\(bu" 4 +README, Install notes: \fIhttps://github\.com/trentm/node\-bunyan#readme\fR +. +.IP "\(bu" 4 +Report bugs to \fIhttps://github\.com/trentm/node\-bunyan/issues\fR\. +. +.IP "\(bu" 4 +See the full changelog at: \fIhttps://github\.com/trentm/node\-bunyan/blob/master/CHANGES\.md\fR +. +.IP "" 0 +. +.SH "LICENSE" +MIT License (see \fIhttps://github\.com/trentm/node\-bunyan/blob/master/LICENSE\.txt\fR) +. +.SH "COPYRIGHT" +node\-bunyan is Copyright (c) 2012 Joyent, Inc\. Copyright (c) 2012 Trent Mick\. All rights reserved\. diff --git a/datalab/web/node_modules/bunyan/docs/bunyan.1.html b/datalab/web/node_modules/bunyan/docs/bunyan.1.html new file mode 100644 index 0000000000000000000000000000000000000000..c11eaf08bbd44c1c1eaa99b5d61003c73e4097f6 --- /dev/null +++ b/datalab/web/node_modules/bunyan/docs/bunyan.1.html @@ -0,0 +1,281 @@ + + + + + + bunyan(1) - filter and pretty-print Bunyan log file content + + + + + +
+ + + +
    +
  1. bunyan(1)
  2. +
  3. bunyan manual
  4. +
  5. bunyan(1)
  6. +
+ +

NAME

+

+ bunyan - filter and pretty-print Bunyan log file content +

+ +

SYNOPSIS

+ +

bunyan [OPTIONS]

+ +

... | bunyan [OPTIONS]

+ +

bunyan [OPTIONS] -p PID

+ +

DESCRIPTION

+ +

"Bunyan" is a simple and fast a JSON logging library for node.js services, +a one-JSON-object-per-line log format, and a bunyan CLI tool for nicely +viewing those logs. This man page describes the latter.

+ +

Pretty-printing

+ +

A bunyan log file is a stream of JSON objects, optionally interspersed with +non-JSON log lines. The primary usage of bunyan(1) is to pretty print, +for example:

+ +
$ bunyan foo.log          # or `cat foo.log | bunyan
+[2012-02-08T22:56:52.856Z]  INFO: myservice/123 on example.com: My message
+    extra: multi
+    line
+[2012-02-08T22:56:54.856Z] ERROR: myservice/123 on example.com: My message
+...
+
+ +

By default the "long" output format is used. Use the -o FORMAT option to +emit other formats. E.g.:

+ +
$ bunyan foo.log -o short
+22:56:52.856Z  INFO myservice: My message
+    extra: multi
+    line
+22:56:54.856Z ERROR myservice: My message
+...
+
+ +

These will color the output if supported in your terminal. +See "OUTPUT FORMATS" below.

+ +

Filtering

+ +

The bunyan CLI can also be used to filter a bunyan log. Use -l LEVEL +to filter by level:

+ +
$ bunyan foo.log -l error       # show only 'error' level records
+[2012-02-08T22:56:54.856Z] ERROR: myservice/123 on example.com: My message
+
+ +

Use -c COND to filter on a JavaScript expression returning true on the +record data. In the COND code, this refers to the record object:

+ +
$ bunyan foo.log -c `this.three`     # show records with the 'extra' field
+[2012-02-08T22:56:52.856Z]  INFO: myservice/123 on example.com: My message
+    extra: multi
+    line
+
+ +

OPTIONS

+ +
+
-h, --help

Print this help info and exit.

+
--version

Print version of this command and exit.

+
-q, --quiet

Don't warn if input isn't valid JSON.

+
+ + +

Dtrace options (only on dtrace-supporting platforms):

+ +
+
-p PID, -p NAME
Process bunyan:log-* probes from the process with the given PID. +Can be used multiple times, or specify all processes with '*', +or a set of processes whose command & args match a pattern with +'-p NAME'.
+
+ + +

Filtering options:

+ +
+
-l, --level LEVEL

Only show messages at or above the specified level. You can specify level +names or numeric values. (See 'Log Levels' below.)

+
-c COND, --condition COND

Run each log message through the condition and only show those that +resolve to a truish value. E.g. -c 'this.pid == 123'.

+
--strict

Suppress all but legal Bunyan JSON log lines. By default non-JSON, and +non-Bunyan lines are passed through.

+
+ + +

Output options:

+ +
+
--color

Colorize output. Defaults to try if output stream is a TTY.

+
--no-color

Force no coloring (e.g. terminal doesn't support it)

+
-o FORMAT, --output FORMAT

Specify an output format. One of long (the default), short, json, +json-N, bunyan (the native bunyan 0-indent JSON output) or inspect.

+
-j

Shortcut for -o json.

+
-L, --time local

Display the time field in local time, rather than the default UTC +time.

+
+ + +

LOG LEVELS

+ +

In Bunyan log records, then level field is a number. For the -l|--level +argument the level names are supported as shortcuts. In -c|--condition +scripts, uppercase symbols like "DEBUG" are defined for convenience.

+ +
Level Name      Level Number    Symbol in COND Scripts
+trace           10              TRACE
+debug           20              DEBUG
+info            30              INFO
+warn            40              WARN
+error           50              ERROR
+fatal           60              FATAL
+
+ +

OUTPUT FORMATS

+ +
FORMAT NAME         DESCRIPTION
+long (default)      The default output. Long form. Colored and "pretty".
+                    'req' and 'res' and 'err' fields are rendered specially
+                    as an HTTP request, HTTP response and exception
+                    stack trace, respectively. For backward compat, the
+                    name "paul" also works for this.
+short               Like the default output, but more concise. Some
+                    typically redundant fields are ellided.
+json                JSON output, 2-space indentation.
+json-N              JSON output, N-space indentation, e.g. "json-4"
+bunyan              Alias for "json-0", the Bunyan "native" format.
+inspect             Node.js `util.inspect` output.
+
+ +

DTRACE SUPPORT

+ +

On systems that support DTrace (e.g., MacOS, FreeBSD, illumos derivatives +like SmartOS and OmniOS), Bunyan will create a DTrace provider (bunyan) +that makes available the following probes:

+ +
log-trace
+log-debug
+log-info
+log-warn
+log-error
+log-fatal
+
+ +

Each of these probes has a single argument: the string that would be +written to the log. Note that when a probe is enabled, it will +fire whenever the corresponding function is called, even if the level of +the log message is less than that of any stream.

+ +

See https://github.com/trentm/node-bunyan#dtrace-support for more details +and the '-p PID' option above for convenience usage.

+ +

ENVIRONMENT

+ +
+
BUNYAN_NO_COLOR
Set to a non-empty value to force no output coloring. See '--no-color'.
+
+ + +

PROJECT & BUGS

+ +

bunyan is written in JavaScript and requires node.js (node). The project +lives at https://github.com/trentm/node-bunyan and is published to npm as +"bunyan".

+ + + + +

LICENSE

+ +

MIT License (see https://github.com/trentm/node-bunyan/blob/master/LICENSE.txt)

+ + + +

node-bunyan is Copyright (c) 2012 Joyent, Inc. Copyright (c) 2012 Trent Mick. +All rights reserved.

+ + +
    +
  1. +
  2. January 2015
  3. +
  4. bunyan(1)
  5. +
+ +
+Fork me on GitHub + diff --git a/datalab/web/node_modules/bunyan/docs/bunyan.1.ronn b/datalab/web/node_modules/bunyan/docs/bunyan.1.ronn new file mode 100644 index 0000000000000000000000000000000000000000..c09b93382bcd22ad6d19ab2a7ebb6c8c07f855c8 --- /dev/null +++ b/datalab/web/node_modules/bunyan/docs/bunyan.1.ronn @@ -0,0 +1,195 @@ +# bunyan(1) -- filter and pretty-print Bunyan log file content + + +## SYNOPSIS + +`bunyan` \[OPTIONS\] + +... | `bunyan` \[OPTIONS\] + +`bunyan` \[OPTIONS\] -p PID + + +## DESCRIPTION + +"Bunyan" is **a simple and fast a JSON logging library** for node.js services, +a one-JSON-object-per-line log format, and **a `bunyan` CLI tool** for nicely +viewing those logs. This man page describes the latter. + + +### Pretty-printing + +A bunyan log file is a stream of JSON objects, optionally interspersed with +non-JSON log lines. The primary usage of bunyan(1) is to pretty print, +for example: + + $ bunyan foo.log # or `cat foo.log | bunyan + [2012-02-08T22:56:52.856Z] INFO: myservice/123 on example.com: My message + extra: multi + line + [2012-02-08T22:56:54.856Z] ERROR: myservice/123 on example.com: My message + ... + +By default the "long" output format is used. Use the `-o FORMAT` option to +emit other formats. E.g.: + + $ bunyan foo.log -o short + 22:56:52.856Z INFO myservice: My message + extra: multi + line + 22:56:54.856Z ERROR myservice: My message + ... + +These will color the output if supported in your terminal. +See "OUTPUT FORMATS" below. + + +### Filtering + +The `bunyan` CLI can also be used to filter a bunyan log. Use `-l LEVEL` +to filter by level: + + $ bunyan foo.log -l error # show only 'error' level records + [2012-02-08T22:56:54.856Z] ERROR: myservice/123 on example.com: My message + +Use `-c COND` to filter on a JavaScript expression returning true on the +record data. In the COND code, `this` refers to the record object: + + $ bunyan foo.log -c `this.three` # show records with the 'extra' field + [2012-02-08T22:56:52.856Z] INFO: myservice/123 on example.com: My message + extra: multi + line + + +## OPTIONS + + * `-h`, `--help`: + Print this help info and exit. + + * `--version`: + Print version of this command and exit. + + * `-q`, `--quiet`: + Don't warn if input isn't valid JSON. + +Dtrace options (only on dtrace-supporting platforms): + + * `-p PID`, `-p NAME`: + Process bunyan:log-\* probes from the process with the given PID. + Can be used multiple times, or specify all processes with '\*', + or a set of processes whose command & args match a pattern with + '-p NAME'. + +Filtering options: + + * `-l`, `--level LEVEL`: + Only show messages at or above the specified level. You can specify level + *names* or numeric values. (See 'Log Levels' below.) + + * `-c COND`, `--condition COND`: + Run each log message through the condition and only show those that + resolve to a truish value. E.g. `-c 'this.pid == 123'`. + + * `--strict`: + Suppress all but legal Bunyan JSON log lines. By default non-JSON, and + non-Bunyan lines are passed through. + +Output options: + + * `--color`: + Colorize output. Defaults to try if output stream is a TTY. + + * `--no-color`: + Force no coloring (e.g. terminal doesn't support it) + + * `-o FORMAT`, `--output FORMAT`: + Specify an output format. One of `long` (the default), `short`, `json`, + `json-N`, `bunyan` (the native bunyan 0-indent JSON output) or `inspect`. + + * `-j`: + Shortcut for `-o json`. + + * `-L`, `--time local`: + Display the time field in *local* time, rather than the default UTC + time. + + +## LOG LEVELS + +In Bunyan log records, then `level` field is a number. For the `-l|--level` +argument the level **names** are supported as shortcuts. In `-c|--condition` +scripts, uppercase symbols like "DEBUG" are defined for convenience. + + Level Name Level Number Symbol in COND Scripts + trace 10 TRACE + debug 20 DEBUG + info 30 INFO + warn 40 WARN + error 50 ERROR + fatal 60 FATAL + + +## OUTPUT FORMATS + + FORMAT NAME DESCRIPTION + long (default) The default output. Long form. Colored and "pretty". + 'req' and 'res' and 'err' fields are rendered specially + as an HTTP request, HTTP response and exception + stack trace, respectively. For backward compat, the + name "paul" also works for this. + short Like the default output, but more concise. Some + typically redundant fields are ellided. + json JSON output, 2-space indentation. + json-N JSON output, N-space indentation, e.g. "json-4" + bunyan Alias for "json-0", the Bunyan "native" format. + inspect Node.js `util.inspect` output. + + +## DTRACE SUPPORT + +On systems that support DTrace (e.g., MacOS, FreeBSD, illumos derivatives +like SmartOS and OmniOS), Bunyan will create a DTrace provider (`bunyan`) +that makes available the following probes: + + log-trace + log-debug + log-info + log-warn + log-error + log-fatal + +Each of these probes has a single argument: the string that would be +written to the log. Note that when a probe is enabled, it will +fire whenever the corresponding function is called, even if the level of +the log message is less than that of any stream. + +See for more details +and the '-p PID' option above for convenience usage. + + +## ENVIRONMENT + + * `BUNYAN_NO_COLOR`: + Set to a non-empty value to force no output coloring. See '--no-color'. + + +## PROJECT & BUGS + +`bunyan` is written in JavaScript and requires node.js (`node`). The project +lives at and is published to npm as +"bunyan". + +* README, Install notes: +* Report bugs to . +* See the full changelog at: + + +## LICENSE + +MIT License (see ) + + +## COPYRIGHT + +node-bunyan is Copyright (c) 2012 Joyent, Inc. Copyright (c) 2012 Trent Mick. +All rights reserved. diff --git a/datalab/web/node_modules/bunyan/docs/img/bunyan.browserify.png b/datalab/web/node_modules/bunyan/docs/img/bunyan.browserify.png new file mode 100644 index 0000000000000000000000000000000000000000..411aa1fedae850bb3e5c550d2c7d17cb998c9429 Binary files /dev/null and b/datalab/web/node_modules/bunyan/docs/img/bunyan.browserify.png differ diff --git a/datalab/web/node_modules/bunyan/docs/index.html b/datalab/web/node_modules/bunyan/docs/index.html new file mode 100644 index 0000000000000000000000000000000000000000..4defe1a9e22abe608de01bc67889a87707cdc3f8 --- /dev/null +++ b/datalab/web/node_modules/bunyan/docs/index.html @@ -0,0 +1 @@ +bunyan(1) man page diff --git a/datalab/web/node_modules/bunyan/lib/bunyan.js b/datalab/web/node_modules/bunyan/lib/bunyan.js new file mode 100644 index 0000000000000000000000000000000000000000..d5dc1cf44a95ed44a59d4047e7a1242d91cc5fb0 --- /dev/null +++ b/datalab/web/node_modules/bunyan/lib/bunyan.js @@ -0,0 +1,1627 @@ +/** + * Copyright (c) 2017 Trent Mick. + * Copyright (c) 2017 Joyent Inc. + * + * The bunyan logging library for node.js. + * + * -*- mode: js -*- + * vim: expandtab:ts=4:sw=4 + */ + +var VERSION = '1.8.12'; + +/* + * Bunyan log format version. This becomes the 'v' field on all log records. + * This will be incremented if there is any backward incompatible change to + * the log record format. Details will be in 'CHANGES.md' (the change log). + */ +var LOG_VERSION = 0; + + +var xxx = function xxx(s) { // internal dev/debug logging + var args = ['XX' + 'X: '+s].concat( + Array.prototype.slice.call(arguments, 1)); + console.error.apply(this, args); +}; +var xxx = function xxx() {}; // comment out to turn on debug logging + + +/* + * Runtime environment notes: + * + * Bunyan is intended to run in a number of runtime environments. Here are + * some notes on differences for those envs and how the code copes. + * + * - node.js: The primary target environment. + * - NW.js: http://nwjs.io/ An *app* environment that feels like both a + * node env -- it has node-like globals (`process`, `global`) and + * browser-like globals (`window`, `navigator`). My *understanding* is that + * bunyan can operate as if this is vanilla node.js. + * - browser: Failing the above, we sniff using the `window` global + * . + * - browserify: http://browserify.org/ A browser-targetting bundler of + * node.js deps. The runtime is a browser env, so can't use fs access, + * etc. Browserify's build looks for `require()` imports + * to bundle. For some imports it won't be able to handle, we "hide" + * from browserify with `require('frobshizzle' + '')`. + * - Other? Please open issues if things are broken. + */ +var runtimeEnv; +if (typeof (process) !== 'undefined' && process.versions) { + if (process.versions.nw) { + runtimeEnv = 'nw'; + } else if (process.versions.node) { + runtimeEnv = 'node'; + } +} +if (!runtimeEnv && typeof (window) !== 'undefined' && + window.window === window) { + runtimeEnv = 'browser'; +} +if (!runtimeEnv) { + throw new Error('unknown runtime environment'); +} + + +var os, fs, dtrace; +if (runtimeEnv === 'browser') { + os = { + hostname: function () { + return window.location.host; + } + }; + fs = {}; + dtrace = null; +} else { + os = require('os'); + fs = require('fs'); + try { + dtrace = require('dtrace-provider' + ''); + } catch (e) { + dtrace = null; + } +} +var util = require('util'); +var assert = require('assert'); +var EventEmitter = require('events').EventEmitter; +var stream = require('stream'); + +try { + var safeJsonStringify = require('safe-json-stringify'); +} catch (e) { + safeJsonStringify = null; +} +if (process.env.BUNYAN_TEST_NO_SAFE_JSON_STRINGIFY) { + safeJsonStringify = null; +} + +// The 'mv' module is required for rotating-file stream support. +try { + var mv = require('mv' + ''); +} catch (e) { + mv = null; +} + +try { + var sourceMapSupport = require('source-map-support' + ''); +} catch (_) { + sourceMapSupport = null; +} + + +//---- Internal support stuff + +/** + * A shallow copy of an object. Bunyan logging attempts to never cause + * exceptions, so this function attempts to handle non-objects gracefully. + */ +function objCopy(obj) { + if (obj == null) { // null or undefined + return obj; + } else if (Array.isArray(obj)) { + return obj.slice(); + } else if (typeof (obj) === 'object') { + var copy = {}; + Object.keys(obj).forEach(function (k) { + copy[k] = obj[k]; + }); + return copy; + } else { + return obj; + } +} + +var format = util.format; +if (!format) { + // If node < 0.6, then use its `util.format`: + // : + var inspect = util.inspect; + var formatRegExp = /%[sdj%]/g; + format = function format(f) { + if (typeof (f) !== 'string') { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function (x) { + if (i >= len) + return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': return fastAndSafeJsonStringify(args[i++]); + case '%%': return '%'; + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (x === null || typeof (x) !== 'object') { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; + }; +} + + +/** + * Gather some caller info 3 stack levels up. + * See . + */ +function getCaller3Info() { + if (this === undefined) { + // Cannot access caller info in 'strict' mode. + return; + } + var obj = {}; + var saveLimit = Error.stackTraceLimit; + var savePrepare = Error.prepareStackTrace; + Error.stackTraceLimit = 3; + + Error.prepareStackTrace = function (_, stack) { + var caller = stack[2]; + if (sourceMapSupport) { + caller = sourceMapSupport.wrapCallSite(caller); + } + obj.file = caller.getFileName(); + obj.line = caller.getLineNumber(); + var func = caller.getFunctionName(); + if (func) + obj.func = func; + }; + Error.captureStackTrace(this, getCaller3Info); + this.stack; + + Error.stackTraceLimit = saveLimit; + Error.prepareStackTrace = savePrepare; + return obj; +} + + +function _indent(s, indent) { + if (!indent) indent = ' '; + var lines = s.split(/\r?\n/g); + return indent + lines.join('\n' + indent); +} + + +/** + * Warn about an bunyan processing error. + * + * @param msg {String} Message with which to warn. + * @param dedupKey {String} Optional. A short string key for this warning to + * have its warning only printed once. + */ +function _warn(msg, dedupKey) { + assert.ok(msg); + if (dedupKey) { + if (_warned[dedupKey]) { + return; + } + _warned[dedupKey] = true; + } + process.stderr.write(msg + '\n'); +} +function _haveWarned(dedupKey) { + return _warned[dedupKey]; +} +var _warned = {}; + + +function ConsoleRawStream() {} +ConsoleRawStream.prototype.write = function (rec) { + if (rec.level < INFO) { + console.log(rec); + } else if (rec.level < WARN) { + console.info(rec); + } else if (rec.level < ERROR) { + console.warn(rec); + } else { + console.error(rec); + } +}; + + +//---- Levels + +var TRACE = 10; +var DEBUG = 20; +var INFO = 30; +var WARN = 40; +var ERROR = 50; +var FATAL = 60; + +var levelFromName = { + 'trace': TRACE, + 'debug': DEBUG, + 'info': INFO, + 'warn': WARN, + 'error': ERROR, + 'fatal': FATAL +}; +var nameFromLevel = {}; +Object.keys(levelFromName).forEach(function (name) { + nameFromLevel[levelFromName[name]] = name; +}); + +// Dtrace probes. +var dtp = undefined; +var probes = dtrace && {}; + +/** + * Resolve a level number, name (upper or lowercase) to a level number value. + * + * @param nameOrNum {String|Number} A level name (case-insensitive) or positive + * integer level. + * @api public + */ +function resolveLevel(nameOrNum) { + var level; + var type = typeof (nameOrNum); + if (type === 'string') { + level = levelFromName[nameOrNum.toLowerCase()]; + if (!level) { + throw new Error(format('unknown level name: "%s"', nameOrNum)); + } + } else if (type !== 'number') { + throw new TypeError(format('cannot resolve level: invalid arg (%s):', + type, nameOrNum)); + } else if (nameOrNum < 0 || Math.floor(nameOrNum) !== nameOrNum) { + throw new TypeError(format('level is not a positive integer: %s', + nameOrNum)); + } else { + level = nameOrNum; + } + return level; +} + + +function isWritable(obj) { + if (obj instanceof stream.Writable) { + return true; + } + return typeof (obj.write) === 'function'; +} + + +//---- Logger class + +/** + * Create a Logger instance. + * + * @param options {Object} See documentation for full details. At minimum + * this must include a 'name' string key. Configuration keys: + * - `streams`: specify the logger output streams. This is an array of + * objects with these fields: + * - `type`: The stream type. See README.md for full details. + * Often this is implied by the other fields. Examples are + * 'file', 'stream' and "raw". + * - `level`: Defaults to 'info'. + * - `path` or `stream`: The specify the file path or writeable + * stream to which log records are written. E.g. + * `stream: process.stdout`. + * - `closeOnExit` (boolean): Optional. Default is true for a + * 'file' stream when `path` is given, false otherwise. + * See README.md for full details. + * - `level`: set the level for a single output stream (cannot be used + * with `streams`) + * - `stream`: the output stream for a logger with just one, e.g. + * `process.stdout` (cannot be used with `streams`) + * - `serializers`: object mapping log record field names to + * serializing functions. See README.md for details. + * - `src`: Boolean (default false). Set true to enable 'src' automatic + * field with log call source info. + * All other keys are log record fields. + * + * An alternative *internal* call signature is used for creating a child: + * new Logger(, [, ]); + * + * @param _childSimple (Boolean) An assertion that the given `_childOptions` + * (a) only add fields (no config) and (b) no serialization handling is + * required for them. IOW, this is a fast path for frequent child + * creation. + */ +function Logger(options, _childOptions, _childSimple) { + xxx('Logger start:', options) + if (!(this instanceof Logger)) { + return new Logger(options, _childOptions); + } + + // Input arg validation. + var parent; + if (_childOptions !== undefined) { + parent = options; + options = _childOptions; + if (!(parent instanceof Logger)) { + throw new TypeError( + 'invalid Logger creation: do not pass a second arg'); + } + } + if (!options) { + throw new TypeError('options (object) is required'); + } + if (!parent) { + if (!options.name) { + throw new TypeError('options.name (string) is required'); + } + } else { + if (options.name) { + throw new TypeError( + 'invalid options.name: child cannot set logger name'); + } + } + if (options.stream && options.streams) { + throw new TypeError('cannot mix "streams" and "stream" options'); + } + if (options.streams && !Array.isArray(options.streams)) { + throw new TypeError('invalid options.streams: must be an array') + } + if (options.serializers && (typeof (options.serializers) !== 'object' || + Array.isArray(options.serializers))) { + throw new TypeError('invalid options.serializers: must be an object') + } + + EventEmitter.call(this); + + // Fast path for simple child creation. + if (parent && _childSimple) { + // `_isSimpleChild` is a signal to stream close handling that this child + // owns none of its streams. + this._isSimpleChild = true; + + this._level = parent._level; + this.streams = parent.streams; + this.serializers = parent.serializers; + this.src = parent.src; + var fields = this.fields = {}; + var parentFieldNames = Object.keys(parent.fields); + for (var i = 0; i < parentFieldNames.length; i++) { + var name = parentFieldNames[i]; + fields[name] = parent.fields[name]; + } + var names = Object.keys(options); + for (var i = 0; i < names.length; i++) { + var name = names[i]; + fields[name] = options[name]; + } + return; + } + + // Start values. + var self = this; + if (parent) { + this._level = parent._level; + this.streams = []; + for (var i = 0; i < parent.streams.length; i++) { + var s = objCopy(parent.streams[i]); + s.closeOnExit = false; // Don't own parent stream. + this.streams.push(s); + } + this.serializers = objCopy(parent.serializers); + this.src = parent.src; + this.fields = objCopy(parent.fields); + if (options.level) { + this.level(options.level); + } + } else { + this._level = Number.POSITIVE_INFINITY; + this.streams = []; + this.serializers = null; + this.src = false; + this.fields = {}; + } + + if (!dtp && dtrace) { + dtp = dtrace.createDTraceProvider('bunyan'); + + for (var level in levelFromName) { + var probe; + + probes[levelFromName[level]] = probe = + dtp.addProbe('log-' + level, 'char *'); + + // Explicitly add a reference to dtp to prevent it from being GC'd + probe.dtp = dtp; + } + + dtp.enable(); + } + + // Handle *config* options (i.e. options that are not just plain data + // for log records). + if (options.stream) { + self.addStream({ + type: 'stream', + stream: options.stream, + closeOnExit: false, + level: options.level + }); + } else if (options.streams) { + options.streams.forEach(function (s) { + self.addStream(s, options.level); + }); + } else if (parent && options.level) { + this.level(options.level); + } else if (!parent) { + if (runtimeEnv === 'browser') { + /* + * In the browser we'll be emitting to console.log by default. + * Any console.log worth its salt these days can nicely render + * and introspect objects (e.g. the Firefox and Chrome console) + * so let's emit the raw log record. Are there browsers for which + * that breaks things? + */ + self.addStream({ + type: 'raw', + stream: new ConsoleRawStream(), + closeOnExit: false, + level: options.level + }); + } else { + self.addStream({ + type: 'stream', + stream: process.stdout, + closeOnExit: false, + level: options.level + }); + } + } + if (options.serializers) { + self.addSerializers(options.serializers); + } + if (options.src) { + this.src = true; + } + xxx('Logger: ', self) + + // Fields. + // These are the default fields for log records (minus the attributes + // removed in this constructor). To allow storing raw log records + // (unrendered), `this.fields` must never be mutated. Create a copy for + // any changes. + var fields = objCopy(options); + delete fields.stream; + delete fields.level; + delete fields.streams; + delete fields.serializers; + delete fields.src; + if (this.serializers) { + this._applySerializers(fields); + } + if (!fields.hostname && !self.fields.hostname) { + fields.hostname = os.hostname(); + } + if (!fields.pid) { + fields.pid = process.pid; + } + Object.keys(fields).forEach(function (k) { + self.fields[k] = fields[k]; + }); +} + +util.inherits(Logger, EventEmitter); + + +/** + * Add a stream + * + * @param stream {Object}. Object with these fields: + * - `type`: The stream type. See README.md for full details. + * Often this is implied by the other fields. Examples are + * 'file', 'stream' and "raw". + * - `path` or `stream`: The specify the file path or writeable + * stream to which log records are written. E.g. + * `stream: process.stdout`. + * - `level`: Optional. Falls back to `defaultLevel`. + * - `closeOnExit` (boolean): Optional. Default is true for a + * 'file' stream when `path` is given, false otherwise. + * See README.md for full details. + * @param defaultLevel {Number|String} Optional. A level to use if + * `stream.level` is not set. If neither is given, this defaults to INFO. + */ +Logger.prototype.addStream = function addStream(s, defaultLevel) { + var self = this; + if (defaultLevel === null || defaultLevel === undefined) { + defaultLevel = INFO; + } + + s = objCopy(s); + + // Implicit 'type' from other args. + if (!s.type) { + if (s.stream) { + s.type = 'stream'; + } else if (s.path) { + s.type = 'file' + } + } + s.raw = (s.type === 'raw'); // PERF: Allow for faster check in `_emit`. + + if (s.level !== undefined) { + s.level = resolveLevel(s.level); + } else { + s.level = resolveLevel(defaultLevel); + } + if (s.level < self._level) { + self._level = s.level; + } + + switch (s.type) { + case 'stream': + assert.ok(isWritable(s.stream), + '"stream" stream is not writable: ' + util.inspect(s.stream)); + + if (!s.closeOnExit) { + s.closeOnExit = false; + } + break; + case 'file': + if (s.reemitErrorEvents === undefined) { + s.reemitErrorEvents = true; + } + if (!s.stream) { + s.stream = fs.createWriteStream(s.path, + {flags: 'a', encoding: 'utf8'}); + if (!s.closeOnExit) { + s.closeOnExit = true; + } + } else { + if (!s.closeOnExit) { + s.closeOnExit = false; + } + } + break; + case 'rotating-file': + assert.ok(!s.stream, + '"rotating-file" stream should not give a "stream"'); + assert.ok(s.path); + assert.ok(mv, '"rotating-file" stream type is not supported: ' + + 'missing "mv" module'); + s.stream = new RotatingFileStream(s); + if (!s.closeOnExit) { + s.closeOnExit = true; + } + break; + case 'raw': + if (!s.closeOnExit) { + s.closeOnExit = false; + } + break; + default: + throw new TypeError('unknown stream type "' + s.type + '"'); + } + + if (s.reemitErrorEvents && typeof (s.stream.on) === 'function') { + // TODO: When we have `.close()`, it should remove event + // listeners to not leak Logger instances. + s.stream.on('error', function onStreamError(err) { + self.emit('error', err, s); + }); + } + + self.streams.push(s); + delete self.haveNonRawStreams; // reset +} + + +/** + * Add serializers + * + * @param serializers {Object} Optional. Object mapping log record field names + * to serializing functions. See README.md for details. + */ +Logger.prototype.addSerializers = function addSerializers(serializers) { + var self = this; + + if (!self.serializers) { + self.serializers = {}; + } + Object.keys(serializers).forEach(function (field) { + var serializer = serializers[field]; + if (typeof (serializer) !== 'function') { + throw new TypeError(format( + 'invalid serializer for "%s" field: must be a function', + field)); + } else { + self.serializers[field] = serializer; + } + }); +} + + + +/** + * Create a child logger, typically to add a few log record fields. + * + * This can be useful when passing a logger to a sub-component, e.g. a + * 'wuzzle' component of your service: + * + * var wuzzleLog = log.child({component: 'wuzzle'}) + * var wuzzle = new Wuzzle({..., log: wuzzleLog}) + * + * Then log records from the wuzzle code will have the same structure as + * the app log, *plus the component='wuzzle' field*. + * + * @param options {Object} Optional. Set of options to apply to the child. + * All of the same options for a new Logger apply here. Notes: + * - The parent's streams are inherited and cannot be removed in this + * call. Any given `streams` are *added* to the set inherited from + * the parent. + * - The parent's serializers are inherited, though can effectively be + * overwritten by using duplicate keys. + * - Can use `level` to set the level of the streams inherited from + * the parent. The level for the parent is NOT affected. + * @param simple {Boolean} Optional. Set to true to assert that `options` + * (a) only add fields (no config) and (b) no serialization handling is + * required for them. IOW, this is a fast path for frequent child + * creation. See 'tools/timechild.js' for numbers. + */ +Logger.prototype.child = function (options, simple) { + return new (this.constructor)(this, options || {}, simple); +} + + +/** + * A convenience method to reopen 'file' streams on a logger. This can be + * useful with external log rotation utilities that move and re-open log files + * (e.g. logrotate on Linux, logadm on SmartOS/Illumos). Those utilities + * typically have rotation options to copy-and-truncate the log file, but + * you may not want to use that. An alternative is to do this in your + * application: + * + * var log = bunyan.createLogger(...); + * ... + * process.on('SIGUSR2', function () { + * log.reopenFileStreams(); + * }); + * ... + * + * See . + */ +Logger.prototype.reopenFileStreams = function () { + var self = this; + self.streams.forEach(function (s) { + if (s.type === 'file') { + if (s.stream) { + // Not sure if typically would want this, or more immediate + // `s.stream.destroy()`. + s.stream.end(); + s.stream.destroySoon(); + delete s.stream; + } + s.stream = fs.createWriteStream(s.path, + {flags: 'a', encoding: 'utf8'}); + s.stream.on('error', function (err) { + self.emit('error', err, s); + }); + } + }); +}; + + +/* BEGIN JSSTYLED */ +/** + * Close this logger. + * + * This closes streams (that it owns, as per 'endOnClose' attributes on + * streams), etc. Typically you **don't** need to bother calling this. +Logger.prototype.close = function () { + if (this._closed) { + return; + } + if (!this._isSimpleChild) { + self.streams.forEach(function (s) { + if (s.endOnClose) { + xxx('closing stream s:', s); + s.stream.end(); + s.endOnClose = false; + } + }); + } + this._closed = true; +} + */ +/* END JSSTYLED */ + + +/** + * Get/set the level of all streams on this logger. + * + * Get Usage: + * // Returns the current log level (lowest level of all its streams). + * log.level() -> INFO + * + * Set Usage: + * log.level(INFO) // set all streams to level INFO + * log.level('info') // can use 'info' et al aliases + */ +Logger.prototype.level = function level(value) { + if (value === undefined) { + return this._level; + } + var newLevel = resolveLevel(value); + var len = this.streams.length; + for (var i = 0; i < len; i++) { + this.streams[i].level = newLevel; + } + this._level = newLevel; +} + + +/** + * Get/set the level of a particular stream on this logger. + * + * Get Usage: + * // Returns an array of the levels of each stream. + * log.levels() -> [TRACE, INFO] + * + * // Returns a level of the identified stream. + * log.levels(0) -> TRACE // level of stream at index 0 + * log.levels('foo') // level of stream with name 'foo' + * + * Set Usage: + * log.levels(0, INFO) // set level of stream 0 to INFO + * log.levels(0, 'info') // can use 'info' et al aliases + * log.levels('foo', WARN) // set stream named 'foo' to WARN + * + * Stream names: When streams are defined, they can optionally be given + * a name. For example, + * log = new Logger({ + * streams: [ + * { + * name: 'foo', + * path: '/var/log/my-service/foo.log' + * level: 'trace' + * }, + * ... + * + * @param name {String|Number} The stream index or name. + * @param value {Number|String} The level value (INFO) or alias ('info'). + * If not given, this is a 'get' operation. + * @throws {Error} If there is no stream with the given name. + */ +Logger.prototype.levels = function levels(name, value) { + if (name === undefined) { + assert.equal(value, undefined); + return this.streams.map( + function (s) { return s.level }); + } + var stream; + if (typeof (name) === 'number') { + stream = this.streams[name]; + if (stream === undefined) { + throw new Error('invalid stream index: ' + name); + } + } else { + var len = this.streams.length; + for (var i = 0; i < len; i++) { + var s = this.streams[i]; + if (s.name === name) { + stream = s; + break; + } + } + if (!stream) { + throw new Error(format('no stream with name "%s"', name)); + } + } + if (value === undefined) { + return stream.level; + } else { + var newLevel = resolveLevel(value); + stream.level = newLevel; + if (newLevel < this._level) { + this._level = newLevel; + } + } +} + + +/** + * Apply registered serializers to the appropriate keys in the given fields. + * + * Pre-condition: This is only called if there is at least one serializer. + * + * @param fields (Object) The log record fields. + * @param excludeFields (Object) Optional mapping of keys to `true` for + * keys to NOT apply a serializer. + */ +Logger.prototype._applySerializers = function (fields, excludeFields) { + var self = this; + + xxx('_applySerializers: excludeFields', excludeFields); + + // Check each serializer against these (presuming number of serializers + // is typically less than number of fields). + Object.keys(this.serializers).forEach(function (name) { + if (fields[name] === undefined || + (excludeFields && excludeFields[name])) + { + return; + } + xxx('_applySerializers; apply to "%s" key', name) + try { + fields[name] = self.serializers[name](fields[name]); + } catch (err) { + _warn(format('bunyan: ERROR: Exception thrown from the "%s" ' + + 'Bunyan serializer. This should never happen. This is a bug ' + + 'in that serializer function.\n%s', + name, err.stack || err)); + fields[name] = format('(Error in Bunyan log "%s" serializer ' + + 'broke field. See stderr for details.)', name); + } + }); +} + + +/** + * Emit a log record. + * + * @param rec {log record} + * @param noemit {Boolean} Optional. Set to true to skip emission + * and just return the JSON string. + */ +Logger.prototype._emit = function (rec, noemit) { + var i; + + // Lazily determine if this Logger has non-'raw' streams. If there are + // any, then we need to stringify the log record. + if (this.haveNonRawStreams === undefined) { + this.haveNonRawStreams = false; + for (i = 0; i < this.streams.length; i++) { + if (!this.streams[i].raw) { + this.haveNonRawStreams = true; + break; + } + } + } + + // Stringify the object (creates a warning str on error). + var str; + if (noemit || this.haveNonRawStreams) { + str = fastAndSafeJsonStringify(rec) + '\n'; + } + + if (noemit) + return str; + + var level = rec.level; + for (i = 0; i < this.streams.length; i++) { + var s = this.streams[i]; + if (s.level <= level) { + xxx('writing log rec "%s" to "%s" stream (%d <= %d): %j', + rec.msg, s.type, s.level, level, rec); + s.stream.write(s.raw ? rec : str); + } + }; + + return str; +} + + +/** + * Build a record object suitable for emitting from the arguments + * provided to the a log emitter. + */ +function mkRecord(log, minLevel, args) { + var excludeFields, fields, msgArgs; + if (args[0] instanceof Error) { + // `log.(err, ...)` + fields = { + // Use this Logger's err serializer, if defined. + err: (log.serializers && log.serializers.err + ? log.serializers.err(args[0]) + : Logger.stdSerializers.err(args[0])) + }; + excludeFields = {err: true}; + if (args.length === 1) { + msgArgs = [fields.err.message]; + } else { + msgArgs = args.slice(1); + } + } else if (typeof (args[0]) !== 'object' || Array.isArray(args[0])) { + // `log.(msg, ...)` + fields = null; + msgArgs = args.slice(); + } else if (Buffer.isBuffer(args[0])) { // `log.(buf, ...)` + // Almost certainly an error, show `inspect(buf)`. See bunyan + // issue #35. + fields = null; + msgArgs = args.slice(); + msgArgs[0] = util.inspect(msgArgs[0]); + } else { // `log.(fields, msg, ...)` + fields = args[0]; + if (fields && args.length === 1 && fields.err && + fields.err instanceof Error) + { + msgArgs = [fields.err.message]; + } else { + msgArgs = args.slice(1); + } + } + + // Build up the record object. + var rec = objCopy(log.fields); + var level = rec.level = minLevel; + var recFields = (fields ? objCopy(fields) : null); + if (recFields) { + if (log.serializers) { + log._applySerializers(recFields, excludeFields); + } + Object.keys(recFields).forEach(function (k) { + rec[k] = recFields[k]; + }); + } + rec.msg = format.apply(log, msgArgs); + if (!rec.time) { + rec.time = (new Date()); + } + // Get call source info + if (log.src && !rec.src) { + rec.src = getCaller3Info() + } + rec.v = LOG_VERSION; + + return rec; +}; + + +/** + * Build an array that dtrace-provider can use to fire a USDT probe. If we've + * already built the appropriate string, we use it. Otherwise, build the + * record object and stringify it. + */ +function mkProbeArgs(str, log, minLevel, msgArgs) { + return [ str || log._emit(mkRecord(log, minLevel, msgArgs), true) ]; +} + + +/** + * Build a log emitter function for level minLevel. I.e. this is the + * creator of `log.info`, `log.error`, etc. + */ +function mkLogEmitter(minLevel) { + return function () { + var log = this; + var str = null; + var rec = null; + + if (!this._emit) { + /* + * Show this invalid Bunyan usage warning *once*. + * + * See for + * an example of how this can happen. + */ + var dedupKey = 'unbound'; + if (!_haveWarned[dedupKey]) { + var caller = getCaller3Info(); + _warn(format('bunyan usage error: %s:%s: attempt to log ' + + 'with an unbound log method: `this` is: %s', + caller.file, caller.line, util.inspect(this)), + dedupKey); + } + return; + } else if (arguments.length === 0) { // `log.()` + return (this._level <= minLevel); + } + + var msgArgs = new Array(arguments.length); + for (var i = 0; i < msgArgs.length; ++i) { + msgArgs[i] = arguments[i]; + } + + if (this._level <= minLevel) { + rec = mkRecord(log, minLevel, msgArgs); + str = this._emit(rec); + } + + if (probes) { + probes[minLevel].fire(mkProbeArgs, str, log, minLevel, msgArgs); + } + } +} + + +/** + * The functions below log a record at a specific level. + * + * Usages: + * log.() -> boolean is-trace-enabled + * log.( err, [ msg, ...]) + * log.( msg, ...) + * log.( fields, msg, ...) + * + * where is the lowercase version of the log level. E.g.: + * + * log.info() + * + * @params fields {Object} Optional set of additional fields to log. + * @params msg {String} Log message. This can be followed by additional + * arguments that are handled like + * [util.format](http://nodejs.org/docs/latest/api/all.html#util.format). + */ +Logger.prototype.trace = mkLogEmitter(TRACE); +Logger.prototype.debug = mkLogEmitter(DEBUG); +Logger.prototype.info = mkLogEmitter(INFO); +Logger.prototype.warn = mkLogEmitter(WARN); +Logger.prototype.error = mkLogEmitter(ERROR); +Logger.prototype.fatal = mkLogEmitter(FATAL); + + + +//---- Standard serializers +// A serializer is a function that serializes a JavaScript object to a +// JSON representation for logging. There is a standard set of presumed +// interesting objects in node.js-land. + +Logger.stdSerializers = {}; + +// Serialize an HTTP request. +Logger.stdSerializers.req = function (req) { + if (!req || !req.connection) + return req; + return { + method: req.method, + url: req.url, + headers: req.headers, + remoteAddress: req.connection.remoteAddress, + remotePort: req.connection.remotePort + }; + // Trailers: Skipping for speed. If you need trailers in your app, then + // make a custom serializer. + //if (Object.keys(trailers).length > 0) { + // obj.trailers = req.trailers; + //} +}; + +// Serialize an HTTP response. +Logger.stdSerializers.res = function (res) { + if (!res || !res.statusCode) + return res; + return { + statusCode: res.statusCode, + header: res._header + } +}; + + +/* + * This function dumps long stack traces for exceptions having a cause() + * method. The error classes from + * [verror](https://github.com/davepacheco/node-verror) and + * [restify v2.0](https://github.com/mcavage/node-restify) are examples. + * + * Based on `dumpException` in + * https://github.com/davepacheco/node-extsprintf/blob/master/lib/extsprintf.js + */ +function getFullErrorStack(ex) +{ + var ret = ex.stack || ex.toString(); + if (ex.cause && typeof (ex.cause) === 'function') { + var cex = ex.cause(); + if (cex) { + ret += '\nCaused by: ' + getFullErrorStack(cex); + } + } + return (ret); +} + +// Serialize an Error object +// (Core error properties are enumerable in node 0.4, not in 0.6). +var errSerializer = Logger.stdSerializers.err = function (err) { + if (!err || !err.stack) + return err; + var obj = { + message: err.message, + name: err.name, + stack: getFullErrorStack(err), + code: err.code, + signal: err.signal + } + return obj; +}; + + +// A JSON stringifier that handles cycles safely - tracks seen values in a Set. +function safeCyclesSet() { + var seen = new Set(); + return function (key, val) { + if (!val || typeof (val) !== 'object') { + return val; + } + if (seen.has(val)) { + return '[Circular]'; + } + seen.add(val); + return val; + }; +} + +/** + * A JSON stringifier that handles cycles safely - tracks seen vals in an Array. + * + * Note: This approach has performance problems when dealing with large objects, + * see trentm/node-bunyan#445, but since this is the only option for node 0.10 + * and earlier (as Set was introduced in Node 0.12), it's used as a fallback + * when Set is not available. + */ +function safeCyclesArray() { + var seen = []; + return function (key, val) { + if (!val || typeof (val) !== 'object') { + return val; + } + if (seen.indexOf(val) !== -1) { + return '[Circular]'; + } + seen.push(val); + return val; + }; +} + +/** + * A JSON stringifier that handles cycles safely. + * + * Usage: JSON.stringify(obj, safeCycles()) + * + * Choose the best safe cycle function from what is available - see + * trentm/node-bunyan#445. + */ +var safeCycles = typeof (Set) !== 'undefined' ? safeCyclesSet : safeCyclesArray; + +/** + * A fast JSON.stringify that handles cycles and getter exceptions (when + * safeJsonStringify is installed). + * + * This function attempts to use the regular JSON.stringify for speed, but on + * error (e.g. JSON cycle detection exception) it falls back to safe stringify + * handlers that can deal with cycles and/or getter exceptions. + */ +function fastAndSafeJsonStringify(rec) { + try { + return JSON.stringify(rec); + } catch (ex) { + try { + return JSON.stringify(rec, safeCycles()); + } catch (e) { + if (safeJsonStringify) { + return safeJsonStringify(rec); + } else { + var dedupKey = e.stack.split(/\n/g, 3).join('\n'); + _warn('bunyan: ERROR: Exception in ' + + '`JSON.stringify(rec)`. You can install the ' + + '"safe-json-stringify" module to have Bunyan fallback ' + + 'to safer stringification. Record:\n' + + _indent(format('%s\n%s', util.inspect(rec), e.stack)), + dedupKey); + return format('(Exception in JSON.stringify(rec): %j. ' + + 'See stderr for details.)', e.message); + } + } + } +} + + +var RotatingFileStream = null; +if (mv) { + +RotatingFileStream = function RotatingFileStream(options) { + this.path = options.path; + + this.count = (options.count == null ? 10 : options.count); + assert.equal(typeof (this.count), 'number', + format('rotating-file stream "count" is not a number: %j (%s) in %j', + this.count, typeof (this.count), this)); + assert.ok(this.count >= 0, + format('rotating-file stream "count" is not >= 0: %j in %j', + this.count, this)); + + // Parse `options.period`. + if (options.period) { + // where scope is: + // h hours (at the start of the hour) + // d days (at the start of the day, i.e. just after midnight) + // w weeks (at the start of Sunday) + // m months (on the first of the month) + // y years (at the start of Jan 1st) + // with special values 'hourly' (1h), 'daily' (1d), "weekly" (1w), + // 'monthly' (1m) and 'yearly' (1y) + var period = { + 'hourly': '1h', + 'daily': '1d', + 'weekly': '1w', + 'monthly': '1m', + 'yearly': '1y' + }[options.period] || options.period; + var m = /^([1-9][0-9]*)([hdwmy]|ms)$/.exec(period); + if (!m) { + throw new Error(format('invalid period: "%s"', options.period)); + } + this.periodNum = Number(m[1]); + this.periodScope = m[2]; + } else { + this.periodNum = 1; + this.periodScope = 'd'; + } + + var lastModified = null; + try { + var fileInfo = fs.statSync(this.path); + lastModified = fileInfo.mtime.getTime(); + } + catch (err) { + // file doesn't exist + } + var rotateAfterOpen = false; + if (lastModified) { + var lastRotTime = this._calcRotTime(0); + if (lastModified < lastRotTime) { + rotateAfterOpen = true; + } + } + + // TODO: template support for backup files + // template: + // default is %P.%n + // '/var/log/archive/foo.log' -> foo.log.%n + // '/var/log/archive/foo.log.%n' + // codes: + // XXX support strftime codes (per node version of those) + // or whatever module. Pick non-colliding for extra + // codes + // %P `path` base value + // %n integer number of rotated log (1,2,3,...) + // %d datetime in YYYY-MM-DD_HH-MM-SS + // XXX what should default date format be? + // prior art? Want to avoid ':' in + // filenames (illegal on Windows for one). + + this.stream = fs.createWriteStream(this.path, + {flags: 'a', encoding: 'utf8'}); + + this.rotQueue = []; + this.rotating = false; + if (rotateAfterOpen) { + this._debug('rotateAfterOpen -> call rotate()'); + this.rotate(); + } else { + this._setupNextRot(); + } +} + +util.inherits(RotatingFileStream, EventEmitter); + +RotatingFileStream.prototype._debug = function () { + // Set this to `true` to add debug logging. + if (false) { + if (arguments.length === 0) { + return true; + } + var args = Array.prototype.slice.call(arguments); + args[0] = '[' + (new Date().toISOString()) + ', ' + + this.path + '] ' + args[0]; + console.log.apply(this, args); + } else { + return false; + } +}; + +RotatingFileStream.prototype._setupNextRot = function () { + this.rotAt = this._calcRotTime(1); + this._setRotationTimer(); +} + +RotatingFileStream.prototype._setRotationTimer = function () { + var self = this; + var delay = this.rotAt - Date.now(); + // Cap timeout to Node's max setTimeout, see + // . + var TIMEOUT_MAX = 2147483647; // 2^31-1 + if (delay > TIMEOUT_MAX) { + delay = TIMEOUT_MAX; + } + this.timeout = setTimeout( + function () { + self._debug('_setRotationTimer timeout -> call rotate()'); + self.rotate(); + }, + delay); + if (typeof (this.timeout.unref) === 'function') { + this.timeout.unref(); + } +} + +RotatingFileStream.prototype._calcRotTime = +function _calcRotTime(periodOffset) { + this._debug('_calcRotTime: %s%s', this.periodNum, this.periodScope); + var d = new Date(); + + this._debug(' now local: %s', d); + this._debug(' now utc: %s', d.toISOString()); + var rotAt; + switch (this.periodScope) { + case 'ms': + // Hidden millisecond period for debugging. + if (this.rotAt) { + rotAt = this.rotAt + this.periodNum * periodOffset; + } else { + rotAt = Date.now() + this.periodNum * periodOffset; + } + break; + case 'h': + if (this.rotAt) { + rotAt = this.rotAt + this.periodNum * 60 * 60 * 1000 * periodOffset; + } else { + // First time: top of the next hour. + rotAt = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), + d.getUTCDate(), d.getUTCHours() + periodOffset); + } + break; + case 'd': + if (this.rotAt) { + rotAt = this.rotAt + this.periodNum * 24 * 60 * 60 * 1000 + * periodOffset; + } else { + // First time: start of tomorrow (i.e. at the coming midnight) UTC. + rotAt = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), + d.getUTCDate() + periodOffset); + } + break; + case 'w': + // Currently, always on Sunday morning at 00:00:00 (UTC). + if (this.rotAt) { + rotAt = this.rotAt + this.periodNum * 7 * 24 * 60 * 60 * 1000 + * periodOffset; + } else { + // First time: this coming Sunday. + var dayOffset = (7 - d.getUTCDay()); + if (periodOffset < 1) { + dayOffset = -d.getUTCDay(); + } + if (periodOffset > 1 || periodOffset < -1) { + dayOffset += 7 * periodOffset; + } + rotAt = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), + d.getUTCDate() + dayOffset); + } + break; + case 'm': + if (this.rotAt) { + rotAt = Date.UTC(d.getUTCFullYear(), + d.getUTCMonth() + this.periodNum * periodOffset, 1); + } else { + // First time: the start of the next month. + rotAt = Date.UTC(d.getUTCFullYear(), + d.getUTCMonth() + periodOffset, 1); + } + break; + case 'y': + if (this.rotAt) { + rotAt = Date.UTC(d.getUTCFullYear() + this.periodNum * periodOffset, + 0, 1); + } else { + // First time: the start of the next year. + rotAt = Date.UTC(d.getUTCFullYear() + periodOffset, 0, 1); + } + break; + default: + assert.fail(format('invalid period scope: "%s"', this.periodScope)); + } + + if (this._debug()) { + this._debug(' **rotAt**: %s (utc: %s)', rotAt, + new Date(rotAt).toUTCString()); + var now = Date.now(); + this._debug(' now: %s (%sms == %smin == %sh to go)', + now, + rotAt - now, + (rotAt-now)/1000/60, + (rotAt-now)/1000/60/60); + } + return rotAt; +}; + +RotatingFileStream.prototype.rotate = function rotate() { + // XXX What about shutdown? + var self = this; + + // If rotation period is > ~25 days, we have to break into multiple + // setTimeout's. See . + if (self.rotAt && self.rotAt > Date.now()) { + return self._setRotationTimer(); + } + + this._debug('rotate'); + if (self.rotating) { + throw new TypeError('cannot start a rotation when already rotating'); + } + self.rotating = true; + + self.stream.end(); // XXX can do moves sync after this? test at high rate + + function del() { + var toDel = self.path + '.' + String(n - 1); + if (n === 0) { + toDel = self.path; + } + n -= 1; + self._debug(' rm %s', toDel); + fs.unlink(toDel, function (delErr) { + //XXX handle err other than not exists + moves(); + }); + } + + function moves() { + if (self.count === 0 || n < 0) { + return finish(); + } + var before = self.path; + var after = self.path + '.' + String(n); + if (n > 0) { + before += '.' + String(n - 1); + } + n -= 1; + fs.exists(before, function (exists) { + if (!exists) { + moves(); + } else { + self._debug(' mv %s %s', before, after); + mv(before, after, function (mvErr) { + if (mvErr) { + self.emit('error', mvErr); + finish(); // XXX finish here? + } else { + moves(); + } + }); + } + }) + } + + function finish() { + self._debug(' open %s', self.path); + self.stream = fs.createWriteStream(self.path, + {flags: 'a', encoding: 'utf8'}); + var q = self.rotQueue, len = q.length; + for (var i = 0; i < len; i++) { + self.stream.write(q[i]); + } + self.rotQueue = []; + self.rotating = false; + self.emit('drain'); + self._setupNextRot(); + } + + var n = this.count; + del(); +}; + +RotatingFileStream.prototype.write = function write(s) { + if (this.rotating) { + this.rotQueue.push(s); + return false; + } else { + return this.stream.write(s); + } +}; + +RotatingFileStream.prototype.end = function end(s) { + this.stream.end(); +}; + +RotatingFileStream.prototype.destroy = function destroy(s) { + this.stream.destroy(); +}; + +RotatingFileStream.prototype.destroySoon = function destroySoon(s) { + this.stream.destroySoon(); +}; + +} /* if (mv) */ + + + +/** + * RingBuffer is a Writable Stream that just stores the last N records in + * memory. + * + * @param options {Object}, with the following fields: + * + * - limit: number of records to keep in memory + */ +function RingBuffer(options) { + this.limit = options && options.limit ? options.limit : 100; + this.writable = true; + this.records = []; + EventEmitter.call(this); +} + +util.inherits(RingBuffer, EventEmitter); + +RingBuffer.prototype.write = function (record) { + if (!this.writable) + throw (new Error('RingBuffer has been ended already')); + + this.records.push(record); + + if (this.records.length > this.limit) + this.records.shift(); + + return (true); +}; + +RingBuffer.prototype.end = function () { + if (arguments.length > 0) + this.write.apply(this, Array.prototype.slice.call(arguments)); + this.writable = false; +}; + +RingBuffer.prototype.destroy = function () { + this.writable = false; + this.emit('close'); +}; + +RingBuffer.prototype.destroySoon = function () { + this.destroy(); +}; + + +//---- Exports + +module.exports = Logger; + +module.exports.TRACE = TRACE; +module.exports.DEBUG = DEBUG; +module.exports.INFO = INFO; +module.exports.WARN = WARN; +module.exports.ERROR = ERROR; +module.exports.FATAL = FATAL; +module.exports.resolveLevel = resolveLevel; +module.exports.levelFromName = levelFromName; +module.exports.nameFromLevel = nameFromLevel; + +module.exports.VERSION = VERSION; +module.exports.LOG_VERSION = LOG_VERSION; + +module.exports.createLogger = function createLogger(options) { + return new Logger(options); +}; + +module.exports.RingBuffer = RingBuffer; +module.exports.RotatingFileStream = RotatingFileStream; + +// Useful for custom `type == 'raw'` streams that may do JSON stringification +// of log records themselves. Usage: +// var str = JSON.stringify(rec, bunyan.safeCycles()); +module.exports.safeCycles = safeCycles; diff --git a/datalab/web/node_modules/bunyan/package.json b/datalab/web/node_modules/bunyan/package.json new file mode 100644 index 0000000000000000000000000000000000000000..162f88845bf7658cdbba103c7a3aa84c2e9022ff --- /dev/null +++ b/datalab/web/node_modules/bunyan/package.json @@ -0,0 +1,41 @@ +{ + "name": "bunyan", + "version": "1.8.12", + "description": "a JSON logging library for node.js services", + "author": "Trent Mick (http://trentm.com)", + "main": "./lib/bunyan.js", + "bin": { + "bunyan": "./bin/bunyan" + }, + + "repository": { + "type": "git", + "url": "git://github.com/trentm/node-bunyan.git" + }, + "engines": ["node >=0.10.0"], + "keywords": ["log", "logging", "log4j", "json", "bunyan"], + "license": "MIT", + + "// dtrace-provider": "required for dtrace features", + "// mv": "required for RotatingFileStream", + "// moment": "required for local time with CLI", + "optionalDependencies": { + "dtrace-provider": "~0.8", + "mv": "~2", + "safe-json-stringify": "~1", + "moment": "^2.10.6" + }, + "devDependencies": { + "nodeunit": "0.9", + "ben": "0.0.0", + "markdown-toc": "0.12.x", + "verror": "1.3.3", + "vasync": "1.4.3" + }, + + "scripts": { + "test": "make test" + }, + "dependencies": { + } +} diff --git a/datalab/web/node_modules/callsite/.npmignore b/datalab/web/node_modules/callsite/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..f1250e584c94b80208b61cf7cae29db8e486a5c7 --- /dev/null +++ b/datalab/web/node_modules/callsite/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/datalab/web/node_modules/callsite/History.md b/datalab/web/node_modules/callsite/History.md new file mode 100644 index 0000000000000000000000000000000000000000..499419840612b00325012937d73456529caebe56 --- /dev/null +++ b/datalab/web/node_modules/callsite/History.md @@ -0,0 +1,10 @@ + +1.0.0 / 2013-01-24 +================== + + * remove lame magical getters + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/datalab/web/node_modules/callsite/Makefile b/datalab/web/node_modules/callsite/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..634e37219281be9e2f2129c5d31390b166cfdd9e --- /dev/null +++ b/datalab/web/node_modules/callsite/Makefile @@ -0,0 +1,6 @@ + +test: + @./node_modules/.bin/mocha \ + --require should + +.PHONY: test \ No newline at end of file diff --git a/datalab/web/node_modules/callsite/Readme.md b/datalab/web/node_modules/callsite/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..0dbd16ade58538b308f208e1fa5abce2aa85af30 --- /dev/null +++ b/datalab/web/node_modules/callsite/Readme.md @@ -0,0 +1,44 @@ +# callstack + + Access to v8's "raw" `CallSite`s. + +## Installation + + $ npm install callsite + +## Example + +```js +var stack = require('callsite'); + +foo(); + +function foo() { + bar(); +} + +function bar() { + baz(); +} + +function baz() { + console.log(); + stack().forEach(function(site){ + console.log(' \033[36m%s\033[90m in %s:%d\033[0m' + , site.getFunctionName() || 'anonymous' + , site.getFileName() + , site.getLineNumber()); + }); + console.log(); +} +``` + +## Why? + + Because you can do weird, stupid, clever, wacky things such as: + + - [better-assert](https://github.com/visionmedia/better-assert) + +## License + + MIT diff --git a/datalab/web/node_modules/callsite/index.js b/datalab/web/node_modules/callsite/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d3ee6f8cf382e17e1f19c833bdb26c34fc382012 --- /dev/null +++ b/datalab/web/node_modules/callsite/index.js @@ -0,0 +1,10 @@ + +module.exports = function(){ + var orig = Error.prepareStackTrace; + Error.prepareStackTrace = function(_, stack){ return stack; }; + var err = new Error; + Error.captureStackTrace(err, arguments.callee); + var stack = err.stack; + Error.prepareStackTrace = orig; + return stack; +}; diff --git a/datalab/web/node_modules/callsite/package.json b/datalab/web/node_modules/callsite/package.json new file mode 100644 index 0000000000000000000000000000000000000000..348434e512ca36d4b8743715a3ac0a26727446c7 --- /dev/null +++ b/datalab/web/node_modules/callsite/package.json @@ -0,0 +1,11 @@ +{ + "name": "callsite" + , "version": "1.0.0" + , "description": "access to v8's CallSites" + , "keywords": ["stack", "trace", "line"] + , "author": "TJ Holowaychuk " + , "dependencies": {} + , "devDependencies": { "mocha": "*", "should": "*" } + , "main": "index" + , "engines": { "node": "*" } +} diff --git a/datalab/web/node_modules/component-bind/.npmignore b/datalab/web/node_modules/component-bind/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..f1250e584c94b80208b61cf7cae29db8e486a5c7 --- /dev/null +++ b/datalab/web/node_modules/component-bind/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/datalab/web/node_modules/component-bind/History.md b/datalab/web/node_modules/component-bind/History.md new file mode 100644 index 0000000000000000000000000000000000000000..2795fdbc4e96dd882c6846e3c21e6280fb0f082f --- /dev/null +++ b/datalab/web/node_modules/component-bind/History.md @@ -0,0 +1,13 @@ + +1.0.0 / 2014-05-27 +================== + + * index: use slice ref (#7, @viatropos) + * package: rename package to "component-bind" + * package: add "repository" field (#6, @repoify) + * package: add "component" section + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/datalab/web/node_modules/component-bind/Makefile b/datalab/web/node_modules/component-bind/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..4e9c8d36ebcd2f63843cf5a534e4db3459b2d637 --- /dev/null +++ b/datalab/web/node_modules/component-bind/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test \ No newline at end of file diff --git a/datalab/web/node_modules/component-bind/Readme.md b/datalab/web/node_modules/component-bind/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..6a8febc8a314eac0592ded590a2e26fb5a5b6a90 --- /dev/null +++ b/datalab/web/node_modules/component-bind/Readme.md @@ -0,0 +1,64 @@ +# bind + + Function binding utility. + +## Installation + +``` +$ component install component/bind +``` + +## API + + - [bind(obj, fn)](#bindobj-fn) + - [bind(obj, fn, ...)](#bindobj-fn-) + - [bind(obj, name)](#bindobj-name) + + + +### bind(obj, fn) +should bind the function to the given object. + +```js +var tobi = { name: 'tobi' }; + +function name() { + return this.name; +} + +var fn = bind(tobi, name); +fn().should.equal('tobi'); +``` + + +### bind(obj, fn, ...) +should curry the remaining arguments. + +```js +function add(a, b) { + return a + b; +} + +bind(null, add)(1, 2).should.equal(3); +bind(null, add, 1)(2).should.equal(3); +bind(null, add, 1, 2)().should.equal(3); +``` + + +### bind(obj, name) +should bind the method of the given name. + +```js +var tobi = { name: 'tobi' }; + +tobi.getName = function() { + return this.name; +}; + +var fn = bind(tobi, 'getName'); +fn().should.equal('tobi'); +``` + +## License + + MIT \ No newline at end of file diff --git a/datalab/web/node_modules/component-bind/component.json b/datalab/web/node_modules/component-bind/component.json new file mode 100644 index 0000000000000000000000000000000000000000..4e1e93f5006167b3491842ac76d327058103fe87 --- /dev/null +++ b/datalab/web/node_modules/component-bind/component.json @@ -0,0 +1,13 @@ +{ + "name": "bind", + "version": "1.0.0", + "description": "function binding utility", + "keywords": [ + "bind", + "utility" + ], + "dependencies": {}, + "scripts": [ + "index.js" + ] +} diff --git a/datalab/web/node_modules/component-bind/index.js b/datalab/web/node_modules/component-bind/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4eeb2c0a4a04adba3cb92fc54d3897fcce0efdf3 --- /dev/null +++ b/datalab/web/node_modules/component-bind/index.js @@ -0,0 +1,23 @@ +/** + * Slice reference. + */ + +var slice = [].slice; + +/** + * Bind `obj` to `fn`. + * + * @param {Object} obj + * @param {Function|String} fn or string + * @return {Function} + * @api public + */ + +module.exports = function(obj, fn){ + if ('string' == typeof fn) fn = obj[fn]; + if ('function' != typeof fn) throw new Error('bind() requires a function'); + var args = slice.call(arguments, 2); + return function(){ + return fn.apply(obj, args.concat(slice.call(arguments))); + } +}; diff --git a/datalab/web/node_modules/component-bind/package.json b/datalab/web/node_modules/component-bind/package.json new file mode 100644 index 0000000000000000000000000000000000000000..08258d4e2c293de99d58c02caf3f87eddb311aab --- /dev/null +++ b/datalab/web/node_modules/component-bind/package.json @@ -0,0 +1,22 @@ +{ + "name": "component-bind", + "version": "1.0.0", + "description": "function binding utility", + "keywords": [ + "bind", + "utility" + ], + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "component": { + "scripts": { + "bind/index.js": "index.js" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/component/bind.git" + } +} diff --git a/datalab/web/node_modules/component-emitter/History.md b/datalab/web/node_modules/component-emitter/History.md new file mode 100644 index 0000000000000000000000000000000000000000..9189c6009d3d30db44b56c33339340108fd0f5a6 --- /dev/null +++ b/datalab/web/node_modules/component-emitter/History.md @@ -0,0 +1,68 @@ + +1.2.1 / 2016-04-18 +================== + + * enable client side use + +1.2.0 / 2014-02-12 +================== + + * prefix events with `$` to support object prototype method names + +1.1.3 / 2014-06-20 +================== + + * republish for npm + * add LICENSE file + +1.1.2 / 2014-02-10 +================== + + * package: rename to "component-emitter" + * package: update "main" and "component" fields + * Add license to Readme (same format as the other components) + * created .npmignore + * travis stuff + +1.1.1 / 2013-12-01 +================== + + * fix .once adding .on to the listener + * docs: Emitter#off() + * component: add `.repo` prop + +1.1.0 / 2013-10-20 +================== + + * add `.addEventListener()` and `.removeEventListener()` aliases + +1.0.1 / 2013-06-27 +================== + + * add support for legacy ie + +1.0.0 / 2013-02-26 +================== + + * add `.off()` support for removing all listeners + +0.0.6 / 2012-10-08 +================== + + * add `this._callbacks` initialization to prevent funky gotcha + +0.0.5 / 2012-09-07 +================== + + * fix `Emitter.call(this)` usage + +0.0.3 / 2012-07-11 +================== + + * add `.listeners()` + * rename `.has()` to `.hasListeners()` + +0.0.2 / 2012-06-28 +================== + + * fix `.off()` with `.once()`-registered callbacks diff --git a/datalab/web/node_modules/component-emitter/LICENSE b/datalab/web/node_modules/component-emitter/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d6e43f2bd206e1b7e7bfe03e79af76a983d60b57 --- /dev/null +++ b/datalab/web/node_modules/component-emitter/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2014 Component contributors + +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. diff --git a/datalab/web/node_modules/component-emitter/Readme.md b/datalab/web/node_modules/component-emitter/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..0466411194ffd088fd30774f2294c4bed95fb03e --- /dev/null +++ b/datalab/web/node_modules/component-emitter/Readme.md @@ -0,0 +1,74 @@ +# Emitter [![Build Status](https://travis-ci.org/component/emitter.png)](https://travis-ci.org/component/emitter) + + Event emitter component. + +## Installation + +``` +$ component install component/emitter +``` + +## API + +### Emitter(obj) + + The `Emitter` may also be used as a mixin. For example + a "plain" object may become an emitter, or you may + extend an existing prototype. + + As an `Emitter` instance: + +```js +var Emitter = require('emitter'); +var emitter = new Emitter; +emitter.emit('something'); +``` + + As a mixin: + +```js +var Emitter = require('emitter'); +var user = { name: 'tobi' }; +Emitter(user); + +user.emit('im a user'); +``` + + As a prototype mixin: + +```js +var Emitter = require('emitter'); +Emitter(User.prototype); +``` + +### Emitter#on(event, fn) + + Register an `event` handler `fn`. + +### Emitter#once(event, fn) + + Register a single-shot `event` handler `fn`, + removed immediately after it is invoked the + first time. + +### Emitter#off(event, fn) + + * Pass `event` and `fn` to remove a listener. + * Pass `event` to remove all listeners on that event. + * Pass nothing to remove all listeners on all events. + +### Emitter#emit(event, ...) + + Emit an `event` with variable option args. + +### Emitter#listeners(event) + + Return an array of callbacks, or an empty array. + +### Emitter#hasListeners(event) + + Check if this emitter has `event` handlers. + +## License + +MIT diff --git a/datalab/web/node_modules/component-emitter/index.js b/datalab/web/node_modules/component-emitter/index.js new file mode 100644 index 0000000000000000000000000000000000000000..df94c78e42e04bf0512a14ae6754f4e039844ae4 --- /dev/null +++ b/datalab/web/node_modules/component-emitter/index.js @@ -0,0 +1,163 @@ + +/** + * Expose `Emitter`. + */ + +if (typeof module !== 'undefined') { + module.exports = Emitter; +} + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = +Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = +Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; +}; + +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; +}; + +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; +}; + +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; diff --git a/datalab/web/node_modules/component-emitter/package.json b/datalab/web/node_modules/component-emitter/package.json new file mode 100644 index 0000000000000000000000000000000000000000..46045703929ed4e01489e2a10885b21e0c07ef3f --- /dev/null +++ b/datalab/web/node_modules/component-emitter/package.json @@ -0,0 +1,24 @@ +{ + "name": "component-emitter", + "description": "Event emitter", + "version": "1.2.1", + "license": "MIT", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "component": { + "scripts": { + "emitter/index.js": "index.js" + } + }, + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/component/emitter.git" + }, + "scripts": { + "test": "make test" + }, + "files": ["index.js", "LICENSE"] +} diff --git a/datalab/web/node_modules/component-inherit/.npmignore b/datalab/web/node_modules/component-inherit/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..665aa2197e07b3628cb0433e5d1244f9429f6ade --- /dev/null +++ b/datalab/web/node_modules/component-inherit/.npmignore @@ -0,0 +1,3 @@ +components +build +node_modules diff --git a/datalab/web/node_modules/component-inherit/History.md b/datalab/web/node_modules/component-inherit/History.md new file mode 100644 index 0000000000000000000000000000000000000000..22d87e1cde4cd53b7415a0daf31a3f5389d48d09 --- /dev/null +++ b/datalab/web/node_modules/component-inherit/History.md @@ -0,0 +1,5 @@ + +0.0.2 / 2012-09-03 +================== + + * fix typo in package.json diff --git a/datalab/web/node_modules/component-inherit/Makefile b/datalab/web/node_modules/component-inherit/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..ebbc52a3df3bf5bd55c578ef664efbf555a3d822 --- /dev/null +++ b/datalab/web/node_modules/component-inherit/Makefile @@ -0,0 +1,16 @@ + +build: components index.js + @component build + +components: + @Component install + +clean: + rm -fr build components template.js + +test: + @node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: clean test diff --git a/datalab/web/node_modules/component-inherit/Readme.md b/datalab/web/node_modules/component-inherit/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..f03ab279fffa37849bd672a12c1c3aa011f29301 --- /dev/null +++ b/datalab/web/node_modules/component-inherit/Readme.md @@ -0,0 +1,24 @@ +# inherit + + Prototype inheritance utility. + +## Installation + +``` +$ component install component/inherit +``` + +## Example + +```js +var inherit = require('inherit'); + +function Human() {} +function Woman() {} + +inherit(Woman, Human); +``` + +## License + + MIT diff --git a/datalab/web/node_modules/component-inherit/component.json b/datalab/web/node_modules/component-inherit/component.json new file mode 100644 index 0000000000000000000000000000000000000000..ae57747f3710aa4adacb4c133459fa563566b568 --- /dev/null +++ b/datalab/web/node_modules/component-inherit/component.json @@ -0,0 +1,10 @@ +{ + "name": "inherit", + "description": "Prototype inheritance utility", + "version": "0.0.3", + "keywords": ["inherit", "utility"], + "dependencies": {}, + "scripts": [ + "index.js" + ] +} diff --git a/datalab/web/node_modules/component-inherit/index.js b/datalab/web/node_modules/component-inherit/index.js new file mode 100644 index 0000000000000000000000000000000000000000..aaebc03ba7e848b81df65da3b5c16169fc5501ee --- /dev/null +++ b/datalab/web/node_modules/component-inherit/index.js @@ -0,0 +1,7 @@ + +module.exports = function(a, b){ + var fn = function(){}; + fn.prototype = b.prototype; + a.prototype = new fn; + a.prototype.constructor = a; +}; \ No newline at end of file diff --git a/datalab/web/node_modules/component-inherit/package.json b/datalab/web/node_modules/component-inherit/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6e19c2e45ba92ed574f5d83d2906d0790850f99f --- /dev/null +++ b/datalab/web/node_modules/component-inherit/package.json @@ -0,0 +1,19 @@ +{ + "name": "component-inherit", + "description": "Prototype inheritance utility", + "version": "0.0.3", + "keywords": [ + "inherit", + "utility" + ], + "dependencies": {}, + "component": { + "scripts": { + "inherit/index.js": "index.js" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/component/inherit.git" + } +} diff --git a/datalab/web/node_modules/component-inherit/test/inherit.js b/datalab/web/node_modules/component-inherit/test/inherit.js new file mode 100644 index 0000000000000000000000000000000000000000..14852f242e1f8c7c0ae52bb014b8413288df67ae --- /dev/null +++ b/datalab/web/node_modules/component-inherit/test/inherit.js @@ -0,0 +1,21 @@ + +/** + * Module dependencies. + */ + +var inherit = require('..'); + +describe('inherit(a, b)', function(){ + it('should inherit b\'s prototype', function(){ + function Loki(){} + function Animal(){} + + Animal.prototype.species = 'unknown'; + + inherit(Loki, Animal); + + var loki = new Loki; + loki.species.should.equal('unknown'); + loki.constructor.should.equal(Loki); + }) +}) \ No newline at end of file diff --git a/datalab/web/node_modules/concat-map/.travis.yml b/datalab/web/node_modules/concat-map/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..f1d0f13c8a54d0f8d78f86a1f9348f3c59750694 --- /dev/null +++ b/datalab/web/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/datalab/web/node_modules/concat-map/LICENSE b/datalab/web/node_modules/concat-map/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ee27ba4b4412b0e4a05af5e3d8a005bc6681fdf3 --- /dev/null +++ b/datalab/web/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +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. diff --git a/datalab/web/node_modules/concat-map/README.markdown b/datalab/web/node_modules/concat-map/README.markdown new file mode 100644 index 0000000000000000000000000000000000000000..408f70a1be473c86e729fe8cc1d5fb4e0e364ce9 --- /dev/null +++ b/datalab/web/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/datalab/web/node_modules/concat-map/example/map.js b/datalab/web/node_modules/concat-map/example/map.js new file mode 100644 index 0000000000000000000000000000000000000000..33656217b61d8f06a55db4631ec95eea828495d2 --- /dev/null +++ b/datalab/web/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/datalab/web/node_modules/concat-map/index.js b/datalab/web/node_modules/concat-map/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b29a7812e5055ae915e771447e1380e01bf3bfdd --- /dev/null +++ b/datalab/web/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/datalab/web/node_modules/concat-map/package.json b/datalab/web/node_modules/concat-map/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d3640e6b027b9ea87afbfd361ca12fc05cca0e9c --- /dev/null +++ b/datalab/web/node_modules/concat-map/package.json @@ -0,0 +1,43 @@ +{ + "name" : "concat-map", + "description" : "concatenative mapdashery", + "version" : "0.0.1", + "repository" : { + "type" : "git", + "url" : "git://github.com/substack/node-concat-map.git" + }, + "main" : "index.js", + "keywords" : [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories" : { + "example" : "example", + "test" : "test" + }, + "scripts" : { + "test" : "tape test/*.js" + }, + "devDependencies" : { + "tape" : "~2.4.0" + }, + "license" : "MIT", + "author" : { + "name" : "James Halliday", + "email" : "mail@substack.net", + "url" : "http://substack.net" + }, + "testling" : { + "files" : "test/*.js", + "browsers" : { + "ie" : [ 6, 7, 8, 9 ], + "ff" : [ 3.5, 10, 15.0 ], + "chrome" : [ 10, 22 ], + "safari" : [ 5.1 ], + "opera" : [ 12 ] + } + } +} diff --git a/datalab/web/node_modules/concat-map/test/map.js b/datalab/web/node_modules/concat-map/test/map.js new file mode 100644 index 0000000000000000000000000000000000000000..fdbd7022f6da17600dad4d477734115bf28287e0 --- /dev/null +++ b/datalab/web/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/datalab/web/node_modules/cookie/HISTORY.md b/datalab/web/node_modules/cookie/HISTORY.md new file mode 100644 index 0000000000000000000000000000000000000000..5bd648542ccf915e78a1b1fc574bdc33009a7e4c --- /dev/null +++ b/datalab/web/node_modules/cookie/HISTORY.md @@ -0,0 +1,118 @@ +0.3.1 / 2016-05-26 +================== + + * Fix `sameSite: true` to work with draft-7 clients + - `true` now sends `SameSite=Strict` instead of `SameSite` + +0.3.0 / 2016-05-26 +================== + + * Add `sameSite` option + - Replaces `firstPartyOnly` option, never implemented by browsers + * Improve error message when `encode` is not a function + * Improve error message when `expires` is not a `Date` + +0.2.4 / 2016-05-20 +================== + + * perf: enable strict mode + * perf: use for loop in parse + * perf: use string concatination for serialization + +0.2.3 / 2015-10-25 +================== + + * Fix cookie `Max-Age` to never be a floating point number + +0.2.2 / 2015-09-17 +================== + + * Fix regression when setting empty cookie value + - Ease the new restriction, which is just basic header-level validation + * Fix typo in invalid value errors + +0.2.1 / 2015-09-17 +================== + + * Throw on invalid values provided to `serialize` + - Ensures the resulting string is a valid HTTP header value + +0.2.0 / 2015-08-13 +================== + + * Add `firstPartyOnly` option + * Throw better error for invalid argument to parse + * perf: hoist regular expression + +0.1.5 / 2015-09-17 +================== + + * Fix regression when setting empty cookie value + - Ease the new restriction, which is just basic header-level validation + * Fix typo in invalid value errors + +0.1.4 / 2015-09-17 +================== + + * Throw better error for invalid argument to parse + * Throw on invalid values provided to `serialize` + - Ensures the resulting string is a valid HTTP header value + +0.1.3 / 2015-05-19 +================== + + * Reduce the scope of try-catch deopt + * Remove argument reassignments + +0.1.2 / 2014-04-16 +================== + + * Remove unnecessary files from npm package + +0.1.1 / 2014-02-23 +================== + + * Fix bad parse when cookie value contained a comma + * Fix support for `maxAge` of `0` + +0.1.0 / 2013-05-01 +================== + + * Add `decode` option + * Add `encode` option + +0.0.6 / 2013-04-08 +================== + + * Ignore cookie parts missing `=` + +0.0.5 / 2012-10-29 +================== + + * Return raw cookie value if value unescape errors + +0.0.4 / 2012-06-21 +================== + + * Use encode/decodeURIComponent for cookie encoding/decoding + - Improve server/client interoperability + +0.0.3 / 2012-06-06 +================== + + * Only escape special characters per the cookie RFC + +0.0.2 / 2012-06-01 +================== + + * Fix `maxAge` option to not throw error + +0.0.1 / 2012-05-28 +================== + + * Add more tests + +0.0.0 / 2012-05-28 +================== + + * Initial release diff --git a/datalab/web/node_modules/cookie/LICENSE b/datalab/web/node_modules/cookie/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..058b6b4efa3f45896ae691f2558a2a1aca05bebd --- /dev/null +++ b/datalab/web/node_modules/cookie/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012-2014 Roman Shtylman +Copyright (c) 2015 Douglas Christopher Wilson + +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. + diff --git a/datalab/web/node_modules/cookie/README.md b/datalab/web/node_modules/cookie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..db0d0782581acc80eaa0c99c9f169a665c6cdd92 --- /dev/null +++ b/datalab/web/node_modules/cookie/README.md @@ -0,0 +1,220 @@ +# cookie + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Basic HTTP cookie parser and serializer for HTTP servers. + +## Installation + +```sh +$ npm install cookie +``` + +## API + +```js +var cookie = require('cookie'); +``` + +### cookie.parse(str, options) + +Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs. +The `str` argument is the string representing a `Cookie` header value and `options` is an +optional object containing additional parsing options. + +```js +var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2'); +// { foo: 'bar', equation: 'E=mc^2' } +``` + +#### Options + +`cookie.parse` accepts these properties in the options object. + +##### decode + +Specifies a function that will be used to decode a cookie's value. Since the value of a cookie +has a limited character set (and must be a simple string), this function can be used to decode +a previously-encoded cookie value into a JavaScript string or other object. + +The default function is the global `decodeURIComponent`, which will decode any URL-encoded +sequences into their byte representations. + +**note** if an error is thrown from this function, the original, non-decoded cookie value will +be returned as the cookie's value. + +### cookie.serialize(name, value, options) + +Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the +name for the cookie, the `value` argument is the value to set the cookie to, and the `options` +argument is an optional object containing additional serialization options. + +```js +var setCookie = cookie.serialize('foo', 'bar'); +// foo=bar +``` + +#### Options + +`cookie.serialize` accepts these properties in the options object. + +##### domain + +Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6266-5.2.3]. By default, no +domain is set, and most clients will consider the cookie to apply to only the current domain. + +##### encode + +Specifies a function that will be used to encode a cookie's value. Since value of a cookie +has a limited character set (and must be a simple string), this function can be used to encode +a value into a string suited for a cookie's value. + +The default function is the global `ecodeURIComponent`, which will encode a JavaScript string +into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range. + +##### expires + +Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6266-5.2.1]. +By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and +will delete it on a condition like exiting a web browser application. + +**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and +`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### httpOnly + +Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6266-5.2.6]. When truthy, +the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not allow client-side +JavaScript to see the cookie in `document.cookie`. + +##### maxAge + +Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6266-5.2.2]. +The given number will be converted to an integer by rounding down. By default, no maximum age is set. + +**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and +`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### path + +Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6266-5.2.4]. By default, the path +is considered the ["default path"][rfc-6266-5.1.4]. By default, no maximum age is set, and most +clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting +a web browser application. + +##### sameSite + +Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][draft-west-first-party-cookies-07]. + + - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + - `false` will not set the `SameSite` attribute. + - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. + - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + +More information about the different enforcement levels can be found in the specification +https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1.1 + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +##### secure + +Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6266-5.2.5]. When truthy, +the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to +the server in the future if the browser does not have an HTTPS connection. + +## Example + +The following example uses this module in conjunction with the Node.js core HTTP server +to prompt a user for their name and display it back on future visits. + +```js +var cookie = require('cookie'); +var escapeHtml = require('escape-html'); +var http = require('http'); +var url = require('url'); + +function onRequest(req, res) { + // Parse the query string + var query = url.parse(req.url, true, true).query; + + if (query && query.name) { + // Set a new cookie with the name + res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), { + httpOnly: true, + maxAge: 60 * 60 * 24 * 7 // 1 week + })); + + // Redirect back after setting cookie + res.statusCode = 302; + res.setHeader('Location', req.headers.referer || '/'); + res.end(); + return; + } + + // Parse the cookies on the request + var cookies = cookie.parse(req.headers.cookie || ''); + + // Get the visitor name set in the cookie + var name = cookies.name; + + res.setHeader('Content-Type', 'text/html; charset=UTF-8'); + + if (name) { + res.write('

Welcome back, ' + escapeHtml(name) + '!

'); + } else { + res.write('

Hello, new visitor!

'); + } + + res.write('
'); + res.write(' '); + res.end(' values + * + * @param {string} str + * @param {object} [options] + * @return {object} + * @public + */ + +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + + var obj = {} + var opt = options || {}; + var pairs = str.split(pairSplitRegExp); + var dec = opt.decode || decode; + + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; + var eq_idx = pair.indexOf('='); + + // skip things that don't look like key=value + if (eq_idx < 0) { + continue; + } + + var key = pair.substr(0, eq_idx).trim() + var val = pair.substr(++eq_idx, pair.length).trim(); + + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + + // only assign once + if (undefined == obj[key]) { + obj[key] = tryDecode(val, dec); + } + } + + return obj; +} + +/** + * Serialize data into a cookie header. + * + * Serialize the a name value pair into a cookie string suitable for + * http headers. An optional options object specified cookie parameters. + * + * serialize('foo', 'bar', { httpOnly: true }) + * => "foo=bar; httpOnly" + * + * @param {string} name + * @param {string} val + * @param {object} [options] + * @return {string} + * @public + */ + +function serialize(name, val, options) { + var opt = options || {}; + var enc = opt.encode || encode; + + if (typeof enc !== 'function') { + throw new TypeError('option encode is invalid'); + } + + if (!fieldContentRegExp.test(name)) { + throw new TypeError('argument name is invalid'); + } + + var value = enc(val); + + if (value && !fieldContentRegExp.test(value)) { + throw new TypeError('argument val is invalid'); + } + + var str = name + '=' + value; + + if (null != opt.maxAge) { + var maxAge = opt.maxAge - 0; + if (isNaN(maxAge)) throw new Error('maxAge should be a Number'); + str += '; Max-Age=' + Math.floor(maxAge); + } + + if (opt.domain) { + if (!fieldContentRegExp.test(opt.domain)) { + throw new TypeError('option domain is invalid'); + } + + str += '; Domain=' + opt.domain; + } + + if (opt.path) { + if (!fieldContentRegExp.test(opt.path)) { + throw new TypeError('option path is invalid'); + } + + str += '; Path=' + opt.path; + } + + if (opt.expires) { + if (typeof opt.expires.toUTCString !== 'function') { + throw new TypeError('option expires is invalid'); + } + + str += '; Expires=' + opt.expires.toUTCString(); + } + + if (opt.httpOnly) { + str += '; HttpOnly'; + } + + if (opt.secure) { + str += '; Secure'; + } + + if (opt.sameSite) { + var sameSite = typeof opt.sameSite === 'string' + ? opt.sameSite.toLowerCase() : opt.sameSite; + + switch (sameSite) { + case true: + str += '; SameSite=Strict'; + break; + case 'lax': + str += '; SameSite=Lax'; + break; + case 'strict': + str += '; SameSite=Strict'; + break; + default: + throw new TypeError('option sameSite is invalid'); + } + } + + return str; +} + +/** + * Try decoding a string using a decoding function. + * + * @param {string} str + * @param {function} decode + * @private + */ + +function tryDecode(str, decode) { + try { + return decode(str); + } catch (e) { + return str; + } +} diff --git a/datalab/web/node_modules/cookie/package.json b/datalab/web/node_modules/cookie/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b485150346f2a7e242452384fb20d015bf66adb3 --- /dev/null +++ b/datalab/web/node_modules/cookie/package.json @@ -0,0 +1,33 @@ +{ + "name": "cookie", + "description": "HTTP server cookie parsing and serialization", + "version": "0.3.1", + "author": "Roman Shtylman ", + "contributors": [ + "Douglas Christopher Wilson " + ], + "license": "MIT", + "keywords": [ + "cookie", + "cookies" + ], + "repository": "jshttp/cookie", + "devDependencies": { + "istanbul": "0.4.3", + "mocha": "1.21.5" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" + } +} diff --git a/datalab/web/node_modules/debug/.coveralls.yml b/datalab/web/node_modules/debug/.coveralls.yml new file mode 100644 index 0000000000000000000000000000000000000000..20a7068581791335487166ddc5001a2ca3a3b060 --- /dev/null +++ b/datalab/web/node_modules/debug/.coveralls.yml @@ -0,0 +1 @@ +repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve diff --git a/datalab/web/node_modules/debug/.eslintrc b/datalab/web/node_modules/debug/.eslintrc new file mode 100644 index 0000000000000000000000000000000000000000..146371edbe325121c7666716c0fe238310b5e6ca --- /dev/null +++ b/datalab/web/node_modules/debug/.eslintrc @@ -0,0 +1,14 @@ +{ + "env": { + "browser": true, + "node": true + }, + "globals": { + "chrome": true + }, + "rules": { + "no-console": 0, + "no-empty": [1, { "allowEmptyCatch": true }] + }, + "extends": "eslint:recommended" +} diff --git a/datalab/web/node_modules/debug/.npmignore b/datalab/web/node_modules/debug/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..5f60eecc84e219e52554407ad38d04abd1cf2111 --- /dev/null +++ b/datalab/web/node_modules/debug/.npmignore @@ -0,0 +1,9 @@ +support +test +examples +example +*.sock +dist +yarn.lock +coverage +bower.json diff --git a/datalab/web/node_modules/debug/.travis.yml b/datalab/web/node_modules/debug/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..a764300377fa424ed6b2651e72aaa3d68cd2075f --- /dev/null +++ b/datalab/web/node_modules/debug/.travis.yml @@ -0,0 +1,20 @@ +sudo: false + +language: node_js + +node_js: + - "4" + - "6" + - "8" + +install: + - make install + +script: + - make lint + - make test + +matrix: + include: + - node_js: '8' + env: BROWSER=1 diff --git a/datalab/web/node_modules/debug/CHANGELOG.md b/datalab/web/node_modules/debug/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..820d21e3322b9d2778786ea743dd5e818991d595 --- /dev/null +++ b/datalab/web/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/datalab/web/node_modules/debug/LICENSE b/datalab/web/node_modules/debug/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..658c933d28255e8c716899789e8c0f846e5dc125 --- /dev/null +++ b/datalab/web/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +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. + diff --git a/datalab/web/node_modules/debug/Makefile b/datalab/web/node_modules/debug/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..3ddd1360e6a95e6d7161f2d4d4f8cb9a0816f577 --- /dev/null +++ b/datalab/web/node_modules/debug/Makefile @@ -0,0 +1,58 @@ +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# Path +PATH := node_modules/.bin:$(PATH) +SHELL := /bin/bash + +# applications +NODE ?= $(shell which node) +YARN ?= $(shell which yarn) +PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm)) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +install: node_modules + +browser: dist/debug.js + +node_modules: package.json + @NODE_ENV= $(PKG) install + @touch node_modules + +dist/debug.js: src/*.js node_modules + @mkdir -p dist + @$(BROWSERIFY) \ + --standalone debug \ + . > dist/debug.js + +lint: + @eslint *.js src/*.js + +test-node: + @istanbul cover node_modules/mocha/bin/_mocha -- test/**.js + @cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js + +test-browser: + @$(MAKE) browser + @karma start --single-run + +test-all: + @concurrently \ + "make test-node" \ + "make test-browser" + +test: + @if [ "x$(BROWSER)" = "x" ]; then \ + $(MAKE) test-node; \ + else \ + $(MAKE) test-browser; \ + fi + +clean: + rimraf dist coverage + +.PHONY: browser install clean lint test test-all test-node test-browser diff --git a/datalab/web/node_modules/debug/README.md b/datalab/web/node_modules/debug/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8e754d17b164ad9c15b82e26426afa71298a34d1 --- /dev/null +++ b/datalab/web/node_modules/debug/README.md @@ -0,0 +1,368 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows note + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Note that PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Then, run the program to be debugged as usual. + + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> + +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. diff --git a/datalab/web/node_modules/debug/karma.conf.js b/datalab/web/node_modules/debug/karma.conf.js new file mode 100644 index 0000000000000000000000000000000000000000..103a82d15bd72b3cdf9ba4108272985f7e0bfdb3 --- /dev/null +++ b/datalab/web/node_modules/debug/karma.conf.js @@ -0,0 +1,70 @@ +// Karma configuration +// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['mocha', 'chai', 'sinon'], + + + // list of files / patterns to load in the browser + files: [ + 'dist/debug.js', + 'test/*spec.js' + ], + + + // list of files to exclude + exclude: [ + 'src/node.js' + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['PhantomJS'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/datalab/web/node_modules/debug/node.js b/datalab/web/node_modules/debug/node.js new file mode 100644 index 0000000000000000000000000000000000000000..7fc36fe6dbecbfd41530c5a490cc738ec2968653 --- /dev/null +++ b/datalab/web/node_modules/debug/node.js @@ -0,0 +1 @@ +module.exports = require('./src/node'); diff --git a/datalab/web/node_modules/debug/package.json b/datalab/web/node_modules/debug/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ada43cfe9cf0930f98547ffda68373006004068a --- /dev/null +++ b/datalab/web/node_modules/debug/package.json @@ -0,0 +1,43 @@ +{ + "name": "debug", + "version": "3.1.0", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": "TJ Holowaychuk ", + "contributors": [ + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + }, + "devDependencies": { + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^2.11.15", + "eslint": "^3.12.1", + "istanbul": "^0.4.5", + "karma": "^1.3.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "karma-sinon": "^1.0.5", + "mocha": "^3.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "sinon": "^1.17.6", + "sinon-chai": "^2.8.0" + }, + "main": "./src/index.js", + "browser": "./src/browser.js" +} diff --git a/datalab/web/node_modules/debug/src/browser.js b/datalab/web/node_modules/debug/src/browser.js new file mode 100644 index 0000000000000000000000000000000000000000..f5149ff5296aa11442834d29fdc8565bb159d0be --- /dev/null +++ b/datalab/web/node_modules/debug/src/browser.js @@ -0,0 +1,195 @@ +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', + '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', + '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', + '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', + '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', + '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', + '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', + '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', + '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', + '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', + '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} diff --git a/datalab/web/node_modules/debug/src/debug.js b/datalab/web/node_modules/debug/src/debug.js new file mode 100644 index 0000000000000000000000000000000000000000..77e6384a3397605624a1706eb864455f8e7f38ba --- /dev/null +++ b/datalab/web/node_modules/debug/src/debug.js @@ -0,0 +1,225 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * Active `debug` instances. + */ +exports.instances = []; + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + +exports.formatters = {}; + +/** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + +function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function createDebug(namespace) { + + var prevTime; + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + exports.instances.push(debug); + + return debug; +} + +function destroy () { + var index = exports.instances.indexOf(this); + if (index !== -1) { + exports.instances.splice(index, 1); + return true; + } else { + return false; + } +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < exports.instances.length; i++) { + var instance = exports.instances[i]; + instance.enabled = exports.enabled(instance.namespace); + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/datalab/web/node_modules/debug/src/index.js b/datalab/web/node_modules/debug/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..cabcbcda135e862c4780a270a8df97784e65ebb3 --- /dev/null +++ b/datalab/web/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer') { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/datalab/web/node_modules/debug/src/node.js b/datalab/web/node_modules/debug/src/node.js new file mode 100644 index 0000000000000000000000000000000000000000..d666fb9c00919bf71317101ebe1096df0e43b215 --- /dev/null +++ b/datalab/web/node_modules/debug/src/node.js @@ -0,0 +1,186 @@ +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [ 6, 2, 3, 4, 5, 1 ]; + +try { + var supportsColor = require('supports-color'); + if (supportsColor && supportsColor.level >= 2) { + exports.colors = [ + 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, + 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, + 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 214, 215, 220, 221 + ]; + } +} catch (err) { + // swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // camel-case + var prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); + + // coerce string value into JS value + var val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) val = false; + else if (val === 'null') val = null; + else val = Number(val); + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts + ? Boolean(exports.inspectOpts.colors) + : tty.isatty(process.stderr.fd); +} + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +exports.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n').map(function(str) { + return str.trim() + }).join(' '); +}; + +/** + * Map %o to `util.inspect()`, allowing multiple lines if needed. + */ + +exports.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + var name = this.namespace; + var useColors = this.useColors; + + if (useColors) { + var c = this.color; + var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c); + var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m'; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } else { + return new Date().toISOString() + ' '; + } +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log() { + return process.stderr.write(util.format.apply(util, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init (debug) { + debug.inspectOpts = {}; + + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/datalab/web/node_modules/dtrace-provider/.gitmodules b/datalab/web/node_modules/dtrace-provider/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..933bc026fe7aa07fc7c24ca00136d92656d24ecb --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libusdt"] + path = libusdt + url = https://github.com/chrisa/libusdt diff --git a/datalab/web/node_modules/dtrace-provider/.npmignore b/datalab/web/node_modules/dtrace-provider/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..c8d744eb50bced54401624ee115b0e4bd2604187 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/.npmignore @@ -0,0 +1,10 @@ +.lock-wscript +*.node +*~ +.#* +*# +build +*.log +test +TODO.md +*.tgz diff --git a/datalab/web/node_modules/dtrace-provider/CHANGES.md b/datalab/web/node_modules/dtrace-provider/CHANGES.md new file mode 100644 index 0000000000000000000000000000000000000000..9c2342996cea0c1a1b1016304989db942bef7a19 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/CHANGES.md @@ -0,0 +1,112 @@ +dtrace-provider - Changes +========================= + +## HISTORY + + * 0.8.7: + Known support for v0.10.48, v0.12.16, v4.6.0, v7.5.0, v8.9.4, v10.3.0 (#119) + Don't crash when attempting to fire unknown probes (#120) + + * 0.8.6: + Improved compilation failure behaviour (#96) + + * 0.8.5: + Reverted "Install fails on Debian due to differently named node binary" for + now + + * 0.8.4: + Only log error once when DTraceProviderBindings can't be found + Install fails on Debian due to differently named node binary + + * 0.8.3: + Install fails with yarn + + * 0.8.2: + Error installing in 64-bit SmartOS zones with 32-bit node + + * 0.8.1: + Support FreeBSD 10 & 11 + + * 0.8.0: + Support passing additional arguments to probe function via `.fire()` + + * 0.7.1: + Update libusdt for chrisa/libusdt#12 fix + + * 0.7.0: known support for v0.10.47, v0.12.16, v4.6.0. + Updated NaN dependency to remove warnings on newer Node versions. + + * 0.2.8: + Add NODE_MODULE() declaration for compatibility with Node 0.9.1+ + (reported by Trent Mick) + Remove execSync dependency from tests. + + * 0.2.7: + Don't build on FreeBSD by default - DTrace is not yet built in releases. + + * 0.2.6: + Fall back to make(1) if gmake(1) is unavailable, still expected to be GNU Make + (Trent Mick) + + * 0.2.5: + Add "json" probe argument type, automatically serialising objects as JSON + Trust npm to set PATH appropriately when invoking node (reported by Dave Pacheco) + libusdt update - allow provider memory to be freed (reported by Bryan Cantrill) + Build libusdt with gmake by default (reported by Keith Wesolowski) + Turn the various scripts in test/ into a TAP-based testsuite. + + * 0.2.4: + Improve Node architecture detection to support 0.6.x, and respect + npm's prefix when choosing a node binary to use (reported by Trent Mick) + + * 0.2.3: + libusdt update - don't invoke ranlib on SunOS-derived systems + Disambiguate module name in probe tuple, and optionally allow it to be + specified when creating a provider. (Bryan Cantrill bcantrill@acm.org) + + * 0.2.2: + libusdt update for build fixes + Respect MAKE variable in build script + + * 0.2.1: + Update binding.gyp for clang on Snow Leopard - no space after -L. + + * 0.2.0: + Update libusdt, and attempt to build it correctly for various platforms. + Add support for disabling providers and removing probes. + + * 0.1.1: + Replace Node-specific implementation with wrappers for libusdt. + Extend argument support to 32 primitives. + Adds Solaris x86_64 support. + + * 0.0.9: + Force the build architecture to x86_64 for OS X. + + * 0.0.8: + Removed overridden "scripts" section from package.json, breaking Windows installs + + * 0.0.7: + Fix for multiple enable() calls breaking providers. + + * 0.0.6: + Fix for segfault trying to use non-enabled probes (Mark Cavage mcavage@gmail.com) + + * 0.0.5: + Revert changes to make probe objects available. + + * 0.0.4: + Remove unused "sys" import (Alex Whitman) + No longer builds an empty extension on non-DTrace platforms + Probe objects are made available to Javascript. + + * 0.0.3: + Builds to a stubbed-out version on non-DTrace platforms (Mark Cavage ) + + * 0.0.2: + Solaris i386 support. + Fixes memory leaks + Improved performance, enabled- and disabled-probe. + + * 0.0.1: + First working version: OSX x86_64 only. diff --git a/datalab/web/node_modules/dtrace-provider/LICENCE b/datalab/web/node_modules/dtrace-provider/LICENCE new file mode 100644 index 0000000000000000000000000000000000000000..558a83338792f90c04c2d9e0c86335cd54d2bf72 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/LICENCE @@ -0,0 +1,21 @@ +Copyright 2011 Chris Andrews. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of + conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY CHRIS ANDREWS ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CHRIS ANDREWS OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/datalab/web/node_modules/dtrace-provider/README.md b/datalab/web/node_modules/dtrace-provider/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6da6bff6d15fb339cf4c556ebd868642c9718058 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/README.md @@ -0,0 +1,230 @@ +# dtrace-provider - Native DTrace providers for Node.js apps. + +This extension allows you to create native DTrace providers for your +Node.js applications. That is, to create providers and probes which +expose information specific to your application, rather than +information about the node runtime. + +You could use this to expose high-level information about the inner +workings of your application, or to create a specific context in which +to look at information from other runtime or system-level providers. + +The provider is not created in the usual way, by declaring it and then +changing the build process to include it, but instead dynamically at +runtime. This is done entirely in-process, and there is no background +compiler or [dtrace(1M)](https://illumos.org/man/1M/dtrace) invocation. +The process creating the provider need not run as root. + +## INSTALL + + $ npm install dtrace-provider + +## EXAMPLE + +Here's a simple example of creating a provider: + +```javascript +var d = require('dtrace-provider'); + +var dtp = d.createDTraceProvider("nodeapp"); +var p1 = dtp.addProbe("probe1", "int", "int"); +var p2 = dtp.addProbe("probe2", "char *"); +dtp.enable(); +``` + +Probes may be fired via the provider object: + +```javascript +dtp.fire("probe1", function() { + return [1, 2]; +}); +dtp.fire("probe2", function() { + return ["hello, dtrace via provider", "foo"]; +}); +``` + +or via the probe objects themselves: + +```javascript +p1.fire(function() { + return [1, 2, 3, 4, 5, 6]; +}); +p2.fire(function() { + return ["hello, dtrace via probe", "foo"]; +}); +``` + +Note that `.fire()` takes a callback that returns the arguments to be +provided when the DTrace probe actually fires. This allows you to call +`.fire()` unconditionally when you want to fire the probe, but the +callback will be invoked only when the DTrace probe is actually +enabled. This allows you to create probes whose arguments might be +expensive to construct, and only do any work when the probe is +actually enabled. (Examples might include converting a large object to +a string representation or gathering large amounts of information.) + +In some cases, creating a new closure to pass to `.fire()` each time +it's called may introduce unwanted overhead. For extremely +CPU-intensive or memory-conscious workloads, you can avoid this by +lifting the closures for your hot probes into an outer scope. You can +then supply arguments to that function as additional arguments to +`.fire()`. As an example, you can convert the following program: + +```javascript +function manipulateObj(largeObj) { + var count = 0; + var name = null; + ... + p1.fire(function () { + return [count, keyToValue(name), JSON.stringify(largeObj)]; + }); +} +``` + +Into this one: + +```javascript +function f(a, b, c) { + return [a, keyToValue(b), JSON.stringify(c)]; +} + +function manipulateObj(largeObj) { + var count = 0; + var name = null; + ... + p1.fire(f, count, name, largeObj); +} +``` + +Be careful to avoid passing `.fire()` additional arguments that are +themselves expensive to construct, as that undermines the design goal +here: minimizing the effect of disabled probes. + +This example creates a provider called "nodeapp", and adds two +probes. It then enables the provider, at which point the provider +becomes visible to DTrace. + +The probes are then fired, which produces this output: + + $ sudo dtrace -Z -n 'nodeapp*:::probe1{ trace(arg0); trace(arg1) }' \ + -n 'nodeapp*:::probe2{ trace(copyinstr(arg0)); }' + dtrace: description 'nodeapp*:::probe1' matched 0 probes + dtrace: description 'nodeapp*:::probe2' matched 0 probes + CPU ID FUNCTION:NAME + 1 123562 func:probe1 1 2 + 1 123563 func:probe2 hello, dtrace + +Arguments are captured by a callback only executed when the probe is +enabled. This means you can do more expensive work to gather arguments. + +The maximum number of arguments supported is 32. + +Available argument types are "int", for integer numeric values, +"char *" for strings, and "json" for objects rendered into JSON strings. + +Arguments typed as "json" will be created as "char *" probes in +DTrace, but objects passed to these probe arguments will be +automatically serialized to JSON before being passed to DTrace. This +feature is best used in conjunction with the json() D subroutine, but +is available whether or not the platform supports it. + + # create a json probe: + + var dtp = d.createDTraceProvider("nodeapp"); + var p1 = dtp.addProbe("j1", "json"); + dtp.enable(); + p1.fire(function() { return { "foo": "bar" }; }); + + # on a platform supporting json(): + + $ sudo dtrace -Z -n 'nodeapp*:::j1{ this->j = copyinstr(arg0); \ + trace(json(this->j, "foo")) }' + dtrace: description 'nodeapp$target:::j1' matched 0 probes + CPU ID FUNCTION:NAME + 0 68712 j1:j1 bar + +## PLATFORM SUPPORT + +This libusdt-based Node.JS module supports 64 and 32 bit processes on +Mac OS X and Solaris-like systems such as illumos or SmartOS. As more +platform support is added to libusdt, those platforms will be +supported by this module. See libusdt's status at: + + https://github.com/chrisa/libusdt#readme + +When using Mac OS X, be aware that as of 10.11 (El Capitan), DTrace use +is restricted, and you'll probably want to +[disable SIP](http://internals.exposed/blog/dtrace-vs-sip.html) to +effectively use DTrace. + +FreeBSD 10 and 11 are also supported, but you'll need to make sure that +you have the DTrace headers installed in `/usr/src` otherwise libusdt +won't be able to compile. You can +[clone them using SVN](https://www.freebsd.org/doc/handbook/svn.html), +or find the correct `src.txz` +[here](http://ftp.freebsd.org/pub/FreeBSD/releases/) and extract that. +Also note that FreeBSD 10 is restricted to only 4 working arguments per +probe. + +Platforms not supporting DTrace (notably, Linux and Windows) may +install this module without building libusdt, with a stub no-op +implementation provided for compatibility. This allows cross-platform +npm modules to embed probes and include a dependency on this module. + +GNU Make is required to build libusdt; the build scripts will look for +gmake in `PATH` first, and then for make. + +### TROUBLESHOOTING BUILD ISSUES + +If compilation fails during installation on platforms with DTrace, then +the library will fall back to the stub implementation that does nothing. +To force an installation failure when compiling fails, set the environment +variable `NODE_DTRACE_PROVIDER_REQUIRE` to `hard`: + +```shell +$ NODE_DTRACE_PROVIDER_REQUIRE=hard npm install +``` + +This will then show you the output of the build process so you can see at +which point it's having an issue. Common issues are: + +- Missing a C/C++ compiler toolchain for your platform. +- `python` is Python 3 instead of Python 2; run `npm config set python python2.7` + (or similar) to set the Python binary npm uses. +- On OS X you may need to agree to the XCode license if that's the compiler + toolchain you're using. This will usually manifest with an error like + `Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.` + To accept the license, you can run `sudo xcodebuild -license`. + +Once you've found and fixed the issue, you can run `npm rebuild` to rerun +the lifecycle scripts. + +## CAVEATS + +There is some overhead to probes, even when disabled. Probes are +already using the "is-enabled" feature of DTrace to control execution +of the arguments-gathering callback, but some work still needs to be +done before that's checked. This overhead should not be a problem +unless probes are placed in particularly hot code paths. + +## CONTRIBUTING + +To clone the project's source code: + + $ git clone --recursive https://github.com/chrisa/node-dtrace-provider.git + +For issues, please use the [GitHub issue tracker](https://github.com/chrisa/node-dtrace-provider/issues) +linked to the repository. GitHub pull requests are very welcome. + +## RUNNING THE TESTS + +```shell +$ npm install +$ sudo ./node_modules/.bin/tap --tap test/*.test.js +``` + +## OTHER IMPLEMENTATIONS + +This node extension is derived from the ruby-dtrace gem, via the Perl +module Devel::DTrace::Provider, both of which provide the same +functionality to those languages. diff --git a/datalab/web/node_modules/dtrace-provider/binding.gyp b/datalab/web/node_modules/dtrace-provider/binding.gyp new file mode 100644 index 0000000000000000000000000000000000000000..aa5df4b0b7e89c97f4e856b376154a9fd4f12df0 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/binding.gyp @@ -0,0 +1,35 @@ +{ + 'conditions': [ + # If we are on Mac OS X, FreeBSD, or a Solarish system, attempt + # to build the DTrace provider extension. + ['OS=="mac" or OS=="solaris" or OS=="freebsd"', { + 'targets': [ + { + 'target_name': 'ndtp', + 'type': 'none', + 'actions': [{ + 'inputs': [''], + 'outputs': [''], + 'action_name': 'build_ndtp', + 'action': [ + 'bash', 'build.sh' + ] + }] + } + ] + }, + + # If we are on another system (like Windows or Linux), then DTrace is + # unavailable. This target is necessary because GYP requires at least + # one target to exist. We end up building nothing, and fall back to the + # stub implementation when the package is loaded. + { + 'targets': [ + { + 'target_name': 'DTraceProviderStub', + 'type': 'none' + } + ] + }] + ] +} diff --git a/datalab/web/node_modules/dtrace-provider/build.sh b/datalab/web/node_modules/dtrace-provider/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..f358801a0ceb84819c3e3adc1f2cda54f0a33a13 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/build.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +set -o pipefail + +if [[ -n "$V" ]]; then + set -o xtrace +fi + +fail() { + if [[ -z "$NODE_DTRACE_PROVIDER_REQUIRE" && -z "$V" ]]; then + echo "-----------------------------------------------------------------" + echo "Building dtrace-provider failed with exit code $1, falling back" + echo "on stub implementation." + echo "" + echo "Re-run install with V set in your environment to see the build" + echo "output, or NODE_DTRACE_PROVIDER_REQUIRE=hard to force an" + echo "installation failure." + echo "-----------------------------------------------------------------" + fi + + if [[ "$NODE_DTRACE_PROVIDER_REQUIRE" == "hard" ]]; then + exit 1 + else + exit 0 + fi +} + +buildUSDT() { + if [[ -z "$NODE_DTRACE_PROVIDER_REQUIRE" && -z "$V" ]]; then + exec 1> /dev/null + exec 2> /dev/null + fi + + # GYP's MAKEFLAGS confuses libusdt's Makefile + unset MAKEFLAGS + + # Ask node what architecture it's been built for ("target_arch" in + # config.gypi), and build libusdt to match. + # + # We use node from the path; npm will have adjusted PATH for us if + # necessary, otherwise we assume the user did so when building by + # hand. + # + # (This will need to change at the point that GYP is able to build + # node extensions universal on the Mac - for now we'll go with x86_64 + # on a 64 bit Mac, because that's the default architecture in that + # situation.) + export ARCH=`node -e "console.log(process.arch === 'x64' ? 'x86_64' : 'i386')"` + echo "Building libusdt for ${ARCH}" + + # Respect a MAKE variable if set + if [[ -z $MAKE ]]; then + # Default to `gmake` first if available, because we require GNU make + # and `make` isn't GNU make on some plats. + MAKE=`which gmake` + if [[ -z $MAKE ]]; then + MAKE=make + fi + fi + + # Build libusdt. + $MAKE -C libusdt clean all +} + +buildNDTP() { + if [[ -z "$NODE_DTRACE_PROVIDER_REQUIRE" && -z "$V" ]]; then + exec 1> /dev/null + exec 2> /dev/null + fi + + node-gyp rebuild -C src +} + +(buildUSDT) +LIBUSDT_STATUS=$? +if [[ "$LIBUSDT_STATUS" -ne 0 ]]; then + fail $LIBUSDT_STATUS +fi + +(buildNDTP) +NODE_GYP_STATUS=$? +if [[ "$NODE_GYP_STATUS" -ne 0 ]]; then + fail $NODE_GYP_STATUS +fi + +exit 0 diff --git a/datalab/web/node_modules/dtrace-provider/build/DTraceProviderStub.target.mk b/datalab/web/node_modules/dtrace-provider/build/DTraceProviderStub.target.mk new file mode 100644 index 0000000000000000000000000000000000000000..a1236233e042b006e49c0685438ef0fd5e7c4aa7 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/build/DTraceProviderStub.target.mk @@ -0,0 +1,18 @@ +# This file is generated by gyp; do not edit. + +TOOLSET := target +TARGET := DTraceProviderStub +### Rules for final target. +$(obj).target/DTraceProviderStub.stamp: TOOLSET := $(TOOLSET) +$(obj).target/DTraceProviderStub.stamp: FORCE_DO_CMD + $(call do_cmd,touch) + +all_deps += $(obj).target/DTraceProviderStub.stamp +# Add target alias +.PHONY: DTraceProviderStub +DTraceProviderStub: $(obj).target/DTraceProviderStub.stamp + +# Add target alias to "all" target. +.PHONY: all +all: DTraceProviderStub + diff --git a/datalab/web/node_modules/dtrace-provider/build/Makefile b/datalab/web/node_modules/dtrace-provider/build/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..431500621c75aaf6d1171b53b66c45cff1d4f22d --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/build/Makefile @@ -0,0 +1,324 @@ +# We borrow heavily from the kernel build setup, though we are simpler since +# we don't have Kconfig tweaking settings on us. + +# The implicit make rules have it looking for RCS files, among other things. +# We instead explicitly write all the rules we care about. +# It's even quicker (saves ~200ms) to pass -r on the command line. +MAKEFLAGS=-r + +# The source directory tree. +srcdir := .. +abs_srcdir := $(abspath $(srcdir)) + +# The name of the builddir. +builddir_name ?= . + +# The V=1 flag on command line makes us verbosely print command lines. +ifdef V + quiet= +else + quiet=quiet_ +endif + +# Specify BUILDTYPE=Release on the command line for a release build. +BUILDTYPE ?= Release + +# Directory all our build output goes into. +# Note that this must be two directories beneath src/ for unit tests to pass, +# as they reach into the src/ directory for data with relative paths. +builddir ?= $(builddir_name)/$(BUILDTYPE) +abs_builddir := $(abspath $(builddir)) +depsdir := $(builddir)/.deps + +# Object output directory. +obj := $(builddir)/obj +abs_obj := $(abspath $(obj)) + +# We build up a list of every single one of the targets so we can slurp in the +# generated dependency rule Makefiles in one pass. +all_deps := + + + +CC.target ?= $(CC) +CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS) +CXX.target ?= $(CXX) +CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS) +LINK.target ?= $(LINK) +LDFLAGS.target ?= $(LDFLAGS) +AR.target ?= $(AR) + +# C++ apps need to be linked with g++. +LINK ?= $(CXX.target) + +# TODO(evan): move all cross-compilation logic to gyp-time so we don't need +# to replicate this environment fallback in make as well. +CC.host ?= gcc +CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host) +CXX.host ?= g++ +CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host) +LINK.host ?= $(CXX.host) +LDFLAGS.host ?= $(LDFLAGS_host) +AR.host ?= ar + +# Define a dir function that can handle spaces. +# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions +# "leading spaces cannot appear in the text of the first argument as written. +# These characters can be put into the argument value by variable substitution." +empty := +space := $(empty) $(empty) + +# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces +replace_spaces = $(subst $(space),?,$1) +unreplace_spaces = $(subst ?,$(space),$1) +dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1))) + +# Flags to make gcc output dependency info. Note that you need to be +# careful here to use the flags that ccache and distcc can understand. +# We write to a dep file on the side first and then rename at the end +# so we can't end up with a broken dep file. +depfile = $(depsdir)/$(call replace_spaces,$@).d +DEPFLAGS = -MMD -MF $(depfile).raw + +# We have to fixup the deps output in a few ways. +# (1) the file output should mention the proper .o file. +# ccache or distcc lose the path to the target, so we convert a rule of +# the form: +# foobar.o: DEP1 DEP2 +# into +# path/to/foobar.o: DEP1 DEP2 +# (2) we want missing files not to cause us to fail to build. +# We want to rewrite +# foobar.o: DEP1 DEP2 \ +# DEP3 +# to +# DEP1: +# DEP2: +# DEP3: +# so if the files are missing, they're just considered phony rules. +# We have to do some pretty insane escaping to get those backslashes +# and dollar signs past make, the shell, and sed at the same time. +# Doesn't work with spaces, but that's fine: .d files have spaces in +# their names replaced with other characters. +define fixup_dep +# The depfile may not exist if the input file didn't have any #includes. +touch $(depfile).raw +# Fixup path as in (1). +sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef + +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c + +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") + +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) + +quiet_cmd_alink_thin = AR($(TOOLSET)) $@ +cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) + +# Due to circular dependencies between libraries :(, we wrap the +# special "figure out circular dependencies" flags around the entire +# input list during linking. +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group + +# We support two kinds of shared objects (.so): +# 1) shared_library, which is just bundling together many dependent libraries +# into a link line. +# 2) loadable_module, which is generating a module intended for dlopen(). +# +# They differ only slightly: +# In the former case, we want to package all dependent code into the .so. +# In the latter case, we want to package just the API exposed by the +# outermost module. +# This means shared_library uses --whole-archive, while loadable_module doesn't. +# (Note that --whole-archive is incompatible with the --start-group used in +# normal linking.) + +# Other shared-object link notes: +# - Set SONAME to the library filename so our binaries don't reference +# the local, absolute paths used on the link command-line. +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) + + +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' + +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain ? instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds until one fails. +define do_postbuilds + @E=0;\ + for p in $(POSTBUILDS); do\ + eval $$p;\ + E=$$?;\ + if [ $$E -ne 0 ]; then\ + break;\ + fi;\ + done;\ + if [ $$E -ne 0 ]; then\ + rm -rf "$@";\ + exit $$E;\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains ? for +# spaces already and dirx strips the ? characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word 1,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "all" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: all +all: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +TOOLSET := target +# Suffix rules, putting all outputs into $(obj). +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + +# Try building from generated source, too. +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + +$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD + @$(call do_cmd,cxx,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD + @$(call do_cmd,cc,1) +$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD + @$(call do_cmd,cc,1) + + +ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ + $(findstring $(join ^,$(prefix)),\ + $(join ^,DTraceProviderStub.target.mk)))),) + include DTraceProviderStub.target.mk +endif + +quiet_cmd_regen_makefile = ACTION Regenerating $@ +cmd_regen_makefile = cd $(srcdir); /tools/node/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/root/.cache/node-gyp/16.20.2" "-Dnode_gyp_dir=/tools/node/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/root/.cache/node-gyp/16.20.2/<(target_arch)/node.lib" "-Dmodule_root_dir=/datalab/web/node_modules/dtrace-provider" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/datalab/web/node_modules/dtrace-provider/build/config.gypi -I/tools/node/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/root/.cache/node-gyp/16.20.2/include/node/common.gypi "--toplevel-dir=." binding.gyp +Makefile: $(srcdir)/../../../../root/.cache/node-gyp/16.20.2/include/node/common.gypi $(srcdir)/build/config.gypi $(srcdir)/../../../../tools/node/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/binding.gyp + $(call do_cmd,regen_makefile) + +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif diff --git a/datalab/web/node_modules/dtrace-provider/build/Release/.deps/Release/obj.target/DTraceProviderStub.stamp.d b/datalab/web/node_modules/dtrace-provider/build/Release/.deps/Release/obj.target/DTraceProviderStub.stamp.d new file mode 100644 index 0000000000000000000000000000000000000000..b7a618efc16c9747a0f363889254990f510e900c --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/build/Release/.deps/Release/obj.target/DTraceProviderStub.stamp.d @@ -0,0 +1 @@ +cmd_Release/obj.target/DTraceProviderStub.stamp := touch Release/obj.target/DTraceProviderStub.stamp diff --git a/datalab/web/node_modules/dtrace-provider/build/Release/obj.target/DTraceProviderStub.stamp b/datalab/web/node_modules/dtrace-provider/build/Release/obj.target/DTraceProviderStub.stamp new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/datalab/web/node_modules/dtrace-provider/build/binding.Makefile b/datalab/web/node_modules/dtrace-provider/build/binding.Makefile new file mode 100644 index 0000000000000000000000000000000000000000..839015bc7a7ec823a2e7d9cc7b9c87eef58a96e9 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/build/binding.Makefile @@ -0,0 +1,6 @@ +# This file is generated by gyp; do not edit. + +export builddir_name ?= ./build/. +.PHONY: all +all: + $(MAKE) DTraceProviderStub diff --git a/datalab/web/node_modules/dtrace-provider/build/config.gypi b/datalab/web/node_modules/dtrace-provider/build/config.gypi new file mode 100644 index 0000000000000000000000000000000000000000..19da6824c720a98ff4f47dbcc93131aead591010 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/build/config.gypi @@ -0,0 +1,391 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "asan": 0, + "coverage": "false", + "dcheck_always_on": 0, + "debug_nghttp2": "false", + "debug_node": "false", + "enable_lto": "false", + "enable_pgo_generate": "false", + "enable_pgo_use": "false", + "error_on_warn": "false", + "force_dynamic_crt": 0, + "gas_version": "2.30", + "host_arch": "x64", + "icu_data_in": "../../deps/icu-tmp/icudt71l.dat", + "icu_endianness": "l", + "icu_gyp_path": "tools/icu/icu-generic.gyp", + "icu_path": "deps/icu-small", + "icu_small": "false", + "icu_ver_major": "71", + "is_debug": 0, + "libdir": "lib", + "llvm_version": "0.0", + "napi_build_version": "8", + "node_builtin_shareable_builtins": [ + "deps/cjs-module-lexer/lexer.js", + "deps/cjs-module-lexer/dist/lexer.js", + "deps/undici/undici.js" + ], + "node_byteorder": "little", + "node_debug_lib": "false", + "node_enable_d8": "false", + "node_install_corepack": "true", + "node_install_npm": "true", + "node_library_files": [ + "lib/_http_agent.js", + "lib/_http_client.js", + "lib/_http_common.js", + "lib/_http_incoming.js", + "lib/_http_outgoing.js", + "lib/_http_server.js", + "lib/_stream_duplex.js", + "lib/_stream_passthrough.js", + "lib/_stream_readable.js", + "lib/_stream_transform.js", + "lib/_stream_wrap.js", + "lib/_stream_writable.js", + "lib/_tls_common.js", + "lib/_tls_wrap.js", + "lib/assert.js", + "lib/assert/strict.js", + "lib/async_hooks.js", + "lib/buffer.js", + "lib/child_process.js", + "lib/cluster.js", + "lib/console.js", + "lib/constants.js", + "lib/crypto.js", + "lib/dgram.js", + "lib/diagnostics_channel.js", + "lib/dns.js", + "lib/dns/promises.js", + "lib/domain.js", + "lib/events.js", + "lib/fs.js", + "lib/fs/promises.js", + "lib/http.js", + "lib/http2.js", + "lib/https.js", + "lib/inspector.js", + "lib/internal/abort_controller.js", + "lib/internal/assert.js", + "lib/internal/assert/assertion_error.js", + "lib/internal/assert/calltracker.js", + "lib/internal/async_hooks.js", + "lib/internal/blob.js", + "lib/internal/blocklist.js", + "lib/internal/bootstrap/environment.js", + "lib/internal/bootstrap/loaders.js", + "lib/internal/bootstrap/node.js", + "lib/internal/bootstrap/pre_execution.js", + "lib/internal/bootstrap/switches/does_not_own_process_state.js", + "lib/internal/bootstrap/switches/does_own_process_state.js", + "lib/internal/bootstrap/switches/is_main_thread.js", + "lib/internal/bootstrap/switches/is_not_main_thread.js", + "lib/internal/buffer.js", + "lib/internal/child_process.js", + "lib/internal/child_process/serialization.js", + "lib/internal/cli_table.js", + "lib/internal/cluster/child.js", + "lib/internal/cluster/primary.js", + "lib/internal/cluster/round_robin_handle.js", + "lib/internal/cluster/shared_handle.js", + "lib/internal/cluster/utils.js", + "lib/internal/cluster/worker.js", + "lib/internal/console/constructor.js", + "lib/internal/console/global.js", + "lib/internal/constants.js", + "lib/internal/crypto/aes.js", + "lib/internal/crypto/certificate.js", + "lib/internal/crypto/cfrg.js", + "lib/internal/crypto/cipher.js", + "lib/internal/crypto/diffiehellman.js", + "lib/internal/crypto/ec.js", + "lib/internal/crypto/hash.js", + "lib/internal/crypto/hashnames.js", + "lib/internal/crypto/hkdf.js", + "lib/internal/crypto/keygen.js", + "lib/internal/crypto/keys.js", + "lib/internal/crypto/mac.js", + "lib/internal/crypto/pbkdf2.js", + "lib/internal/crypto/random.js", + "lib/internal/crypto/rsa.js", + "lib/internal/crypto/scrypt.js", + "lib/internal/crypto/sig.js", + "lib/internal/crypto/util.js", + "lib/internal/crypto/webcrypto.js", + "lib/internal/crypto/x509.js", + "lib/internal/debugger/inspect.js", + "lib/internal/debugger/inspect_client.js", + "lib/internal/debugger/inspect_repl.js", + "lib/internal/dgram.js", + "lib/internal/dns/promises.js", + "lib/internal/dns/utils.js", + "lib/internal/dtrace.js", + "lib/internal/encoding.js", + "lib/internal/error_serdes.js", + "lib/internal/errors.js", + "lib/internal/event_target.js", + "lib/internal/fixed_queue.js", + "lib/internal/freelist.js", + "lib/internal/freeze_intrinsics.js", + "lib/internal/fs/cp/cp-sync.js", + "lib/internal/fs/cp/cp.js", + "lib/internal/fs/dir.js", + "lib/internal/fs/promises.js", + "lib/internal/fs/read_file_context.js", + "lib/internal/fs/rimraf.js", + "lib/internal/fs/streams.js", + "lib/internal/fs/sync_write_stream.js", + "lib/internal/fs/utils.js", + "lib/internal/fs/watchers.js", + "lib/internal/heap_utils.js", + "lib/internal/histogram.js", + "lib/internal/http.js", + "lib/internal/http2/compat.js", + "lib/internal/http2/core.js", + "lib/internal/http2/util.js", + "lib/internal/idna.js", + "lib/internal/inspector_async_hook.js", + "lib/internal/js_stream_socket.js", + "lib/internal/legacy/processbinding.js", + "lib/internal/linkedlist.js", + "lib/internal/main/check_syntax.js", + "lib/internal/main/eval_stdin.js", + "lib/internal/main/eval_string.js", + "lib/internal/main/inspect.js", + "lib/internal/main/mksnapshot.js", + "lib/internal/main/print_help.js", + "lib/internal/main/prof_process.js", + "lib/internal/main/repl.js", + "lib/internal/main/run_main_module.js", + "lib/internal/main/test_runner.js", + "lib/internal/main/watch_mode.js", + "lib/internal/main/worker_thread.js", + "lib/internal/modules/cjs/helpers.js", + "lib/internal/modules/cjs/loader.js", + "lib/internal/modules/esm/assert.js", + "lib/internal/modules/esm/create_dynamic_module.js", + "lib/internal/modules/esm/fetch_module.js", + "lib/internal/modules/esm/formats.js", + "lib/internal/modules/esm/get_format.js", + "lib/internal/modules/esm/handle_process_exit.js", + "lib/internal/modules/esm/initialize_import_meta.js", + "lib/internal/modules/esm/load.js", + "lib/internal/modules/esm/loader.js", + "lib/internal/modules/esm/module_job.js", + "lib/internal/modules/esm/module_map.js", + "lib/internal/modules/esm/package_config.js", + "lib/internal/modules/esm/resolve.js", + "lib/internal/modules/esm/translators.js", + "lib/internal/modules/package_json_reader.js", + "lib/internal/modules/run_main.js", + "lib/internal/net.js", + "lib/internal/options.js", + "lib/internal/per_context/domexception.js", + "lib/internal/per_context/messageport.js", + "lib/internal/per_context/primordials.js", + "lib/internal/perf/event_loop_delay.js", + "lib/internal/perf/event_loop_utilization.js", + "lib/internal/perf/nodetiming.js", + "lib/internal/perf/observe.js", + "lib/internal/perf/performance.js", + "lib/internal/perf/performance_entry.js", + "lib/internal/perf/resource_timing.js", + "lib/internal/perf/timerify.js", + "lib/internal/perf/usertiming.js", + "lib/internal/perf/utils.js", + "lib/internal/policy/manifest.js", + "lib/internal/policy/sri.js", + "lib/internal/priority_queue.js", + "lib/internal/process/esm_loader.js", + "lib/internal/process/execution.js", + "lib/internal/process/per_thread.js", + "lib/internal/process/policy.js", + "lib/internal/process/promises.js", + "lib/internal/process/report.js", + "lib/internal/process/signal.js", + "lib/internal/process/task_queues.js", + "lib/internal/process/warning.js", + "lib/internal/process/worker_thread_only.js", + "lib/internal/promise_hooks.js", + "lib/internal/querystring.js", + "lib/internal/readline/callbacks.js", + "lib/internal/readline/emitKeypressEvents.js", + "lib/internal/readline/interface.js", + "lib/internal/readline/utils.js", + "lib/internal/repl.js", + "lib/internal/repl/await.js", + "lib/internal/repl/history.js", + "lib/internal/repl/utils.js", + "lib/internal/socket_list.js", + "lib/internal/socketaddress.js", + "lib/internal/source_map/prepare_stack_trace.js", + "lib/internal/source_map/source_map.js", + "lib/internal/source_map/source_map_cache.js", + "lib/internal/stream_base_commons.js", + "lib/internal/streams/add-abort-signal.js", + "lib/internal/streams/buffer_list.js", + "lib/internal/streams/compose.js", + "lib/internal/streams/destroy.js", + "lib/internal/streams/duplex.js", + "lib/internal/streams/duplexify.js", + "lib/internal/streams/end-of-stream.js", + "lib/internal/streams/from.js", + "lib/internal/streams/lazy_transform.js", + "lib/internal/streams/legacy.js", + "lib/internal/streams/operators.js", + "lib/internal/streams/passthrough.js", + "lib/internal/streams/pipeline.js", + "lib/internal/streams/readable.js", + "lib/internal/streams/state.js", + "lib/internal/streams/transform.js", + "lib/internal/streams/utils.js", + "lib/internal/streams/writable.js", + "lib/internal/test/binding.js", + "lib/internal/test/transfer.js", + "lib/internal/test_runner/harness.js", + "lib/internal/test_runner/runner.js", + "lib/internal/test_runner/tap_stream.js", + "lib/internal/test_runner/test.js", + "lib/internal/test_runner/utils.js", + "lib/internal/timers.js", + "lib/internal/tls/parse-cert-string.js", + "lib/internal/tls/secure-context.js", + "lib/internal/tls/secure-pair.js", + "lib/internal/trace_events_async_hooks.js", + "lib/internal/tty.js", + "lib/internal/url.js", + "lib/internal/util.js", + "lib/internal/util/colors.js", + "lib/internal/util/comparisons.js", + "lib/internal/util/debuglog.js", + "lib/internal/util/inspect.js", + "lib/internal/util/inspector.js", + "lib/internal/util/iterable_weak_map.js", + "lib/internal/util/parse_args/parse_args.js", + "lib/internal/util/parse_args/utils.js", + "lib/internal/util/types.js", + "lib/internal/v8/startup_snapshot.js", + "lib/internal/v8_prof_polyfill.js", + "lib/internal/v8_prof_processor.js", + "lib/internal/validators.js", + "lib/internal/vm/module.js", + "lib/internal/watch_mode/files_watcher.js", + "lib/internal/watchdog.js", + "lib/internal/webstreams/adapters.js", + "lib/internal/webstreams/compression.js", + "lib/internal/webstreams/encoding.js", + "lib/internal/webstreams/queuingstrategies.js", + "lib/internal/webstreams/readablestream.js", + "lib/internal/webstreams/transfer.js", + "lib/internal/webstreams/transformstream.js", + "lib/internal/webstreams/util.js", + "lib/internal/webstreams/writablestream.js", + "lib/internal/worker.js", + "lib/internal/worker/io.js", + "lib/internal/worker/js_transferable.js", + "lib/module.js", + "lib/net.js", + "lib/os.js", + "lib/path.js", + "lib/path/posix.js", + "lib/path/win32.js", + "lib/perf_hooks.js", + "lib/process.js", + "lib/punycode.js", + "lib/querystring.js", + "lib/readline.js", + "lib/repl.js", + "lib/stream.js", + "lib/stream/consumers.js", + "lib/stream/promises.js", + "lib/stream/web.js", + "lib/string_decoder.js", + "lib/sys.js", + "lib/test.js", + "lib/timers.js", + "lib/timers/promises.js", + "lib/tls.js", + "lib/trace_events.js", + "lib/tty.js", + "lib/url.js", + "lib/util.js", + "lib/util/types.js", + "lib/v8.js", + "lib/vm.js", + "lib/wasi.js", + "lib/worker_threads.js", + "lib/zlib.js" + ], + "node_module_version": 93, + "node_no_browser_globals": "false", + "node_prefix": "/", + "node_release_urlbase": "https://nodejs.org/download/release/", + "node_section_ordering_info": "", + "node_shared": "false", + "node_shared_brotli": "false", + "node_shared_cares": "false", + "node_shared_http_parser": "false", + "node_shared_libuv": "false", + "node_shared_nghttp2": "false", + "node_shared_nghttp3": "false", + "node_shared_ngtcp2": "false", + "node_shared_openssl": "false", + "node_shared_zlib": "false", + "node_tag": "", + "node_target_type": "executable", + "node_use_bundled_v8": "true", + "node_use_dtrace": "false", + "node_use_etw": "false", + "node_use_node_code_cache": "true", + "node_use_node_snapshot": "true", + "node_use_openssl": "true", + "node_use_v8_platform": "true", + "node_with_ltcg": "false", + "node_without_node_options": "false", + "openssl_fips": "", + "openssl_is_fips": "false", + "openssl_quic": "true", + "ossfuzz": "false", + "shlib_suffix": "so.93", + "target_arch": "x64", + "v8_enable_31bit_smis_on_64bit_arch": 0, + "v8_enable_gdbjit": 0, + "v8_enable_hugepage": 0, + "v8_enable_i18n_support": 1, + "v8_enable_inspector": 1, + "v8_enable_lite_mode": 0, + "v8_enable_object_print": 1, + "v8_enable_pointer_compression": 0, + "v8_enable_webassembly": 1, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 1, + "v8_promise_internal_field_count": 1, + "v8_random_seed": 0, + "v8_trace_maps": 0, + "v8_use_siphash": 1, + "want_separate_host_toolset": 0, + "nodedir": "/root/.cache/node-gyp/16.20.2", + "standalone_static_library": 1, + "user_agent": "npm/8.19.4 node/v16.20.2 linux x64 workspaces/false", + "userconfig": "/root/.npmrc", + "local_prefix": "/datalab/web", + "metrics_registry": "https://registry.npmjs.org/", + "prefix": "/tools/node", + "cache": "/root/.npm", + "node_gyp": "/tools/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js", + "globalconfig": "/tools/node/etc/npmrc", + "init_module": "/root/.npm-init.js", + "global_prefix": "/tools/node" + } +} diff --git a/datalab/web/node_modules/dtrace-provider/build/node_gyp_bins/python3 b/datalab/web/node_modules/dtrace-provider/build/node_gyp_bins/python3 new file mode 100644 index 0000000000000000000000000000000000000000..cbff23f853ec82928bb6b3b2b4f14fb0f27c0345 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/build/node_gyp_bins/python3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b94e9b56bc1f96b18d36a0f1d14308575bb7b5960eda94ae0520f0376e95d12d +size 5909000 diff --git a/datalab/web/node_modules/dtrace-provider/dtrace-provider.js b/datalab/web/node_modules/dtrace-provider/dtrace-provider.js new file mode 100644 index 0000000000000000000000000000000000000000..121b5f07bf685f02e3ec7bfeddf2d7ab8a013013 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/dtrace-provider.js @@ -0,0 +1,41 @@ +var DTraceProvider; + +function DTraceProviderStub() {} +DTraceProviderStub.prototype.addProbe = function(name) { + var p = { 'fire': function () {} }; + this[name] = p; + return (p); +}; +DTraceProviderStub.prototype.enable = function() {}; +DTraceProviderStub.prototype.fire = function() {}; +DTraceProviderStub.prototype.disable = function() {}; + +var builds = ['Release', 'default', 'Debug']; +var err = null; + +for (var i = 0; i < builds.length; i++) { + try { + var binding = require('./src/build/' + builds[i] + '/DTraceProviderBindings'); + DTraceProvider = binding.DTraceProvider; + break; + } catch (e) { + if (err === null) { + err = e; + } + } +} + +if (!DTraceProvider) { + if (process.env.NODE_DTRACE_PROVIDER_REQUIRE === 'hard') { + throw err; + } else { + DTraceProvider = DTraceProviderStub; + } +} + +exports.DTraceProvider = DTraceProvider; +exports.createDTraceProvider = function(name, module) { + if (arguments.length == 2) + return (new exports.DTraceProvider(name, module)); + return (new exports.DTraceProvider(name)); +}; diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/.npmignore b/datalab/web/node_modules/dtrace-provider/libusdt/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..fba1d9701b5de2dd93c627ce0816ef01fee9dae7 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/.npmignore @@ -0,0 +1,10 @@ +*.o +*.a +*.gch +*~ +*# +.#* +test_usdt +test_usdt32 +test_usdt64 +test_mem_usage diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/LICENCE b/datalab/web/node_modules/dtrace-provider/libusdt/LICENCE new file mode 100644 index 0000000000000000000000000000000000000000..e74a6f8b8b0f7914e2eb076d537203caa4242cdb --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/LICENCE @@ -0,0 +1,21 @@ +Copyright 2012 Chris Andrews. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of + conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY CHRIS ANDREWS ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CHRIS ANDREWS OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/Makefile b/datalab/web/node_modules/dtrace-provider/libusdt/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..71a9dbee3ecb98c0f06e7f240734df3e44697853 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/Makefile @@ -0,0 +1,158 @@ +CC = gcc +CFLAGS = -O2 -Wall + +# MAC_BUILD - set this to "universal" to build a 2-way fat library +MAC_BUILD = universal + +# if ARCH set, disable universal build on the mac +ifdef ARCH +MAC_BUILD = +else +ARCH = $(shell uname -m) +endif + +UNAME = $(shell uname -s) + +ifeq ($(UNAME), Linux) +RANLIB=ranlib +CFLAGS+=-D_GNU_SOURCE -fPIC +endif + +ifeq ($(UNAME), SunOS) +RANLIB=/bin/true +PATH +=:/usr/perl5/5.10.0/bin:/usr/perl5/5.12/bin +CFLAGS += -fPIC +ifeq ($(ARCH), i86pc) +ARCH = $(shell isainfo -k) +ifeq ($(ARCH), amd64) +ARCH = x86_64 +else +ARCH = i386 +endif +endif +ifeq ($(ARCH), x86_64) +CFLAGS += -m64 +else +CFLAGS += -m32 +endif +endif + +ifeq ($(UNAME), FreeBSD) +RANLIB=ranlib +CFLAGS += -Wno-error=unknown-pragmas -I/usr/src/sys/cddl/compat/opensolaris -I/usr/src/sys/cddl/contrib/opensolaris/uts/common +CFLAGS += -fPIC +ifeq ($(ARCH), i386) +CFLAGS += -m32 +endif +ifeq ($(ARCH), amd64) +ARCH = x86_64 +endif +endif + +ifeq ($(UNAME), Darwin) +RANLIB=ranlib +ifeq ($(MAC_BUILD), universal) +CFLAGS += -arch i386 -arch x86_64 +else +CFLAGS += -arch $(ARCH) +endif +endif + +# main library build +objects = usdt.o usdt_dof_file.o usdt_tracepoints.o usdt_probe.o usdt_dof.o usdt_dof_sections.o +headers = usdt.h usdt_internal.h + +.c.o: $(headers) + +all: libusdt.a + +libusdt.a: $(objects) $(headers) + rm -f libusdt.a + $(AR) cru libusdt.a $(objects) + $(RANLIB) libusdt.a + +# Tracepoints build. +# +# If on Darwin and building a universal library, manually assemble a +# two-way fat object file from both the 32 and 64 bit tracepoint asm +# files. +# +# Otherwise, just choose the appropriate asm file based on the build +# architecture. + +ifeq ($(UNAME), Darwin) +ifeq ($(MAC_BUILD), universal) + +usdt_tracepoints_i386.o: usdt_tracepoints_i386.s + $(CC) -arch i386 -o usdt_tracepoints_i386.o -c usdt_tracepoints_i386.s + +usdt_tracepoints_x86_64.o: usdt_tracepoints_x86_64.s + $(CC) -arch x86_64 -o usdt_tracepoints_x86_64.o -c usdt_tracepoints_x86_64.s + +usdt_tracepoints.o: usdt_tracepoints_i386.o usdt_tracepoints_x86_64.o + lipo -create -output usdt_tracepoints.o usdt_tracepoints_i386.o \ + usdt_tracepoints_x86_64.o + +else # Darwin, not universal +usdt_tracepoints.o: usdt_tracepoints_$(ARCH).s + $(CC) -arch $(ARCH) -o usdt_tracepoints.o -c usdt_tracepoints_$(ARCH).s +endif + +else # not Darwin; FreeBSD and Illumos + +ifeq ($(ARCH), x86_64) +usdt_tracepoints.o: usdt_tracepoints_x86_64.s + $(CC) $(CFLAGS) -o usdt_tracepoints.o -c usdt_tracepoints_x86_64.s +endif +ifeq ($(ARCH), i386) +usdt_tracepoints.o: usdt_tracepoints_i386.s + $(CC) $(CFLAGS) -o usdt_tracepoints.o -c usdt_tracepoints_i386.s +endif + +endif + +clean: + rm -f *.gch + rm -f *.o + rm -f libusdt.a + rm -f test_usdt + rm -f test_usdt32 + rm -f test_usdt64 + rm -f test_mem_usage + +.PHONY: clean test + +# testing + +test_mem_usage: libusdt.a test_mem_usage.o + $(CC) $(CFLAGS) -o test_mem_usage test_mem_usage.o libusdt.a + +ifeq ($(UNAME), Darwin) +ifeq ($(MAC_BUILD), universal) +test_usdt64: libusdt.a test_usdt.o + $(CC) -arch x86_64 -o test_usdt64 test_usdt.o libusdt.a +test_usdt32: libusdt.a test_usdt.o + $(CC) -arch i386 -o test_usdt32 test_usdt.o libusdt.a +else +test_usdt: libusdt.a test_usdt.o + $(CC) $(CFLAGS) -o test_usdt test_usdt.o libusdt.a +endif +else +test_usdt: libusdt.a test_usdt.o + $(CC) $(CFLAGS) -o test_usdt test_usdt.o libusdt.a +endif + +ifeq ($(UNAME), Darwin) +ifeq ($(MAC_BUILD), universal) +test: test_usdt32 test_usdt64 + sudo prove test.pl :: 64 + sudo prove test.pl :: 32 +else +test: test_usdt + sudo prove test.pl +endif +else +test: test_usdt + sudo prove test.pl +endif + diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/README.md b/datalab/web/node_modules/dtrace-provider/libusdt/README.md new file mode 100644 index 0000000000000000000000000000000000000000..660274ac485e2ac7811d1fe52653e94efa66b24c --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/README.md @@ -0,0 +1,77 @@ +libusdt +======= + +This is "libusdt", a library for creating DTrace USDT providers. + +The idea here is to allow the specification of a DTrace provider +dynamically in code and then create the provider at runtime. This +allows providers to be specified in dynamic languages, given suitable +bindings. + +The general approach is to create two stub functions for each probe, +one for the is-enabled check and one for the probe itself. These +contain the appropriate instruction sequences to appear to DTrace as +compiled-in tracepoints. A minimal DOF document is built describing +the provider and indicating these stub functions as the tracepoints, +then submitted to the kernel, creating the provider. The API then +exposes the stubs, through which the probes may be fired. + +Status +------ + +The implementation here works as shown in test_usdt.c on Mac OS X, +i386 and x86_64, on Solaris-like systems, i386 and x86_64 and on +FreeBSD and Oracle Linux, x86_64 only. + +Is-enabled probes are supported and exposed in the API. + +There is a "test" target which runs a number of tests of the library, +for which perl is required. + +OS X builds are Universal by default, and on Solaris, the ARCH +variable may be set to either i386 or x86_64 to force a particular +build. + +FreeBSD builds suffer from broken argument handling; this is a known +issue with the current state of DTrace generally on FreeBSD: only the +first five arguments work reliably. See: + + http://wiki.freebsd.org/DTraceTODO + +See Also +-------- + +There are various language bindings available: + +Lua: + + https://github.com/chrisa/lua-usdt + +Ruby (by Kevin Chan): + + https://github.com/kevinykchan/ruby-usdt + +Node.JS: + + https://github.com/chrisa/node-dtrace-provider + +Perl: + + https://github.com/chrisa/perl-Devel-DTrace-Provider + +To Do +----- + +Platform support: + + * add support for FreeBSD 9.0 i386 + * add support for Mac OS X PowerPC + * add support for Solaris SPARC + +Features: + + * add a "low level" API, allowing alternative provision of + tracepoints for closer integration with language VMs. + + * support structured types, with close integration with the host + DTrace system. diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/test.pl b/datalab/web/node_modules/dtrace-provider/libusdt/test.pl new file mode 100644 index 0000000000000000000000000000000000000000..28fdf5e3245f546d40332ce5f0b339ab4d23ba77 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/test.pl @@ -0,0 +1,116 @@ +#!/usr/bin/perl +use strict; +use warnings; +use IPC::Open3; +use Symbol 'gensym'; +use IO::Handle; +use Test::More qw/ no_plan /; + +my $USDT_ARG_MAX = 32; +if ($^O eq 'freebsd') { + # FreeBSD currently only supports 5 arguments to USDT probes + $USDT_ARG_MAX = 5; +} + +my $arch; +if (scalar @ARGV == 1) { + $arch = $ARGV[0]; +} + +my $user_t = ($^O eq 'darwin') ? 'user_addr_t' : 'uintptr_t'; + +run_tests('c', 'A'); +run_tests('i', 1); + +sub run_tests { + my ($type, $start_arg) = @_; + + for my $i (0..$USDT_ARG_MAX) { + my ($t_status, $d_status, $output) = run_dtrace('type'.$type, $i.'arg', split(//, $type x $i)); + is($t_status, 0, 'test exit status is 0'); + is($d_status, 0, 'dtrace exit status is 0'); + like($output, qr/type[ic]:\d+arg/, 'function and name match'); + + my $arg = $start_arg; + for my $j (0..$i - 1) { + like($output, qr/arg$j:'\Q$arg\E'/, "type '$type' arg $j is $arg"); + if ($type eq 'i') { + $arg++; + } + else { + $arg = chr(ord($arg) + 1); + } + } + } +} + +# -------------------------------------------------------------------------- + +sub gen_d { + my (@types) = @_; + + my $d = 'testlibusdt*:::{ '; + my $i = 0; + for my $type (@types) { + if ($type eq 'i') { + $d .= "printf(\"arg$i:'%i' \", args[$i]); "; + } + if ($type eq 'c') { + $d .= "printf(\"arg$i:'%s' \", copyinstr(($user_t)args[$i])); "; + } + $i++; + } + $d .= '}'; + + return $d; +} + +sub run_dtrace { + my ($func, $name, @types) = @_; + my $d = gen_d(@types); + + my @t_cmd; + if (defined $arch) { + @t_cmd = ("./test_usdt$arch", $func, $name, @types); + } + else { + @t_cmd = ("./test_usdt", $func, $name, @types); + } + + my ($d_wtr, $d_rdr, $d_err); + my ($t_wtr, $t_rdr, $t_err); + + $d_err = gensym; + $t_err = gensym; + + #diag(join(' ', @t_cmd)); + my $t_pid = open3($t_wtr, $t_rdr, $t_err, @t_cmd); + my $enabled = $t_rdr->getline; + + my @d_cmd = ('/usr/sbin/dtrace', '-p', $t_pid, '-n', $d); + + #diag(join(' ', @d_cmd)); + my $d_pid = open3($d_wtr, $d_rdr, $d_err, @d_cmd); + my $matched = $d_err->getline; # expect "matched 1 probe" + + $t_wtr->print("go\n"); + $t_wtr->flush; + waitpid( $t_pid, 0 ); + my $t_status = $? >> 8; + + my ($header, $output) = ($d_rdr->getline, $d_rdr->getline); + chomp $header; + chomp $output; + #diag("DTrace header: $header\n"); + #diag("DTrace output: $output\n"); + waitpid( $d_pid, 0 ); + + my $d_status = $? >> 8; + while (!$d_err->eof) { + my $error = $d_err->getline; + chomp $error; + #diag "DTrace error: $error"; + } + + return ($t_status, $d_status, $output || ''); +} diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/test_mem_usage.c b/datalab/web/node_modules/dtrace-provider/libusdt/test_mem_usage.c new file mode 100644 index 0000000000000000000000000000000000000000..4296f8f9c2eb43789056b1317446916f4088ea67 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/test_mem_usage.c @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +#include "usdt.h" + +#include +#include +#include + +static void +create_and_free_provider(int argc, char **argv) +{ + usdt_provider_t *provider; + usdt_probedef_t *probedef; + + if ((provider = usdt_create_provider("testlibusdt", "modname")) == NULL) { + fprintf(stderr, "unable to create provider\n"); + exit (1); + } + if ((probedef = usdt_create_probe((const char *)argv[1], + (const char *)argv[2], + (argc-3), (const char **)&argv[3])) == NULL) + { + fprintf(stderr, "unable to create probe\n"); + exit (1); + } + usdt_provider_add_probe(provider, probedef); + + if ((usdt_provider_enable(provider)) < 0) { + fprintf(stderr, "unable to enable provider: %s\n", usdt_errstr(provider)); + exit (1); + } + + if ((usdt_provider_disable(provider)) < 0) { + fprintf(stderr, "unable to disable provider: %s\n", usdt_errstr(provider)); + exit (1); + } + + usdt_probe_release(probedef); + usdt_provider_free(provider); +} + +int +main(int argc, char **argv) +{ + char char_argv[USDT_ARG_MAX]; + int int_argv[USDT_ARG_MAX * 2]; + int i; + char buf[255]; + + for (i = 0; i < USDT_ARG_MAX; i++) + int_argv[i] = i + 1; + for (i = 0; i < USDT_ARG_MAX; i++) + char_argv[i] = (char) i + 65; + + if (argc < 3) { + fprintf(stderr, "usage: %s func name [types ...]\n", argv[0]); + return(1); + } + + for (i = 0; i < USDT_ARG_MAX; i++) { + if (argv[i+3] != NULL && i+3 < argc) { + if (strncmp("c", argv[i+3], 1) == 0) { + argv[i+3] = strdup("char *"); + } + if (strncmp("i", argv[i+3], 1) == 0) { + argv[i+3] = strdup("int"); + } + } + } + + for (i = 0; i < 100000; i++) + create_and_free_provider(argc, argv); + + return 0; +} diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/test_usdt.c b/datalab/web/node_modules/dtrace-provider/libusdt/test_usdt.c new file mode 100644 index 0000000000000000000000000000000000000000..0c5464a90f41f4644797766edcac34516bd96cc3 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/test_usdt.c @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +#include "usdt.h" + +#include +#include +#include + +static void +fire_probe(usdt_probedef_t *probedef, int argc, void **argv) +{ + if (usdt_is_enabled(probedef->probe)) + usdt_fire_probe(probedef->probe, argc, argv); +} + +int main(int argc, char **argv) { + usdt_provider_t *provider; + usdt_probedef_t *probedef; + char char_argv[USDT_ARG_MAX]; + int int_argv[USDT_ARG_MAX * 2]; + void **args = NULL; + int i; + char buf[255]; + + for (i = 0; i < USDT_ARG_MAX; i++) + int_argv[i] = i + 1; + for (i = 0; i < USDT_ARG_MAX; i++) + char_argv[i] = (char) i + 65; + + if (argc < 3) { + fprintf(stderr, "usage: %s func name [types ...]\n", argv[0]); + return(1); + } + + if (argc > 3) { + args = malloc((argc-3) * sizeof(void *)); + } + + for (i = 0; i < USDT_ARG_MAX; i++) { + if (argv[i+3] != NULL && i+3 < argc) { + if (strncmp("c", argv[i+3], 1) == 0) { + args[i] = (void *)strndup(&char_argv[i], 1); + argv[i+3] = strdup("char *"); + } + if (strncmp("i", argv[i+3], 1) == 0) { + args[i] = (void *)(long)int_argv[i]; + argv[i+3] = strdup("int"); + } + } + } + + if ((provider = usdt_create_provider("testlibusdt", "modname")) == NULL) { + fprintf(stderr, "unable to create provider\n"); + exit (1); + } + if ((probedef = usdt_create_probe((const char *)argv[1], + (const char *)argv[2], + (argc-3), (const char **)&argv[3])) == NULL) + { + fprintf(stderr, "unable to create probe\n"); + exit (1); + } + usdt_provider_add_probe(provider, probedef); + + if ((usdt_provider_enable(provider)) < 0) { + fprintf(stderr, "unable to enable provider: %s\n", usdt_errstr(provider)); + exit (1); + } + + fprintf(stdout, "enabled\n"); + fflush(stdout); + fgets(buf, 255, stdin); + + fire_probe(probedef, (argc-3), (void **)args); + usdt_probe_release(probedef); + + if ((usdt_provider_disable(provider)) < 0) { + fprintf(stderr, "unable to disable provider: %s\n", usdt_errstr(provider)); + exit (1); + } + + usdt_provider_free(provider); + + return 0; +} diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/usdt.c b/datalab/web/node_modules/dtrace-provider/libusdt/usdt.c new file mode 100644 index 0000000000000000000000000000000000000000..2029e83dbb9e963b5acba4b3c6b6c0915e34fb51 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/usdt.c @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +#include "usdt_internal.h" + +#include +#include +#include + +char *usdt_errors[] = { + "failed to allocate memory", + "failed to allocate page-aligned memory", + "no probes defined", + "failed to load DOF: %s", + "provider is already enabled", + "failed to unload DOF: %s", + "probe named %s:%s:%s:%s already exists", + "failed to remove probe %s:%s:%s:%s" +}; + +static void +free_probedef(usdt_probedef_t *pd) +{ + int i; + + switch (pd->refcnt) { + case 1: + free((char *)pd->function); + free((char *)pd->name); + if (pd->probe) { + usdt_free_tracepoints(pd->probe); + free(pd->probe); + } + for (i = 0; i < pd->argc; i++) + free(pd->types[i]); + free(pd); + break; + case 2: + pd->refcnt = 1; + break; + default: + break; + } +} + +usdt_provider_t * +usdt_create_provider(const char *name, const char *module) +{ + usdt_provider_t *provider; + + if ((provider = malloc(sizeof *provider)) == NULL) + return NULL; + + provider->name = strdup(name); + provider->module = strdup(module); + provider->probedefs = NULL; + provider->enabled = 0; + + return provider; +} + +usdt_probedef_t * +usdt_create_probe(const char *func, const char *name, size_t argc, const char **types) +{ + int i; + usdt_probedef_t *p; + + if (argc > USDT_ARG_MAX) + argc = USDT_ARG_MAX; + + if ((p = malloc(sizeof *p)) == NULL) + return (NULL); + + p->refcnt = 2; + p->function = strdup(func); + p->name = strdup(name); + p->argc = argc; + p->probe = NULL; + + for (i = 0; i < argc; i++) + p->types[i] = strdup(types[i]); + + return (p); +} + +void +usdt_probe_release(usdt_probedef_t *probedef) +{ + free_probedef(probedef); +} + +int +usdt_provider_add_probe(usdt_provider_t *provider, usdt_probedef_t *probedef) +{ + usdt_probedef_t *pd; + + if (provider->probedefs != NULL) { + for (pd = provider->probedefs; (pd != NULL); pd = pd->next) { + if ((strcmp(pd->name, probedef->name) == 0) && + (strcmp(pd->function, probedef->function) == 0)) { + usdt_error(provider, USDT_ERROR_DUP_PROBE, + provider->name, provider->module, + probedef->function, probedef->name); + return (-1); + } + } + } + + probedef->next = NULL; + if (provider->probedefs == NULL) + provider->probedefs = probedef; + else { + for (pd = provider->probedefs; (pd->next != NULL); pd = pd->next) ; + pd->next = probedef; + } + + return (0); +} + +int +usdt_provider_remove_probe(usdt_provider_t *provider, usdt_probedef_t *probedef) +{ + usdt_probedef_t *pd, *prev_pd = NULL; + + if (provider->probedefs == NULL) { + usdt_error(provider, USDT_ERROR_NOPROBES); + return (-1); + } + + for (pd = provider->probedefs; (pd != NULL); + prev_pd = pd, pd = pd->next) { + + if ((strcmp(pd->name, probedef->name) == 0) && + (strcmp(pd->function, probedef->function) == 0)) { + + if (prev_pd == NULL) + provider->probedefs = pd->next; + else + prev_pd->next = pd->next; + + return (0); + } + } + + usdt_error(provider, USDT_ERROR_REMOVE_PROBE, + provider->name, provider->module, + probedef->function, probedef->name); + return (-1); +} + +int +usdt_provider_enable(usdt_provider_t *provider) +{ + usdt_strtab_t strtab; + usdt_dof_file_t *file; + usdt_probedef_t *pd; + int i; + size_t size; + usdt_dof_section_t sects[5]; + + if (provider->enabled == 1) { + usdt_error(provider, USDT_ERROR_ALREADYENABLED); + return (0); /* not fatal */ + } + + if (provider->probedefs == NULL) { + usdt_error(provider, USDT_ERROR_NOPROBES); + return (-1); + } + + for (pd = provider->probedefs; pd != NULL; pd = pd->next) { + if ((pd->probe = malloc(sizeof(*pd->probe))) == NULL) { + usdt_error(provider, USDT_ERROR_MALLOC); + return (-1); + } + } + + if ((usdt_strtab_init(&strtab, 0)) < 0) { + usdt_error(provider, USDT_ERROR_MALLOC); + return (-1); + } + + if ((usdt_strtab_add(&strtab, provider->name)) == 0) { + usdt_error(provider, USDT_ERROR_MALLOC); + return (-1); + } + + if ((usdt_dof_probes_sect(§s[0], provider, &strtab)) < 0) + return (-1); + if ((usdt_dof_prargs_sect(§s[1], provider)) < 0) + return (-1); + + size = usdt_provider_dof_size(provider, &strtab); + if ((file = usdt_dof_file_init(provider, size)) == NULL) + return (-1); + + if ((usdt_dof_proffs_sect(§s[2], provider, file->dof)) < 0) + return (-1); + if ((usdt_dof_prenoffs_sect(§s[3], provider, file->dof)) < 0) + return (-1); + if ((usdt_dof_provider_sect(§s[4], provider)) < 0) + return (-1); + + for (i = 0; i < 5; i++) + usdt_dof_file_append_section(file, §s[i]); + + usdt_dof_file_generate(file, &strtab); + + usdt_dof_section_free((usdt_dof_section_t *)&strtab); + for (i = 0; i < 5; i++) + usdt_dof_section_free(§s[i]); + + if ((usdt_dof_file_load(file, provider->module)) < 0) { + usdt_error(provider, USDT_ERROR_LOADDOF, strerror(errno)); + return (-1); + } + + provider->enabled = 1; + provider->file = file; + + return (0); +} + +int +usdt_provider_disable(usdt_provider_t *provider) +{ + usdt_probedef_t *pd; + + if (provider->enabled == 0) + return (0); + + if ((usdt_dof_file_unload((usdt_dof_file_t *)provider->file)) < 0) { + usdt_error(provider, USDT_ERROR_UNLOADDOF, strerror(errno)); + return (-1); + } + + usdt_dof_file_free(provider->file); + provider->file = NULL; + + /* We would like to free the tracepoints here too, but OS X + * (and to a lesser extent Illumos) struggle with this: + * + * If a provider is repeatedly disabled and re-enabled, and is + * allowed to reuse the same memory for its tracepoints, *and* + * there's a DTrace consumer running with enablings for these + * probes, tracepoints are not always cleaned up sufficiently + * that the newly-created probes work. + * + * Here, then, we will leak the memory holding the + * tracepoints, which serves to stop us reusing the same + * memory address for new tracepoints, avoiding the bug. + */ + + for (pd = provider->probedefs; (pd != NULL); pd = pd->next) { + /* may have an as yet never-enabled probe on an + otherwise enabled provider */ + if (pd->probe) { + /* usdt_free_tracepoints(pd->probe); */ + free(pd->probe); + pd->probe = NULL; + } + } + + provider->enabled = 0; + + return (0); +} + +void +usdt_provider_free(usdt_provider_t *provider) +{ + usdt_probedef_t *pd, *next; + + for (pd = provider->probedefs; pd != NULL; pd = next) { + next = pd->next; + free_probedef(pd); + } + + free((char *)provider->name); + free((char *)provider->module); + free(provider); +} + +int +usdt_is_enabled(usdt_probe_t *probe) +{ + if (probe != NULL) + return (*probe->isenabled_addr)(); + else + return 0; +} + +void +usdt_fire_probe(usdt_probe_t *probe, size_t argc, void **nargv) +{ + if (probe != NULL) + usdt_probe_args(probe->probe_addr, argc, nargv); +} + +static void +usdt_verror(usdt_provider_t *provider, usdt_error_t error, va_list argp) +{ + vasprintf(&provider->error, usdt_errors[error], argp); +} + +void +usdt_error(usdt_provider_t *provider, usdt_error_t error, ...) +{ + va_list argp; + + va_start(argp, error); + usdt_verror(provider, error, argp); + va_end(argp); +} + +char * +usdt_errstr(usdt_provider_t *provider) +{ + return (provider->error); +} diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/usdt.h b/datalab/web/node_modules/dtrace-provider/libusdt/usdt.h new file mode 100644 index 0000000000000000000000000000000000000000..69b4e901a48f45811cf7721ade447bb9aade80b5 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/usdt.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +#include +#include + +#define USDT_ARG_MAX 32 + +typedef enum usdt_error { + USDT_ERROR_MALLOC = 0, + USDT_ERROR_VALLOC, + USDT_ERROR_NOPROBES, + USDT_ERROR_LOADDOF, + USDT_ERROR_ALREADYENABLED, + USDT_ERROR_UNLOADDOF, + USDT_ERROR_DUP_PROBE, + USDT_ERROR_REMOVE_PROBE +} usdt_error_t; + +typedef struct usdt_probe { + int (*isenabled_addr)(void); + void *probe_addr; +} usdt_probe_t; + +int usdt_is_enabled(usdt_probe_t *probe); +void usdt_fire_probe(usdt_probe_t *probe, size_t argc, void **argv); + +typedef struct usdt_probedef { + const char *name; + const char *function; + size_t argc; + char *types[USDT_ARG_MAX]; + struct usdt_probe *probe; + struct usdt_probedef *next; + int refcnt; +} usdt_probedef_t; + +usdt_probedef_t *usdt_create_probe(const char *func, const char *name, + size_t argc, const char **types); +void usdt_probe_release(usdt_probedef_t *probedef); + +typedef struct usdt_provider { + const char *name; + const char *module; + usdt_probedef_t *probedefs; + char *error; + int enabled; + void *file; +} usdt_provider_t; + +usdt_provider_t *usdt_create_provider(const char *name, const char *module); +int usdt_provider_add_probe(usdt_provider_t *provider, usdt_probedef_t *probedef); +int usdt_provider_remove_probe(usdt_provider_t *provider, usdt_probedef_t *probedef); +int usdt_provider_enable(usdt_provider_t *provider); +int usdt_provider_disable(usdt_provider_t *provider); +void usdt_provider_free(usdt_provider_t *provider); + +void usdt_error(usdt_provider_t *provider, usdt_error_t error, ...); +char *usdt_errstr(usdt_provider_t *provider); + diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/usdt_dof.c b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_dof.c new file mode 100644 index 0000000000000000000000000000000000000000..633fb697669c5004ab5221b01af14e874776d626 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_dof.c @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +#include "usdt_internal.h" + +int +usdt_dof_section_add_data(usdt_dof_section_t *section, void *data, size_t length) +{ + int newlen = section->size + length; + + if ((section->data = realloc((char *)section->data, newlen)) == NULL) + return (-1); + + memcpy(section->data + section->size, data, length); + section->size = newlen; + return (0); +} + +size_t +usdt_provider_dof_size(usdt_provider_t *provider, usdt_strtab_t *strtab) +{ + uint8_t i, j; + int args = 0; + int probes = 0; + size_t size = 0; + usdt_probedef_t *pd; + size_t sections[8]; + + for (pd = provider->probedefs; pd != NULL; pd = pd->next) { + args += pd->argc; + probes++; + } + + sections[0] = sizeof(dof_hdr_t); + sections[1] = sizeof(dof_sec_t) * 6; + sections[2] = strtab->size; + sections[3] = sizeof(dof_probe_t) * probes; + sections[4] = sizeof(uint8_t) * args; + sections[5] = sizeof(uint32_t) * probes; + sections[6] = sizeof(uint32_t) * probes; + sections[7] = sizeof(dof_provider_t); + + for (i = 0; i < 8; i++) { + size += sections[i]; + j = size % 8; + if (j > 0) + size += (8 - j); + } + + return size; +} + +int +usdt_dof_section_init(usdt_dof_section_t *section, uint32_t type, dof_secidx_t index) +{ + section->type = type; + section->index = index; + section->flags = DOF_SECF_LOAD; + section->offset = 0; + section->size = 0; + section->entsize = 0; + section->pad = 0; + section->next = NULL; + + if ((section->data = malloc(1)) == NULL) + return (-1); + + switch(type) { + case DOF_SECT_PROBES: section->align = 8; break; + case DOF_SECT_PRARGS: section->align = 1; break; + case DOF_SECT_PROFFS: section->align = 4; break; + case DOF_SECT_PRENOFFS: section->align = 4; break; + case DOF_SECT_PROVIDER: section->align = 4; break; + } + + return (0); +} + +void +usdt_dof_section_free(usdt_dof_section_t *section) +{ + free(section->data); +} + +int +usdt_strtab_init(usdt_strtab_t *strtab, dof_secidx_t index) +{ + strtab->type = DOF_SECT_STRTAB;; + strtab->index = index; + strtab->flags = DOF_SECF_LOAD; + strtab->offset = 0; + strtab->size = 0; + strtab->entsize = 0; + strtab->pad = 0; + strtab->data = NULL; + strtab->align = 1; + strtab->strindex = 1; + + if ((strtab->data = (char *) malloc(1)) == NULL) + return (-1); + + *strtab->data = '\0'; + + return (0); +} + +dof_stridx_t +usdt_strtab_add(usdt_strtab_t *strtab, const char *string) +{ + size_t length; + int index; + + length = strlen(string); + index = strtab->strindex; + strtab->strindex += (length + 1); + + if ((strtab->data = realloc(strtab->data, strtab->strindex)) == NULL) + return (0); + + memcpy((char *) (strtab->data + index), (char *)string, length + 1); + strtab->size = index + length + 1; + + return (index); +} + diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/usdt_dof_file.c b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_dof_file.c new file mode 100644 index 0000000000000000000000000000000000000000..1c0b4f8a4897c69931f056f3e2d7c77abfc8f61d --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_dof_file.c @@ -0,0 +1,290 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +#include "usdt_internal.h" + +#include + +static uint8_t +dof_version(uint8_t header_version) +{ + uint8_t dof_version; + /* DOF versioning: Apple always needs version 3, but Solaris can use + 1 or 2 depending on whether is-enabled probes are needed. */ +#ifdef __APPLE__ + dof_version = DOF_VERSION_3; +#else + switch(header_version) { + case 1: + dof_version = DOF_VERSION_1; + break; + case 2: + dof_version = DOF_VERSION_2; + break; + default: + dof_version = DOF_VERSION; + } +#endif + return dof_version; +} + +#ifdef __APPLE__ +static const char *helper = "/dev/dtracehelper"; + +static int +load_dof(int fd, dof_helper_t *dh) +{ + int ret; + uint8_t buffer[sizeof(dof_ioctl_data_t) + sizeof(dof_helper_t)]; + dof_ioctl_data_t* ioctlData = (dof_ioctl_data_t*)buffer; + user_addr_t val; + + ioctlData->dofiod_count = 1; + memcpy(&ioctlData->dofiod_helpers[0], dh, sizeof(dof_helper_t)); + + val = (user_addr_t)(unsigned long)ioctlData; + ret = ioctl(fd, DTRACEHIOC_ADDDOF, &val); + + if (ret < 0) + return ret; + + return (int)(ioctlData->dofiod_helpers[0].dofhp_dof); +} + +#else /* Solaris and FreeBSD */ + +/* ignore Sol10 GA ... */ +static const char *helper = "/dev/dtrace/helper"; + +static int +load_dof(int fd, dof_helper_t *dh) +{ + int ret; + + ret = ioctl(fd, DTRACEHIOC_ADDDOF, dh); +#if defined(__FreeBSD__) && __FreeBSD__ <= 10 + if (ret != -1) + ret = dh ->gen; +#endif + return ret; +} + +#endif + +static void +pad_section(usdt_dof_section_t *sec) +{ + size_t i, pad; + + if (sec->align > 1) { + i = sec->offset % sec->align; + if (i > 0) { + pad = sec->align - i; + sec->offset = (pad + sec->offset); + sec->pad = pad; + } + } +} + +static void +dof_header(dof_hdr_t *header) +{ + int i; + + header->dofh_ident[DOF_ID_MAG0] = DOF_MAG_MAG0; + header->dofh_ident[DOF_ID_MAG1] = DOF_MAG_MAG1; + header->dofh_ident[DOF_ID_MAG2] = DOF_MAG_MAG2; + header->dofh_ident[DOF_ID_MAG3] = DOF_MAG_MAG3; + + header->dofh_ident[DOF_ID_MODEL] = DOF_MODEL_NATIVE; + header->dofh_ident[DOF_ID_ENCODING] = DOF_ENCODE_NATIVE; + header->dofh_ident[DOF_ID_VERSION] = dof_version(2); + header->dofh_ident[DOF_ID_DIFVERS] = DIF_VERSION; + header->dofh_ident[DOF_ID_DIFIREG] = DIF_DIR_NREGS; + header->dofh_ident[DOF_ID_DIFTREG] = DIF_DTR_NREGS; + + for (i = DOF_ID_PAD; i < DOF_ID_SIZE; i++) + header->dofh_ident[i] = 0; + + header->dofh_flags = 0; + + header->dofh_hdrsize = sizeof(dof_hdr_t); + header->dofh_secsize = sizeof(dof_sec_t); + header->dofh_secoff = sizeof(dof_hdr_t); + + header->dofh_loadsz = 0; + header->dofh_filesz = 0; + header->dofh_pad = 0; +} + +static size_t +add_header(usdt_dof_file_t *file, size_t offset, usdt_dof_section_t *section) +{ + dof_sec_t header; + + header.dofs_flags = section->flags; + header.dofs_type = section->type; + header.dofs_offset = section->offset; + header.dofs_size = section->size; + header.dofs_entsize = section->entsize; + header.dofs_align = section->align; + + memcpy((file->dof + offset), &header, sizeof(dof_sec_t)); + return (offset + sizeof(dof_sec_t)); +} + +static size_t +add_section(usdt_dof_file_t *file, size_t offset, usdt_dof_section_t *section) +{ + if (section->pad > 0) { + /* maximum padding required is 7 */ + memcpy((file->dof + offset), "\0\0\0\0\0\0\0", section->pad); + offset += section->pad; + } + + memcpy((file->dof + offset), section->data, section->size); + return (offset + section->size); +} + +int +usdt_dof_file_unload(usdt_dof_file_t *file) +{ + int fd, ret; + + if ((fd = open(helper, O_RDWR)) < 0) + return (-1); + +#ifdef __FreeBSD__ + ret = ioctl(fd, DTRACEHIOC_REMOVE, &file->gen); +#else + ret = ioctl(fd, DTRACEHIOC_REMOVE, file->gen); +#endif + + if (ret < 0) + return (-1); + + if ((close(fd)) < 0) + return (-1); + + return (0); +} + +int +usdt_dof_file_load(usdt_dof_file_t *file, const char *module) +{ + dof_helper_t dh; + dof_hdr_t *dof; + int fd; + + dof = (dof_hdr_t *) file->dof; + + dh.dofhp_dof = (uintptr_t)dof; + dh.dofhp_addr = (uintptr_t)dof; +#if __FreeBSD__ >= 11 + dh.dofhp_pid = getpid(); +#endif + (void) strncpy(dh.dofhp_mod, module, sizeof (dh.dofhp_mod)); + + if ((fd = open(helper, O_RDWR)) < 0) + return (-1); + + file->gen = load_dof(fd, &dh); + + if ((close(fd)) < 0) + return (-1); + + if (file->gen < 0) + return (-1); + + return (0); +} + +void +usdt_dof_file_append_section(usdt_dof_file_t *file, usdt_dof_section_t *section) +{ + usdt_dof_section_t *s; + + if (file->sections == NULL) { + file->sections = section; + } + else { + for (s = file->sections; (s->next != NULL); s = s->next) ; + s->next = section; + } +} + +void +usdt_dof_file_generate(usdt_dof_file_t *file, usdt_strtab_t *strtab) +{ + dof_hdr_t header; + uint64_t filesz; + uint64_t loadsz; + usdt_dof_section_t *sec; + size_t offset; + + dof_header(&header); + header.dofh_secnum = 6; + + filesz = sizeof(dof_hdr_t) + (sizeof(dof_sec_t) * header.dofh_secnum); + loadsz = filesz; + + strtab->offset = filesz; + pad_section((usdt_dof_section_t *)strtab); + filesz += strtab->size + strtab->pad; + + if (strtab->flags & 1) + loadsz += strtab->size + strtab->pad; + + for (sec = file->sections; sec != NULL; sec = sec->next) { + sec->offset = filesz; + pad_section(sec); + filesz += sec->size + sec->pad; + if (sec->flags & 1) + loadsz += sec->size + sec->pad; + } + + header.dofh_loadsz = loadsz; + header.dofh_filesz = filesz; + memcpy(file->dof, &header, sizeof(dof_hdr_t)); + + offset = sizeof(dof_hdr_t); + + offset = add_header(file, offset, (usdt_dof_section_t *)strtab); + + for (sec = file->sections; sec != NULL; sec = sec->next) + offset = add_header(file, offset, sec); + + offset = add_section(file, offset, (usdt_dof_section_t *)strtab); + + for (sec = file->sections; sec != NULL; sec = sec->next) + offset = add_section(file, offset, sec); +} + +usdt_dof_file_t * +usdt_dof_file_init(usdt_provider_t *provider, size_t size) +{ + usdt_dof_file_t *file; + + if ((file = malloc(sizeof(*file))) == NULL) { + usdt_error(provider, USDT_ERROR_MALLOC); + return (NULL); + } + + if ((file->dof = valloc(size)) == NULL) { + usdt_error(provider, USDT_ERROR_VALLOC); + return (NULL); + } + + file->sections = NULL; + file->size = size; + + return (file); +} + +void +usdt_dof_file_free(usdt_dof_file_t *file) +{ + free(file->dof); + free(file); +} diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/usdt_dof_sections.c b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_dof_sections.c new file mode 100644 index 0000000000000000000000000000000000000000..9b8cb4e8a3d733e1fff18cb36d0d8c18f56b3991 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_dof_sections.c @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +#include "usdt_internal.h" + +int +usdt_dof_probes_sect(usdt_dof_section_t *probes, + usdt_provider_t *provider, usdt_strtab_t *strtab) +{ + usdt_probedef_t *pd; + dof_probe_t p; + dof_stridx_t type, argv; + uint8_t argc, i; + uint32_t argidx = 0; + uint32_t offidx = 0; + + usdt_dof_section_init(probes, DOF_SECT_PROBES, 1); + + for (pd = provider->probedefs; pd != NULL; pd = pd->next) { + argc = 0; + argv = 0; + type = 0; + + for (i = 0; i < pd->argc; i++) { + type = usdt_strtab_add(strtab, pd->types[i]); + argc++; + if (argv == 0) + argv = type; + } + + if (usdt_create_tracepoints(pd->probe) < 0) { + usdt_error(provider, USDT_ERROR_VALLOC); + return (-1); + } + +#ifdef __x86_64__ + p.dofpr_addr = (uint64_t) pd->probe->isenabled_addr; +#elif __i386__ || __i386 + p.dofpr_addr = (uint32_t) pd->probe->isenabled_addr; +#else +#error "only x86_64 and i386 supported" +#endif + p.dofpr_func = usdt_strtab_add(strtab, pd->function); + p.dofpr_name = usdt_strtab_add(strtab, pd->name); + p.dofpr_nargv = argv; + p.dofpr_xargv = argv; + p.dofpr_argidx = argidx; + p.dofpr_offidx = offidx; + p.dofpr_nargc = argc; + p.dofpr_xargc = argc; + p.dofpr_noffs = 1; + p.dofpr_enoffidx = offidx; + p.dofpr_nenoffs = 1; + p.dofpr_pad1 = 0; + p.dofpr_pad2 = 0; + + usdt_dof_section_add_data(probes, &p, sizeof(dof_probe_t)); + probes->entsize = sizeof(dof_probe_t); + + argidx += argc; + offidx++; + } + + return (0); +} + +int +usdt_dof_prargs_sect(usdt_dof_section_t *prargs, usdt_provider_t *provider) +{ + usdt_probedef_t *pd; + uint8_t i; + + usdt_dof_section_init(prargs, DOF_SECT_PRARGS, 2); + prargs->entsize = 1; + + for (pd = provider->probedefs; pd != NULL; pd = pd->next) { + for (i = 0; i < pd->argc; i++) + usdt_dof_section_add_data(prargs, &i, 1); + } + if (prargs->size == 0) { + i = 0; + if (usdt_dof_section_add_data(prargs, &i, 1) < 0) { + usdt_error(provider, USDT_ERROR_MALLOC); + return (-1); + } + } + + return (0); +} + +int +usdt_dof_proffs_sect(usdt_dof_section_t *proffs, + usdt_provider_t *provider, char *dof) +{ + usdt_probedef_t *pd; + uint32_t off; + + usdt_dof_section_init(proffs, DOF_SECT_PROFFS, 3); + proffs->entsize = 4; + + for (pd = provider->probedefs; pd != NULL; pd = pd->next) { + off = usdt_probe_offset(pd->probe, dof, pd->argc); + if (usdt_dof_section_add_data(proffs, &off, 4) < 0) { + usdt_error(provider, USDT_ERROR_MALLOC); + return (-1); + } + } + + return (0); +} + +int +usdt_dof_prenoffs_sect(usdt_dof_section_t *prenoffs, + usdt_provider_t *provider, char *dof) +{ + usdt_probedef_t *pd; + uint32_t off; + + usdt_dof_section_init(prenoffs, DOF_SECT_PRENOFFS, 4); + prenoffs->entsize = 4; + + for (pd = provider->probedefs; pd != NULL; pd = pd->next) { + off = usdt_is_enabled_offset(pd->probe, dof); + if (usdt_dof_section_add_data(prenoffs, &off, 4) < 0) { + usdt_error(provider, USDT_ERROR_MALLOC); + return (-1); + } + } + + return (0); +} + +int +usdt_dof_provider_sect(usdt_dof_section_t *provider_s, usdt_provider_t *provider) +{ + dof_provider_t p; + + usdt_dof_section_init(provider_s, DOF_SECT_PROVIDER, 5); + + p.dofpv_strtab = 0; + p.dofpv_probes = 1; + p.dofpv_prargs = 2; + p.dofpv_proffs = 3; + p.dofpv_prenoffs = 4; + p.dofpv_name = 1; /* provider name always first strtab entry. */ + + /* + * Stability is something of a hack. Everything is marked * + * "stable" here to permit use of the "args" array, which is * + * needed to access arguments past "arg9". + * + * It should be up to the creator of the provider to decide + * this, though, and it should be possible to set the + * appropriate stability at creation time. + */ + + p.dofpv_provattr = DOF_ATTR(DTRACE_STABILITY_STABLE, + DTRACE_STABILITY_STABLE, + DTRACE_STABILITY_STABLE); + p.dofpv_modattr = DOF_ATTR(DTRACE_STABILITY_STABLE, + DTRACE_STABILITY_STABLE, + DTRACE_STABILITY_STABLE); + p.dofpv_funcattr = DOF_ATTR(DTRACE_STABILITY_STABLE, + DTRACE_STABILITY_STABLE, + DTRACE_STABILITY_STABLE); + p.dofpv_nameattr = DOF_ATTR(DTRACE_STABILITY_STABLE, + DTRACE_STABILITY_STABLE, + DTRACE_STABILITY_STABLE); + p.dofpv_argsattr = DOF_ATTR(DTRACE_STABILITY_STABLE, + DTRACE_STABILITY_STABLE, + DTRACE_STABILITY_STABLE); + + if ((usdt_dof_section_add_data(provider_s, &p, sizeof(p))) < 0) { + usdt_error(provider, USDT_ERROR_MALLOC); + return (-1); + } + + return (0); +} diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/usdt_internal.h b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..25853fbf13c6d2e4460813ea45a54e0323f8aa5a --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_internal.h @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +#ifdef __linux__ +#include +#if __BYTE_ORDER == __LITTLE_ENDIAN +#ifndef _LITTLE_ENDIAN +#define _LITTLE_ENDIAN +#endif +#endif +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define FUNC_SIZE 32 + +#include "usdt.h" + +extern void usdt_tracepoint_isenabled(void); +extern void usdt_tracepoint_probe(void); +extern void usdt_tracepoint_end(void); +extern void usdt_probe_args(void *, int, void**); + +uint32_t usdt_probe_offset(usdt_probe_t *probe, char *dof, uint8_t argc); +uint32_t usdt_is_enabled_offset(usdt_probe_t *probe, char *dof); +int usdt_create_tracepoints(usdt_probe_t *probe); +void usdt_free_tracepoints(usdt_probe_t *probe); + +typedef struct usdt_dof_section { + dof_secidx_t index; + uint32_t type; + uint32_t flags; + uint32_t align; + uint64_t offset; + uint64_t size; + uint32_t entsize; + size_t pad; + struct usdt_dof_section *next; + char *data; +} usdt_dof_section_t; + +int usdt_dof_section_init(usdt_dof_section_t *section, + uint32_t type, dof_secidx_t index); +int usdt_dof_section_add_data(usdt_dof_section_t *section, + void *data, size_t length); +void usdt_dof_section_free(usdt_dof_section_t *section); + +typedef struct usdt_strtab { + dof_secidx_t index; + uint32_t type; + uint32_t flags; + uint32_t align; + uint64_t offset; + uint64_t size; + uint32_t entsize; + size_t pad; + int strindex; + char *data; +} usdt_strtab_t; + +int usdt_strtab_init(usdt_strtab_t *strtab, dof_secidx_t index); +dof_stridx_t usdt_strtab_add(usdt_strtab_t *strtab, const char *string); +char *usdt_strtab_header(usdt_strtab_t *strtab); +size_t usdt_strtab_size(usdt_strtab_t *strtab); + +size_t usdt_provider_dof_size(usdt_provider_t *provider, usdt_strtab_t *strtab); + +typedef struct usdt_dof_file { + char *dof; + int gen; + size_t size; + usdt_dof_section_t *sections; +} usdt_dof_file_t; + +usdt_dof_file_t *usdt_dof_file_init(usdt_provider_t *provider, size_t size); +void usdt_dof_file_append_section(usdt_dof_file_t *file, usdt_dof_section_t *section); +void usdt_dof_file_generate(usdt_dof_file_t *file, usdt_strtab_t *strtab); +int usdt_dof_file_load(usdt_dof_file_t *file, const char *module); +int usdt_dof_file_unload(usdt_dof_file_t *file); +void usdt_dof_file_free(usdt_dof_file_t *file); + +int usdt_dof_probes_sect(usdt_dof_section_t *probes, + usdt_provider_t *provider, usdt_strtab_t *strtab); +int usdt_dof_prargs_sect(usdt_dof_section_t *prargs, + usdt_provider_t *provider); +int usdt_dof_proffs_sect(usdt_dof_section_t *proffs, + usdt_provider_t *provider, char *dof); +int usdt_dof_prenoffs_sect(usdt_dof_section_t *prenoffs, + usdt_provider_t *provider, char *dof); +int usdt_dof_provider_sect(usdt_dof_section_t *provider_s, + usdt_provider_t *provider); + diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/usdt_probe.c b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_probe.c new file mode 100644 index 0000000000000000000000000000000000000000..62aa9c0e7897e5c68cdec21ee3d93e6e0e1b6458 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_probe.c @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +#include "usdt_internal.h" + +#ifdef __APPLE__ + +uint32_t +usdt_probe_offset(usdt_probe_t *probe, char *dof, uint8_t argc) +{ + uint32_t offset; +#ifdef __x86_64__ + offset = ((uint64_t) probe->probe_addr - (uint64_t) dof + 2); +#elif __i386__ + offset = ((uint32_t) probe->probe_addr - (uint32_t) dof + 2); +#else +#error "only x86_64 and i386 supported" +#endif + return (offset); +} + +uint32_t +usdt_is_enabled_offset(usdt_probe_t *probe, char *dof) +{ + uint32_t offset; +#ifdef __x86_64__ + offset = ((uint64_t) probe->isenabled_addr - (uint64_t) dof + 6); +#elif __i386__ + offset = ((uint32_t) probe->isenabled_addr - (uint32_t) dof + 6); +#else +#error "only x86_64 and i386 supported" +#endif + return (offset); +} + +#elif defined __linux__ + +uint32_t +usdt_probe_offset(usdt_probe_t *probe, char *dof, uint8_t argc) +{ + return (16); +} + +uint32_t +usdt_is_enabled_offset(usdt_probe_t *probe, char *dof) +{ + return (10); +} + +#else /* solaris and freebsd */ + +uint32_t +usdt_probe_offset(usdt_probe_t *probe, char *dof, uint8_t argc) +{ + return (16); +} + +uint32_t +usdt_is_enabled_offset(usdt_probe_t *probe, char *dof) +{ + return (8); +} + +#endif + +int +usdt_create_tracepoints(usdt_probe_t *probe) +{ + /* Prepare the tracepoints - for each probe, a separate chunk + * of memory with the tracepoint code copied into it, to give + * us unique addresses for each tracepoint. + * + * On Oracle Linux, this must be an mmapped file because USDT + * probes there are implemented as uprobes, which are + * addressed by inode and offset. The file used is a small + * mkstemp'd file we immediately unlink. + * + * Elsewhere, we can use the heap directly because USDT will + * instrument any memory mapped by the process. + */ + + size_t size; +#ifdef __linux__ + int fd; + char tmp[20] = "/tmp/libusdtXXXXXX"; + + if ((fd = mkstemp(tmp)) < 0) + return (-1); + if (unlink(tmp) < 0) + return (-1); + if (write(fd, "\0", FUNC_SIZE) < FUNC_SIZE) + return (-1); + + probe->isenabled_addr = (int (*)())mmap(NULL, FUNC_SIZE, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE, fd, 0); +#else + probe->isenabled_addr = (int (*)())valloc(FUNC_SIZE); +#endif + if (probe->isenabled_addr == NULL) + return (-1); + + /* ensure that the tracepoints will fit the heap we're allocating */ + size = ((char *)usdt_tracepoint_end - (char *)usdt_tracepoint_isenabled); + assert(size < FUNC_SIZE); + + size = ((char *)usdt_tracepoint_probe - (char *)usdt_tracepoint_isenabled); + probe->probe_addr = (char *)probe->isenabled_addr + size; + + memcpy((void *)probe->isenabled_addr, + (const void *)usdt_tracepoint_isenabled, FUNC_SIZE); + +#ifdef __linux__ + mprotect((void *)probe->isenabled_addr, FUNC_SIZE, + PROT_READ | PROT_EXEC); +#else + mprotect((void *)probe->isenabled_addr, FUNC_SIZE, + PROT_READ | PROT_WRITE | PROT_EXEC); +#endif + + return (0); +} + +void +usdt_free_tracepoints(usdt_probe_t *probe) +{ +#ifdef __linux__ + (void) munmap(probe->isenabled_addr, FUNC_SIZE); +#else + free(probe->isenabled_addr); +#endif +} diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/usdt_tracepoints_i386.s b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_tracepoints_i386.s new file mode 100644 index 0000000000000000000000000000000000000000..64c155b238210f565e8e1aef854985e7aa87b7ac --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_tracepoints_i386.s @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +/* + * Stub functions containing DTrace tracepoints for probes and + * is-enabled probes. These functions are copied for each probe + * dynamically created. + * + */ + .text + + .align 4, 0x90 + .globl usdt_tracepoint_isenabled + .globl _usdt_tracepoint_isenabled + .globl usdt_tracepoint_probe + .globl _usdt_tracepoint_probe + .globl usdt_tracepoint_end + .globl _usdt_tracepoint_end + .globl usdt_probe_args + .globl _usdt_probe_args + +usdt_tracepoint_isenabled: +_usdt_tracepoint_isenabled: + pushl %ebp + movl %esp, %ebp + subl $8, %esp + xorl %eax, %eax + nop + nop + leave + ret +usdt_tracepoint_probe: +_usdt_tracepoint_probe: + nop + nop + nop + nop + nop + addl $0x20,%esp + leave +usdt_tracepoint_end: +_usdt_tracepoint_end: + ret + +/* + * Probe argument marshalling, i386 style + * + */ + +usdt_probe_args: +_usdt_probe_args: + pushl %ebp + movl %esp,%ebp + subl $8,%esp + subl $8,%esp + movl 8(%ebp),%edx + movl 0xc(%ebp),%ecx + test %ecx,%ecx + je fire +args: movl %ecx,%eax + sal $2,%eax + subl $4,%eax + addl 0x10(%ebp),%eax + pushl (%eax) + dec %ecx + jne args +fire: jmp *%edx + diff --git a/datalab/web/node_modules/dtrace-provider/libusdt/usdt_tracepoints_x86_64.s b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_tracepoints_x86_64.s new file mode 100644 index 0000000000000000000000000000000000000000..7db093fd237f9ab2e8b7533da2020cc780aac932 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/libusdt/usdt_tracepoints_x86_64.s @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2012, Chris Andrews. All rights reserved. + */ + +/* + * Stub functions containing DTrace tracepoints for probes and + * is-enabled probes. These functions are copied for each probe + * dynamically created. + * + */ + .text + + .align 4, 0x90 + .globl usdt_tracepoint_isenabled + .globl _usdt_tracepoint_isenabled + .globl usdt_tracepoint_probe + .globl _usdt_tracepoint_probe + .globl usdt_tracepoint_end + .globl _usdt_tracepoint_end + .globl usdt_probe_args + .globl _usdt_probe_args + +usdt_tracepoint_isenabled: +_usdt_tracepoint_isenabled: + pushq %rbp + movq %rsp, %rbp + addq $1, %rax + xorq %rax, %rax + nop + nop + leave + ret +usdt_tracepoint_probe: +_usdt_tracepoint_probe: + nop + nop + nop + nop + nop + addq %r14,%rsp + popq %rbx + popq %r14 + popq %r13 + popq %r12 + leave +usdt_tracepoint_end: +_usdt_tracepoint_end: + ret + +/* + * Probe argument marshalling, x86_64 style + * + */ + +usdt_probe_args: +_usdt_probe_args: + pushq %rbp + movq %rsp,%rbp + pushq %r12 + pushq %r13 + pushq %r14 + pushq %rbx + + movq %rdi,%r12 + movq %rsi,%rbx + movq %rdx,%r11 + movq $0,%r14 + + test %rbx,%rbx + je fire + movq (%r11),%rdi + dec %rbx + test %rbx,%rbx + je fire + addq $8,%r11 + movq (%r11),%rsi + dec %rbx + test %rbx,%rbx + je fire + addq $8,%r11 + movq (%r11),%rdx + dec %rbx + test %rbx,%rbx + je fire + addq $8,%r11 + movq (%r11),%rcx + dec %rbx + test %rbx,%rbx + je fire + addq $8,%r11 + movq (%r11),%r8 + dec %rbx + test %rbx,%rbx + je fire + addq $8,%r11 + movq (%r11),%r9 + + movq %rbx,%r13 +morestack: + dec %rbx + test %rbx,%rbx + je args + subq $16,%rsp + addq $16,%r14 + dec %rbx + test %rbx,%rbx + je args + jmp morestack + +args: + movq %r13,%rbx + movq $0,%r13 +moreargs: + dec %rbx + test %rbx,%rbx + je fire + addq $8,%r11 + movq (%r11),%rax + movq %rax,(%rsp,%r13) + addq $8,%r13 + jmp moreargs + +fire: jmp *%r12 diff --git a/datalab/web/node_modules/dtrace-provider/package.json b/datalab/web/node_modules/dtrace-provider/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6e54d27d0df97a2c3c71f6b5d4ad0f50d9e35a56 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/package.json @@ -0,0 +1,33 @@ +{ + "name": "dtrace-provider", + "version": "0.8.7", + "description": "Native DTrace providers for node.js applications", + "keywords": [ + "dtrace", + "usdt" + ], + "homepage": "https://github.com/chrisa/node-dtrace-provider#readme", + "license": "BSD-2-Clause", + "author": { + "name": "Chris Andrews", + "email": "chris@nodnol.org" + }, + "repository": { + "type": "git", + "url": "https://github.com/chrisa/node-dtrace-provider.git" + }, + "engines": { + "node": ">=0.10" + }, + "dependencies": { + "nan": "^2.10.0" + }, + "devDependencies": { + "tap": "0.7.1" + }, + "scripts": { + "install": "node-gyp rebuild || node suppress-error.js", + "test": "tap test/*.test.js" + }, + "main": "./dtrace-provider.js" +} diff --git a/datalab/web/node_modules/dtrace-provider/src/binding.gyp b/datalab/web/node_modules/dtrace-provider/src/binding.gyp new file mode 100644 index 0000000000000000000000000000000000000000..b17688ea831a9a8604540dabd631c70d8b7b866d --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/src/binding.gyp @@ -0,0 +1,47 @@ +{ + 'conditions' : [ + ['OS=="mac" or OS=="solaris"', { + 'variables': { + 'escaped_root': ' + +namespace node { + + using namespace v8; + + // Integer Argument + +#ifdef __x86_64__ +# define INTMETHOD ToInteger() +#else +# define INTMETHOD ToInt32() +#endif + + void * DTraceIntegerArgument::ArgumentValue(v8::Local value) { + if (value->IsUndefined()) + return 0; + else + return (void *)(long) value->INTMETHOD->Value(); + } + + void DTraceIntegerArgument::FreeArgument(void *arg) { + } + + const char * DTraceIntegerArgument::Type() { + return "int"; + } + + // String Argument + + void * DTraceStringArgument::ArgumentValue(v8::Local value) { + if (value->IsUndefined()) + return (void *) strdup("undefined"); + + String::Utf8Value str(value->ToString()); + return (void *) strdup(*str); + } + + void DTraceStringArgument::FreeArgument(void *arg) { + free(arg); + } + + const char * DTraceStringArgument::Type() { + return "char *"; + } + + // JSON Argument + + DTraceJsonArgument::DTraceJsonArgument() { + Nan::HandleScope scope; + v8::Local context = Nan::GetCurrentContext(); + v8::Local global = context->Global(); + v8::Local l_JSON = global->Get(Nan::New("JSON").ToLocalChecked())->ToObject(); + v8::Local l_JSON_stringify + = v8::Local::Cast(l_JSON->Get(Nan::New("stringify").ToLocalChecked())); + JSON.Reset(l_JSON); + JSON_stringify.Reset(l_JSON_stringify); + } + + DTraceJsonArgument::~DTraceJsonArgument() { + JSON.Reset(); + JSON_stringify.Reset(); + } + + void * DTraceJsonArgument::ArgumentValue(v8::Local value) { + Nan::HandleScope scope; + + if (value->IsUndefined()) + return (void *) strdup("undefined"); + + v8::Local info[1]; + info[0] = value; + v8::Local j = Nan::New(JSON_stringify)->Call( + Nan::New(JSON), 1, info); + + if (*j == NULL) + return (void *) strdup("{ \"error\": \"stringify failed\" }"); + + String::Utf8Value json(j->ToString()); + return (void *) strdup(*json); + } + + void DTraceJsonArgument::FreeArgument(void *arg) { + free(arg); + } + + const char * DTraceJsonArgument::Type() { + return "char *"; + } + +} // namespace node diff --git a/datalab/web/node_modules/dtrace-provider/src/dtrace_probe.cc b/datalab/web/node_modules/dtrace-provider/src/dtrace_probe.cc new file mode 100644 index 0000000000000000000000000000000000000000..32192b9710bb54c01d06d4f85244179db82ed3d6 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/src/dtrace_probe.cc @@ -0,0 +1,105 @@ +#include "dtrace_provider.h" +#include + +namespace node { + + using namespace v8; + + DTraceProbe::DTraceProbe() : Nan::ObjectWrap() { + argc = 0; + probedef = NULL; + } + + DTraceProbe::~DTraceProbe() { + for (size_t i = 0; i < argc; i++) + delete(this->arguments[i]); + usdt_probe_release(probedef); + } + + Nan::Persistent DTraceProbe::constructor_template; + + void DTraceProbe::Initialize(v8::Local target) { + Nan::HandleScope scope; + + Local t = Nan::New(DTraceProbe::New); + t->InstanceTemplate()->SetInternalFieldCount(2); + t->SetClassName(Nan::New("DTraceProbe").ToLocalChecked()); + constructor_template.Reset(t); + + Nan::SetPrototypeMethod(t, "fire", DTraceProbe::Fire); + + target->Set(Nan::New("DTraceProbe").ToLocalChecked(), t->GetFunction()); + } + + NAN_METHOD(DTraceProbe::New) { + Nan::HandleScope scope; + DTraceProbe *probe = new DTraceProbe(); + probe->Wrap(info.This()); + info.GetReturnValue().Set(info.This()); + } + + NAN_METHOD(DTraceProbe::Fire) { + Nan::HandleScope scope; + + if (!info[0]->IsFunction()) { + Nan::ThrowTypeError("Must give probe value callback as first argument"); + return; + } + + DTraceProbe *pd = Nan::ObjectWrap::Unwrap(info.Holder()); + info.GetReturnValue().Set(pd->_fire(info, 0)); + } + + v8::Local DTraceProbe::_fire(Nan::NAN_METHOD_ARGS_TYPE argsinfo, size_t fnidx) { + Nan::HandleScope scope; + + if (usdt_is_enabled(this->probedef->probe) == 0) { + return Nan::Undefined(); + } + + // invoke fire callback + Nan::TryCatch try_catch; + + size_t cblen = argsinfo.Length() - fnidx - 1; + Local *cbargs = new Local[cblen]; + + for (size_t i = 0; i < cblen; i++) { + cbargs[i] = argsinfo[i + fnidx + 1]; + } + + Local cb = Local::Cast(argsinfo[fnidx]); + Local probe_args = cb->Call(this->handle(), cblen, cbargs); + + delete [] cbargs; + + // exception in args callback? + if (try_catch.HasCaught()) { + Nan::FatalException(try_catch); + return Nan::Undefined(); + } + + // check return + if (!probe_args->IsArray()) { + return Nan::Undefined(); + } + + Local a = Local::Cast(probe_args); + void *argv[USDT_ARG_MAX]; + + // convert each argument value + for (size_t i = 0; i < argc; i++) { + argv[i] = this->arguments[i]->ArgumentValue(a->Get(i)); + } + + // finally fire the probe + usdt_fire_probe(this->probedef->probe, argc, argv); + + // free argument values + for (size_t i = 0; i < argc; i++) { + this->arguments[i]->FreeArgument(argv[i]); + } + + return Nan::True(); + } + +} // namespace node diff --git a/datalab/web/node_modules/dtrace-provider/src/dtrace_provider.cc b/datalab/web/node_modules/dtrace-provider/src/dtrace_provider.cc new file mode 100644 index 0000000000000000000000000000000000000000..b7ec867936aec65fe397104a776680934a859271 --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/src/dtrace_provider.cc @@ -0,0 +1,225 @@ +#include "dtrace_provider.h" +#include + +#include + +namespace node { + + using namespace v8; + + DTraceProvider::DTraceProvider() : Nan::ObjectWrap() { + provider = NULL; + } + + DTraceProvider::~DTraceProvider() { + usdt_provider_disable(provider); + usdt_provider_free(provider); + } + + Nan::Persistent DTraceProvider::constructor_template; + + void DTraceProvider::Initialize(v8::Local target) { + Nan::HandleScope scope; + + Local t = Nan::New(DTraceProvider::New); + t->InstanceTemplate()->SetInternalFieldCount(1); + t->SetClassName(Nan::New("DTraceProvider").ToLocalChecked()); + constructor_template.Reset(t); + + Nan::SetPrototypeMethod(t, "addProbe", DTraceProvider::AddProbe); + Nan::SetPrototypeMethod(t, "removeProbe", DTraceProvider::RemoveProbe); + Nan::SetPrototypeMethod(t, "enable", DTraceProvider::Enable); + Nan::SetPrototypeMethod(t, "disable", DTraceProvider::Disable); + Nan::SetPrototypeMethod(t, "fire", DTraceProvider::Fire); + + target->Set(Nan::New("DTraceProvider").ToLocalChecked(), t->GetFunction()); + + DTraceProbe::Initialize(target); + } + + NAN_METHOD(DTraceProvider::New) { + Nan::HandleScope scope; + DTraceProvider *p = new DTraceProvider(); + char module[128]; + + p->Wrap(info.This()); + + if (info.Length() < 1 || !info[0]->IsString()) { + Nan::ThrowTypeError("Must give provider name as argument"); + return; + } + + String::Utf8Value name(info[0]->ToString()); + + if (info.Length() == 2) { + if (!info[1]->IsString()) { + Nan::ThrowTypeError("Must give module name as argument"); + return; + } + + String::Utf8Value mod(info[1]->ToString()); + (void) snprintf(module, sizeof (module), "%s", *mod); + } else if (info.Length() == 1) { + // If no module name is provided, develop a synthetic module name based + // on our address + (void) snprintf(module, sizeof (module), "mod-%p", p); + } else { + Nan::ThrowError("Expected only provider name and module as arguments"); + return; + } + + if ((p->provider = usdt_create_provider(*name, module)) == NULL) { + Nan::ThrowError("usdt_create_provider failed"); + return; + } + + info.GetReturnValue().Set(info.This()); + } + + NAN_METHOD(DTraceProvider::AddProbe) { + Nan::HandleScope scope; + const char *types[USDT_ARG_MAX]; + + v8::Local obj = info.Holder(); + DTraceProvider *provider = Nan::ObjectWrap::Unwrap(obj); + + // create a DTraceProbe object + v8::Local klass = + Nan::New(DTraceProbe::constructor_template)->GetFunction(); + v8::Local pd = Nan::NewInstance(klass).ToLocalChecked(); + + // store in provider object + DTraceProbe *probe = Nan::ObjectWrap::Unwrap(pd->ToObject()); + obj->Set(info[0]->ToString(), pd); + + // reference the provider to avoid GC'ing it when only probes remain in scope. + Nan::ForceSet(pd, Nan::New("__prov__").ToLocalChecked(), obj, + static_cast(DontEnum | ReadOnly | DontDelete)); + + // add probe to provider + for (int i = 0; i < USDT_ARG_MAX; i++) { + if (i < info.Length() - 1) { + String::Utf8Value type(info[i + 1]->ToString()); + + if (strncmp("json", *type, 4) == 0) + probe->arguments[i] = new DTraceJsonArgument(); + else if (strncmp("char *", *type, 6) == 0) + probe->arguments[i] = new DTraceStringArgument(); + else if (strncmp("int", *type, 3) == 0) + probe->arguments[i] = new DTraceIntegerArgument(); + else + probe->arguments[i] = new DTraceStringArgument(); + + types[i] = strdup(probe->arguments[i]->Type()); + probe->argc++; + } + } + + String::Utf8Value name(info[0]->ToString()); + probe->probedef = usdt_create_probe(*name, *name, probe->argc, types); + Nan::SetInternalFieldPointer(pd, 1, provider); + usdt_provider_add_probe(provider->provider, probe->probedef); + + for (size_t i = 0; i < probe->argc; i++) { + free((char *)types[i]); + } + + info.GetReturnValue().Set(pd); + } + + NAN_METHOD(DTraceProvider::RemoveProbe) { + Nan::HandleScope scope; + + v8::Local provider_obj = info.Holder(); + DTraceProvider *provider = Nan::ObjectWrap::Unwrap(provider_obj); + + v8::Local probe_obj = Local::Cast(info[0]); + DTraceProbe *probe = Nan::ObjectWrap::Unwrap(probe_obj); + + v8::Local name = Nan::New(probe->probedef->name).ToLocalChecked(); + provider_obj->Delete(name); + + if (usdt_provider_remove_probe(provider->provider, probe->probedef) != 0) { + Nan::ThrowError(usdt_errstr(provider->provider)); + return; + } + + info.GetReturnValue().Set(Nan::True()); + } + + NAN_METHOD(DTraceProvider::Enable) { + Nan::HandleScope scope; + DTraceProvider *provider = Nan::ObjectWrap::Unwrap(info.Holder()); + + if (usdt_provider_enable(provider->provider) != 0) { + Nan::ThrowError(usdt_errstr(provider->provider)); + return; + } + + return; + } + + NAN_METHOD(DTraceProvider::Disable) { + Nan::HandleScope scope; + DTraceProvider *provider = Nan::ObjectWrap::Unwrap(info.Holder()); + + if (usdt_provider_disable(provider->provider) != 0) { + Nan::ThrowError(usdt_errstr(provider->provider)); + return; + } + + return; + } + + NAN_METHOD(DTraceProvider::Fire) { + Nan::HandleScope scope; + + if (!info[0]->IsString()) { + Nan::ThrowTypeError("Must give probe name as first argument"); + return; + } + + if (!info[1]->IsFunction()) { + Nan::ThrowTypeError("Must give probe value callback as second argument"); + return; + } + + v8::Local holder = info.Holder(); + DTraceProvider *provider = Nan::ObjectWrap::Unwrap(holder); + + Nan::MaybeLocal maybe = Nan::Get(holder, info[0]); + if (maybe.IsEmpty()) { + return; + } + + v8::Local value = maybe.ToLocalChecked(); + if (!value->IsObject()) { + return; + } + + v8::Local probe = Local::Cast(value); + if (probe->InternalFieldCount() != 2) { + return; + } + + if (Nan::GetInternalFieldPointer(probe, 1) != provider) { + return; + } + + DTraceProbe *p = Nan::ObjectWrap::Unwrap(probe); + if (p == NULL) { + return; + } + + p->_fire(info, 1); + + info.GetReturnValue().Set(Nan::True()); + } + + extern "C" void + init(v8::Local target) { + DTraceProvider::Initialize(target); + } + + NODE_MODULE(DTraceProviderBindings, init) +} // namespace node diff --git a/datalab/web/node_modules/dtrace-provider/src/dtrace_provider.h b/datalab/web/node_modules/dtrace-provider/src/dtrace_provider.h new file mode 100644 index 0000000000000000000000000000000000000000..ac7e6177fed2c32416c1afa7c5f158b4baac39fc --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/src/dtrace_provider.h @@ -0,0 +1,102 @@ +#include +#include + +extern "C" { +#include +} + +#include +#include +#include + +#include +#include +#include +#include + +#ifndef __APPLE__ +#include +#ifndef __FreeBSD__ +#include +#endif +#endif + +namespace node { + + using namespace v8; + + class DTraceArgument { + public: + virtual const char *Type() = 0; + virtual void *ArgumentValue(v8::Local) = 0; + virtual void FreeArgument(void *) = 0; + virtual ~DTraceArgument() { }; + }; + + class DTraceIntegerArgument : public DTraceArgument { + public: + const char *Type(); + void *ArgumentValue(v8::Local); + void FreeArgument(void *); + }; + + class DTraceStringArgument : public DTraceArgument { + public: + const char *Type(); + void *ArgumentValue(v8::Local); + void FreeArgument(void *); + }; + + class DTraceJsonArgument : public DTraceArgument { + public: + const char *Type(); + void *ArgumentValue(v8::Local); + void FreeArgument(void *); + DTraceJsonArgument(); + ~DTraceJsonArgument(); + private: + Nan::Persistent JSON; + Nan::Persistent JSON_stringify; + }; + + class DTraceProbe : public Nan::ObjectWrap { + + public: + static void Initialize(v8::Local target); + usdt_probedef_t *probedef; + size_t argc; + DTraceArgument *arguments[USDT_ARG_MAX]; + + static NAN_METHOD(New); + static NAN_METHOD(Fire); + + v8::Local _fire(Nan::NAN_METHOD_ARGS_TYPE, size_t); + + static Nan::Persistent constructor_template; + + DTraceProbe(); + ~DTraceProbe(); + private: + }; + + class DTraceProvider : public Nan::ObjectWrap { + + public: + static void Initialize(v8::Local target); + usdt_provider_t *provider; + + static NAN_METHOD(New); + static NAN_METHOD(AddProbe); + static NAN_METHOD(RemoveProbe); + static NAN_METHOD(Enable); + static NAN_METHOD(Disable); + static NAN_METHOD(Fire); + + DTraceProvider(); + ~DTraceProvider(); + private: + static Nan::Persistent constructor_template; + }; + + void InitDTraceProvider(v8::Local target); +} diff --git a/datalab/web/node_modules/dtrace-provider/suppress-error.js b/datalab/web/node_modules/dtrace-provider/suppress-error.js new file mode 100644 index 0000000000000000000000000000000000000000..cdb37906d62ce63117d052c51e31ca62b72ef68e --- /dev/null +++ b/datalab/web/node_modules/dtrace-provider/suppress-error.js @@ -0,0 +1,28 @@ +/** + * During `npm install`, we run: + * + * node-gyp rebuild || node suppress-error.js + * + * (Note that this expression is written to work on *nix and Windows.) + * + * When we run node-gyp, we detect whether or not we're on a supported platform, + * and either compile the node addon or exit having done nothing. It's possible + * for the platform to lack the requirements to run node-gyp though (such as + * Python 2, make, Visual C++ Build Tools, and so on), in which case we fall + * back onto this script. + * + * If NODE_DTRACE_PROVIDER_REQUIRE is set to "hard", then we want to propagate + * the failure and stop the install. Otherwise, we want to suppress it and + * allow the program to fall back onto the stub code. + * + * There is one case where we might stop an install and not want to: on Debian + * and Ubuntu, where the binary is named "nodejs" instead of "node", the + * fallback will fail to run. There doesn't really seem to be a great way to + * handle this scenario, so users on those systems will need to either install + * node-gyp's requirements or set up a "node" symbolic link. + */ +if (process.env.NODE_DTRACE_PROVIDER_REQUIRE === 'hard') { + process.exit(1); +} else { + process.exit(0); +} diff --git a/datalab/web/node_modules/engine.io-client/LICENSE b/datalab/web/node_modules/engine.io-client/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..b248ba1bc58ee725286db72e7fcfd4674fe063eb --- /dev/null +++ b/datalab/web/node_modules/engine.io-client/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2015 Automattic + +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. diff --git a/datalab/web/node_modules/engine.io-client/README.md b/datalab/web/node_modules/engine.io-client/README.md new file mode 100644 index 0000000000000000000000000000000000000000..7e335a3608b0432886eeff74b7826c48fc69a8c8 --- /dev/null +++ b/datalab/web/node_modules/engine.io-client/README.md @@ -0,0 +1,299 @@ + +# Engine.IO client + +[![Build Status](https://travis-ci.org/socketio/engine.io-client.svg?branch=master)](http://travis-ci.org/socketio/engine.io-client) +[![NPM version](https://badge.fury.io/js/engine.io-client.svg)](http://badge.fury.io/js/engine.io-client) + +This is the client for [Engine.IO](http://github.com/socketio/engine.io), +the implementation of transport-based cross-browser/cross-device +bi-directional communication layer for [Socket.IO](http://github.com/socketio/socket.io). + +## How to use + +### Standalone + +You can find an `engine.io.js` file in this repository, which is a +standalone build you can use as follows: + +```html + + +``` + +### With browserify + +Engine.IO is a commonjs module, which means you can include it by using +`require` on the browser and package using [browserify](http://browserify.org/): + +1. install the client package + + ```bash + $ npm install engine.io-client + ``` + +1. write your app code + + ```js + var socket = require('engine.io-client')('ws://localhost'); + socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); + }); + ``` + +1. build your app bundle + + ```bash + $ browserify app.js > bundle.js + ``` + +1. include on your page + + ```html + + ``` + +### Sending and receiving binary + +```html + + +``` + +### Node.JS + +Add `engine.io-client` to your `package.json` and then: + +```js +var socket = require('engine.io-client')('ws://localhost'); +socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); +}); +``` + +### Node.js with certificates +```js +var opts = { + key: fs.readFileSync('test/fixtures/client.key'), + cert: fs.readFileSync('test/fixtures/client.crt'), + ca: fs.readFileSync('test/fixtures/ca.crt') +}; + +var socket = require('engine.io-client')('ws://localhost', opts); +socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); +}); +``` + +### Node.js with extraHeaders +```js +var opts = { + extraHeaders: { + 'X-Custom-Header-For-My-Project': 'my-secret-access-token', + 'Cookie': 'user_session=NI2JlCKF90aE0sJZD9ZzujtdsUqNYSBYxzlTsvdSUe35ZzdtVRGqYFr0kdGxbfc5gUOkR9RGp20GVKza; path=/; expires=Tue, 07-Apr-2015 18:18:08 GMT; secure; HttpOnly' + } +}; + +var socket = require('engine.io-client')('ws://localhost', opts); +socket.on('open', function(){ + socket.on('message', function(data){}); + socket.on('close', function(){}); +}); +``` + +## Features + +- Lightweight +- Runs on browser and node.js seamlessly +- Transports are independent of `Engine` + - Easy to debug + - Easy to unit test +- Runs inside HTML5 WebWorker +- Can send and receive binary data + - Receives as ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer + in Node + - When XHR2 or WebSockets are used, binary is emitted directly. Otherwise + binary is encoded into base64 strings, and decoded when binary types are + supported. + - With browsers that don't support ArrayBuffer, an object { base64: true, + data: dataAsBase64String } is emitted on the `message` event. + +## API + +### Socket + +The client class. Mixes in [Emitter](http://github.com/component/emitter). +Exposed as `eio` in the browser standalone build. + +#### Properties + +- `protocol` _(Number)_: protocol revision number +- `binaryType` _(String)_ : can be set to 'arraybuffer' or 'blob' in browsers, + and `buffer` or `arraybuffer` in Node. Blob is only used in browser if it's + supported. + +#### Events + +- `open` + - Fired upon successful connection. +- `message` + - Fired when data is received from the server. + - **Arguments** + - `String` | `ArrayBuffer`: utf-8 encoded data or ArrayBuffer containing + binary data +- `close` + - Fired upon disconnection. In compliance with the WebSocket API spec, this event may be + fired even if the `open` event does not occur (i.e. due to connection error or `close()`). +- `error` + - Fired when an error occurs. +- `flush` + - Fired upon completing a buffer flush +- `drain` + - Fired after `drain` event of transport if writeBuffer is empty +- `upgradeError` + - Fired if an error occurs with a transport we're trying to upgrade to. +- `upgrade` + - Fired upon upgrade success, after the new transport is set +- `ping` + - Fired upon _flushing_ a ping packet (ie: actual packet write out) +- `pong` + - Fired upon receiving a pong packet. + +#### Methods + +- **constructor** + - Initializes the client + - **Parameters** + - `String` uri + - `Object`: optional, options object + - **Options** + - `agent` (`http.Agent`): `http.Agent` to use, defaults to `false` (NodeJS only) + - `upgrade` (`Boolean`): defaults to true, whether the client should try + to upgrade the transport from long-polling to something better. + - `forceJSONP` (`Boolean`): forces JSONP for polling transport. + - `jsonp` (`Boolean`): determines whether to use JSONP when + necessary for polling. If disabled (by settings to false) an error will + be emitted (saying "No transports available") if no other transports + are available. If another transport is available for opening a + connection (e.g. WebSocket) that transport + will be used instead. + - `forceBase64` (`Boolean`): forces base 64 encoding for polling transport even when XHR2 responseType is available and WebSocket even if the used standard supports binary. + - `enablesXDR` (`Boolean`): enables XDomainRequest for IE8 to avoid loading bar flashing with click sound. default to `false` because XDomainRequest has a flaw of not sending cookie. + - `timestampRequests` (`Boolean`): whether to add the timestamp with each + transport request. Note: polling requests are always stamped unless this + option is explicitly set to `false` (`false`) + - `timestampParam` (`String`): timestamp parameter (`t`) + - `policyPort` (`Number`): port the policy server listens on (`843`) + - `path` (`String`): path to connect to, default is `/engine.io` + - `transports` (`Array`): a list of transports to try (in order). + Defaults to `['polling', 'websocket']`. `Engine` + always attempts to connect directly with the first one, provided the + feature detection test for it passes. + - `transportOptions` (`Object`): hash of options, indexed by transport name, overriding the common options for the given transport + - `rememberUpgrade` (`Boolean`): defaults to false. + If true and if the previous websocket connection to the server succeeded, + the connection attempt will bypass the normal upgrade process and will initially + try websocket. A connection attempt following a transport error will use the + normal upgrade process. It is recommended you turn this on only when using + SSL/TLS connections, or if you know that your network does not block websockets. + - `pfx` (`String`): Certificate, Private key and CA certificates to use for SSL. Can be used in Node.js client environment to manually specify certificate information. + - `key` (`String`): Private key to use for SSL. Can be used in Node.js client environment to manually specify certificate information. + - `passphrase` (`String`): A string of passphrase for the private key or pfx. Can be used in Node.js client environment to manually specify certificate information. + - `cert` (`String`): Public x509 certificate to use. Can be used in Node.js client environment to manually specify certificate information. + - `ca` (`String`|`Array`): An authority certificate or array of authority certificates to check the remote host against.. Can be used in Node.js client environment to manually specify certificate information. + - `ciphers` (`String`): A string describing the ciphers to use or exclude. Consult the [cipher format list](http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) for details on the format. Can be used in Node.js client environment to manually specify certificate information. + - `rejectUnauthorized` (`Boolean`): If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. Can be used in Node.js client environment to manually specify certificate information. + - `perMessageDeflate` (`Object|Boolean`): parameters of the WebSocket permessage-deflate extension + (see [ws module](https://github.com/einaros/ws) api docs). Set to `false` to disable. (`true`) + - `threshold` (`Number`): data is compressed only if the byte size is above this value. This option is ignored on the browser. (`1024`) + - `extraHeaders` (`Object`): Headers that will be passed for each request to the server (via xhr-polling and via websockets). These values then can be used during handshake or for special proxies. Can only be used in Node.js client environment. + - `onlyBinaryUpgrades` (`Boolean`): whether transport upgrades should be restricted to transports supporting binary data (`false`) + - `forceNode` (`Boolean`): Uses NodeJS implementation for websockets - even if there is a native Browser-Websocket available, which is preferred by default over the NodeJS implementation. (This is useful when using hybrid platforms like nw.js or electron) (`false`, NodeJS only) + - `localAddress` (`String`): the local IP address to connect to + - **Polling-only options** + - `requestTimeout` (`Number`): Timeout for xhr-polling requests in milliseconds (`0`) + - **Websocket-only options** + - `protocols` (`Array`): a list of subprotocols (see [MDN reference](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#Subprotocols)) +- `send` + - Sends a message to the server + - **Parameters** + - `String` | `ArrayBuffer` | `ArrayBufferView` | `Blob`: data to send + - `Object`: optional, options object + - `Function`: optional, callback upon `drain` + - **Options** + - `compress` (`Boolean`): whether to compress sending data. This option is ignored and forced to be `true` on the browser. (`true`) +- `close` + - Disconnects the client. + +### Transport + +The transport class. Private. _Inherits from EventEmitter_. + +#### Events + +- `poll`: emitted by polling transports upon starting a new request +- `pollComplete`: emitted by polling transports upon completing a request +- `drain`: emitted by polling transports upon a buffer drain + +## Tests + +`engine.io-client` is used to test +[engine](http://github.com/socketio/engine.io). Running the `engine.io` +test suite ensures the client works and vice-versa. + +Browser tests are run using [zuul](https://github.com/defunctzombie/zuul). You can +run the tests locally using the following command. + +``` +./node_modules/.bin/zuul --local 8080 -- test/index.js +``` + +Additionally, `engine.io-client` has a standalone test suite you can run +with `make test` which will run node.js and browser tests. You must have zuul setup with +a saucelabs account. + +## Support + +The support channels for `engine.io-client` are the same as `socket.io`: + - irc.freenode.net **#socket.io** + - [Google Groups](http://groups.google.com/group/socket_io) + - [Website](http://socket.io) + +## Development + +To contribute patches, run tests or benchmarks, make sure to clone the +repository: + +```bash +git clone git://github.com/socketio/engine.io-client.git +``` + +Then: + +```bash +cd engine.io-client +npm install +``` + +See the `Tests` section above for how to run tests before submitting any patches. + +## License + +MIT - Copyright (c) 2014 Automattic, Inc. diff --git a/datalab/web/node_modules/engine.io-client/engine.io.js b/datalab/web/node_modules/engine.io-client/engine.io.js new file mode 100644 index 0000000000000000000000000000000000000000..a37bbd6f997d6ad24f1e0fa2b33b4587e1fc1d54 --- /dev/null +++ b/datalab/web/node_modules/engine.io-client/engine.io.js @@ -0,0 +1,4692 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["eio"] = factory(); + else + root["eio"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(1); + + /** + * Exports parser + * + * @api public + * + */ + module.exports.parser = __webpack_require__(8); + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + /** + * Module dependencies. + */ + + var transports = __webpack_require__(2); + var Emitter = __webpack_require__(18); + var debug = __webpack_require__(22)('engine.io-client:socket'); + var index = __webpack_require__(29); + var parser = __webpack_require__(8); + var parseuri = __webpack_require__(30); + var parseqs = __webpack_require__(19); + + /** + * Module exports. + */ + + module.exports = Socket; + + /** + * Socket constructor. + * + * @param {String|Object} uri or options + * @param {Object} options + * @api public + */ + + function Socket(uri, opts) { + if (!(this instanceof Socket)) return new Socket(uri, opts); + + opts = opts || {}; + + if (uri && 'object' === (typeof uri === 'undefined' ? 'undefined' : _typeof(uri))) { + opts = uri; + uri = null; + } + + if (uri) { + uri = parseuri(uri); + opts.hostname = uri.host; + opts.secure = uri.protocol === 'https' || uri.protocol === 'wss'; + opts.port = uri.port; + if (uri.query) opts.query = uri.query; + } else if (opts.host) { + opts.hostname = parseuri(opts.host).host; + } + + this.secure = null != opts.secure ? opts.secure : global.location && 'https:' === location.protocol; + + if (opts.hostname && !opts.port) { + // if no port is specified manually, use the protocol default + opts.port = this.secure ? '443' : '80'; + } + + this.agent = opts.agent || false; + this.hostname = opts.hostname || (global.location ? location.hostname : 'localhost'); + this.port = opts.port || (global.location && location.port ? location.port : this.secure ? 443 : 80); + this.query = opts.query || {}; + if ('string' === typeof this.query) this.query = parseqs.decode(this.query); + this.upgrade = false !== opts.upgrade; + this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/'; + this.forceJSONP = !!opts.forceJSONP; + this.jsonp = false !== opts.jsonp; + this.forceBase64 = !!opts.forceBase64; + this.enablesXDR = !!opts.enablesXDR; + this.timestampParam = opts.timestampParam || 't'; + this.timestampRequests = opts.timestampRequests; + this.transports = opts.transports || ['polling', 'websocket']; + this.transportOptions = opts.transportOptions || {}; + this.readyState = ''; + this.writeBuffer = []; + this.prevBufferLen = 0; + this.policyPort = opts.policyPort || 843; + this.rememberUpgrade = opts.rememberUpgrade || false; + this.binaryType = null; + this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades; + this.perMessageDeflate = false !== opts.perMessageDeflate ? opts.perMessageDeflate || {} : false; + + if (true === this.perMessageDeflate) this.perMessageDeflate = {}; + if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) { + this.perMessageDeflate.threshold = 1024; + } + + // SSL options for Node.js client + this.pfx = opts.pfx || null; + this.key = opts.key || null; + this.passphrase = opts.passphrase || null; + this.cert = opts.cert || null; + this.ca = opts.ca || null; + this.ciphers = opts.ciphers || null; + this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized; + this.forceNode = !!opts.forceNode; + + // other options for Node.js client + var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) === 'object' && global; + if (freeGlobal.global === freeGlobal) { + if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) { + this.extraHeaders = opts.extraHeaders; + } + + if (opts.localAddress) { + this.localAddress = opts.localAddress; + } + } + + // set on handshake + this.id = null; + this.upgrades = null; + this.pingInterval = null; + this.pingTimeout = null; + + // set on heartbeat + this.pingIntervalTimer = null; + this.pingTimeoutTimer = null; + + this.open(); + } + + Socket.priorWebsocketSuccess = false; + + /** + * Mix in `Emitter`. + */ + + Emitter(Socket.prototype); + + /** + * Protocol version. + * + * @api public + */ + + Socket.protocol = parser.protocol; // this is an int + + /** + * Expose deps for legacy compatibility + * and standalone browser access. + */ + + Socket.Socket = Socket; + Socket.Transport = __webpack_require__(7); + Socket.transports = __webpack_require__(2); + Socket.parser = __webpack_require__(8); + + /** + * Creates transport of the given type. + * + * @param {String} transport name + * @return {Transport} + * @api private + */ + + Socket.prototype.createTransport = function (name) { + debug('creating transport "%s"', name); + var query = clone(this.query); + + // append engine.io protocol identifier + query.EIO = parser.protocol; + + // transport name + query.transport = name; + + // per-transport options + var options = this.transportOptions[name] || {}; + + // session id if we already have one + if (this.id) query.sid = this.id; + + var transport = new transports[name]({ + query: query, + socket: this, + agent: options.agent || this.agent, + hostname: options.hostname || this.hostname, + port: options.port || this.port, + secure: options.secure || this.secure, + path: options.path || this.path, + forceJSONP: options.forceJSONP || this.forceJSONP, + jsonp: options.jsonp || this.jsonp, + forceBase64: options.forceBase64 || this.forceBase64, + enablesXDR: options.enablesXDR || this.enablesXDR, + timestampRequests: options.timestampRequests || this.timestampRequests, + timestampParam: options.timestampParam || this.timestampParam, + policyPort: options.policyPort || this.policyPort, + pfx: options.pfx || this.pfx, + key: options.key || this.key, + passphrase: options.passphrase || this.passphrase, + cert: options.cert || this.cert, + ca: options.ca || this.ca, + ciphers: options.ciphers || this.ciphers, + rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized, + perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate, + extraHeaders: options.extraHeaders || this.extraHeaders, + forceNode: options.forceNode || this.forceNode, + localAddress: options.localAddress || this.localAddress, + requestTimeout: options.requestTimeout || this.requestTimeout, + protocols: options.protocols || void 0 + }); + + return transport; + }; + + function clone(obj) { + var o = {}; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + o[i] = obj[i]; + } + } + return o; + } + + /** + * Initializes transport to use and starts probe. + * + * @api private + */ + Socket.prototype.open = function () { + var transport; + if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) { + transport = 'websocket'; + } else if (0 === this.transports.length) { + // Emit error on next tick so it can be listened to + var self = this; + setTimeout(function () { + self.emit('error', 'No transports available'); + }, 0); + return; + } else { + transport = this.transports[0]; + } + this.readyState = 'opening'; + + // Retry with the next transport if the transport is disabled (jsonp: false) + try { + transport = this.createTransport(transport); + } catch (e) { + this.transports.shift(); + this.open(); + return; + } + + transport.open(); + this.setTransport(transport); + }; + + /** + * Sets the current transport. Disables the existing one (if any). + * + * @api private + */ + + Socket.prototype.setTransport = function (transport) { + debug('setting transport %s', transport.name); + var self = this; + + if (this.transport) { + debug('clearing existing transport %s', this.transport.name); + this.transport.removeAllListeners(); + } + + // set up transport + this.transport = transport; + + // set up transport listeners + transport.on('drain', function () { + self.onDrain(); + }).on('packet', function (packet) { + self.onPacket(packet); + }).on('error', function (e) { + self.onError(e); + }).on('close', function () { + self.onClose('transport close'); + }); + }; + + /** + * Probes a transport. + * + * @param {String} transport name + * @api private + */ + + Socket.prototype.probe = function (name) { + debug('probing transport "%s"', name); + var transport = this.createTransport(name, { probe: 1 }); + var failed = false; + var self = this; + + Socket.priorWebsocketSuccess = false; + + function onTransportOpen() { + if (self.onlyBinaryUpgrades) { + var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary; + failed = failed || upgradeLosesBinary; + } + if (failed) return; + + debug('probe transport "%s" opened', name); + transport.send([{ type: 'ping', data: 'probe' }]); + transport.once('packet', function (msg) { + if (failed) return; + if ('pong' === msg.type && 'probe' === msg.data) { + debug('probe transport "%s" pong', name); + self.upgrading = true; + self.emit('upgrading', transport); + if (!transport) return; + Socket.priorWebsocketSuccess = 'websocket' === transport.name; + + debug('pausing current transport "%s"', self.transport.name); + self.transport.pause(function () { + if (failed) return; + if ('closed' === self.readyState) return; + debug('changing transport and sending upgrade packet'); + + cleanup(); + + self.setTransport(transport); + transport.send([{ type: 'upgrade' }]); + self.emit('upgrade', transport); + transport = null; + self.upgrading = false; + self.flush(); + }); + } else { + debug('probe transport "%s" failed', name); + var err = new Error('probe error'); + err.transport = transport.name; + self.emit('upgradeError', err); + } + }); + } + + function freezeTransport() { + if (failed) return; + + // Any callback called by transport should be ignored since now + failed = true; + + cleanup(); + + transport.close(); + transport = null; + } + + // Handle any error that happens while probing + function onerror(err) { + var error = new Error('probe error: ' + err); + error.transport = transport.name; + + freezeTransport(); + + debug('probe transport "%s" failed because of error: %s', name, err); + + self.emit('upgradeError', error); + } + + function onTransportClose() { + onerror('transport closed'); + } + + // When the socket is closed while we're probing + function onclose() { + onerror('socket closed'); + } + + // When the socket is upgraded while we're probing + function onupgrade(to) { + if (transport && to.name !== transport.name) { + debug('"%s" works - aborting "%s"', to.name, transport.name); + freezeTransport(); + } + } + + // Remove all listeners on the transport and on self + function cleanup() { + transport.removeListener('open', onTransportOpen); + transport.removeListener('error', onerror); + transport.removeListener('close', onTransportClose); + self.removeListener('close', onclose); + self.removeListener('upgrading', onupgrade); + } + + transport.once('open', onTransportOpen); + transport.once('error', onerror); + transport.once('close', onTransportClose); + + this.once('close', onclose); + this.once('upgrading', onupgrade); + + transport.open(); + }; + + /** + * Called when connection is deemed open. + * + * @api public + */ + + Socket.prototype.onOpen = function () { + debug('socket open'); + this.readyState = 'open'; + Socket.priorWebsocketSuccess = 'websocket' === this.transport.name; + this.emit('open'); + this.flush(); + + // we check for `readyState` in case an `open` + // listener already closed the socket + if ('open' === this.readyState && this.upgrade && this.transport.pause) { + debug('starting upgrade probes'); + for (var i = 0, l = this.upgrades.length; i < l; i++) { + this.probe(this.upgrades[i]); + } + } + }; + + /** + * Handles a packet. + * + * @api private + */ + + Socket.prototype.onPacket = function (packet) { + if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) { + debug('socket receive: type "%s", data "%s"', packet.type, packet.data); + + this.emit('packet', packet); + + // Socket is live - any packet counts + this.emit('heartbeat'); + + switch (packet.type) { + case 'open': + this.onHandshake(JSON.parse(packet.data)); + break; + + case 'pong': + this.setPing(); + this.emit('pong'); + break; + + case 'error': + var err = new Error('server error'); + err.code = packet.data; + this.onError(err); + break; + + case 'message': + this.emit('data', packet.data); + this.emit('message', packet.data); + break; + } + } else { + debug('packet received with socket readyState "%s"', this.readyState); + } + }; + + /** + * Called upon handshake completion. + * + * @param {Object} handshake obj + * @api private + */ + + Socket.prototype.onHandshake = function (data) { + this.emit('handshake', data); + this.id = data.sid; + this.transport.query.sid = data.sid; + this.upgrades = this.filterUpgrades(data.upgrades); + this.pingInterval = data.pingInterval; + this.pingTimeout = data.pingTimeout; + this.onOpen(); + // In case open handler closes socket + if ('closed' === this.readyState) return; + this.setPing(); + + // Prolong liveness of socket on heartbeat + this.removeListener('heartbeat', this.onHeartbeat); + this.on('heartbeat', this.onHeartbeat); + }; + + /** + * Resets ping timeout. + * + * @api private + */ + + Socket.prototype.onHeartbeat = function (timeout) { + clearTimeout(this.pingTimeoutTimer); + var self = this; + self.pingTimeoutTimer = setTimeout(function () { + if ('closed' === self.readyState) return; + self.onClose('ping timeout'); + }, timeout || self.pingInterval + self.pingTimeout); + }; + + /** + * Pings server every `this.pingInterval` and expects response + * within `this.pingTimeout` or closes connection. + * + * @api private + */ + + Socket.prototype.setPing = function () { + var self = this; + clearTimeout(self.pingIntervalTimer); + self.pingIntervalTimer = setTimeout(function () { + debug('writing ping packet - expecting pong within %sms', self.pingTimeout); + self.ping(); + self.onHeartbeat(self.pingTimeout); + }, self.pingInterval); + }; + + /** + * Sends a ping packet. + * + * @api private + */ + + Socket.prototype.ping = function () { + var self = this; + this.sendPacket('ping', function () { + self.emit('ping'); + }); + }; + + /** + * Called on `drain` event + * + * @api private + */ + + Socket.prototype.onDrain = function () { + this.writeBuffer.splice(0, this.prevBufferLen); + + // setting prevBufferLen = 0 is very important + // for example, when upgrading, upgrade packet is sent over, + // and a nonzero prevBufferLen could cause problems on `drain` + this.prevBufferLen = 0; + + if (0 === this.writeBuffer.length) { + this.emit('drain'); + } else { + this.flush(); + } + }; + + /** + * Flush write buffers. + * + * @api private + */ + + Socket.prototype.flush = function () { + if ('closed' !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length) { + debug('flushing %d packets in socket', this.writeBuffer.length); + this.transport.send(this.writeBuffer); + // keep track of current length of writeBuffer + // splice writeBuffer and callbackBuffer on `drain` + this.prevBufferLen = this.writeBuffer.length; + this.emit('flush'); + } + }; + + /** + * Sends a message. + * + * @param {String} message. + * @param {Function} callback function. + * @param {Object} options. + * @return {Socket} for chaining. + * @api public + */ + + Socket.prototype.write = Socket.prototype.send = function (msg, options, fn) { + this.sendPacket('message', msg, options, fn); + return this; + }; + + /** + * Sends a packet. + * + * @param {String} packet type. + * @param {String} data. + * @param {Object} options. + * @param {Function} callback function. + * @api private + */ + + Socket.prototype.sendPacket = function (type, data, options, fn) { + if ('function' === typeof data) { + fn = data; + data = undefined; + } + + if ('function' === typeof options) { + fn = options; + options = null; + } + + if ('closing' === this.readyState || 'closed' === this.readyState) { + return; + } + + options = options || {}; + options.compress = false !== options.compress; + + var packet = { + type: type, + data: data, + options: options + }; + this.emit('packetCreate', packet); + this.writeBuffer.push(packet); + if (fn) this.once('flush', fn); + this.flush(); + }; + + /** + * Closes the connection. + * + * @api private + */ + + Socket.prototype.close = function () { + if ('opening' === this.readyState || 'open' === this.readyState) { + this.readyState = 'closing'; + + var self = this; + + if (this.writeBuffer.length) { + this.once('drain', function () { + if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + }); + } else if (this.upgrading) { + waitForUpgrade(); + } else { + close(); + } + } + + function close() { + self.onClose('forced close'); + debug('socket closing - telling transport to close'); + self.transport.close(); + } + + function cleanupAndClose() { + self.removeListener('upgrade', cleanupAndClose); + self.removeListener('upgradeError', cleanupAndClose); + close(); + } + + function waitForUpgrade() { + // wait for upgrade to finish since we can't send packets while pausing a transport + self.once('upgrade', cleanupAndClose); + self.once('upgradeError', cleanupAndClose); + } + + return this; + }; + + /** + * Called upon transport error + * + * @api private + */ + + Socket.prototype.onError = function (err) { + debug('socket error %j', err); + Socket.priorWebsocketSuccess = false; + this.emit('error', err); + this.onClose('transport error', err); + }; + + /** + * Called upon transport close. + * + * @api private + */ + + Socket.prototype.onClose = function (reason, desc) { + if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) { + debug('socket close with reason: "%s"', reason); + var self = this; + + // clear timers + clearTimeout(this.pingIntervalTimer); + clearTimeout(this.pingTimeoutTimer); + + // stop event from firing again for transport + this.transport.removeAllListeners('close'); + + // ensure transport won't stay open + this.transport.close(); + + // ignore further transport communication + this.transport.removeAllListeners(); + + // set ready state + this.readyState = 'closed'; + + // clear session id + this.id = null; + + // emit close event + this.emit('close', reason, desc); + + // clean buffers after, so users can still + // grab the buffers on `close` event + self.writeBuffer = []; + self.prevBufferLen = 0; + } + }; + + /** + * Filters upgrades, returning only those matching client transports. + * + * @param {Array} server upgrades + * @api private + * + */ + + Socket.prototype.filterUpgrades = function (upgrades) { + var filteredUpgrades = []; + for (var i = 0, j = upgrades.length; i < j; i++) { + if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]); + } + return filteredUpgrades; + }; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + /** + * Module dependencies + */ + + var XMLHttpRequest = __webpack_require__(3); + var XHR = __webpack_require__(5); + var JSONP = __webpack_require__(26); + var websocket = __webpack_require__(27); + + /** + * Export transports. + */ + + exports.polling = polling; + exports.websocket = websocket; + + /** + * Polling transport polymorphic constructor. + * Decides on xhr vs jsonp based on feature detection. + * + * @api private + */ + + function polling(opts) { + var xhr; + var xd = false; + var xs = false; + var jsonp = false !== opts.jsonp; + + if (global.location) { + var isSSL = 'https:' === location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (!port) { + port = isSSL ? 443 : 80; + } + + xd = opts.hostname !== location.hostname || port !== opts.port; + xs = opts.secure !== isSSL; + } + + opts.xdomain = xd; + opts.xscheme = xs; + xhr = new XMLHttpRequest(opts); + + if ('open' in xhr && !opts.forceJSONP) { + return new XHR(opts); + } else { + if (!jsonp) throw new Error('JSONP disabled'); + return new JSONP(opts); + } + } + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + // browser shim for xmlhttprequest module + + var hasCORS = __webpack_require__(4); + + module.exports = function (opts) { + var xdomain = opts.xdomain; + + // scheme must be same when usign XDomainRequest + // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx + var xscheme = opts.xscheme; + + // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default. + // https://github.com/Automattic/engine.io-client/pull/217 + var enablesXDR = opts.enablesXDR; + + // XMLHttpRequest can be disabled on IE + try { + if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { + return new XMLHttpRequest(); + } + } catch (e) {} + + // Use XDomainRequest for IE8 if enablesXDR is true + // because loading bar keeps flashing when using jsonp-polling + // https://github.com/yujiosaka/socke.io-ie8-loading-example + try { + if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) { + return new XDomainRequest(); + } + } catch (e) {} + + if (!xdomain) { + try { + return new global[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP'); + } catch (e) {} + } + }; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + + /** + * Module exports. + * + * Logic borrowed from Modernizr: + * + * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js + */ + + try { + module.exports = typeof XMLHttpRequest !== 'undefined' && + 'withCredentials' in new XMLHttpRequest(); + } catch (err) { + // if XMLHttp support is disabled in IE then it will throw + // when trying to create + module.exports = false; + } + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + /** + * Module requirements. + */ + + var XMLHttpRequest = __webpack_require__(3); + var Polling = __webpack_require__(6); + var Emitter = __webpack_require__(18); + var inherit = __webpack_require__(20); + var debug = __webpack_require__(22)('engine.io-client:polling-xhr'); + + /** + * Module exports. + */ + + module.exports = XHR; + module.exports.Request = Request; + + /** + * Empty function + */ + + function empty() {} + + /** + * XHR Polling constructor. + * + * @param {Object} opts + * @api public + */ + + function XHR(opts) { + Polling.call(this, opts); + this.requestTimeout = opts.requestTimeout; + this.extraHeaders = opts.extraHeaders; + + if (global.location) { + var isSSL = 'https:' === location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (!port) { + port = isSSL ? 443 : 80; + } + + this.xd = opts.hostname !== global.location.hostname || port !== opts.port; + this.xs = opts.secure !== isSSL; + } + } + + /** + * Inherits from Polling. + */ + + inherit(XHR, Polling); + + /** + * XHR supports binary + */ + + XHR.prototype.supportsBinary = true; + + /** + * Creates a request. + * + * @param {String} method + * @api private + */ + + XHR.prototype.request = function (opts) { + opts = opts || {}; + opts.uri = this.uri(); + opts.xd = this.xd; + opts.xs = this.xs; + opts.agent = this.agent || false; + opts.supportsBinary = this.supportsBinary; + opts.enablesXDR = this.enablesXDR; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + opts.requestTimeout = this.requestTimeout; + + // other options for Node.js client + opts.extraHeaders = this.extraHeaders; + + return new Request(opts); + }; + + /** + * Sends data. + * + * @param {String} data to send. + * @param {Function} called upon flush. + * @api private + */ + + XHR.prototype.doWrite = function (data, fn) { + var isBinary = typeof data !== 'string' && data !== undefined; + var req = this.request({ method: 'POST', data: data, isBinary: isBinary }); + var self = this; + req.on('success', fn); + req.on('error', function (err) { + self.onError('xhr post error', err); + }); + this.sendXhr = req; + }; + + /** + * Starts a poll cycle. + * + * @api private + */ + + XHR.prototype.doPoll = function () { + debug('xhr poll'); + var req = this.request(); + var self = this; + req.on('data', function (data) { + self.onData(data); + }); + req.on('error', function (err) { + self.onError('xhr poll error', err); + }); + this.pollXhr = req; + }; + + /** + * Request constructor + * + * @param {Object} options + * @api public + */ + + function Request(opts) { + this.method = opts.method || 'GET'; + this.uri = opts.uri; + this.xd = !!opts.xd; + this.xs = !!opts.xs; + this.async = false !== opts.async; + this.data = undefined !== opts.data ? opts.data : null; + this.agent = opts.agent; + this.isBinary = opts.isBinary; + this.supportsBinary = opts.supportsBinary; + this.enablesXDR = opts.enablesXDR; + this.requestTimeout = opts.requestTimeout; + + // SSL options for Node.js client + this.pfx = opts.pfx; + this.key = opts.key; + this.passphrase = opts.passphrase; + this.cert = opts.cert; + this.ca = opts.ca; + this.ciphers = opts.ciphers; + this.rejectUnauthorized = opts.rejectUnauthorized; + + // other options for Node.js client + this.extraHeaders = opts.extraHeaders; + + this.create(); + } + + /** + * Mix in `Emitter`. + */ + + Emitter(Request.prototype); + + /** + * Creates the XHR object and sends the request. + * + * @api private + */ + + Request.prototype.create = function () { + var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR }; + + // SSL options for Node.js client + opts.pfx = this.pfx; + opts.key = this.key; + opts.passphrase = this.passphrase; + opts.cert = this.cert; + opts.ca = this.ca; + opts.ciphers = this.ciphers; + opts.rejectUnauthorized = this.rejectUnauthorized; + + var xhr = this.xhr = new XMLHttpRequest(opts); + var self = this; + + try { + debug('xhr open %s: %s', this.method, this.uri); + xhr.open(this.method, this.uri, this.async); + try { + if (this.extraHeaders) { + xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true); + for (var i in this.extraHeaders) { + if (this.extraHeaders.hasOwnProperty(i)) { + xhr.setRequestHeader(i, this.extraHeaders[i]); + } + } + } + } catch (e) {} + + if ('POST' === this.method) { + try { + if (this.isBinary) { + xhr.setRequestHeader('Content-type', 'application/octet-stream'); + } else { + xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8'); + } + } catch (e) {} + } + + try { + xhr.setRequestHeader('Accept', '*/*'); + } catch (e) {} + + // ie6 check + if ('withCredentials' in xhr) { + xhr.withCredentials = true; + } + + if (this.requestTimeout) { + xhr.timeout = this.requestTimeout; + } + + if (this.hasXDR()) { + xhr.onload = function () { + self.onLoad(); + }; + xhr.onerror = function () { + self.onError(xhr.responseText); + }; + } else { + xhr.onreadystatechange = function () { + if (xhr.readyState === 2) { + try { + var contentType = xhr.getResponseHeader('Content-Type'); + if (self.supportsBinary && contentType === 'application/octet-stream') { + xhr.responseType = 'arraybuffer'; + } + } catch (e) {} + } + if (4 !== xhr.readyState) return; + if (200 === xhr.status || 1223 === xhr.status) { + self.onLoad(); + } else { + // make sure the `error` event handler that's user-set + // does not throw in the same tick and gets caught here + setTimeout(function () { + self.onError(xhr.status); + }, 0); + } + }; + } + + debug('xhr data %s', this.data); + xhr.send(this.data); + } catch (e) { + // Need to defer since .create() is called directly fhrom the constructor + // and thus the 'error' event can only be only bound *after* this exception + // occurs. Therefore, also, we cannot throw here at all. + setTimeout(function () { + self.onError(e); + }, 0); + return; + } + + if (global.document) { + this.index = Request.requestsCount++; + Request.requests[this.index] = this; + } + }; + + /** + * Called upon successful response. + * + * @api private + */ + + Request.prototype.onSuccess = function () { + this.emit('success'); + this.cleanup(); + }; + + /** + * Called if we have data. + * + * @api private + */ + + Request.prototype.onData = function (data) { + this.emit('data', data); + this.onSuccess(); + }; + + /** + * Called upon error. + * + * @api private + */ + + Request.prototype.onError = function (err) { + this.emit('error', err); + this.cleanup(true); + }; + + /** + * Cleans up house. + * + * @api private + */ + + Request.prototype.cleanup = function (fromError) { + if ('undefined' === typeof this.xhr || null === this.xhr) { + return; + } + // xmlhttprequest + if (this.hasXDR()) { + this.xhr.onload = this.xhr.onerror = empty; + } else { + this.xhr.onreadystatechange = empty; + } + + if (fromError) { + try { + this.xhr.abort(); + } catch (e) {} + } + + if (global.document) { + delete Request.requests[this.index]; + } + + this.xhr = null; + }; + + /** + * Called upon load. + * + * @api private + */ + + Request.prototype.onLoad = function () { + var data; + try { + var contentType; + try { + contentType = this.xhr.getResponseHeader('Content-Type'); + } catch (e) {} + if (contentType === 'application/octet-stream') { + data = this.xhr.response || this.xhr.responseText; + } else { + data = this.xhr.responseText; + } + } catch (e) { + this.onError(e); + } + if (null != data) { + this.onData(data); + } + }; + + /** + * Check if it has XDomainRequest. + * + * @api private + */ + + Request.prototype.hasXDR = function () { + return 'undefined' !== typeof global.XDomainRequest && !this.xs && this.enablesXDR; + }; + + /** + * Aborts the request. + * + * @api public + */ + + Request.prototype.abort = function () { + this.cleanup(); + }; + + /** + * Aborts pending requests when unloading the window. This is needed to prevent + * memory leaks (e.g. when using IE) and to ensure that no spurious error is + * emitted. + */ + + Request.requestsCount = 0; + Request.requests = {}; + + if (global.document) { + if (global.attachEvent) { + global.attachEvent('onunload', unloadHandler); + } else if (global.addEventListener) { + global.addEventListener('beforeunload', unloadHandler, false); + } + } + + function unloadHandler() { + for (var i in Request.requests) { + if (Request.requests.hasOwnProperty(i)) { + Request.requests[i].abort(); + } + } + } + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + /** + * Module dependencies. + */ + + var Transport = __webpack_require__(7); + var parseqs = __webpack_require__(19); + var parser = __webpack_require__(8); + var inherit = __webpack_require__(20); + var yeast = __webpack_require__(21); + var debug = __webpack_require__(22)('engine.io-client:polling'); + + /** + * Module exports. + */ + + module.exports = Polling; + + /** + * Is XHR2 supported? + */ + + var hasXHR2 = function () { + var XMLHttpRequest = __webpack_require__(3); + var xhr = new XMLHttpRequest({ xdomain: false }); + return null != xhr.responseType; + }(); + + /** + * Polling interface. + * + * @param {Object} opts + * @api private + */ + + function Polling(opts) { + var forceBase64 = opts && opts.forceBase64; + if (!hasXHR2 || forceBase64) { + this.supportsBinary = false; + } + Transport.call(this, opts); + } + + /** + * Inherits from Transport. + */ + + inherit(Polling, Transport); + + /** + * Transport name. + */ + + Polling.prototype.name = 'polling'; + + /** + * Opens the socket (triggers polling). We write a PING message to determine + * when the transport is open. + * + * @api private + */ + + Polling.prototype.doOpen = function () { + this.poll(); + }; + + /** + * Pauses polling. + * + * @param {Function} callback upon buffers are flushed and transport is paused + * @api private + */ + + Polling.prototype.pause = function (onPause) { + var self = this; + + this.readyState = 'pausing'; + + function pause() { + debug('paused'); + self.readyState = 'paused'; + onPause(); + } + + if (this.polling || !this.writable) { + var total = 0; + + if (this.polling) { + debug('we are currently polling - waiting to pause'); + total++; + this.once('pollComplete', function () { + debug('pre-pause polling complete'); + --total || pause(); + }); + } + + if (!this.writable) { + debug('we are currently writing - waiting to pause'); + total++; + this.once('drain', function () { + debug('pre-pause writing complete'); + --total || pause(); + }); + } + } else { + pause(); + } + }; + + /** + * Starts polling cycle. + * + * @api public + */ + + Polling.prototype.poll = function () { + debug('polling'); + this.polling = true; + this.doPoll(); + this.emit('poll'); + }; + + /** + * Overloads onData to detect payloads. + * + * @api private + */ + + Polling.prototype.onData = function (data) { + var self = this; + debug('polling got data %s', data); + var callback = function callback(packet, index, total) { + // if its the first message we consider the transport open + if ('opening' === self.readyState) { + self.onOpen(); + } + + // if its a close packet, we close the ongoing requests + if ('close' === packet.type) { + self.onClose(); + return false; + } + + // otherwise bypass onData and handle the message + self.onPacket(packet); + }; + + // decode payload + parser.decodePayload(data, this.socket.binaryType, callback); + + // if an event did not trigger closing + if ('closed' !== this.readyState) { + // if we got data we're not polling + this.polling = false; + this.emit('pollComplete'); + + if ('open' === this.readyState) { + this.poll(); + } else { + debug('ignoring poll - transport state "%s"', this.readyState); + } + } + }; + + /** + * For polling, send a close packet. + * + * @api private + */ + + Polling.prototype.doClose = function () { + var self = this; + + function close() { + debug('writing close packet'); + self.write([{ type: 'close' }]); + } + + if ('open' === this.readyState) { + debug('transport open - closing'); + close(); + } else { + // in case we're trying to close while + // handshaking is in progress (GH-164) + debug('transport not open - deferring close'); + this.once('open', close); + } + }; + + /** + * Writes a packets payload. + * + * @param {Array} data packets + * @param {Function} drain callback + * @api private + */ + + Polling.prototype.write = function (packets) { + var self = this; + this.writable = false; + var callbackfn = function callbackfn() { + self.writable = true; + self.emit('drain'); + }; + + parser.encodePayload(packets, this.supportsBinary, function (data) { + self.doWrite(data, callbackfn); + }); + }; + + /** + * Generates uri for connection. + * + * @api private + */ + + Polling.prototype.uri = function () { + var query = this.query || {}; + var schema = this.secure ? 'https' : 'http'; + var port = ''; + + // cache busting is forced + if (false !== this.timestampRequests) { + query[this.timestampParam] = yeast(); + } + + if (!this.supportsBinary && !query.sid) { + query.b64 = 1; + } + + query = parseqs.encode(query); + + // avoid port if default for schema + if (this.port && ('https' === schema && Number(this.port) !== 443 || 'http' === schema && Number(this.port) !== 80)) { + port = ':' + this.port; + } + + // prepend ? to query + if (query.length) { + query = '?' + query; + } + + var ipv6 = this.hostname.indexOf(':') !== -1; + return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; + }; + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + /** + * Module dependencies. + */ + + var parser = __webpack_require__(8); + var Emitter = __webpack_require__(18); + + /** + * Module exports. + */ + + module.exports = Transport; + + /** + * Transport abstract constructor. + * + * @param {Object} options. + * @api private + */ + + function Transport(opts) { + this.path = opts.path; + this.hostname = opts.hostname; + this.port = opts.port; + this.secure = opts.secure; + this.query = opts.query; + this.timestampParam = opts.timestampParam; + this.timestampRequests = opts.timestampRequests; + this.readyState = ''; + this.agent = opts.agent || false; + this.socket = opts.socket; + this.enablesXDR = opts.enablesXDR; + + // SSL options for Node.js client + this.pfx = opts.pfx; + this.key = opts.key; + this.passphrase = opts.passphrase; + this.cert = opts.cert; + this.ca = opts.ca; + this.ciphers = opts.ciphers; + this.rejectUnauthorized = opts.rejectUnauthorized; + this.forceNode = opts.forceNode; + + // other options for Node.js client + this.extraHeaders = opts.extraHeaders; + this.localAddress = opts.localAddress; + } + + /** + * Mix in `Emitter`. + */ + + Emitter(Transport.prototype); + + /** + * Emits an error. + * + * @param {String} str + * @return {Transport} for chaining + * @api public + */ + + Transport.prototype.onError = function (msg, desc) { + var err = new Error(msg); + err.type = 'TransportError'; + err.description = desc; + this.emit('error', err); + return this; + }; + + /** + * Opens the transport. + * + * @api public + */ + + Transport.prototype.open = function () { + if ('closed' === this.readyState || '' === this.readyState) { + this.readyState = 'opening'; + this.doOpen(); + } + + return this; + }; + + /** + * Closes the transport. + * + * @api private + */ + + Transport.prototype.close = function () { + if ('opening' === this.readyState || 'open' === this.readyState) { + this.doClose(); + this.onClose(); + } + + return this; + }; + + /** + * Sends multiple packets. + * + * @param {Array} packets + * @api private + */ + + Transport.prototype.send = function (packets) { + if ('open' === this.readyState) { + this.write(packets); + } else { + throw new Error('Transport not open'); + } + }; + + /** + * Called upon open + * + * @api private + */ + + Transport.prototype.onOpen = function () { + this.readyState = 'open'; + this.writable = true; + this.emit('open'); + }; + + /** + * Called with data. + * + * @param {String} data + * @api private + */ + + Transport.prototype.onData = function (data) { + var packet = parser.decodePacket(data, this.socket.binaryType); + this.onPacket(packet); + }; + + /** + * Called with a decoded packet. + */ + + Transport.prototype.onPacket = function (packet) { + this.emit('packet', packet); + }; + + /** + * Called upon close. + * + * @api private + */ + + Transport.prototype.onClose = function () { + this.readyState = 'closed'; + this.emit('close'); + }; + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {/** + * Module dependencies. + */ + + var keys = __webpack_require__(9); + var hasBinary = __webpack_require__(10); + var sliceBuffer = __webpack_require__(12); + var after = __webpack_require__(13); + var utf8 = __webpack_require__(14); + + var base64encoder; + if (global && global.ArrayBuffer) { + base64encoder = __webpack_require__(16); + } + + /** + * Check if we are running an android browser. That requires us to use + * ArrayBuffer with polling transports... + * + * http://ghinda.net/jpeg-blob-ajax-android/ + */ + + var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent); + + /** + * Check if we are running in PhantomJS. + * Uploading a Blob with PhantomJS does not work correctly, as reported here: + * https://github.com/ariya/phantomjs/issues/11395 + * @type boolean + */ + var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent); + + /** + * When true, avoids using Blobs to encode payloads. + * @type boolean + */ + var dontSendBlobs = isAndroid || isPhantomJS; + + /** + * Current protocol version. + */ + + exports.protocol = 3; + + /** + * Packet types. + */ + + var packets = exports.packets = { + open: 0 // non-ws + , close: 1 // non-ws + , ping: 2 + , pong: 3 + , message: 4 + , upgrade: 5 + , noop: 6 + }; + + var packetslist = keys(packets); + + /** + * Premade error packet. + */ + + var err = { type: 'error', data: 'parser error' }; + + /** + * Create a blob api even for blob builder when vendor prefixes exist + */ + + var Blob = __webpack_require__(17); + + /** + * Encodes a packet. + * + * [ ] + * + * Example: + * + * 5hello world + * 3 + * 4 + * + * Binary is encoded in an identical principle + * + * @api private + */ + + exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = false; + } + + if (typeof utf8encode === 'function') { + callback = utf8encode; + utf8encode = null; + } + + var data = (packet.data === undefined) + ? undefined + : packet.data.buffer || packet.data; + + if (global.ArrayBuffer && data instanceof ArrayBuffer) { + return encodeArrayBuffer(packet, supportsBinary, callback); + } else if (Blob && data instanceof global.Blob) { + return encodeBlob(packet, supportsBinary, callback); + } + + // might be an object with { base64: true, data: dataAsBase64String } + if (data && data.base64) { + return encodeBase64Object(packet, callback); + } + + // Sending data as a utf-8 string + var encoded = packets[packet.type]; + + // data fragment is optional + if (undefined !== packet.data) { + encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data); + } + + return callback('' + encoded); + + }; + + function encodeBase64Object(packet, callback) { + // packet data is an object { base64: true, data: dataAsBase64String } + var message = 'b' + exports.packets[packet.type] + packet.data.data; + return callback(message); + } + + /** + * Encode packet helpers for binary types + */ + + function encodeArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var data = packet.data; + var contentArray = new Uint8Array(data); + var resultBuffer = new Uint8Array(1 + data.byteLength); + + resultBuffer[0] = packets[packet.type]; + for (var i = 0; i < contentArray.length; i++) { + resultBuffer[i+1] = contentArray[i]; + } + + return callback(resultBuffer.buffer); + } + + function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + var fr = new FileReader(); + fr.onload = function() { + packet.data = fr.result; + exports.encodePacket(packet, supportsBinary, true, callback); + }; + return fr.readAsArrayBuffer(packet.data); + } + + function encodeBlob(packet, supportsBinary, callback) { + if (!supportsBinary) { + return exports.encodeBase64Packet(packet, callback); + } + + if (dontSendBlobs) { + return encodeBlobAsArrayBuffer(packet, supportsBinary, callback); + } + + var length = new Uint8Array(1); + length[0] = packets[packet.type]; + var blob = new Blob([length.buffer, packet.data]); + + return callback(blob); + } + + /** + * Encodes a packet with binary data in a base64 string + * + * @param {Object} packet, has `type` and `data` + * @return {String} base64 encoded message + */ + + exports.encodeBase64Packet = function(packet, callback) { + var message = 'b' + exports.packets[packet.type]; + if (Blob && packet.data instanceof global.Blob) { + var fr = new FileReader(); + fr.onload = function() { + var b64 = fr.result.split(',')[1]; + callback(message + b64); + }; + return fr.readAsDataURL(packet.data); + } + + var b64data; + try { + b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data)); + } catch (e) { + // iPhone Safari doesn't let you apply with typed arrays + var typed = new Uint8Array(packet.data); + var basic = new Array(typed.length); + for (var i = 0; i < typed.length; i++) { + basic[i] = typed[i]; + } + b64data = String.fromCharCode.apply(null, basic); + } + message += global.btoa(b64data); + return callback(message); + }; + + /** + * Decodes a packet. Changes format to Blob if requested. + * + * @return {Object} with `type` and `data` (if any) + * @api private + */ + + exports.decodePacket = function (data, binaryType, utf8decode) { + if (data === undefined) { + return err; + } + // String data + if (typeof data === 'string') { + if (data.charAt(0) === 'b') { + return exports.decodeBase64Packet(data.substr(1), binaryType); + } + + if (utf8decode) { + data = tryDecode(data); + if (data === false) { + return err; + } + } + var type = data.charAt(0); + + if (Number(type) != type || !packetslist[type]) { + return err; + } + + if (data.length > 1) { + return { type: packetslist[type], data: data.substring(1) }; + } else { + return { type: packetslist[type] }; + } + } + + var asArray = new Uint8Array(data); + var type = asArray[0]; + var rest = sliceBuffer(data, 1); + if (Blob && binaryType === 'blob') { + rest = new Blob([rest]); + } + return { type: packetslist[type], data: rest }; + }; + + function tryDecode(data) { + try { + data = utf8.decode(data, { strict: false }); + } catch (e) { + return false; + } + return data; + } + + /** + * Decodes a packet encoded in a base64 string + * + * @param {String} base64 encoded message + * @return {Object} with `type` and `data` (if any) + */ + + exports.decodeBase64Packet = function(msg, binaryType) { + var type = packetslist[msg.charAt(0)]; + if (!base64encoder) { + return { type: type, data: { base64: true, data: msg.substr(1) } }; + } + + var data = base64encoder.decode(msg.substr(1)); + + if (binaryType === 'blob' && Blob) { + data = new Blob([data]); + } + + return { type: type, data: data }; + }; + + /** + * Encodes multiple messages (payload). + * + * :data + * + * Example: + * + * 11:hello world2:hi + * + * If any contents are binary, they will be encoded as base64 strings. Base64 + * encoded strings are marked with a b before the length specifier + * + * @param {Array} packets + * @api private + */ + + exports.encodePayload = function (packets, supportsBinary, callback) { + if (typeof supportsBinary === 'function') { + callback = supportsBinary; + supportsBinary = null; + } + + var isBinary = hasBinary(packets); + + if (supportsBinary && isBinary) { + if (Blob && !dontSendBlobs) { + return exports.encodePayloadAsBlob(packets, callback); + } + + return exports.encodePayloadAsArrayBuffer(packets, callback); + } + + if (!packets.length) { + return callback('0:'); + } + + function setLengthHeader(message) { + return message.length + ':' + message; + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) { + doneCallback(null, setLengthHeader(message)); + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(results.join('')); + }); + }; + + /** + * Async array map using after + */ + + function map(ary, each, done) { + var result = new Array(ary.length); + var next = after(ary.length, done); + + var eachWithIndex = function(i, el, cb) { + each(el, function(error, msg) { + result[i] = msg; + cb(error, result); + }); + }; + + for (var i = 0; i < ary.length; i++) { + eachWithIndex(i, ary[i], next); + } + } + + /* + * Decodes data when a payload is maybe expected. Possible binary contents are + * decoded from their base64 representation + * + * @param {String} data, callback method + * @api public + */ + + exports.decodePayload = function (data, binaryType, callback) { + if (typeof data !== 'string') { + return exports.decodePayloadAsBinary(data, binaryType, callback); + } + + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var packet; + if (data === '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + var length = '', n, msg; + + for (var i = 0, l = data.length; i < l; i++) { + var chr = data.charAt(i); + + if (chr !== ':') { + length += chr; + continue; + } + + if (length === '' || (length != (n = Number(length)))) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + msg = data.substr(i + 1, n); + + if (length != msg.length) { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + if (msg.length) { + packet = exports.decodePacket(msg, binaryType, false); + + if (err.type === packet.type && err.data === packet.data) { + // parser error in individual packet - ignoring payload + return callback(err, 0, 1); + } + + var ret = callback(packet, i + n, l); + if (false === ret) return; + } + + // advance cursor + i += n; + length = ''; + } + + if (length !== '') { + // parser error - ignoring payload + return callback(err, 0, 1); + } + + }; + + /** + * Encodes multiple messages (payload) as binary. + * + * <1 = binary, 0 = string>[...] + * + * Example: + * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers + * + * @param {Array} packets + * @return {ArrayBuffer} encoded payload + * @api private + */ + + exports.encodePayloadAsArrayBuffer = function(packets, callback) { + if (!packets.length) { + return callback(new ArrayBuffer(0)); + } + + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, true, function(data) { + return doneCallback(null, data); + }); + } + + map(packets, encodeOne, function(err, encodedPackets) { + var totalLength = encodedPackets.reduce(function(acc, p) { + var len; + if (typeof p === 'string'){ + len = p.length; + } else { + len = p.byteLength; + } + return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2 + }, 0); + + var resultArray = new Uint8Array(totalLength); + + var bufferIndex = 0; + encodedPackets.forEach(function(p) { + var isString = typeof p === 'string'; + var ab = p; + if (isString) { + var view = new Uint8Array(p.length); + for (var i = 0; i < p.length; i++) { + view[i] = p.charCodeAt(i); + } + ab = view.buffer; + } + + if (isString) { // not true binary + resultArray[bufferIndex++] = 0; + } else { // true binary + resultArray[bufferIndex++] = 1; + } + + var lenStr = ab.byteLength.toString(); + for (var i = 0; i < lenStr.length; i++) { + resultArray[bufferIndex++] = parseInt(lenStr[i]); + } + resultArray[bufferIndex++] = 255; + + var view = new Uint8Array(ab); + for (var i = 0; i < view.length; i++) { + resultArray[bufferIndex++] = view[i]; + } + }); + + return callback(resultArray.buffer); + }); + }; + + /** + * Encode as Blob + */ + + exports.encodePayloadAsBlob = function(packets, callback) { + function encodeOne(packet, doneCallback) { + exports.encodePacket(packet, true, true, function(encoded) { + var binaryIdentifier = new Uint8Array(1); + binaryIdentifier[0] = 1; + if (typeof encoded === 'string') { + var view = new Uint8Array(encoded.length); + for (var i = 0; i < encoded.length; i++) { + view[i] = encoded.charCodeAt(i); + } + encoded = view.buffer; + binaryIdentifier[0] = 0; + } + + var len = (encoded instanceof ArrayBuffer) + ? encoded.byteLength + : encoded.size; + + var lenStr = len.toString(); + var lengthAry = new Uint8Array(lenStr.length + 1); + for (var i = 0; i < lenStr.length; i++) { + lengthAry[i] = parseInt(lenStr[i]); + } + lengthAry[lenStr.length] = 255; + + if (Blob) { + var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]); + doneCallback(null, blob); + } + }); + } + + map(packets, encodeOne, function(err, results) { + return callback(new Blob(results)); + }); + }; + + /* + * Decodes data when a payload is maybe expected. Strings are decoded by + * interpreting each byte as a key code for entries marked to start with 0. See + * description of encodePayloadAsBinary + * + * @param {ArrayBuffer} data, callback method + * @api public + */ + + exports.decodePayloadAsBinary = function (data, binaryType, callback) { + if (typeof binaryType === 'function') { + callback = binaryType; + binaryType = null; + } + + var bufferTail = data; + var buffers = []; + + while (bufferTail.byteLength > 0) { + var tailArray = new Uint8Array(bufferTail); + var isString = tailArray[0] === 0; + var msgLength = ''; + + for (var i = 1; ; i++) { + if (tailArray[i] === 255) break; + + // 310 = char length of Number.MAX_VALUE + if (msgLength.length > 310) { + return callback(err, 0, 1); + } + + msgLength += tailArray[i]; + } + + bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length); + msgLength = parseInt(msgLength); + + var msg = sliceBuffer(bufferTail, 0, msgLength); + if (isString) { + try { + msg = String.fromCharCode.apply(null, new Uint8Array(msg)); + } catch (e) { + // iPhone Safari doesn't let you apply to typed arrays + var typed = new Uint8Array(msg); + msg = ''; + for (var i = 0; i < typed.length; i++) { + msg += String.fromCharCode(typed[i]); + } + } + } + + buffers.push(msg); + bufferTail = sliceBuffer(bufferTail, msgLength); + } + + var total = buffers.length; + buffers.forEach(function(buffer, i) { + callback(exports.decodePacket(buffer, binaryType, true), i, total); + }); + }; + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + + /** + * Gets the keys for an object. + * + * @return {Array} keys + * @api private + */ + + module.exports = Object.keys || function keys (obj){ + var arr = []; + var has = Object.prototype.hasOwnProperty; + + for (var i in obj) { + if (has.call(obj, i)) { + arr.push(i); + } + } + return arr; + }; + + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {/* global Blob File */ + + /* + * Module requirements. + */ + + var isArray = __webpack_require__(11); + + var toString = Object.prototype.toString; + var withNativeBlob = typeof global.Blob === 'function' || toString.call(global.Blob) === '[object BlobConstructor]'; + var withNativeFile = typeof global.File === 'function' || toString.call(global.File) === '[object FileConstructor]'; + + /** + * Module exports. + */ + + module.exports = hasBinary; + + /** + * Checks for binary data. + * + * Supports Buffer, ArrayBuffer, Blob and File. + * + * @param {Object} anything + * @api public + */ + + function hasBinary (obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + + if (isArray(obj)) { + for (var i = 0, l = obj.length; i < l; i++) { + if (hasBinary(obj[i])) { + return true; + } + } + return false; + } + + if ((typeof global.Buffer === 'function' && global.Buffer.isBuffer && global.Buffer.isBuffer(obj)) || + (typeof global.ArrayBuffer === 'function' && obj instanceof ArrayBuffer) || + (withNativeBlob && obj instanceof Blob) || + (withNativeFile && obj instanceof File) + ) { + return true; + } + + // see: https://github.com/Automattic/has-binary/pull/4 + if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) { + return hasBinary(obj.toJSON(), true); + } + + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) { + return true; + } + } + + return false; + } + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 11 */ +/***/ function(module, exports) { + + var toString = {}.toString; + + module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; + }; + + +/***/ }, +/* 12 */ +/***/ function(module, exports) { + + /** + * An abstraction for slicing an arraybuffer even when + * ArrayBuffer.prototype.slice is not supported + * + * @api public + */ + + module.exports = function(arraybuffer, start, end) { + var bytes = arraybuffer.byteLength; + start = start || 0; + end = end || bytes; + + if (arraybuffer.slice) { return arraybuffer.slice(start, end); } + + if (start < 0) { start += bytes; } + if (end < 0) { end += bytes; } + if (end > bytes) { end = bytes; } + + if (start >= bytes || start >= end || bytes === 0) { + return new ArrayBuffer(0); + } + + var abv = new Uint8Array(arraybuffer); + var result = new Uint8Array(end - start); + for (var i = start, ii = 0; i < end; i++, ii++) { + result[ii] = abv[i]; + } + return result.buffer; + }; + + +/***/ }, +/* 13 */ +/***/ function(module, exports) { + + module.exports = after + + function after(count, callback, err_cb) { + var bail = false + err_cb = err_cb || noop + proxy.count = count + + return (count === 0) ? callback() : proxy + + function proxy(err, result) { + if (proxy.count <= 0) { + throw new Error('after called too many times') + } + --proxy.count + + // after first error, rest are passed to err_cb + if (err) { + bail = true + callback(err) + // future error callbacks will go to error handler + callback = err_cb + } else if (proxy.count === 0 && !bail) { + callback(null, result) + } + } + } + + function noop() {} + + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/utf8js v2.1.2 by @mathias */ + ;(function(root) { + + // Detect free variables `exports` + var freeExports = typeof exports == 'object' && exports; + + // Detect free variable `module` + var freeModule = typeof module == 'object' && module && + module.exports == freeExports && module; + + // Detect free variable `global`, from Node.js or Browserified code, + // and use it as `root` + var freeGlobal = typeof global == 'object' && global; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; + } + + /*--------------------------------------------------------------------------*/ + + var stringFromCharCode = String.fromCharCode; + + // Taken from https://mths.be/punycode + function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + var value; + var extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + // Taken from https://mths.be/punycode + function ucs2encode(array) { + var length = array.length; + var index = -1; + var value; + var output = ''; + while (++index < length) { + value = array[index]; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + } + return output; + } + + function checkScalarValue(codePoint, strict) { + if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { + if (strict) { + throw Error( + 'Lone surrogate U+' + codePoint.toString(16).toUpperCase() + + ' is not a scalar value' + ); + } + return false; + } + return true; + } + /*--------------------------------------------------------------------------*/ + + function createByte(codePoint, shift) { + return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80); + } + + function encodeCodePoint(codePoint, strict) { + if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence + return stringFromCharCode(codePoint); + } + var symbol = ''; + if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence + symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0); + } + else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence + if (!checkScalarValue(codePoint, strict)) { + codePoint = 0xFFFD; + } + symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0); + symbol += createByte(codePoint, 6); + } + else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence + symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0); + symbol += createByte(codePoint, 12); + symbol += createByte(codePoint, 6); + } + symbol += stringFromCharCode((codePoint & 0x3F) | 0x80); + return symbol; + } + + function utf8encode(string, opts) { + opts = opts || {}; + var strict = false !== opts.strict; + + var codePoints = ucs2decode(string); + var length = codePoints.length; + var index = -1; + var codePoint; + var byteString = ''; + while (++index < length) { + codePoint = codePoints[index]; + byteString += encodeCodePoint(codePoint, strict); + } + return byteString; + } + + /*--------------------------------------------------------------------------*/ + + function readContinuationByte() { + if (byteIndex >= byteCount) { + throw Error('Invalid byte index'); + } + + var continuationByte = byteArray[byteIndex] & 0xFF; + byteIndex++; + + if ((continuationByte & 0xC0) == 0x80) { + return continuationByte & 0x3F; + } + + // If we end up here, it’s not a continuation byte + throw Error('Invalid continuation byte'); + } + + function decodeSymbol(strict) { + var byte1; + var byte2; + var byte3; + var byte4; + var codePoint; + + if (byteIndex > byteCount) { + throw Error('Invalid byte index'); + } + + if (byteIndex == byteCount) { + return false; + } + + // Read first byte + byte1 = byteArray[byteIndex] & 0xFF; + byteIndex++; + + // 1-byte sequence (no continuation bytes) + if ((byte1 & 0x80) == 0) { + return byte1; + } + + // 2-byte sequence + if ((byte1 & 0xE0) == 0xC0) { + byte2 = readContinuationByte(); + codePoint = ((byte1 & 0x1F) << 6) | byte2; + if (codePoint >= 0x80) { + return codePoint; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 3-byte sequence (may include unpaired surrogates) + if ((byte1 & 0xF0) == 0xE0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3; + if (codePoint >= 0x0800) { + return checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD; + } else { + throw Error('Invalid continuation byte'); + } + } + + // 4-byte sequence + if ((byte1 & 0xF8) == 0xF0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + byte4 = readContinuationByte(); + codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) | + (byte3 << 0x06) | byte4; + if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { + return codePoint; + } + } + + throw Error('Invalid UTF-8 detected'); + } + + var byteArray; + var byteCount; + var byteIndex; + function utf8decode(byteString, opts) { + opts = opts || {}; + var strict = false !== opts.strict; + + byteArray = ucs2decode(byteString); + byteCount = byteArray.length; + byteIndex = 0; + var codePoints = []; + var tmp; + while ((tmp = decodeSymbol(strict)) !== false) { + codePoints.push(tmp); + } + return ucs2encode(codePoints); + } + + /*--------------------------------------------------------------------------*/ + + var utf8 = { + 'version': '2.1.2', + 'encode': utf8encode, + 'decode': utf8decode + }; + + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + true + ) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { + return utf8; + }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { // in Node.js or RingoJS v0.8.0+ + freeModule.exports = utf8; + } else { // in Narwhal or RingoJS v0.7.0- + var object = {}; + var hasOwnProperty = object.hasOwnProperty; + for (var key in utf8) { + hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]); + } + } + } else { // in Rhino or a web browser + root.utf8 = utf8; + } + + }(this)); + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15)(module), (function() { return this; }()))) + +/***/ }, +/* 15 */ +/***/ function(module, exports) { + + module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + } + + +/***/ }, +/* 16 */ +/***/ function(module, exports) { + + /* + * base64-arraybuffer + * https://github.com/niklasvh/base64-arraybuffer + * + * Copyright (c) 2012 Niklas von Hertzen + * Licensed under the MIT license. + */ + (function(){ + "use strict"; + + var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + // Use a lookup table to find the index. + var lookup = new Uint8Array(256); + for (var i = 0; i < chars.length; i++) { + lookup[chars.charCodeAt(i)] = i; + } + + exports.encode = function(arraybuffer) { + var bytes = new Uint8Array(arraybuffer), + i, len = bytes.length, base64 = ""; + + for (i = 0; i < len; i+=3) { + base64 += chars[bytes[i] >> 2]; + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + base64 += chars[bytes[i + 2] & 63]; + } + + if ((len % 3) === 2) { + base64 = base64.substring(0, base64.length - 1) + "="; + } else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + "=="; + } + + return base64; + }; + + exports.decode = function(base64) { + var bufferLength = base64.length * 0.75, + len = base64.length, i, p = 0, + encoded1, encoded2, encoded3, encoded4; + + if (base64[base64.length - 1] === "=") { + bufferLength--; + if (base64[base64.length - 2] === "=") { + bufferLength--; + } + } + + var arraybuffer = new ArrayBuffer(bufferLength), + bytes = new Uint8Array(arraybuffer); + + for (i = 0; i < len; i+=4) { + encoded1 = lookup[base64.charCodeAt(i)]; + encoded2 = lookup[base64.charCodeAt(i+1)]; + encoded3 = lookup[base64.charCodeAt(i+2)]; + encoded4 = lookup[base64.charCodeAt(i+3)]; + + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } + + return arraybuffer; + }; + })(); + + +/***/ }, +/* 17 */ +/***/ function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {/** + * Create a blob builder even when vendor prefixes exist + */ + + var BlobBuilder = global.BlobBuilder + || global.WebKitBlobBuilder + || global.MSBlobBuilder + || global.MozBlobBuilder; + + /** + * Check if Blob constructor is supported + */ + + var blobSupported = (function() { + try { + var a = new Blob(['hi']); + return a.size === 2; + } catch(e) { + return false; + } + })(); + + /** + * Check if Blob constructor supports ArrayBufferViews + * Fails in Safari 6, so we need to map to ArrayBuffers there. + */ + + var blobSupportsArrayBufferView = blobSupported && (function() { + try { + var b = new Blob([new Uint8Array([1,2])]); + return b.size === 2; + } catch(e) { + return false; + } + })(); + + /** + * Check if BlobBuilder is supported + */ + + var blobBuilderSupported = BlobBuilder + && BlobBuilder.prototype.append + && BlobBuilder.prototype.getBlob; + + /** + * Helper function that maps ArrayBufferViews to ArrayBuffers + * Used by BlobBuilder constructor and old browsers that didn't + * support it in the Blob constructor. + */ + + function mapArrayBufferViews(ary) { + for (var i = 0; i < ary.length; i++) { + var chunk = ary[i]; + if (chunk.buffer instanceof ArrayBuffer) { + var buf = chunk.buffer; + + // if this is a subarray, make a copy so we only + // include the subarray region from the underlying buffer + if (chunk.byteLength !== buf.byteLength) { + var copy = new Uint8Array(chunk.byteLength); + copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); + buf = copy.buffer; + } + + ary[i] = buf; + } + } + } + + function BlobBuilderConstructor(ary, options) { + options = options || {}; + + var bb = new BlobBuilder(); + mapArrayBufferViews(ary); + + for (var i = 0; i < ary.length; i++) { + bb.append(ary[i]); + } + + return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); + }; + + function BlobConstructor(ary, options) { + mapArrayBufferViews(ary); + return new Blob(ary, options || {}); + }; + + module.exports = (function() { + if (blobSupported) { + return blobSupportsArrayBufferView ? global.Blob : BlobConstructor; + } else if (blobBuilderSupported) { + return BlobBuilderConstructor; + } else { + return undefined; + } + })(); + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * Expose `Emitter`. + */ + + if (true) { + module.exports = Emitter; + } + + /** + * Initialize a new `Emitter`. + * + * @api public + */ + + function Emitter(obj) { + if (obj) return mixin(obj); + }; + + /** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; + } + + /** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.on = + Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; + }; + + /** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; + }; + + /** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.off = + Emitter.prototype.removeListener = + Emitter.prototype.removeAllListeners = + Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; + }; + + /** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + + Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; + }; + + /** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + + Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; + }; + + /** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + + Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; + }; + + +/***/ }, +/* 19 */ +/***/ function(module, exports) { + + /** + * Compiles a querystring + * Returns string representation of the object + * + * @param {Object} + * @api private + */ + + exports.encode = function (obj) { + var str = ''; + + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + if (str.length) str += '&'; + str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]); + } + } + + return str; + }; + + /** + * Parses a simple querystring into an object + * + * @param {String} qs + * @api private + */ + + exports.decode = function(qs){ + var qry = {}; + var pairs = qs.split('&'); + for (var i = 0, l = pairs.length; i < l; i++) { + var pair = pairs[i].split('='); + qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); + } + return qry; + }; + + +/***/ }, +/* 20 */ +/***/ function(module, exports) { + + + module.exports = function(a, b){ + var fn = function(){}; + fn.prototype = b.prototype; + a.prototype = new fn; + a.prototype.constructor = a; + }; + +/***/ }, +/* 21 */ +/***/ function(module, exports) { + + 'use strict'; + + var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('') + , length = 64 + , map = {} + , seed = 0 + , i = 0 + , prev; + + /** + * Return a string representing the specified number. + * + * @param {Number} num The number to convert. + * @returns {String} The string representation of the number. + * @api public + */ + function encode(num) { + var encoded = ''; + + do { + encoded = alphabet[num % length] + encoded; + num = Math.floor(num / length); + } while (num > 0); + + return encoded; + } + + /** + * Return the integer value specified by the given string. + * + * @param {String} str The string to convert. + * @returns {Number} The integer value represented by the string. + * @api public + */ + function decode(str) { + var decoded = 0; + + for (i = 0; i < str.length; i++) { + decoded = decoded * length + map[str.charAt(i)]; + } + + return decoded; + } + + /** + * Yeast: A tiny growing id generator. + * + * @returns {String} A unique id. + * @api public + */ + function yeast() { + var now = encode(+new Date()); + + if (now !== prev) return seed = 0, prev = now; + return now +'.'+ encode(seed++); + } + + // + // Map each character to its index. + // + for (; i < length; i++) map[alphabet[i]] = i; + + // + // Expose the `yeast`, `encode` and `decode` functions. + // + yeast.encode = encode; + yeast.decode = decode; + module.exports = yeast; + + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = __webpack_require__(24); + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + + /** + * Colors. + */ + + exports.colors = [ + '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', + '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', + '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', + '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', + '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', + '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', + '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', + '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', + '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', + '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', + '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33' + ]; + + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); + } + + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } + }; + + + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + } + + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); + } + + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} + } + + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ + + exports.enable(load()); + + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + function localstorage() { + try { + return window.localStorage; + } catch (e) {} + } + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(23))) + +/***/ }, +/* 23 */ +/***/ function(module, exports) { + + // shim for using process in browser + var process = module.exports = {}; + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + } ()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { return [] } + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; + + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = __webpack_require__(25); + + /** + * Active `debug` instances. + */ + exports.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + exports.names = []; + exports.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + exports.formatters = {}; + + /** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + + function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; + } + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + + var prevTime; + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + exports.instances.push(debug); + + return debug; + } + + function destroy () { + var index = exports.instances.indexOf(this); + if (index !== -1) { + exports.instances.splice(index, 1); + return true; + } else { + return false; + } + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < exports.instances.length; i++) { + var instance = exports.instances[i]; + instance.enabled = exports.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @api public + */ + + function disable() { + exports.enable(''); + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; + } + + +/***/ }, +/* 25 */ +/***/ function(module, exports) { + + /** + * Helpers. + */ + + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); + }; + + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } + } + + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; + } + + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; + } + + /** + * Pluralization helper. + */ + + function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; + } + + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + /** + * Module requirements. + */ + + var Polling = __webpack_require__(6); + var inherit = __webpack_require__(20); + + /** + * Module exports. + */ + + module.exports = JSONPPolling; + + /** + * Cached regular expressions. + */ + + var rNewline = /\n/g; + var rEscapedNewline = /\\n/g; + + /** + * Global JSONP callbacks. + */ + + var callbacks; + + /** + * Noop. + */ + + function empty() {} + + /** + * JSONP Polling constructor. + * + * @param {Object} opts. + * @api public + */ + + function JSONPPolling(opts) { + Polling.call(this, opts); + + this.query = this.query || {}; + + // define global callbacks array if not present + // we do this here (lazily) to avoid unneeded global pollution + if (!callbacks) { + // we need to consider multiple engines in the same page + if (!global.___eio) global.___eio = []; + callbacks = global.___eio; + } + + // callback identifier + this.index = callbacks.length; + + // add callback to jsonp global + var self = this; + callbacks.push(function (msg) { + self.onData(msg); + }); + + // append to query string + this.query.j = this.index; + + // prevent spurious errors from being emitted when the window is unloaded + if (global.document && global.addEventListener) { + global.addEventListener('beforeunload', function () { + if (self.script) self.script.onerror = empty; + }, false); + } + } + + /** + * Inherits from Polling. + */ + + inherit(JSONPPolling, Polling); + + /* + * JSONP only supports binary as base64 encoded strings + */ + + JSONPPolling.prototype.supportsBinary = false; + + /** + * Closes the socket. + * + * @api private + */ + + JSONPPolling.prototype.doClose = function () { + if (this.script) { + this.script.parentNode.removeChild(this.script); + this.script = null; + } + + if (this.form) { + this.form.parentNode.removeChild(this.form); + this.form = null; + this.iframe = null; + } + + Polling.prototype.doClose.call(this); + }; + + /** + * Starts a poll cycle. + * + * @api private + */ + + JSONPPolling.prototype.doPoll = function () { + var self = this; + var script = document.createElement('script'); + + if (this.script) { + this.script.parentNode.removeChild(this.script); + this.script = null; + } + + script.async = true; + script.src = this.uri(); + script.onerror = function (e) { + self.onError('jsonp poll error', e); + }; + + var insertAt = document.getElementsByTagName('script')[0]; + if (insertAt) { + insertAt.parentNode.insertBefore(script, insertAt); + } else { + (document.head || document.body).appendChild(script); + } + this.script = script; + + var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent); + + if (isUAgecko) { + setTimeout(function () { + var iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + document.body.removeChild(iframe); + }, 100); + } + }; + + /** + * Writes with a hidden iframe. + * + * @param {String} data to send + * @param {Function} called upon flush. + * @api private + */ + + JSONPPolling.prototype.doWrite = function (data, fn) { + var self = this; + + if (!this.form) { + var form = document.createElement('form'); + var area = document.createElement('textarea'); + var id = this.iframeId = 'eio_iframe_' + this.index; + var iframe; + + form.className = 'socketio'; + form.style.position = 'absolute'; + form.style.top = '-1000px'; + form.style.left = '-1000px'; + form.target = id; + form.method = 'POST'; + form.setAttribute('accept-charset', 'utf-8'); + area.name = 'd'; + form.appendChild(area); + document.body.appendChild(form); + + this.form = form; + this.area = area; + } + + this.form.action = this.uri(); + + function complete() { + initIframe(); + fn(); + } + + function initIframe() { + if (self.iframe) { + try { + self.form.removeChild(self.iframe); + } catch (e) { + self.onError('jsonp polling iframe removal error', e); + } + } + + try { + // ie6 dynamic iframes with target="" support (thanks Chris Lambacher) + var html = '