nodebook
Version:
Node.js • Apprendre par la pratique. Familiarisez-vous avec JavaScript, Node.js et l'écosystème de modules npm. Apprenez à concevoir et à déployer des *applications web* et des *outils en ligne de commande*.
656 lines (602 loc) • 873 kB
JavaScript
(function loader(mappings, entryPoints, options) {
if (entryPoints.length > 1) {
throw new Error(
"LiveReactLoad supports only one entry point at the moment"
)
}
var entryId = entryPoints[0];
var scope = {
mappings: mappings,
revNums: {},
cache: {},
reloading: false,
reloadHooks: {},
reload: function (fn) {
scope.reloading = true;
try {
fn();
} finally {
scope.reloading = false;
}
}
};
function startClient() {
if (!options.clientEnabled) {
return;
}
if (typeof window.WebSocket === "undefined") {
warn("WebSocket API not available, reloading is disabled");
return;
}
var protocol = window.location.protocol === "https:" ? "wss" : "ws";
var url = protocol + "://" + (options.host || window.location.hostname) + ":" + options.port;
var ws = new WebSocket(url);
ws.onopen = function () {
info("WebSocket client listening for changes...");
};
ws.onmessage = function (m) {
var msg = JSON.parse(m.data);
if (msg.type === "change") {
handleBundleChange(msg.data);
} else if (msg.type === "bundle_error") {
handleBundleError(msg.data);
}
}
}
function compile(mapping, revision) {
var body = mapping[0];
if (typeof body !== "function") {
debug("Compiling module", mapping[2], "[revision " + revision + " ]")
var compiled = compileModule(body, mapping[2].sourcemap);
mapping[0] = compiled;
mapping[2].source = body;
}
}
function compileModule(source, sourcemap) {
var toModule = new Function(
"__livereactload_source", "__livereactload_sourcemap",
"return eval('function __livereactload_module(require, module, exports){\\n' + __livereactload_source + '\\n}; __livereactload_module;' + (__livereactload_sourcemap || ''));"
);
return toModule(source, sourcemap)
}
function unknownUseCase() {
throw new Error(
"Unknown use-case encountered! Please raise an issue: " +
"https://github.com/milankinen/livereactload/issues"
)
}
// returns loaded module from cache or if not found, then
// loads it from the source and caches it
function load(id, recur) {
var mappings = scope.mappings;
var cache = scope.cache;
if (!cache[id]) {
if (!mappings[id]) {
var req = typeof require == "function" && require;
if (req) return req(id);
var error = new Error("Cannot find module '" + id + "'");
error.code = "MODULE_NOT_FOUND";
throw error;
}
var hook = scope.reloadHooks[id];
var module = cache[id] = {
exports: {},
__accepted: false,
onReload: function (hook) {
scope.reloadHooks[id] = hook;
}
};
mappings[id][0].call(module.exports, function require(path) {
var targetId = mappings[id][1][path];
return load(targetId ? targetId : path);
}, module, module.exports, unknownUseCase, mappings, cache, entryPoints);
if (scope.reloading && typeof hook === "function") {
// it's important **not** to assign to module.__accepted because it would point
// to the old module object during the reload event!
cache[id].__accepted = hook()
}
}
return cache[id].exports;
}
/**
* Patches the existing modules with new sources and returns a list of changes
* (module id and old mapping. ATTENTION: This function does not do any reloading yet.
*
* @param mappings
* New mappings
* @returns {Array}
* List of changes
*/
function patch(mappings) {
var compile = scope.compile;
var changes = [];
keys(mappings).forEach(function (id) {
var old = scope.mappings[id];
var mapping = mappings[id];
var meta = mapping[2];
if (!old || old[2].hash !== meta.hash) {
var rev = scope.revNums[id] ? ++scope.revNums[id] : (scope.revNums[id] = 1);
if (old && meta.sourcemap) {
addVersionToSourceMap(meta, rev);
}
compile(mapping, rev);
scope.mappings[id] = mapping;
changes.push([id, old]);
}
});
return changes;
// Updates the source map by adding a revision parameter to the filename.
// Without this new filename, browsers will ignore the updated source map.
function addVersionToSourceMap(meta, revision) {
var comment = meta.sourcemap
.replace(/^\/\*/g, '//')
.replace(/\*\/$/g, '');
// decode sourcemap comment and add hash param
comment = comment.split(',').pop();
var sourcemap = JSON.parse(atob(comment));
for (var i = 0; i < sourcemap.sources.length; i++) {
sourcemap.sources[i] += "?rev=" + revision;
}
// re-encode to sourcemap comment
comment = btoa(JSON.stringify(sourcemap));
comment = '//# sourceMappingURL=data:application/json;base64,' + comment;
meta.sourcemap = comment;
}
}
/**
* Reloads modules based on the given changes. If reloading fails, this function
* tries to restore old implementation.
*
* @param changes
* Changes array received from "patch" function
*/
function reload(changes) {
var changedModules = changes.map(function (c) {
return c[0];
});
var newMods = changes.filter(function (c) {
return !c[1];
}).map(function (c) {
return c[0];
});
scope.reload(function () {
try {
info("Applying changes...");
debug("Changed modules", changedModules);
debug("New modules", newMods);
evaluate(entryId, {});
info("Reload complete!");
} catch (e) {
error("Error occurred while reloading changes. Restoring old implementation...");
console.error(e);
console.error(e.stack);
try {
restore();
evaluate(entryId, {});
info("Restored!");
} catch (re) {
error("Restore failed. You may need to refresh your browser... :-/");
console.error(re);
console.error(re.stack);
}
}
})
function evaluate(id, changeCache) {
if (id in changeCache) {
debug("Circular dependency detected for module", id, "not traversing any further...");
return changeCache[id];
}
if (isExternalModule(id)) {
debug("Module", id, "is an external module. Do not reload");
return false;
}
var module = getModule(id);
debug("Evaluate module details", module);
// initially mark change status to follow module's change status
// TODO: how to propagate change status from children to this without causing infinite recursion?
var meChanged = contains(changedModules, id);
changeCache[id] = meChanged;
if (id in scope.cache) {
delete scope.cache[id];
}
var deps = module.deps.filter(isLocalModule);
var depsChanged = deps.map(function (dep) {
return evaluate(dep, changeCache);
});
// In the case of circular dependencies, the module evaluation stops because of the
// changeCache check above. Also module cache should be clear. However, if some circular
// dependency (or its descendant) gets reloaded, it (re)loads new version of this
// module back to cache. That's why we need to ensure that we're not
// 1) reloading module twice (so that we don't break cross-refs)
// 2) reload any new version if there is no need for reloading
//
// Hence the complex "scope.cache" stuff...
//
var isReloaded = module.cached !== undefined && id in scope.cache;
var depChanged = any(depsChanged);
if (isReloaded || depChanged || meChanged) {
debug("Module changed", id, isReloaded, depChanged, meChanged);
if (!isReloaded) {
var msg = contains(newMods, id) ? " > Add new module ::" : " > Reload module ::";
console.log(msg, id);
load(id);
} else {
console.log(" > Already reloaded ::", id);
}
changeCache[id] = !allExportsProxies(id) && !isAccepted(id);
return changeCache[id];
} else {
// restore old version of the module
if (module.cached !== undefined) {
scope.cache[id] = module.cached;
}
return false;
}
}
function allExportsProxies(id) {
var e = scope.cache[id].exports;
return isProxy(e) || (isPlainObj(e) && all(vals(e), isProxy));
function isProxy(x) {
return x && !!x.__$$LiveReactLoadable;
}
}
function isAccepted(id) {
var accepted = scope.cache[id].__accepted;
scope.cache[id].__accepted = false;
if (accepted === true) {
console.log(" > Manually accepted")
}
return accepted === true;
}
function restore() {
changes.forEach(function (c) {
var id = c[0], mapping = c[1];
if (mapping) {
debug("Restore old mapping", id);
scope.mappings[id] = mapping;
} else {
debug("Delete new mapping", id);
delete scope.mappings[id];
}
})
}
}
function getModule(id) {
return {
deps: vals(scope.mappings[id][1]),
meta: scope.mappings[id][2],
cached: scope.cache[id]
};
}
function handleBundleChange(newMappings) {
info("Bundle changed");
var changes = patch(newMappings);
if (changes.length > 0) {
reload(changes);
} else {
info("Nothing to reload");
}
}
function handleBundleError(data) {
error("Bundling error occurred");
error(data.error);
}
// prepare mappings before starting the app
forEachValue(scope.mappings, compile);
if (options.babel) {
if (isReactTransformEnabled(scope.mappings)) {
info("LiveReactLoad Babel transform detected. Ready to rock!");
} else {
warn(
"Could not detect LiveReactLoad transform (livereactload/babel-transform). " +
"Please see instructions how to setup the transform:\n\n" +
"https://github.com/milankinen/livereactload#installation"
);
}
}
scope.compile = compile;
scope.load = load;
debug("Options:", options);
debug("Entries:", entryPoints, entryId);
startClient();
// standalone bundles may need the exports from entry module
return load(entryId);
// this function is stringified in browserify process and appended to the bundle
// so these helper functions must be inlined into this function, otherwise
// the function is not working
function isReactTransformEnabled(mappings) {
return any(vals(mappings), function (mapping) {
var source = mapping[2].source;
return source && source.indexOf("__$$LiveReactLoadable") !== -1;
});
}
function isLocalModule(id) {
return id.indexOf(options.nodeModulesRoot) === -1
}
function isExternalModule(id) {
return !(id in scope.mappings);
}
function keys(obj) {
return obj ? Object.keys(obj) : [];
}
function vals(obj) {
return keys(obj).map(function (key) {
return obj[key];
});
}
function contains(col, val) {
for (var i = 0; i < col.length; i++) {
if (col[i] === val) return true;
}
return false;
}
function all(col, f) {
if (!f) {
f = function (x) {
return x;
};
}
for (var i = 0; i < col.length; i++) {
if (!f(col[i])) return false;
}
return true;
}
function any(col, f) {
if (!f) {
f = function (x) {
return x;
};
}
for (var i = 0; i < col.length; i++) {
if (f(col[i])) return true;
}
return false;
}
function forEachValue(obj, fn) {
keys(obj).forEach(function (key) {
if (obj.hasOwnProperty(key)) {
fn(obj[key]);
}
});
}
function isPlainObj(x) {
return typeof x == 'object' && x.constructor == Object;
}
function debug() {
if (options.debug) {
console.log.apply(console, ["LiveReactload [DEBUG] ::"].concat(Array.prototype.slice.call(arguments)));
}
}
function info(msg) {
console.info("LiveReactload ::", msg);
}
function warn(msg) {
console.warn("LiveReactload ::", msg);
}
function error(msg) {
console.error("LiveReactload ::", msg);
}
})({
"/Users/oncletom/workspace/nodebook/chapter-04/examples/Buttons.jsx": [
"'use strict';\n\nexports.__esModule = true;\nexports.IconButton = exports.BaseButton = undefined;\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nrequire('./buttons.scss');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// <1>\n\nvar Icon = function Icon(props) {\n return _react2.default.createElement(\n 'svg',\n { 'aria-hidden': 'true' },\n _react2.default.createElement('use', { xlinkHref: 'symbols.svg#' + props.id })\n );\n};\n\nvar BaseButton = exports.BaseButton = function BaseButton(props) {\n return _react2.default.createElement(\n 'button',\n { className: 'btn' },\n props.label\n );\n};\n\nvar IconButton = exports.IconButton = function IconButton(props) {\n return _react2.default.createElement(\n 'button',\n { className: 'btn btn--icon' },\n _react2.default.createElement(Icon, { id: props.icon }),\n props.label\n );\n};\n",
{
"./buttons.scss": "/Users/oncletom/workspace/nodebook/chapter-04/examples/buttons.scss",
"react": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/react/react.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/examples/Buttons.jsx",
"hash": "138c7ee93dd8dafb6c663bbb895d7936",
"browserifyId": 1,
"sourcemap": "//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkJ1dHRvbnMuanN4Il0sIm5hbWVzIjpbIkljb24iLCJwcm9wcyIsImlkIiwiQmFzZUJ1dHRvbiIsImxhYmVsIiwiSWNvbkJ1dHRvbiIsImljb24iXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBOzs7O0FBQ0E7Ozs7QUFBeUI7O0FBRXpCLElBQU1BLE9BQU8sU0FBUEEsSUFBTyxDQUFDQyxLQUFEO0FBQUEsU0FBWTtBQUFBO0FBQUEsTUFBSyxlQUFZLE1BQWpCO0FBQ3ZCLDJDQUFLLFdBQVcsaUJBQWlCQSxNQUFNQyxFQUF2QztBQUR1QixHQUFaO0FBQUEsQ0FBYjs7QUFJTyxJQUFNQyxrQ0FBYSxTQUFiQSxVQUFhLENBQUNGLEtBQUQ7QUFBQSxTQUN4QjtBQUFBO0FBQUEsTUFBUSxXQUFVLEtBQWxCO0FBQXlCQSxVQUFNRztBQUEvQixHQUR3QjtBQUFBLENBQW5COztBQUlBLElBQU1DLGtDQUFhLFNBQWJBLFVBQWEsQ0FBQ0osS0FBRDtBQUFBLFNBQ3hCO0FBQUE7QUFBQSxNQUFRLFdBQVUsZUFBbEI7QUFDRSxrQ0FBQyxJQUFELElBQU0sSUFBSUEsTUFBTUssSUFBaEIsR0FERjtBQUVHTCxVQUFNRztBQUZULEdBRHdCO0FBQUEsQ0FBbkIiLCJmaWxlIjoiQnV0dG9ucy5qc3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0ICcuL2J1dHRvbnMuc2Nzcyc7IC8vIDwxPlxuXG5jb25zdCBJY29uID0gKHByb3BzKSA9PiAoPHN2ZyBhcmlhLWhpZGRlbj1cInRydWVcIj5cbiAgPHVzZSB4bGlua0hyZWY9eydzeW1ib2xzLnN2ZyMnICsgcHJvcHMuaWR9IC8+XG48L3N2Zz4pO1xuXG5leHBvcnQgY29uc3QgQmFzZUJ1dHRvbiA9IChwcm9wcykgPT4gKFxuICA8YnV0dG9uIGNsYXNzTmFtZT1cImJ0blwiPntwcm9wcy5sYWJlbH08L2J1dHRvbj5cbik7XG5cbmV4cG9ydCBjb25zdCBJY29uQnV0dG9uID0gKHByb3BzKSA9PiAoXG4gIDxidXR0b24gY2xhc3NOYW1lPVwiYnRuIGJ0bi0taWNvblwiPlxuICAgIDxJY29uIGlkPXtwcm9wcy5pY29ufSAvPlxuICAgIHtwcm9wcy5sYWJlbH1cbiAgPC9idXR0b24+XG4pO1xuIl19"
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/examples/buttons.scss": [
"module.exports = require('sassify')('.btn.btn--small { font-size: 0.8em; } .btn.btn--regular { font-size: 1em; } .btn.btn--large { font-size: 1.2em; } .btn.btn--icon svg { height: 16px; width: 16px; margin-right: .5em; } ');;",
{
"sassify": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/sassify/lib/sassify-browser.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/examples/buttons.scss",
"hash": "00e139ae28c1a72a8991850e71cf7e84",
"browserifyId": 2,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/cssify/browser.js": [
"module.exports = function (css, customDocument) {\n var doc = customDocument || document;\n if (doc.createStyleSheet) {\n var sheet = doc.createStyleSheet()\n sheet.cssText = css;\n return sheet.ownerNode;\n } else {\n var head = doc.getElementsByTagName('head')[0],\n style = doc.createElement('style');\n\n style.type = 'text/css';\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(doc.createTextNode(css));\n }\n\n head.appendChild(style);\n return style;\n }\n};\n\nmodule.exports.byUrl = function(url) {\n if (document.createStyleSheet) {\n return document.createStyleSheet(url).ownerNode;\n } else {\n var head = document.getElementsByTagName('head')[0],\n link = document.createElement('link');\n\n link.rel = 'stylesheet';\n link.href = url;\n\n head.appendChild(link);\n return link;\n }\n};\n",
{},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/cssify/browser.js",
"hash": "0f8e8e94a51aecbcfa817c62550b0e89",
"browserifyId": 3,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/EventListener.js": [
"(function (process){\n'use strict';\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @typechecks\n */\n\nvar emptyFunction = require('./emptyFunction');\n\n/**\n * Upstream version of event listener. Does not take into account specific\n * nature of platform.\n */\nvar EventListener = {\n /**\n * Listen to DOM events during the bubble phase.\n *\n * @param {DOMEventTarget} target DOM element to register listener on.\n * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.\n * @param {function} callback Callback function.\n * @return {object} Object with a `remove` method.\n */\n listen: function listen(target, eventType, callback) {\n if (target.addEventListener) {\n target.addEventListener(eventType, callback, false);\n return {\n remove: function remove() {\n target.removeEventListener(eventType, callback, false);\n }\n };\n } else if (target.attachEvent) {\n target.attachEvent('on' + eventType, callback);\n return {\n remove: function remove() {\n target.detachEvent('on' + eventType, callback);\n }\n };\n }\n },\n\n /**\n * Listen to DOM events during the capture phase.\n *\n * @param {DOMEventTarget} target DOM element to register listener on.\n * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.\n * @param {function} callback Callback function.\n * @return {object} Object with a `remove` method.\n */\n capture: function capture(target, eventType, callback) {\n if (target.addEventListener) {\n target.addEventListener(eventType, callback, true);\n return {\n remove: function remove() {\n target.removeEventListener(eventType, callback, true);\n }\n };\n } else {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');\n }\n return {\n remove: emptyFunction\n };\n }\n },\n\n registerDefault: function registerDefault() {}\n};\n\nmodule.exports = EventListener;\n}).call(this,require('_process'))",
{
"_process": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/process/browser.js",
"./emptyFunction": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/emptyFunction.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/EventListener.js",
"hash": "bc68b433c2f00c2bb0f06dd9a9be536d",
"browserifyId": 4,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/ExecutionEnvironment.js": [
"/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n */\n\n'use strict';\n\nvar canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\n\n/**\n * Simple, lightweight module assisting with the detection and context of\n * Worker. Helps avoid circular dependencies and allows code to reason about\n * whether or not they are in a Worker, even if they never include the main\n * `ReactWorker` dependency.\n */\nvar ExecutionEnvironment = {\n\n canUseDOM: canUseDOM,\n\n canUseWorkers: typeof Worker !== 'undefined',\n\n canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),\n\n canUseViewport: canUseDOM && !!window.screen,\n\n isInWorker: !canUseDOM // For now, this is true - might change in the future.\n\n};\n\nmodule.exports = ExecutionEnvironment;",
{},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/ExecutionEnvironment.js",
"hash": "c2f8e9f3603a48b4ce9a3de98658deef",
"browserifyId": 5,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/camelize.js": [
"\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @typechecks\n */\n\nvar _hyphenPattern = /-(.)/g;\n\n/**\n * Camelcases a hyphenated string, for example:\n *\n * > camelize('background-color')\n * < \"backgroundColor\"\n *\n * @param {string} string\n * @return {string}\n */\nfunction camelize(string) {\n return string.replace(_hyphenPattern, function (_, character) {\n return character.toUpperCase();\n });\n}\n\nmodule.exports = camelize;",
{},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/camelize.js",
"hash": "cf2bba28dcfacc0f5ef04c3a77cf297e",
"browserifyId": 6,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/camelizeStyleName.js": [
"/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @typechecks\n */\n\n'use strict';\n\nvar camelize = require('./camelize');\n\nvar msPattern = /^-ms-/;\n\n/**\n * Camelcases a hyphenated CSS property name, for example:\n *\n * > camelizeStyleName('background-color')\n * < \"backgroundColor\"\n * > camelizeStyleName('-moz-transition')\n * < \"MozTransition\"\n * > camelizeStyleName('-ms-transition')\n * < \"msTransition\"\n *\n * As Andi Smith suggests\n * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix\n * is converted to lowercase `ms`.\n *\n * @param {string} string\n * @return {string}\n */\nfunction camelizeStyleName(string) {\n return camelize(string.replace(msPattern, 'ms-'));\n}\n\nmodule.exports = camelizeStyleName;",
{
"./camelize": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/camelize.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/camelizeStyleName.js",
"hash": "517dd2ecab40f5c1c8e97822c48fc45f",
"browserifyId": 7,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/containsNode.js": [
"'use strict';\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * \n */\n\nvar isTextNode = require('./isTextNode');\n\n/*eslint-disable no-bitwise */\n\n/**\n * Checks if a given DOM node contains or is another DOM node.\n */\nfunction containsNode(outerNode, innerNode) {\n if (!outerNode || !innerNode) {\n return false;\n } else if (outerNode === innerNode) {\n return true;\n } else if (isTextNode(outerNode)) {\n return false;\n } else if (isTextNode(innerNode)) {\n return containsNode(outerNode, innerNode.parentNode);\n } else if ('contains' in outerNode) {\n return outerNode.contains(innerNode);\n } else if (outerNode.compareDocumentPosition) {\n return !!(outerNode.compareDocumentPosition(innerNode) & 16);\n } else {\n return false;\n }\n}\n\nmodule.exports = containsNode;",
{
"./isTextNode": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/isTextNode.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/containsNode.js",
"hash": "ef8061090339724efbe42f4112342b79",
"browserifyId": 8,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/createArrayFromMixed.js": [
"(function (process){\n'use strict';\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @typechecks\n */\n\nvar invariant = require('./invariant');\n\n/**\n * Convert array-like objects to arrays.\n *\n * This API assumes the caller knows the contents of the data type. For less\n * well defined inputs use createArrayFromMixed.\n *\n * @param {object|function|filelist} obj\n * @return {array}\n */\nfunction toArray(obj) {\n var length = obj.length;\n\n // Some browsers builtin objects can report typeof 'function' (e.g. NodeList\n // in old versions of Safari).\n !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;\n\n !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;\n\n !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;\n\n !(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object can\\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0;\n\n // Old IE doesn't give collections access to hasOwnProperty. Assume inputs\n // without method will throw during the slice call and skip straight to the\n // fallback.\n if (obj.hasOwnProperty) {\n try {\n return Array.prototype.slice.call(obj);\n } catch (e) {\n // IE < 9 does not support Array#slice on collections objects\n }\n }\n\n // Fall back to copying key by key. This assumes all keys have a value,\n // so will not preserve sparsely populated inputs.\n var ret = Array(length);\n for (var ii = 0; ii < length; ii++) {\n ret[ii] = obj[ii];\n }\n return ret;\n}\n\n/**\n * Perform a heuristic test to determine if an object is \"array-like\".\n *\n * A monk asked Joshu, a Zen master, \"Has a dog Buddha nature?\"\n * Joshu replied: \"Mu.\"\n *\n * This function determines if its argument has \"array nature\": it returns\n * true if the argument is an actual array, an `arguments' object, or an\n * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).\n *\n * It will return false for other array-like objects like Filelist.\n *\n * @param {*} obj\n * @return {boolean}\n */\nfunction hasArrayNature(obj) {\n return (\n // not null/false\n !!obj && (\n // arrays are objects, NodeLists are functions in Safari\n typeof obj == 'object' || typeof obj == 'function') &&\n // quacks like an array\n 'length' in obj &&\n // not window\n !('setInterval' in obj) &&\n // no DOM node should be considered an array-like\n // a 'select' element has 'length' and 'item' properties on IE8\n typeof obj.nodeType != 'number' && (\n // a real array\n Array.isArray(obj) ||\n // arguments\n 'callee' in obj ||\n // HTMLCollection/NodeList\n 'item' in obj)\n );\n}\n\n/**\n * Ensure that the argument is an array by wrapping it in an array if it is not.\n * Creates a copy of the argument if it is already an array.\n *\n * This is mostly useful idiomatically:\n *\n * var createArrayFromMixed = require('createArrayFromMixed');\n *\n * function takesOneOrMoreThings(things) {\n * things = createArrayFromMixed(things);\n * ...\n * }\n *\n * This allows you to treat `things' as an array, but accept scalars in the API.\n *\n * If you need to convert an array-like object, like `arguments`, into an array\n * use toArray instead.\n *\n * @param {*} obj\n * @return {array}\n */\nfunction createArrayFromMixed(obj) {\n if (!hasArrayNature(obj)) {\n return [obj];\n } else if (Array.isArray(obj)) {\n return obj.slice();\n } else {\n return toArray(obj);\n }\n}\n\nmodule.exports = createArrayFromMixed;\n}).call(this,require('_process'))",
{
"_process": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/process/browser.js",
"./invariant": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/invariant.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/createArrayFromMixed.js",
"hash": "20f5dbd9b716711a6049107a2792d458",
"browserifyId": 9,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/createNodesFromMarkup.js": [
"(function (process){\n'use strict';\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @typechecks\n */\n\n/*eslint-disable fb-www/unsafe-html*/\n\nvar ExecutionEnvironment = require('./ExecutionEnvironment');\n\nvar createArrayFromMixed = require('./createArrayFromMixed');\nvar getMarkupWrap = require('./getMarkupWrap');\nvar invariant = require('./invariant');\n\n/**\n * Dummy container used to render all markup.\n */\nvar dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;\n\n/**\n * Pattern used by `getNodeName`.\n */\nvar nodeNamePattern = /^\\s*<(\\w+)/;\n\n/**\n * Extracts the `nodeName` of the first element in a string of markup.\n *\n * @param {string} markup String of markup.\n * @return {?string} Node name of the supplied markup.\n */\nfunction getNodeName(markup) {\n var nodeNameMatch = markup.match(nodeNamePattern);\n return nodeNameMatch && nodeNameMatch[1].toLowerCase();\n}\n\n/**\n * Creates an array containing the nodes rendered from the supplied markup. The\n * optionally supplied `handleScript` function will be invoked once for each\n * <script> element that is rendered. If no `handleScript` function is supplied,\n * an exception is thrown if any <script> elements are rendered.\n *\n * @param {string} markup A string of valid HTML markup.\n * @param {?function} handleScript Invoked once for each rendered <script>.\n * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.\n */\nfunction createNodesFromMarkup(markup, handleScript) {\n var node = dummyNode;\n !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0;\n var nodeName = getNodeName(markup);\n\n var wrap = nodeName && getMarkupWrap(nodeName);\n if (wrap) {\n node.innerHTML = wrap[1] + markup + wrap[2];\n\n var wrapDepth = wrap[0];\n while (wrapDepth--) {\n node = node.lastChild;\n }\n } else {\n node.innerHTML = markup;\n }\n\n var scripts = node.getElementsByTagName('script');\n if (scripts.length) {\n !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0;\n createArrayFromMixed(scripts).forEach(handleScript);\n }\n\n var nodes = Array.from(node.childNodes);\n while (node.lastChild) {\n node.removeChild(node.lastChild);\n }\n return nodes;\n}\n\nmodule.exports = createNodesFromMarkup;\n}).call(this,require('_process'))",
{
"_process": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/process/browser.js",
"./ExecutionEnvironment": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/ExecutionEnvironment.js",
"./invariant": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/invariant.js",
"./createArrayFromMixed": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/createArrayFromMixed.js",
"./getMarkupWrap": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/getMarkupWrap.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/createNodesFromMarkup.js",
"hash": "8e81c86776270115dab3f9dbc341149d",
"browserifyId": 10,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/emptyFunction.js": [
"\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * \n */\n\nfunction makeEmptyFunction(arg) {\n return function () {\n return arg;\n };\n}\n\n/**\n * This function accepts and discards inputs; it has no side effects. This is\n * primarily useful idiomatically for overridable function endpoints which\n * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n */\nvar emptyFunction = function emptyFunction() {};\n\nemptyFunction.thatReturns = makeEmptyFunction;\nemptyFunction.thatReturnsFalse = makeEmptyFunction(false);\nemptyFunction.thatReturnsTrue = makeEmptyFunction(true);\nemptyFunction.thatReturnsNull = makeEmptyFunction(null);\nemptyFunction.thatReturnsThis = function () {\n return this;\n};\nemptyFunction.thatReturnsArgument = function (arg) {\n return arg;\n};\n\nmodule.exports = emptyFunction;",
{},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/emptyFunction.js",
"hash": "e38fce0adda18973b801d67702c08c98",
"browserifyId": 11,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/emptyObject.js": [
"(function (process){\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n */\n\n'use strict';\n\nvar emptyObject = {};\n\nif (process.env.NODE_ENV !== 'production') {\n Object.freeze(emptyObject);\n}\n\nmodule.exports = emptyObject;\n}).call(this,require('_process'))",
{
"_process": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/process/browser.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/emptyObject.js",
"hash": "ce5011f518f8c6758dfff4442618a066",
"browserifyId": 12,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/focusNode.js": [
"/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n */\n\n'use strict';\n\n/**\n * @param {DOMElement} node input/textarea to focus\n */\n\nfunction focusNode(node) {\n // IE8 can throw \"Can't move focus to the control because it is invisible,\n // not enabled, or of a type that does not accept the focus.\" for all kinds of\n // reasons that are too expensive and fragile to test.\n try {\n node.focus();\n } catch (e) {}\n}\n\nmodule.exports = focusNode;",
{},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/focusNode.js",
"hash": "921731678baf87f91595b1a111c117e3",
"browserifyId": 13,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/getActiveElement.js": [
"'use strict';\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @typechecks\n */\n\n/* eslint-disable fb-www/typeof-undefined */\n\n/**\n * Same as document.activeElement but wraps in a try-catch block. In IE it is\n * not safe to call document.activeElement if there is nothing focused.\n *\n * The activeElement will be null only if the document or document body is not\n * yet defined.\n */\nfunction getActiveElement() /*?DOMElement*/{\n if (typeof document === 'undefined') {\n return null;\n }\n try {\n return document.activeElement || document.body;\n } catch (e) {\n return document.body;\n }\n}\n\nmodule.exports = getActiveElement;",
{},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/getActiveElement.js",
"hash": "a9e7fd2f63eeaee31f1201e811604dc9",
"browserifyId": 14,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/getMarkupWrap.js": [
"(function (process){\n'use strict';\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n */\n\n/*eslint-disable fb-www/unsafe-html */\n\nvar ExecutionEnvironment = require('./ExecutionEnvironment');\n\nvar invariant = require('./invariant');\n\n/**\n * Dummy container used to detect which wraps are necessary.\n */\nvar dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;\n\n/**\n * Some browsers cannot use `innerHTML` to render certain elements standalone,\n * so we wrap them, render the wrapped nodes, then extract the desired node.\n *\n * In IE8, certain elements cannot render alone, so wrap all elements ('*').\n */\n\nvar shouldWrap = {};\n\nvar selectWrap = [1, '<select multiple=\"true\">', '</select>'];\nvar tableWrap = [1, '<table>', '</table>'];\nvar trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];\n\nvar svgWrap = [1, '<svg xmlns=\"http://www.w3.org/2000/svg\">', '</svg>'];\n\nvar markupWrap = {\n '*': [1, '?<div>', '</div>'],\n\n 'area': [1, '<map>', '</map>'],\n 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],\n 'legend': [1, '<fieldset>', '</fieldset>'],\n 'param': [1, '<object>', '</object>'],\n 'tr': [2, '<table><tbody>', '</tbody></table>'],\n\n 'optgroup': selectWrap,\n 'option': selectWrap,\n\n 'caption': tableWrap,\n 'colgroup': tableWrap,\n 'tbody': tableWrap,\n 'tfoot': tableWrap,\n 'thead': tableWrap,\n\n 'td': trWrap,\n 'th': trWrap\n};\n\n// Initialize the SVG elements since we know they'll always need to be wrapped\n// consistently. If they are created inside a <div> they will be initialized in\n// the wrong namespace (and will not display).\nvar svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];\nsvgElements.forEach(function (nodeName) {\n markupWrap[nodeName] = svgWrap;\n shouldWrap[nodeName] = true;\n});\n\n/**\n * Gets the markup wrap configuration for the supplied `nodeName`.\n *\n * NOTE: This lazily detects which wraps are necessary for the current browser.\n *\n * @param {string} nodeName Lowercase `nodeName`.\n * @return {?array} Markup wrap configuration, if applicable.\n */\nfunction getMarkupWrap(nodeName) {\n !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;\n if (!markupWrap.hasOwnProperty(nodeName)) {\n nodeName = '*';\n }\n if (!shouldWrap.hasOwnProperty(nodeName)) {\n if (nodeName === '*') {\n dummyNode.innerHTML = '<link />';\n } else {\n dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';\n }\n shouldWrap[nodeName] = !dummyNode.firstChild;\n }\n return shouldWrap[nodeName] ? markupWrap[nodeName] : null;\n}\n\nmodule.exports = getMarkupWrap;\n}).call(this,require('_process'))",
{
"_process": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/process/browser.js",
"./ExecutionEnvironment": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/ExecutionEnvironment.js",
"./invariant": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/invariant.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/getMarkupWrap.js",
"hash": "fdef66bc949a387e022368f62060c9ee",
"browserifyId": 15,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/getUnboundedScrollPosition.js": [
"/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @typechecks\n */\n\n'use strict';\n\n/**\n * Gets the scroll position of the supplied element or window.\n *\n * The return values are unbounded, unlike `getScrollPosition`. This means they\n * may be negative or exceed the element boundaries (which is possible using\n * inertial scrolling).\n *\n * @param {DOMWindow|DOMElement} scrollable\n * @return {object} Map with `x` and `y` keys.\n */\n\nfunction getUnboundedScrollPosition(scrollable) {\n if (scrollable === window) {\n return {\n x: window.pageXOffset || document.documentElement.scrollLeft,\n y: window.pageYOffset || document.documentElement.scrollTop\n };\n }\n return {\n x: scrollable.scrollLeft,\n y: scrollable.scrollTop\n };\n}\n\nmodule.exports = getUnboundedScrollPosition;",
{},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/getUnboundedScrollPosition.js",
"hash": "3f8b6f7a628027f4486c14a4e5ae224c",
"browserifyId": 16,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/hyphenate.js": [
"'use strict';\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @typechecks\n */\n\nvar _uppercasePattern = /([A-Z])/g;\n\n/**\n * Hyphenates a camelcased string, for example:\n *\n * > hyphenate('backgroundColor')\n * < \"background-color\"\n *\n * For CSS style names, use `hyphenateStyleName` instead which works properly\n * with all vendor prefixes, including `ms`.\n *\n * @param {string} string\n * @return {string}\n */\nfunction hyphenate(string) {\n return string.replace(_uppercasePattern, '-$1').toLowerCase();\n}\n\nmodule.exports = hyphenate;",
{},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/hyphenate.js",
"hash": "1b033cc2e79cebdcf3d59ea1e159af9f",
"browserifyId": 17,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/hyphenateStyleName.js": [
"/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @typechecks\n */\n\n'use strict';\n\nvar hyphenate = require('./hyphenate');\n\nvar msPattern = /^ms-/;\n\n/**\n * Hyphenates a camelcased CSS property name, for example:\n *\n * > hyphenateStyleName('backgroundColor')\n * < \"background-color\"\n * > hyphenateStyleName('MozTransition')\n * < \"-moz-transition\"\n * > hyphenateStyleName('msTransition')\n * < \"-ms-transition\"\n *\n * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix\n * is converted to `-ms-`.\n *\n * @param {string} string\n * @return {string}\n */\nfunction hyphenateStyleName(string) {\n return hyphenate(string).replace(msPattern, '-ms-');\n}\n\nmodule.exports = hyphenateStyleName;",
{
"./hyphenate": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/hyphenate.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/hyphenateStyleName.js",
"hash": "3c60c4006e5335441b6136ab7f4d8cfd",
"browserifyId": 18,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/invariant.js": [
"(function (process){\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar validateFormat = function validateFormat(format) {};\n\nif (process.env.NODE_ENV !== 'production') {\n validateFormat = function validateFormat(format) {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n };\n}\n\nfunction invariant(condition, format, a, b, c, d, e, f) {\n validateFormat(format);\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(format.replace(/%s/g, function () {\n return args[argIndex++];\n }));\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n}\n\nmodule.exports = invariant;\n}).call(this,require('_process'))",
{
"_process": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/process/browser.js"
},
{
"id": "/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/invariant.js",
"hash": "9067c6b1b1a9f6a80ee8099489d2d012",
"browserifyId": 19,
"sourcemap": ""
}
],
"/Users/oncletom/workspace/nodebook/chapter-04/node_modules/fbjs/lib/isNode.js": [
"'use strict';\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @typechecks\n */\n\n/**\n * @param {*} object The object to check.\n * @return {boolean} Whether or not the object is a DOM node.\n */\nfunction isNode(object) {\n return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.