Permalink
Browse files

re-built loader

  • Loading branch information...
1 parent 5b48ba3 commit d8333a5a66baf7a9f156ca47ae2ab888eb41a31d @cadorn cadorn committed Jul 6, 2012
View
@@ -4,7 +4,7 @@ Optimized [PINF](http://pinf.org/)/[CommonJS](http://commonjs.org/) Loader for J
*Status: ALPHA* [![Build Status](https://secure.travis-ci.org/sourcemint/loader-js.png)](http://travis-ci.org/sourcemint/loader-js)
The `Sourcemint JavaScript Loader` is an optimized *(intended for production use)* **CommonJS package mappings**
-based **JavaScript module loader** for the browser in only **1583 bytes** *(minified and zipped)*.
+based **JavaScript module loader** for the browser in only **1637 bytes** *(minified and zipped)*.
* Copyright: 2011 [Christoph Dorn](http://www.christophdorn.com/)
* Code License: [MIT](http://www.opensource.org/licenses/mit-license.php) and [MPL](http://mozilla.org/MPL/2.0/)
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
Binary file not shown.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
Binary file not shown.
View
@@ -229,6 +229,11 @@ var sourcemint = null;
exports: undefined
}
+ // If embedded in bundle `isMain` will be set to `true` if bundle was `require.main`.
+ if (packageIdentifier === "" && pkg.main === moduleIdentifier && sandboxOptions.isMain === true) {
+ module.require.main = moduleInterface;
+ }
+
if (sandboxOptions.onInitModule) {
sandboxOptions.onInitModule(moduleInterface, module, pkg, sandbox);
}
@@ -271,7 +276,7 @@ var sourcemint = null;
if (loadingBundles[moduleIdentifier]) {
loadingBundlesCallbacks = loadingBundles[moduleIdentifier];
delete loadingBundles[moduleIdentifier];
- for (i=0;i<loadingBundlesCallbacks.length;i++) {
+ for (var i=0 ; i<loadingBundlesCallbacks.length ; i++) {
loadingBundlesCallbacks[i](sandbox);
}
}
@@ -304,8 +309,13 @@ var sourcemint = null;
}
// Call the 'main' module of the program
+ sandbox.boot = function() {
+ return sandbox.require(Package("").main).exports;
+ };
+
+ // Call the 'main' exported function of the main' module of the program
sandbox.main = function() {
- var exports = sandbox.require(Package("").main).exports;
+ var exports = sandbox.boot();
return ((exports.main)?exports.main.apply(null, arguments):undefined);
};
@@ -1 +1 @@
-2226
+2293
@@ -1 +1 @@
-1672
+1715
@@ -1 +1 @@
-3620
+3715
@@ -1 +1 @@
-1583
+1637
@@ -1 +1 @@
-ac623cb21471fa8abc68df8ba0e438af
+3ebdf44c6bf912a10ccb9e10c585e794

0 comments on commit d8333a5

Please sign in to comment.