UNPKG

@quartic/bokehjs

Version:

Interactive, novel data visualization

57 lines (56 loc) 2.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /// <reference path="./node.d.ts" /> ; var bokehjs, pkg, root; var fs = require("fs"); var path = require("path"); var assert = require("assert"); var rootRequire = require("root-require"); root = rootRequire.packpath.parent(); pkg = rootRequire("./package.json"); module.constructor.prototype.require = function (modulePath) { var overridePath; assert(modulePath, 'missing path'); assert(typeof modulePath === 'string', 'path must be a string'); if (!modulePath.startsWith(".")) { overridePath = pkg.browser[modulePath]; if (overridePath != null) { modulePath = path.join(root, overridePath); } else { overridePath = path.join(root, path.dirname(pkg.main), modulePath + ".js"); if (fs.existsSync(overridePath)) { modulePath = overridePath; } } } return this.constructor._load(modulePath, this); }; bokehjs = function () { var Bokeh, load_plugin; if ((typeof window !== "undefined" && window !== null ? window.document : void 0) == null) { throw new Error("bokehjs requires a window with a document. If your runtime environment doesn't provide those, e.g. pure node.js, you can use jsdom library to configure window and document."); } Bokeh = require('./main'); load_plugin = function (path) { var name, obj, plugin, results; plugin = require(path); Bokeh.Models.register_models(plugin.models); results = []; for (name in plugin) { obj = plugin[name]; if (name !== "models") { results.push(Bokeh[name] = obj); } else { results.push(void 0); } } return results; }; load_plugin('./api'); load_plugin('./models/widgets/main'); return Bokeh; }; module.exports = (typeof window !== "undefined" && window !== null ? window.document : void 0) != null ? bokehjs() : bokehjs;