Permalink
Browse files

updated tests

  • Loading branch information...
cadorn committed Jul 5, 2012
1 parent af63e53 commit 7df321de5608f4c0e4995cd7066a1943c0337ba8
@@ -1,10 +1,11 @@
var LOADER = require("sourcemint-platform-nodejs/loader"),
ERROR = require("sourcemint-platform-nodejs/lib/util/error"),
- BUNDLER = require("sourcemint-platform-nodejs/lib/bundler"),
+ BUNDLER = require("sourcemint-platform-browser/lib/bundler"),
EXAMPLES = require("sourcemint-loader-js/tests/examples"),
PATH = require("path"),
- FS = require("fs");
+ FS = require("fs"),
+ Q = require("q");
exports.main = function()
@@ -1,7 +1,7 @@
var PATH = require("path"),
CONNECT = require("connect"),
- BUNDLER = require("sourcemint-platform-nodejs/lib/bundler");
+ BUNDLER = require("sourcemint-platform-browser/lib/bundler");
var EXAMPLES_BASE_PATH = __dirname + "/../../02-LoaderFeatures",
@@ -296,6 +296,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);
}
@@ -389,11 +394,16 @@ var sourcemint = null;
}
// Call the 'main' module of the program
- sandbox.main = function() {
+ sandbox.boot = function() {
/*DEBUG*/ if (typeof Package("").main !== "string") {
/*DEBUG*/ throw new Error("No 'main' property declared in '/package.json' in sandbox '" + sandbox.id + "'!");
/*DEBUG*/ }
- var exports = sandbox.require(Package("").main).exports;
+ return sandbox.require(Package("").main).exports;
+ };
+
+ // Call the 'main' exported function of the main' module of the program
+ sandbox.main = function() {
+ var exports = sandbox.boot();
return ((exports.main)?exports.main.apply(null, arguments):undefined);
};
@@ -270,6 +270,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);
}
@@ -363,11 +368,16 @@ var sourcemint = null;
}
// Call the 'main' module of the program
- sandbox.main = function() {
+ sandbox.boot = function() {
/*DEBUG*/ if (typeof Package("").main !== "string") {
/*DEBUG*/ throw new Error("No 'main' property declared in '/package.json' in sandbox '" + sandbox.id + "'!");
/*DEBUG*/ }
- var exports = sandbox.require(Package("").main).exports;
+ return sandbox.require(Package("").main).exports;
+ };
+
+ // Call the 'main' exported function of the main' module of the program
+ sandbox.main = function() {
+ var exports = sandbox.boot();
return ((exports.main)?exports.main.apply(null, arguments):undefined);
};
@@ -1,7 +1,7 @@
var PATH = require("path"),
CONNECT = require("connect"),
- BUNDLER = require("sourcemint-platform-nodejs/lib/bundler");
+ BUNDLER = require("sourcemint-platform-browser/lib/bundler");
exports.main = function(onReadyDeferred, options)
@@ -1,7 +1,7 @@
var LOADER = require("sourcemint-platform-nodejs/lib/loader"),
ERROR = require("sourcemint-platform-nodejs/lib/util/error"),
- BUNDLER = require("sourcemint-bundler-js/lib/bundler"),
+ BUNDLER = require("sourcemint-platform-nodejs/lib/bundler"),
PATH = require("path"),
FS = require("fs"),
Q = require("q");
Oops, something went wrong.

0 comments on commit 7df321d

Please sign in to comment.