Created
November 14, 2014 23:53
-
-
Save bitmage/f09cf76aef92fb45d33d to your computer and use it in GitHub Desktop.
The uglified umd preamble inserted by Browserify, broken down to a line by line interpretation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=( | |
// t = mapping | |
// n = cache? | |
// r = entry points? | |
function e(t,n,r){ | |
// s = global require | |
// o = module name | |
// u = ??? | |
function s(o,u){ | |
// can we find it in the cache? | |
if(!n[o]){ | |
// can we find it in the bundle's module index? | |
if(!t[o]){ | |
// if we can't find it in the cache or the full list, throw an error | |
var a=typeof require=="function" && require; | |
if(!u&&a)return a(o,!0); | |
if(i)return i(o,!0); | |
var f=new Error("Cannot find module '"+o+"'"); | |
throw f.code="MODULE_NOT_FOUND",f | |
} | |
// 'l' is the module - we cache it in 'n[o]' | |
var l=n[o]={exports:{}}; | |
// execute the module, passing (require, module, exports) | |
t[o][0].call(l.exports, | |
// require | |
// the version passed to each module is different than the global require | |
function(e){ | |
// look up 'e' in our dependencies | |
// t[o][1] = current module's dependencies | |
// the resulting 'n' will be an index | |
var n=t[o][1][e]; | |
// if 'n' exists, then look up the module with that index | |
// otherwise, look up the module with the exact string we were passed | |
return s(n?n:e) | |
}, | |
// module, exports | |
l, l.exports, | |
// global require, module index, module cache, entry points | |
e, t, n, r) | |
} | |
// if it's in the cache, just return it | |
return n[o].exports | |
} | |
// for each entry point, require it | |
var i=typeof require=="function"&&require; | |
for(var o=0;o<r.length;o++) | |
s(r[o]); | |
return s | |
})({ | |
// example of 1 module | |
// browserify will create an entry for each file it packs into the bundle | |
1:[ | |
function(require,module,exports){ ... }, // module code gets wrapped in this | |
{} // dependencies get stored here | |
] | |
}, // end of module index | |
{}, // module cache | |
// entry points that get run immediately | |
[149,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment