prelude.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // modules are defined as an array
  2. // [ module function, map of requireuires ]
  3. //
  4. // map of requireuires is short require name -> numeric require
  5. //
  6. // anything defined in a previous bundle is accessed via the
  7. // orig method which is the requireuire for previous bundles
  8. (function() {
  9. function outer(modules, cache, entry) {
  10. // Save the require from previous bundle to this closure if any
  11. var previousRequire = typeof require == "function" && require;
  12. function newRequire(name, jumped){
  13. if(!cache[name]) {
  14. if(!modules[name]) {
  15. // if we cannot find the module within our internal map or
  16. // cache jump to the current global require ie. the last bundle
  17. // that was added to the page.
  18. var currentRequire = typeof require == "function" && require;
  19. if (!jumped && currentRequire) return currentRequire(name, true);
  20. // If there are other bundles on this page the require from the
  21. // previous one is saved to 'previousRequire'. Repeat this as
  22. // many times as there are bundles until the module is found or
  23. // we exhaust the require chain.
  24. if (previousRequire) return previousRequire(name, true);
  25. var err = new Error('Cannot find module \'' + name + '\'');
  26. err.code = 'MODULE_NOT_FOUND';
  27. throw err;
  28. }
  29. var m = cache[name] = {exports:{}};
  30. modules[name][0].call(m.exports, function(x){
  31. var id = modules[name][1][x];
  32. return newRequire(id ? id : x);
  33. },m,m.exports,outer,modules,cache,entry);
  34. }
  35. return cache[name].exports;
  36. }
  37. for(var i=0;i<entry.length;i++) newRequire(entry[i]);
  38. // Override the current require with this new one
  39. return newRequire;
  40. }
  41. return outer;
  42. })()